55 lib ,
66 systemd ,
77 wlopm ,
8+ libnotify ,
89 wayland-logout ,
910 givc-cli ? null ,
1011 ghafConfig ? { } ,
12+ ghaf-artwork ? null ,
1113} :
1214let
1315 useGivc = ghafConfig . givc . enable ;
@@ -24,6 +26,7 @@ writeShellApplication {
2426 systemd
2527 wlopm
2628 wayland-logout
29+ libnotify
2730 ] ++ ( lib . optional useGivc givc-cli ) ;
2831
2932 text = ''
@@ -52,19 +55,31 @@ writeShellApplication {
5255 ${ if useGivc then "givc-cli ${ ghafConfig . givc . cliArgs } " else "systemctl" } "$1"
5356 ;;
5457 suspend)
55- # Lock sessions
56- loginctl lock-session
58+ ${
59+ if ghafConfig . profiles . graphics . allowSuspend then
60+ ''
61+ # Lock sessions
62+ loginctl lock-session
5763
58- # Switch off display before suspension
59- ${ waylandDisplayCmd "off" }
64+ # Switch off display before suspension
65+ ${ waylandDisplayCmd "off" }
6066
61- # Send suspend command to host, ensure screen is on in case of failure
62- ${ if useGivc then "givc-cli ${ ghafConfig . givc . cliArgs } " else "systemctl" } suspend \
63- || ${ waylandDisplayCmd "on" }
67+ # Send suspend command to host, ensure screen is on in case of failure
68+ ${ if useGivc then "givc-cli ${ ghafConfig . givc . cliArgs } " else "systemctl" } suspend \
69+ || ${ waylandDisplayCmd "on" }
6470
65- # Switch on display on wakeup
66- ${ waylandDisplayCmd "on" }
67- ;;
71+ # Switch on display on wakeup
72+ ${ waylandDisplayCmd "on" }
73+ ''
74+ else
75+ ''
76+ MSG="Suspend functionality is currently not enabled on this system."
77+ echo "$MSG"
78+ notify-send -i ${ ghaf-artwork } /icons/suspend.svg 'Ghaf Power Control' "$MSG"
79+ exit 1
80+ ''
81+ }
82+ ;;
6883 logout)
6984 wayland-logout
7085 loginctl kill-user "$USER" -s SIGKILL
0 commit comments