summaryrefslogtreecommitdiff
path: root/sessionmenu
diff options
context:
space:
mode:
Diffstat (limited to 'sessionmenu')
-rwxr-xr-xsessionmenu38
1 files changed, 23 insertions, 15 deletions
diff --git a/sessionmenu b/sessionmenu
index 01f961e2..be14e6e1 100755
--- a/sessionmenu
+++ b/sessionmenu
@@ -1,15 +1,23 @@
-#!/bin/sh -e
-case $1 in
- quit) exit 0 ;;
- 'Reload i3 configuration') i3-msg reload >&2 ;;
- 'Log out') i3-msg exit >&2 ;;
- 'Shutdown') sudo -n /run/current-system/profile/sbin/shutdown >&2 ;;
- 'Reboot') sudo -n /run/current-system/profile/sbin/reboot >&2 ;;
- *)
- printf '\0%s\x1f%s\n' prompt 'Session'
- printf '%s\0icon\x1f%s\n' \
- 'Reload i3 configuration' reload \
- 'Log out' system-log-out \
- 'Shutdown' system-shutdown \
- 'Reboot' system-reboot ;;
-esac
+#!/usr/bin/env -S guile --no-auto-compile
+!#
+(use-modules (ice-9 format)
+ (ice-9 match))
+
+(match (command-line)
+ ((_ "quit")
+ (exit 0))
+ ((_ "Reload i3 configuration")
+ (system* "i3-msg" "reload"))
+ ((_ "Log out")
+ (system* "i3-msg" "exit"))
+ ((_ "Shutdown")
+ (system* "sudo" "-n" "/run/current-system/profile/sbin/shutdown"))
+ ((_ "Reboot")
+ (system* "sudo" "-n" "/run/current-system/profile/sbin/reboot"))
+ (_
+ (format #t "\0~a\x1f~a~%~{~a\0icon\x1f~a~%~}"
+ "prompt" "Session"
+ '("Reload i3 configuration" "reload"
+ "Log out" "system-log-out"
+ "Shutdown" "system-shutdown"
+ "Reboot" "system-reboot"))))