diff options
| author | jason | 2024-05-20 23:57:50 -0600 |
|---|---|---|
| committer | jason | 2024-05-21 10:13:13 -0600 |
| commit | 6b0e4b8f8d45d0e46ca894dbd518be4596edf4e6 (patch) | |
| tree | aa23a2f9f9f7ffc9a3ac3f9aee8d929331c431bd | |
| parent | 83cdc4bc3b3922e4f034f36fe7b39ccbfc4b453e (diff) | |
| download | dotfiles-6b0e4b8f8d45d0e46ca894dbd518be4596edf4e6.tar.gz dotfiles-6b0e4b8f8d45d0e46ca894dbd518be4596edf4e6.zip | |
enable conditional clam shell mode in sway
| -rw-r--r-- | sway/.config/sway/config | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 47d74f9..8e3716f 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config | |||
| @@ -17,6 +17,12 @@ set $right l | |||
| 17 | # Your preferred terminal emulator | 17 | # Your preferred terminal emulator |
| 18 | set $term foot | 18 | set $term foot |
| 19 | 19 | ||
| 20 | # The built-in laptop screen. Used for clam shell and scaling | ||
| 21 | set $laptop_screen eDP-1 | ||
| 22 | |||
| 23 | # Define the command to sleep | ||
| 24 | set $cmd_sleep loginctl suspend | ||
| 25 | |||
| 20 | ### Application Launcher | 26 | ### Application Launcher |
| 21 | # Note: pass the final command to swaymsg so resulting window can open on | 27 | # Note: pass the final command to swaymsg so resulting window can open on |
| 22 | # workspace command was run on. | 28 | # workspace command was run on. |
| @@ -38,7 +44,7 @@ set $menu dmenu_path | wmenu | xargs swaymsg exec -- | |||
| 38 | 44 | ||
| 39 | ### Displays | 45 | ### Displays |
| 40 | # You can get the names of your outputs by running: swaymsg -t get_outputs | 46 | # You can get the names of your outputs by running: swaymsg -t get_outputs |
| 41 | output eDP-1 scale 1.25 | 47 | output $laptop_screen scale 1.25 |
| 42 | 48 | ||
| 43 | ### Wallpaper | 49 | ### Wallpaper |
| 44 | # output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill | 50 | # output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill |
| @@ -58,7 +64,8 @@ exec swayidle -w \ | |||
| 58 | for_window [class="^.*"] inhibit_idle fullscreen \ | 64 | for_window [class="^.*"] inhibit_idle fullscreen \ |
| 59 | for_window [app_id="^.*"] inhibit_idle fullscreen | 65 | for_window [app_id="^.*"] inhibit_idle fullscreen |
| 60 | 66 | ||
| 61 | ### Input configuration | 67 | ############################################################################### |
| 68 | # Input configuration | ||
| 62 | 69 | ||
| 63 | # You can get the names of your inputs by running: swaymsg -t get_inputs | 70 | # You can get the names of your inputs by running: swaymsg -t get_inputs |
| 64 | # Read `man 5 sway-input` for more information about this section. | 71 | # Read `man 5 sway-input` for more information about this section. |
| @@ -73,6 +80,14 @@ input type:keyboard { | |||
| 73 | xkb_options ctrl:nocaps | 80 | xkb_options ctrl:nocaps |
| 74 | } | 81 | } |
| 75 | 82 | ||
| 83 | # Enable clam shell mode with external displays, or sleep without on lid close | ||
| 84 | # /etc/elogin/logind.conf needs to have ignore set on HandleLidSwitch* | ||
| 85 | bindswitch --reload --locked lid:on \ | ||
| 86 | 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)' | ||
| 87 | bindswitch --reload --locked lid:off output $laptop_screen enable | ||
| 88 | # Ensure reloading in clamshell keeps the correct state | ||
| 89 | exec_always '[ "$(cat /proc/acpi/button/lid/LID0/state | awk \'{print $2}\')" == "closed" ] && swaymsg output $laptop_screen disable || swaymsg output $laptop_screen enable' | ||
| 90 | |||
| 76 | ############################################################################### | 91 | ############################################################################### |
| 77 | # Key bindings | 92 | # Key bindings |
| 78 | 93 | ||