Create erctl, clean up session management.

This commit is contained in:
Érico Rolim 2020-04-21 03:58:16 -03:00
parent 7f75aa0ab6
commit 6383fabcb8
3 changed files with 21 additions and 3 deletions

11
utils/.local/bin/erctl Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# ericonr's script for system tasks
# detect session manager;
# systemd -> systemctl
# non-systemd -> loginctl
command -v systemctl >/dev/null 2>&1 && CTL=systemctl
CTL=${CTL:-loginctl}
exec $CTL "$@"

View File

@ -42,8 +42,7 @@ bindsym $mod+Shift+c reload
# Restart sway inplace (can be used to upgrade sway)
bindsym $mod+Shift+r restart
# Exit sway
set $exit_command "swaynag -t warning -m 'You pressed the exit shortcut.' -b 'Exit session' 'swaymsg exit' -b 'Suspend device' 'systemctl suspend' -b 'Shut down' 'poweroff'"
bindsym $mod+Shift+e exec $exit_command
bindsym $mod+Shift+e exec sway_exit_command
## Input settings
input * {
@ -173,7 +172,7 @@ bindsym --locked $mod+Mod1+a output * dpms on
bindsym --locked $mod+Mod1+z output * dpms off
# Sleep when closed behavior
# TODO: create script to make this multi-platform
bindswitch --reload lid:on exec systemctl suspend
bindswitch --reload lid:on exec erctl suspend
## Layout
# Split in horizontal orientation

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
exec swaynag \
-t warning \
-m 'You pressed the exit shortcut.' \
-b 'Exit session' 'swaymsg exit' \
-b 'Suspend device' 'erctl suspend' \
-b 'Shut down' 'erctl poweroff'