From 47db9a5280e7f158e4c71aa1773036dfeb50a38f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 5 Mar 2025 00:00:01 +1100 Subject: launcher: add power actions --- src/modules/launcher/actions.tsx | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'src/modules') diff --git a/src/modules/launcher/actions.tsx b/src/modules/launcher/actions.tsx index f1e66d4..5a0596a 100644 --- a/src/modules/launcher/actions.tsx +++ b/src/modules/launcher/actions.tsx @@ -167,6 +167,60 @@ const actions = (mode: Variable, entry: Widget.Entry): ActionMap => ({ entry.set_text(""); }, }, + lock: { + icon: "lock", + name: "Lock", + description: "Lock the current session.", + action: () => { + execAsync("loginctl lock-session").catch(console.error); + close(); + }, + }, + logout: { + icon: "logout", + name: "Logout", + description: "End the current session.", + action: () => { + execAsync("uwsm stop").catch(console.error); + close(); + }, + }, + sleep: { + icon: "bedtime", + name: "Sleep", + description: "Suspend then hibernate.", + action: () => { + execAsync("systemctl suspend-then-hibernate").catch(console.error); + close(); + }, + }, + reboot: { + icon: "cached", + name: "Reboot", + description: "Restart the machine.", + action: () => { + execAsync("systemctl reboot").catch(console.error); + close(); + }, + }, + hibernate: { + icon: "downloading", + name: "Hibernate", + description: "Suspend to RAM.", + action: () => { + execAsync("systemctl hibernate").catch(console.error); + close(); + }, + }, + shutdown: { + icon: "power_settings_new", + name: "Shutdown", + description: "Suspend to disk.", + action: () => { + execAsync("systemctl poweroff").catch(console.error); + close(); + }, + }, }); const Action = ({ args, icon, name, description, action }: IAction & { args: string[] }) => ( -- cgit v1.2.3-freya