From 54031d801c44484d7352abc6d0c393558b84b92a Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 10 Jul 2023 04:18:04 +0200 Subject: [PATCH] home-manager: add sway-related files --- .config/kanshi/config | 28 ++++++++++++- .config/sway/config | 96 ++++++++++++++++++------------------------- .config/sway/inputs | 50 ++++++++++++++++++++++ bin/sway-locker | 4 +- bin/swaylock-wrapper | 8 ++-- home-surtur.nix | 34 +++++++++++++++ 6 files changed, 158 insertions(+), 62 deletions(-) create mode 100644 .config/sway/inputs diff --git a/.config/kanshi/config b/.config/kanshi/config index 7f8611c..6cf0745 100644 --- a/.config/kanshi/config +++ b/.config/kanshi/config @@ -25,6 +25,26 @@ # output "Dell Inc. DELL U2412M YPPY077L1JXS" disable #} +#profile bigscreen-sammy { +# output eDP-1 enable mode 1920x1080 position 0,0 +# output "Samsung Electric Company LU28R55 HNMW101193" mode 2560x1440 enable position 1920,0 +#} + +#profile bigscreen-sammy4k-clamshell { +# output eDP-1 disable +# output "Samsung Electric Company LU28R55 HNMW101193" mode 3840x2160 enable position 0,0 +#} + +profile bigscreen-sammy-clamshell { + output eDP-1 disable + output "Samsung Electric Company LU28R55 HNMW101193" mode 2560x1440 enable position 0,0 +} + +profile bigscreen1 { + output eDP-1 disable + output "Dell Inc. DELL U2412M Y1H5T27N1EVL" mode 1920x1200 enable position 0,0 scale .94 +} + profile bigscreen { output eDP-1 disable output "Dell Inc. DELL U2412M Y1H5T27N1EVL" mode 1920x1200 enable position 0,0 scale .94 @@ -32,8 +52,14 @@ profile bigscreen { # output eDP-1 enable mode 1920x1080 position 0,0 scale 1 } +# profile bigscreen2-clamshell { + # output eDP-1 disable + # output "Dell Inc. DELL U2412M YPPY077L1JXS" mode 1920x1200 enable position 0,0 scale .94 + # # output eDP-1 enable mode 1920x1080 position 0,0 scale 1 +# } + profile single-no-clamshell { - output eDP-1 enable position 0,0 + output eDP-1 enable mode 1920x1080 position 0,0 output "Dell Inc. DELL U2412M Y1H5T27N1EVL" mode 1920x1200 disable output "Dell Inc. DELL U2412M YPPY077L1JXS" disable } diff --git a/.config/sway/config b/.config/sway/config index 9422f30..a9b749e 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -8,7 +8,7 @@ set $right l $lock exec swaylock -f $lockt exec ~/utils/bin/sway-locker -t - $chromium_flags --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-gpu-rasterization --enable-zero-copy --js-flags=--jitless + $chromium_flags --enable-features=UseOzonePlatform,VaapiVideoDecoder,WebRTCPipeWireCapturer --ozone-platform=wayland --ignore-gpu-blocklist --enable-gpu-rasterization --enable-zero-copy --disable-gpu-driver-bug-workarounds --js-flags=--jitless $keyring "/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh" $term KITTY_ENABLE_WAYLAND=1 kitty -1 # qterminal alacritty $menu wofi --show drun --allow-markup swaymsg exec -- @@ -19,12 +19,15 @@ set # $bg "~/Pictures/apod/2020-April-29-The-Ion-Tail-of-New-Comet-SWAN.jpg fit #000000" $bg "~/Pictures/apod/2020-August-11-Churning-Clouds-on-Jupiter.jpg" $bg2 "~/Pictures/apod/2019-October-20-Pluto-at-Night.jpg" - $gtk_theme "Dracula" + # $gtk_theme "Dracula" + $gtk_theme "Yaru-purple-dark" $gtk_font_name "CascadiaCodePL ExtraLight" $gtk_font_size "10.4" $icon_theme "Flat-Remix-Blue-Dark" - $theme "Dracula" + # $icon_theme "Yaru-blue-dark" + # $gtk_cursor_theme "Yaru" $gtk_cursor_theme "Adwaita" + $theme "Yaru-purple-dark" $laptop_screen "eDP-1" $ext_screen "Dell Inc. DELL U2412M Y1H5T27N1EVL" $ext_screen2 "Dell Inc. DELL U2412M YPPY077L1JXS" @@ -44,9 +47,26 @@ default_floating_border normal # inverse for $mod+left click to resize, $mod+right click to drag floating_modifier $mod normal +# clipboard sync +# exec wl-paste -pw wl-copy + +# Only enable outer gaps when there is exactly one container +#smart_gaps inverse_outer + +# Activate smart borders (always) +#smart_borders on + +# Activate smart borders (only when there are effectively no gaps) +#smart_borders no_gaps + +# Hide edge borders only if there is one window with no gaps +#hide_edge_borders smart_no_gaps + +# Only enable gaps on a workspace when there is at least one container #smart_gaps on smart_gaps inverse_outer gaps outer 8 +# gaps outer -3 gaps inner 5 font pango:FiraCode Retina 14px @@ -88,9 +108,8 @@ exec_always --no-startup-id swayidle -w \ timeout 545 'pgrep -u $(id -u) swaylock || notify-send -t 15000 -u critical -i "Idle timeout" "Screen is locking soon"' \ timeout 600 "$lock" \ - timeout 610 'swaymsg "output * dpms off"' \ - timeout 15 'pgrep -u $(id -u) swaylock && swaymsg "output * dpms off"' \ - resume 'swaymsg "output * dpms on"' \ + timeout 15 'pgrep -u $(id -u) swaylock && swaymsg "output * power off"' \ + resume 'swaymsg "output * power on"' \ before-sleep "pgrep -u $(id -u) swaylock || $lockt" } @@ -116,9 +135,8 @@ exec --no-startup-id { pgrep -u $(id -u) swayidle || swayidle -w \ timeout 545 'pgrep -u $(id -u) swaylock || notify-send -t 15000 -u critical -i "Idle timeout" "Screen is locking soon"' \ timeout 600 "$lock" \ - timeout 610 'swaymsg "output * dpms off"' \ - timeout 15 'pgrep -u $(id -u) swaylock && swaymsg "output * dpms off"' \ - resume 'swaymsg "output * dpms on"' \ + timeout 15 'pgrep -u $(id -u) swaylock && swaymsg "output * power off"' \ + resume 'swaymsg "output * power on"' \ before-sleep "pgrep -u $(id -u) swaylock || $lockt" } @@ -170,48 +188,7 @@ bindsym } for_window [app_id="^launcher$"] floating enable, border none, resize set width 25 ppt height 100 ppt, move position 0 px 0 px -input 1:1:AT_Translated_Set_2_keyboard -{ - # laptop kbd - xkb_layout gb,sk - xkb_options grp:win_space_toggle,compose:ralt - xkb_variant ",qwerty" - repeat_delay 280 - repeat_rate 55 -} - -input 1133:16522:Logitech_MX_Keys -{ - xkb_layout gb,sk - xkb_options grp:win_space_toggle,compose:ralt - xkb_variant ",qwerty" - repeat_delay 280 - repeat_rate 55 -} - -input 1102:4619:DLL07A7:01_044E:120B -{ - # touchpad - accel_profile adaptive - - tap enabled - # disable-while-typing - dwt enabled - natural_scroll enabled - scroll_method two_finger - # lrm treats 1 finger as left click, 2 fingers as right click, and 3 - # fingers as middle click. - tap_button_map lrm -} -input 1149:8264:Primax_Kensington_Eagle_Trackball -{ - # scroll_factor 1.5 - scroll_factor 0.5 - natural_scroll enabled - accel_profile adaptive - dwt enabled -} - +include ./inputs focus_follows_mouse yes focus_wrapping false popup_during_fullscreen smart @@ -258,13 +235,19 @@ for_window [app_id="qterminal"] border pixel 2 for_window [app_id="xterm"] border pixel 2 for_window [title=".*Brave.*"] border pixel 1 inhibit_idle fullscreen for_window [title=".*Firefox.*"] border pixel 2 inhibit_idle fullscreen +for_window [title="Firefox.*"] border pixel 2 inhibit_idle fullscreen for_window [app_id="firefox"] border pixel 2 inhibit_idle fullscreen +# for_window [title=".*Firefox.*"] border none inhibit_idle fullscreen +# for_window [app_id="firefox"] border none inhibit_idle fullscreen for_window [class="Firefox"] border pixel 2 inhibit_idle fullscreen +for_window [class="swayfox"] border pixel 2 inhibit_idle fullscreen for_window [class="vlc"] border pixel 2 inhibit_idle visible fullscreen for_window [app_id="vlc"] border pixel 2 inhibit_idle visible fullscreen for_window [title=".*VLC*."] border pixel 2 inhibit_idle visible fullscreen +for_window [title="VLC*."] border pixel 2 inhibit_idle visible fullscreen for_window [app_id="org.gnome.Nautilus"] border pixel 1 for_window [app_id="dolphin"] border pixel 1 +# for_window [app_id="kitty"] border pixel 1 for_window [app_id="kitty"] border pixel 2 # as per https://github.com/japhir/ArchConfigs/blob/master/swayconfig @@ -272,7 +255,7 @@ for_window [app_id="kitty"] border pixel 2 bindsym $mod+ctrl+Shift+a exec mpv --no-osc --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0 || notify-send "failed to start webcam" # for_window [title="^video0 - mpv$"] floating enable, sticky enable, resize set height 260 px, move absolute position 0 px 820 px, border none for_window [title="^video0 - mpv$"] floating enable, sticky enable, resize set height 130 px, border none -for_window [title="Firefox — Sharing Indicator$"] floating enable, resize set height 16 px, border none +for_window [title="Firefox Developer Edition — Sharing Indicator$"] floating enable, resize set height 16 px, border none for_window [title="Picture-in-Picture"] floating enable #--- Xtk Applications ------------------------------------------------------ @@ -294,7 +277,7 @@ bindsym Shift+print exec grim -g "$(slurp)" - | wl-copy # screenshot of a window Control+print exec winprint.sh - # colour picker + # colour picker / eyedropper Control+Shift+print exec grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt: | wl-copy $mod+c exec gnome-calculator # -w: Always open a new window for browsing specified URIs. @@ -302,9 +285,9 @@ bindsym $mod+Shift+n exec nemo $mod+m exec QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_QPA_PLATFORMTHEME=wayland vlc $mod+Shift+b exec brave-browser-beta --incognito $chromium_flags - $mod+Shift+w exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 ~/Downloads/firefox-dev/firefox --private-window + $mod+Shift+w exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 ~/Downloads/firefox-dev/firefox --class=swayfox --private-window $mod+Ctrl+Shift+w exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 systemctl --user start ff_nn - $mod+Shift+g exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 firefox --private-window + $mod+Shift+g exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 firefox --class=swayfox --private-window $mod+Shift+v exec ferdi --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-gpu-rasterization --enable-zero-copy $mod+Shift+a exec chromium-freeworld --incognito $chromium_flags --locked $mod+Escape exec systemctl suspend -i @@ -515,6 +498,9 @@ bindsym # Move focus to the parent container $mod+a focus parent + + # focus the child container + $mod+alt+a focus child } # diff --git a/.config/sway/inputs b/.config/sway/inputs new file mode 100644 index 0000000..37f0ff9 --- /dev/null +++ b/.config/sway/inputs @@ -0,0 +1,50 @@ +input 1:1:AT_Translated_Set_2_keyboard +{ + # laptop kbd + xkb_layout gb,sk + xkb_options grp:win_space_toggle,compose:ralt + xkb_variant ",qwerty" + repeat_delay 280 + repeat_rate 55 +} + +input 1133:16522:Logitech_MX_Keys +{ + xkb_layout gb,sk + xkb_options grp:win_space_toggle,compose:ralt + xkb_variant ",qwerty" + repeat_delay 280 + repeat_rate 55 +} + +input 1452:592:Keychron_Keychron_K2 +{ + xkb_layout gb,sk + xkb_options grp:win_space_toggle,compose:ralt + xkb_variant ",qwerty" + repeat_delay 280 + repeat_rate 55 +} + +input 1102:4619:DLL07A7:01_044E:120B +{ + # touchpad + accel_profile adaptive + + tap enabled + # disable-while-typing + dwt enabled + natural_scroll enabled + scroll_method two_finger + # lrm treats 1 finger as left click, 2 fingers as right click, and 3 + # fingers as middle click. + tap_button_map lrm +} +input 1149:8264:Primax_Kensington_Eagle_Trackball +{ + # scroll_factor 1.5 + scroll_factor 0.5 + natural_scroll enabled + accel_profile adaptive + dwt enabled +} diff --git a/bin/sway-locker b/bin/sway-locker index 04b4805..373d2bb 100755 --- a/bin/sway-locker +++ b/bin/sway-locker @@ -6,9 +6,9 @@ isrunning=1 player=`ps -u $USER | grep -Ec "(rhythmbox|totem|mpv|vlc|*mplayer)"` if [ "$player" -ge "$isrunning" ]; then - if [ "$1" == "-t" || "$1" == "-f" ]; then + if [ "$1" == "-t" ] || [ "$1" == "-f" ]; then dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause fi fi -swaylock -C ~/.config/swaylock/config -f +swaylock -f -C ~/.config/swaylock/config --grace 0 && sleep 0.1 diff --git a/bin/swaylock-wrapper b/bin/swaylock-wrapper index 0228c55..0c2353f 100755 --- a/bin/swaylock-wrapper +++ b/bin/swaylock-wrapper @@ -6,12 +6,12 @@ lockt="exec ~/utils/bin/sway-locker -t" revert() { killall swayidle swayidle -w timeout 3600 "$lock" \ - timeout 3610 'swaymsg "output * dpms off"' \ - resume 'swaymsg "output * dpms on"' \ + timeout 3610 'swaymsg "output * power off"' \ + resume 'swaymsg "output * power on"' \ before-sleep "$lockt" } trap revert HUP INT TERM -swayidle -w timeout 5 'swaymsg "output * dpms off"' \ -resume 'swaymsg "output * dpms on"' & +swayidle -w timeout 5 'swaymsg "output * power off"' \ +resume 'swaymsg "output * power on"' & swaylock -C ~/.config/swaylock/config revert diff --git a/home-surtur.nix b/home-surtur.nix index 480c870..5812d09 100644 --- a/home-surtur.nix +++ b/home-surtur.nix @@ -72,6 +72,40 @@ in { source = ./.vim/python.vimrc.vim; }; + ".config/sway/config" = { + source = ./.config/sway/config; + }; + ".config/sway/config.d/dracula.sway" = { + source = ./.config/sway/config.d/dracula.sway; + }; + ".config/sway/env" = { + source = ./.config/sway/env; + }; + ".config/sway/inputs" = { + source = ./.config/sway/inputs; + }; + ".config/waybar/config" = { + source = ./.config/waybar/config; + }; + ".config/waybar/style.css" = { + source = ./.config/waybar/style.css; + }; + ".config/waybar/modules/storage.sh" = { + source = ./.config/waybar/modules/storage.sh; + }; + ".config/kanshi/config" = { + source = ./.config/kanshi/config; + }; + ".config/mako/config" = { + source = ./.config/mako/config; + }; + ".local/bin/swws.py" = { + source = ./bin/swws.py; + }; + ".local/bin/sway-locker" = { + source = ./bin/sway-locker; + }; + ".config/fusuma/config-wl.yml" = { source = ./.config/fusuma/config-wl.yml; };