aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Wilken2022-12-11 14:31:33 +0100
committerTimo Wilken2022-12-11 14:31:33 +0100
commita3e0cc80fdcb6eff8febf9809e601e4fe459b90e (patch)
tree9ba9ffaacc77c8d720fc34531329dd893478cbd8
parent1e4225af95be8b1871a4b60c54a4e805499de887 (diff)
Redirect sessionmenu output properly
-rwxr-xr-xsessionmenu16
1 files changed, 11 insertions, 5 deletions
diff --git a/sessionmenu b/sessionmenu
index be14e6e1..552c2b3c 100755
--- a/sessionmenu
+++ b/sessionmenu
@@ -1,19 +1,25 @@
#!/usr/bin/env -S guile --no-auto-compile
!#
(use-modules (ice-9 format)
- (ice-9 match))
+ (ice-9 match)
+ (ice-9 ports))
+
+(define (call-command/stderr . command)
+ "Call COMMAND using `system*', but redirect all output to stderr."
+ (with-output-to-port (current-error-port)
+ (lambda () (apply system* command))))
(match (command-line)
((_ "quit")
(exit 0))
((_ "Reload i3 configuration")
- (system* "i3-msg" "reload"))
+ (call-command/stderr "i3-msg" "reload"))
((_ "Log out")
- (system* "i3-msg" "exit"))
+ (call-command/stderr "i3-msg" "exit"))
((_ "Shutdown")
- (system* "sudo" "-n" "/run/current-system/profile/sbin/shutdown"))
+ (call-command/stderr "sudo" "-n" "/run/current-system/profile/sbin/shutdown"))
((_ "Reboot")
- (system* "sudo" "-n" "/run/current-system/profile/sbin/reboot"))
+ (call-command/stderr "sudo" "-n" "/run/current-system/profile/sbin/reboot"))
(_
(format #t "\0~a\x1f~a~%~{~a\0icon\x1f~a~%~}"
"prompt" "Session"