From 999f295a78beda2cc6d815c5f2ca2703b658916c Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 5 Mar 2025 00:08:29 +1100 Subject: launcher: allow disabling actions Disable actions in session screen by default Also remove periods from power action descriptions --- src/modules/launcher/actions.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/modules/launcher/actions.tsx b/src/modules/launcher/actions.tsx index 5a0596a..0ded45f 100644 --- a/src/modules/launcher/actions.tsx +++ b/src/modules/launcher/actions.tsx @@ -170,7 +170,7 @@ const actions = (mode: Variable, entry: Widget.Entry): ActionMap => ({ lock: { icon: "lock", name: "Lock", - description: "Lock the current session.", + description: "Lock the current session", action: () => { execAsync("loginctl lock-session").catch(console.error); close(); @@ -179,7 +179,7 @@ const actions = (mode: Variable, entry: Widget.Entry): ActionMap => ({ logout: { icon: "logout", name: "Logout", - description: "End the current session.", + description: "End the current session", action: () => { execAsync("uwsm stop").catch(console.error); close(); @@ -188,7 +188,7 @@ const actions = (mode: Variable, entry: Widget.Entry): ActionMap => ({ sleep: { icon: "bedtime", name: "Sleep", - description: "Suspend then hibernate.", + description: "Suspend then hibernate", action: () => { execAsync("systemctl suspend-then-hibernate").catch(console.error); close(); @@ -197,7 +197,7 @@ const actions = (mode: Variable, entry: Widget.Entry): ActionMap => ({ reboot: { icon: "cached", name: "Reboot", - description: "Restart the machine.", + description: "Restart the machine", action: () => { execAsync("systemctl reboot").catch(console.error); close(); @@ -206,7 +206,7 @@ const actions = (mode: Variable, entry: Widget.Entry): ActionMap => ({ hibernate: { icon: "downloading", name: "Hibernate", - description: "Suspend to RAM.", + description: "Suspend to RAM", action: () => { execAsync("systemctl hibernate").catch(console.error); close(); @@ -215,7 +215,7 @@ const actions = (mode: Variable, entry: Widget.Entry): ActionMap => ({ shutdown: { icon: "power_settings_new", name: "Shutdown", - description: "Suspend to disk.", + description: "Suspend to disk", action: () => { execAsync("systemctl poweroff").catch(console.error); close(); @@ -341,7 +341,9 @@ export default class Actions extends Widget.Box implements LauncherContent { for (const { obj } of fuzzysort.go(wallpaper, Wallpapers.get_default().list, { all: true, key: "path" })) this.#content.add(); } else { - const list = this.#list.filter(a => this.#map[a].available?.() ?? true); + const list = this.#list.filter( + a => this.#map[a].available?.() ?? !config.disabledActions.get().includes(a) + ); for (const { target } of fuzzysort.go(action, list, { all: true })) this.#content.add(); } -- cgit v1.2.3-freya