diff options
| author | jason | 2024-06-07 15:27:13 -0600 |
|---|---|---|
| committer | jason | 2024-06-07 15:53:19 -0600 |
| commit | 7ad79b7200323e1796f7137e115e92a1dc75a50c (patch) | |
| tree | ad11e6d5a55033662882bdb54e069affe76f7e8e | |
| parent | 61ae4296b96eab8645f84a095a5e8499c9b753c3 (diff) | |
| download | dotfiles-7ad79b7200323e1796f7137e115e92a1dc75a50c.tar.gz dotfiles-7ad79b7200323e1796f7137e115e92a1dc75a50c.zip | |
sway tweaks for power saving while sleeping
| -rw-r--r-- | sway/.config/sway/config | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 826a870..8ab6f9a 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config | |||
| @@ -23,13 +23,16 @@ set $laptop_screen eDP-1 | |||
| 23 | 23 | ||
| 24 | # Define the command to sleep | 24 | # Define the command to sleep |
| 25 | set $cmd_sleep loginctl suspend | 25 | set $cmd_sleep loginctl suspend |
| 26 | set $cmd_laptop_screen_disable swaymsg output $laptop_screen power off disable | ||
| 27 | set $cmd_laptop_screen_enable swaymsg output $laptop_screen power on enable | ||
| 26 | 28 | ||
| 27 | ### Application Launcher | 29 | ### Application Launcher |
| 28 | # Note: pass the final command to swaymsg so resulting window can open on | 30 | # Note: pass the final command to swaymsg so resulting window can open on |
| 29 | # workspace command was run on. | 31 | # workspace command was run on. |
| 30 | 32 | ||
| 31 | ##### Default: wmenu | 33 | ##### Default: wmenu |
| 32 | set $menu dmenu_path | wmenu | xargs swaymsg exec -- | 34 | #set $menu dmenu_path | wmenu | xargs swaymsg exec -- |
| 35 | set $menu dmenu_path | wofi -S dmenu | xargs swaymsg exec -- | ||
| 33 | 36 | ||
| 34 | ##### Alacritty popup | 37 | ##### Alacritty popup |
| 35 | # Note: i haven't tested with the new lines + escapes | 38 | # Note: i haven't tested with the new lines + escapes |
| @@ -49,13 +52,14 @@ output $laptop_screen scale 1.25 | |||
| 49 | 52 | ||
| 50 | ### Wallpaper | 53 | ### Wallpaper |
| 51 | output * bg ~/Sync/Files/wallpaper/PagedOut_002_wallpaper_30.png fill | 54 | output * bg ~/Sync/Files/wallpaper/PagedOut_002_wallpaper_30.png fill |
| 52 | # output * bg ~/Sync/Files/wallpaper/Photo\ by\ Pramod\ Tiwari\ \(uvld3ZQxK1g\).jpg fill | 55 | #output * bg ~/Sync/Files/wallpaper/Photo\ by\ Pramod\ Tiwari\ \(uvld3ZQxK1g\).jpg fill |
| 53 | 56 | ||
| 54 | ############################################################################### | 57 | ############################################################################### |
| 55 | # Idle configuration | 58 | # Idle configuration |
| 56 | exec swayidle -w \ | 59 | exec swayidle -w \ |
| 57 | timeout 300 'swaylock -f -c 000000' \ | 60 | timeout 300 'swaylock -f -c 000000' \ |
| 58 | timeout 600 'swaymsg "output * power off"' \ | 61 | timeout 600 'swaymsg "output * power off"' \ |
| 62 | timeout 900 'loginctl suspend' \ | ||
| 59 | resume 'swaymsg "output * power on"' \ | 63 | resume 'swaymsg "output * power on"' \ |
| 60 | before-sleep 'swaylock -f -c 000000' | 64 | before-sleep 'swaylock -f -c 000000' |
| 61 | 65 | ||
| @@ -82,10 +86,11 @@ input type:keyboard { | |||
| 82 | # Enable clam shell mode with external displays, or sleep without on lid close | 86 | # Enable clam shell mode with external displays, or sleep without on lid close |
| 83 | # /etc/elogin/logind.conf needs to have ignore set on HandleLidSwitch* | 87 | # /etc/elogin/logind.conf needs to have ignore set on HandleLidSwitch* |
| 84 | bindswitch --reload --locked lid:on \ | 88 | bindswitch --reload --locked lid:on \ |
| 85 | exec bash -c '[[ $(swaymsg -r -t get_outputs | jq ". | length") == 1 ]] && ($cmd_sleep) || (swaynag -t warning -m "Laptop screen disabling..." -s "ok" && swaymsg output $laptop_screen disable)' | 89 | exec bash -c '[[ $(swaymsg -r -t get_outputs | jq ". | length") == 1 ]] && ($cmd_sleep) || (swaynag -t warning -m "Laptop screen disabling..." -s "ok" && $cmd_laptop_screen_disable)' |
| 86 | bindswitch --reload --locked lid:off output $laptop_screen enable | 90 | bindswitch --reload --locked lid:off \ |
| 91 | exec ($cmd_laptop_screen_enable) | ||
| 87 | # Ensure reloading in clamshell keeps the correct state | 92 | # Ensure reloading in clamshell keeps the correct state |
| 88 | exec_always '[ "$(cat /proc/acpi/button/lid/LID0/state | awk \'{print $2}\')" == "closed" ] && swaymsg output $laptop_screen disable || swaymsg output $laptop_screen enable' | 93 | exec_always '[ "$(cat /proc/acpi/button/lid/LID0/state | awk \'{ print $2 }\')" == "closed" ] && ($cmd_laptop_screen_disable) || ($cmd_laptop_screen_enable)' |
| 89 | 94 | ||
| 90 | ############################################################################### | 95 | ############################################################################### |
| 91 | # Key bindings | 96 | # Key bindings |
| @@ -275,7 +280,7 @@ for_window [instance="sun-awt-X11-XWindowPeer"] border pixel 0 | |||
| 275 | exec [ ! "$(pidof pipewire)" ] && pipewire | 280 | exec [ ! "$(pidof pipewire)" ] && pipewire |
| 276 | exec [ ! "$(pidof syncthing)" ] && syncthing serve | 281 | exec [ ! "$(pidof syncthing)" ] && syncthing serve |
| 277 | # Fix for "No Gcr prompter" with pinentry-gnome3 | 282 | # Fix for "No Gcr prompter" with pinentry-gnome3 |
| 278 | exec dbus-update-activation-environment | 283 | exec dbus-update-activation-environment DISPLAY XAUTHORITY |
| 279 | 284 | ||
| 280 | #exec mako # notifications | 285 | #exec mako # notifications |
| 281 | #exec kanshi # autorandr | 286 | #exec kanshi # autorandr |