launcher: allow disabling actions
Disable actions in session screen by default Also remove periods from power action descriptions
This commit is contained in:
parent
47db9a5280
commit
999f295a78
2 changed files with 10 additions and 7 deletions
|
|
@ -124,6 +124,7 @@ const DEFAULTS = {
|
||||||
wallpaper: {
|
wallpaper: {
|
||||||
style: "medium", // One of "compact", "medium", "large"
|
style: "medium", // One of "compact", "medium", "large"
|
||||||
},
|
},
|
||||||
|
disabledActions: ["logout", "shutdown", "reboot", "hibernate"], // Actions to hide, see launcher/actions.tsx for available actions
|
||||||
},
|
},
|
||||||
notifpopups: {
|
notifpopups: {
|
||||||
maxPopups: -1,
|
maxPopups: -1,
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({
|
||||||
lock: {
|
lock: {
|
||||||
icon: "lock",
|
icon: "lock",
|
||||||
name: "Lock",
|
name: "Lock",
|
||||||
description: "Lock the current session.",
|
description: "Lock the current session",
|
||||||
action: () => {
|
action: () => {
|
||||||
execAsync("loginctl lock-session").catch(console.error);
|
execAsync("loginctl lock-session").catch(console.error);
|
||||||
close();
|
close();
|
||||||
|
|
@ -179,7 +179,7 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({
|
||||||
logout: {
|
logout: {
|
||||||
icon: "logout",
|
icon: "logout",
|
||||||
name: "Logout",
|
name: "Logout",
|
||||||
description: "End the current session.",
|
description: "End the current session",
|
||||||
action: () => {
|
action: () => {
|
||||||
execAsync("uwsm stop").catch(console.error);
|
execAsync("uwsm stop").catch(console.error);
|
||||||
close();
|
close();
|
||||||
|
|
@ -188,7 +188,7 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({
|
||||||
sleep: {
|
sleep: {
|
||||||
icon: "bedtime",
|
icon: "bedtime",
|
||||||
name: "Sleep",
|
name: "Sleep",
|
||||||
description: "Suspend then hibernate.",
|
description: "Suspend then hibernate",
|
||||||
action: () => {
|
action: () => {
|
||||||
execAsync("systemctl suspend-then-hibernate").catch(console.error);
|
execAsync("systemctl suspend-then-hibernate").catch(console.error);
|
||||||
close();
|
close();
|
||||||
|
|
@ -197,7 +197,7 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({
|
||||||
reboot: {
|
reboot: {
|
||||||
icon: "cached",
|
icon: "cached",
|
||||||
name: "Reboot",
|
name: "Reboot",
|
||||||
description: "Restart the machine.",
|
description: "Restart the machine",
|
||||||
action: () => {
|
action: () => {
|
||||||
execAsync("systemctl reboot").catch(console.error);
|
execAsync("systemctl reboot").catch(console.error);
|
||||||
close();
|
close();
|
||||||
|
|
@ -206,7 +206,7 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({
|
||||||
hibernate: {
|
hibernate: {
|
||||||
icon: "downloading",
|
icon: "downloading",
|
||||||
name: "Hibernate",
|
name: "Hibernate",
|
||||||
description: "Suspend to RAM.",
|
description: "Suspend to RAM",
|
||||||
action: () => {
|
action: () => {
|
||||||
execAsync("systemctl hibernate").catch(console.error);
|
execAsync("systemctl hibernate").catch(console.error);
|
||||||
close();
|
close();
|
||||||
|
|
@ -215,7 +215,7 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({
|
||||||
shutdown: {
|
shutdown: {
|
||||||
icon: "power_settings_new",
|
icon: "power_settings_new",
|
||||||
name: "Shutdown",
|
name: "Shutdown",
|
||||||
description: "Suspend to disk.",
|
description: "Suspend to disk",
|
||||||
action: () => {
|
action: () => {
|
||||||
execAsync("systemctl poweroff").catch(console.error);
|
execAsync("systemctl poweroff").catch(console.error);
|
||||||
close();
|
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" }))
|
for (const { obj } of fuzzysort.go(wallpaper, Wallpapers.get_default().list, { all: true, key: "path" }))
|
||||||
this.#content.add(<Wallpaper {...obj} />);
|
this.#content.add(<Wallpaper {...obj} />);
|
||||||
} else {
|
} 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 }))
|
for (const { target } of fuzzysort.go(action, list, { all: true }))
|
||||||
this.#content.add(<Action {...this.#map[target]} args={args.slice(1)} />);
|
this.#content.add(<Action {...this.#map[target]} args={args.slice(1)} />);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue