From b6098b401f4bc26a7c604f68fe54bf516cb191c6 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 18 Jun 2024 12:42:57 -0600 Subject: sway config: clamshell, terminal dmenu, clipboard history --- sway/.config/sway/config | 58 +++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 1e576c6..7a4bcae 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -8,6 +8,7 @@ # Mod4 = Logo key. Mod1 = Alt. set $mod Mod4 set $alt Mod1 +set $ctrl Ctrl # Home row direction keys, like vim set $left h @@ -25,7 +26,7 @@ set $laptop_screen eDP-1 set $cmd_sleep loginctl suspend set $cmd_laptop_screen_disable swaymsg output $laptop_screen power off disable set $cmd_laptop_screen_enable swaymsg output $laptop_screen power on enable - +set $cmd_resume_clamshell [ "$(cat /proc/acpi/button/lid/LID0/state | awk \'{ print $2 }\')" == "closed" ] && ($cmd_laptop_screen_disable) || ($cmd_laptop_screen_enable) ### Application Launcher # Note: pass the final command to swaymsg so resulting window can open on # workspace command was run on. @@ -34,16 +35,21 @@ set $cmd_laptop_screen_enable swaymsg output $laptop_screen power on enable #set $menu dmenu_path | wmenu | xargs swaymsg exec -- #set $menu dmenu_path | wofi -S dmenu | xargs swaymsg exec -- -##### Terminal popup +##### Terminal Launchers (specific to foot. alacritty works too with different options) +set $launcher_alpha 0.9 +# App Launcher set $menu exec foot \ --app-id=launcher \ + -o colors.alpha=$launcher_alpha \ bash -c 'compgen -c | grep -v fzf | sort -u \ | fzf --layout=reverse | xargs -r swaymsg -t command exec' -bindsym Ctrl+$alt+v exec foot \ + +# Clipboard History +bindsym $ctrl+$alt+v exec foot \ --app-id=launcher \ - bash -c 'cliphist list | cliphist-fzf-sixel | cliphist decode \ - | wl-copy --primary' -for_window [app_id="^launcher$"] floating enable, border none, opacity 0.8 + -o colors.alpha=$launcher_alpha \ + cliphist-fzf-sixel +for_window [app_id="^launcher$"] floating enable, border none #, opacity $launcher_alpha ############################################################################### # Output configuration @@ -58,12 +64,13 @@ output * bg ~/Sync/Files/wallpaper/PagedOut_002_wallpaper_30.png fill ############################################################################### # Idle configuration +# swaymsg -t get_outputs --raw | jq '.[] | .name + " " + (.power | tostring) + " " + (.active | tostring) + " " + .model + " " + (.current_mode.width | tostring) + "x" + (.current_mode.height | tostring)' exec swayidle -w \ timeout 300 'swaylock -f -c 000000' \ - timeout 600 'swaymsg "output * power off"' \ - timeout 900 'loginctl suspend' \ - resume 'swaymsg "output * power on"' \ - before-sleep 'swaylock -f -c 000000' + timeout 305 'swaymsg "output * power off"' resume 'swaymsg "output * power on enable" && multimonitor.sh wosleep' \ + timeout 900 'loginctl suspend' resume 'swaymsg "output * power on enable" && multimonitor.sh wosleep' \ + before-sleep 'swaylock -f -c 000000' \ + after-resume 'swaymsg "output * power on enable" && multimonitor.sh wosleep' # Inhibit idle if a window is full screen (e.g. videos) for_window [class="^.*"] inhibit_idle fullscreen \ @@ -76,9 +83,9 @@ for_window [class="^.*"] inhibit_idle fullscreen \ # Read `man 5 sway-input` for more information about this section. input "2362:628:PIXA3854:00_093A:0274_Touchpad" { + # Framework 16" tap enabled - # disable while typing - # dwt enabled + # dwt enabled # disable while typing } input type:keyboard { @@ -87,12 +94,14 @@ input type:keyboard { # Enable clam shell mode with external displays, or sleep without on lid close # /etc/elogin/logind.conf needs to have ignore set on HandleLidSwitch* -bindswitch --reload --locked lid:on \ - 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)' -bindswitch --reload --locked lid:off \ - exec ($cmd_laptop_screen_enable) -# Ensure reloading in clamshell keeps the correct state -exec_always '[ "$(cat /proc/acpi/button/lid/LID0/state | awk \'{ print $2 }\')" == "closed" ] && ($cmd_laptop_screen_disable) || ($cmd_laptop_screen_enable)' +bindswitch --reload --locked lid:on exec multimonitor.sh + # exec bash -c '[[ $(swaymsg -r -t get_outputs | jq ". | length") == 1 ]] && ($cmd_sleep) || ($cmd_laptop_screen_disable)' +bindswitch --reload --locked lid:off exec multimonitor.sh + # exec ($cmd_laptop_screen_enable) +# Ensure reloading config while in clamshell keeps the correct state +# exec_always '[ "$(cat /proc/acpi/button/lid/LID0/state | awk \'{ print $2 }\')" == "closed" ] && ($cmd_laptop_screen_disable) || ($cmd_laptop_screen_enable)' +# v2 exec_always '$cmd_resume_clamshell' +exec_always multimonitor.sh ############################################################################### # Key bindings @@ -272,19 +281,18 @@ for_window [instance="sun-awt-X11-XWindowPeer"] border pixel 0 # fixed in Firefox. # for_window [title="\ -\ Sharing\ Indicator$"] floating enable, sticky enable -# Fix slow loading GTK+ apps, waybar, and GPG pinentry -# exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK -# exec hash dbus-update-activation-environment 2>/dev/null && \ -# dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XAUTHORITY +# Fix for "No Gcr prompter" with pinentry-gnome3 +exec dbus-update-activation-environment DISPLAY XAUTHORITY ############################################################################### # Startup Apps exec [ ! "$(pidof pipewire)" ] && pipewire exec [ ! "$(pidof syncthing)" ] && syncthing serve -exec [ ! "$(ps x | grep wl-paste.*cliphist | wc -l)" -ge 4 ] && wl-paste --watch cliphist store -# Fix for "No Gcr prompter" with pinentry-gnome3 -exec dbus-update-activation-environment DISPLAY XAUTHORITY +# firefox copies an image multiple ways so accept both types of media. the script for +# history selection filters out firefox's text copy. +exec [ ! "$(ps x | grep wl-paste.*image.*cliphist | wc -l)" -ge 4 ] && wl-paste --type image --watch cliphist store +exec [ ! "$(ps x | grep wl-paste.*text.*cliphist | wc -l)" -ge 4 ] && wl-paste --type text --watch cliphist store #exec mako # notifications #exec kanshi # autorandr -- cgit v1.2.1