Skip to content
This repository was archived by the owner on Jan 10, 2026. It is now read-only.

Commit 02bc455

Browse files
committed
Option to Change Default Selection for Application Launch Method (Closes #26)
1 parent 37d57b4 commit 02bc455

File tree

3 files changed

+33
-21
lines changed

3 files changed

+33
-21
lines changed

src/gui/gui.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ function failed_covers_set(covers: FailedCovers) {
279279

280280
async function get_alt_cover(manifest: ipc.AppManifest) {
281281
console.log(manifest.cover_b64);
282-
if(manifest.cover_b64!= undefined){
282+
if (manifest.cover_b64 != undefined) {
283283
console.log("Runnning copy png to frontend")
284284
return <>
285-
<img className={scss.game_cover_image} src={manifest.cover_b64}/>
285+
<img className={scss.game_cover_image} src={manifest.cover_b64} />
286286
</>;
287287
}
288-
else{
288+
else {
289289
return <>
290290
<img className={scss.game_cover_image} src="/no_cover.webp" />
291291
<span className={scss.game_cover_title}>{manifest.name}</span>
@@ -303,8 +303,8 @@ export function GameCover({ manifest, big, on_click }: { manifest: ipc.AppManife
303303
const failed_covers = failed_covers_get();
304304
const already_failed = failed_covers.covers.includes(manifest.app_id);
305305

306-
if(manifest.run_game_id.length<10){
307-
if (!already_failed) {
306+
if (manifest.run_game_id.length < 10) {
307+
if (!already_failed) {
308308
const url = `https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/${manifest.app_id}/library_600x900.jpg`;
309309
setContent(
310310
<img
@@ -328,11 +328,11 @@ export function GameCover({ manifest, big, on_click }: { manifest: ipc.AppManife
328328
setContent(await get_alt_cover(manifest));
329329
}
330330
}
331-
else{
332-
console.log("handling non Steam Game");
333-
setContent(await get_alt_cover(manifest));
331+
else {
332+
console.log("handling non Steam Game");
333+
setContent(await get_alt_cover(manifest));
334334

335-
}
335+
}
336336
} catch (err) {
337337
console.error("Unhandled error in GameCover useEffect:", err);
338338
}
@@ -508,8 +508,8 @@ async function launch(
508508

509509
function ApplicationView({ globals, application, }: { globals: Globals, application: ipc.DesktopFile }) {
510510
const [details, setDetails] = useState(<></>);
511-
const [xwayland_mode, setXWaylandMode] = useState(false);
512-
const [force_wayland, setForceWayland] = useState(true);
511+
const [xwayland_mode, setXWaylandMode] = useState(globals.prefs.cage_mode ? true : false);
512+
const [force_wayland, setForceWayland] = useState(globals.prefs.cage_mode ? false : true);
513513
const [displays, setDisplays] = useState<ipc.Display[] | null>(null);
514514

515515
const refreshDisplays = async () => {
@@ -531,12 +531,12 @@ function ApplicationView({ globals, application, }: { globals: Globals, applicat
531531
<div className={scss.previewer_title}>{application.name}</div>
532532
{details}
533533
<Separator />
534-
<Checkbox title="Run in X11 mode via XWayland (cage)" pair={[xwayland_mode, setXWaylandMode]} onChange={(n) => {
534+
<Checkbox title="Run in X11 mode (cage)" pair={[xwayland_mode, setXWaylandMode]} onChange={(n) => {
535535
if (n) {
536536
setForceWayland(false);
537537
}
538538
}} />
539-
<Checkbox title="Force-enable Wayland for various backends - Qt/GTK/SDL (...)" pair={[force_wayland, setForceWayland]} onChange={(n) => {
539+
<Checkbox title="Run in Wayland mode" pair={[force_wayland, setForceWayland]} onChange={(n) => {
540540
if (n) {
541541
setXWaylandMode(false);
542542
}

src/panel/settings.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export function PanelSettings({ globals }: { globals: Globals }) {
1515
const [pref_twelve, setPrefTwelve] = useState(globals.prefs.twelve_hour_clock ?? false);
1616
const [pref_hide_username, setPrefHideUsername] = useState(globals.prefs.hide_username ?? false);
1717
const [pref_opaque_background, setPrefOpaqueBackground] = useState(globals.prefs.opaque_background ?? false);
18+
const [pref_cage_mode, setPrefCageMode] = useState(globals.prefs.cage_mode ?? false);
1819

1920
useEffect(() => {
2021
const run = async () => {
@@ -40,6 +41,21 @@ export function PanelSettings({ globals }: { globals: Globals }) {
4041
refreshPrefs();
4142
}} />;
4243

44+
const checkbox_cage_mode = <Checkbox pair={[pref_cage_mode, setPrefCageMode]} title="Run in XWayland mode (cage) by default" onChange={(n) => {
45+
prefs.cage_mode = n;
46+
refreshPrefs();
47+
}} />;
48+
49+
const checkbox_12hourclock = <Checkbox pair={[pref_twelve, setPrefTwelve]} title="12-hour clock" onChange={(n) => {
50+
prefs.twelve_hour_clock = n;
51+
refreshPrefs();
52+
}} />;
53+
54+
const checkbox_hideusername = <Checkbox pair={[pref_hide_username, setPrefHideUsername]} title="Hide username in the Home screen" onChange={(n) => {
55+
prefs.hide_username = n;
56+
refreshPrefs();
57+
}} />;
58+
4359
if (globals.is_nvidia) {
4460
checkbox_opaque = <BoxRight>
4561
{cb_op}
@@ -79,15 +95,10 @@ export function PanelSettings({ globals }: { globals: Globals }) {
7995
{warn_nvidia}
8096

8197
<Container>
82-
<Checkbox pair={[pref_hide_username, setPrefHideUsername]} title="Hide username in the Home screen" onChange={(n) => {
83-
prefs.hide_username = n;
84-
refreshPrefs();
85-
}} />
86-
<Checkbox pair={[pref_twelve, setPrefTwelve]} title="12-hour clock" onChange={(n) => {
87-
prefs.twelve_hour_clock = n;
88-
refreshPrefs();
89-
}} />
98+
{checkbox_hideusername}
99+
{checkbox_12hourclock}
90100
{checkbox_opaque}
101+
{checkbox_cage_mode}
91102
</Container>
92103

93104
<Container>

src/preferences.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export namespace preferences {
33
twelve_hour_clock?: boolean; // 24-hour clock
44
hide_username?: boolean;
55
opaque_background?: boolean;
6+
cage_mode?: boolean;
67
}
78

89
export function savePreferences(preferences: Preferences) {

0 commit comments

Comments
 (0)