From 03b3fed5fb0e62dfe44e9fba042619ab66c237dd Mon Sep 17 00:00:00 2001 From: urosm Date: Sat, 12 Aug 2023 01:24:31 +0200 Subject: [PATCH] add `sway` config --- .config/sway/config | 256 ++++++++++++++++++++++++++++++++++++++++++++ .config/sway/torino | 4 + 2 files changed, 260 insertions(+) create mode 100644 .config/sway/config create mode 100644 .config/sway/torino diff --git a/.config/sway/config b/.config/sway/config new file mode 100644 index 0000000..a4f7495 --- /dev/null +++ b/.config/sway/config @@ -0,0 +1,256 @@ +# logo key +set $mod Mod4 + +# home row direction keys +set $left h +set $down j +set $up k +set $right l + +# apps +set $term footclient +set $term_float footclient --app-id=foot_float +set $browser firefox +set $email thunderbird + +# menus +set $drun fuzzel +set $mountmenu fuzzel_mount.sh +set $findmenu fuzzel_find_file.sh +set $openmenu fuzzel_open_file.sh +set $wifimenu $term_float nmtui + +# colors +set $bg #292526 +set $dimmed #6185ff +set $accent #ff3e8b +set $error #ff404f + +# input +input "type:keyboard" { + xkb_layout gb,si + xkb_options caps:escape,grp:alt_shift_toggle +} + +# TODO: figure out how this is viable +# set $xkb_layout_mode "keyboard layout: (g)b (s)i" +# bindsym alt+shift mode $xkb_layout_mode +# +# mode $xkb_layout_mode { +# bindsym g input "type:keyboard" xkb_layout gb, mode default +# bindsym s input "type:keyboard" xkb_layout si, mode default +# } + +input "type:touchpad" { + tap enabled +} + +seat * hide_cursor 5000 + +# output +output * bg $bg solid_color + +# key bindings +# start terminal +bindsym $mod+return exec $term +bindsym $mod+shift+return exec $term_float +bindsym $mod+t exec foot + +# start browser +bindsym $mod+w exec $browser +bindsym $mod+shift+w exec $email + +# start menus +bindsym $mod+space exec $drun +bindsym $mod+home exec $wifimenu +bindsym $mod+insert exec $mountmenu +bindsym $mod+e exec $openmenu +bindsym $mod+shift+e exec $findmenu + +# notifications +bindsym $mod+slash exec notify-send -e -h string:x-canonical-private-synchronous:status "$(date)" "Battery: $(cat /sys/class/power_supply/BAT0/capacity)%" +bindsym $mod+x exec makoctl dismiss +bindsym $mod+shift+x exec makoctl dismiss -a +bindsym $mod+z exec makoctl restore + +# kill window +bindsym $mod+q kill + +# move focus +bindsym $mod+$up focus up +bindsym $mod+$down focus down +bindsym $mod+$left focus left +bindsym $mod+$right focus right + +# move focused window +bindsym $mod+shift+$up move up +bindsym $mod+shift+$down move down +bindsym $mod+shift+$left move left +bindsym $mod+shift+$right move right + +# switch to workspace +bindsym $mod+1 workspace number 1 +bindsym $mod+2 workspace number 2 +bindsym $mod+3 workspace number 3 +bindsym $mod+4 workspace number 4 +bindsym $mod+5 workspace number 5 +bindsym $mod+6 workspace number 6 +bindsym $mod+7 workspace number 7 +bindsym $mod+8 workspace number 8 +bindsym $mod+9 workspace number 9 +bindsym $mod+0 workspace number 10 +bindsym $mod+next workspace next +bindsym $mod+prior workspace prev + +# move focused to workspace +bindsym $mod+shift+1 move container to workspace number 1, workspace number 1 +bindsym $mod+shift+2 move container to workspace number 2, workspace number 2 +bindsym $mod+shift+3 move container to workspace number 3, workspace number 3 +bindsym $mod+shift+4 move container to workspace number 4, workspace number 4 +bindsym $mod+shift+5 move container to workspace number 5, workspace number 5 +bindsym $mod+shift+6 move container to workspace number 6, workspace number 6 +bindsym $mod+shift+7 move container to workspace number 7, workspace number 7 +bindsym $mod+shift+8 move container to workspace number 8, workspace number 8 +bindsym $mod+shift+9 move container to workspace number 9, workspace number 9 +bindsym $mod+shift+0 move container to workspace number 10, workspace number 10 +bindsym $mod+shift+next move container to workspace next, workspace next +bindsym $mod+shift+prior move container to workspace prev, workspace prev + +# resize +set $resize_mode "resize" +bindsym $mod+r mode $resize_mode + +mode $resize_mode { + bindsym $left resize shrink width + bindsym $down resize grow height + bindsym $up resize shrink height + bindsym $right resize grow width + bindsym $mod+$left resize shrink width 25 px + bindsym $mod+$down resize grow height 25 px + bindsym $mod+$up resize shrink height 25 px + bindsym $mod+$right resize grow width 25 px + bindsym escape mode default + bindsym $mod+escape mode default + bindsym $mod+r mode default +} + +# layout +bindsym $mod+d layout toggle tabbed split +bindsym $mod+f fullscreen toggle +bindsym $mod+shift+f floating toggle +bindsym $mod+g focus mode_toggle +bindsym $mod+shift+g sticky toggle + +# scratchpad +bindsym $mod+period move to scratchpad +bindsym $mod+shift+period scratchpad show + +# floating +for_window [window_type="dialog"] floating enable +for_window [window_type="utility"] floating enable +for_window [window_type="toolbar"] floating enable +for_window [window_type="splash"] floating enable +for_window [window_type="menu"] floating enable +for_window [window_type="dropdown_menu"] floating enable +for_window [window_type="popup_menu"] floating enable +for_window [window_type="tooltip"] floating enable +for_window [window_type="notification"] floating enable + +# specific floating +for_window [title="About Mozilla Firefox"] floating enable +for_window [app_id="foot_float"] floating enable + +# laptop +bindsym XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:audio_sink "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" +bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:audio_sink "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" +bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:audio_sink "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" +bindsym XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:audio_source "$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)" +bindsym XF86MonBrightnessUp exec light -A 1;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(light)" +bindsym XF86MonBrightnessDown exec light -U 1;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(light)" +bindsym shift+XF86MonBrightnessUp exec light -A 10;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(light)" +bindsym shift+XF86MonBrightnessDown exec light -U 10;\ + exec notify-send -e -t 1000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(light)" +bindsym print exec grim $(xdg-user-dir DOWNLOAD)/$(date +"%F-%H-%M-%S_screenshot.png") + +# session +set $session_mode "session: (l)ock (r)eload (q)uit re(b)oot (p)oweroff" +bindsym $mod+escape mode $session_mode + +mode $session_mode { + bindsym l exec swaylock, mode default + bindsym r reload, mode default + bindsym q exit, mode default + bindsym b exec systemctl reboot, mode default + bindsym p exec systemctl poweroff, mode default + bindsym escape mode default + bindsym $mod+escape mode default +} + +# border +default_border none +default_floating_border normal 1 + +set $border_mode "border: (n)one (t)itle (p)ixel" +bindsym $mod+b mode $border_mode + +mode $border_mode { + bindsym n border none, mode default + bindsym t border normal 1, mode default + bindsym p border pixel 1, mode default + bindsym escape mode default + bindsym $mod+escape mode default + bindsym $mod+b mode default +} + +# class border background text indicator child_border +client.focused $accent $accent $bg $error $accent +client.focused_inactive $dimmed $dimmed $bg $bg $dimmed +client.unfocused $dimmed $dimmed $bg $bg $dimmed +client.urgent $error $error $bg $error $error + +# statusbar +bar { + # binding_mode_indicator no + colors { + background $bg + statusline $dimmed + separator $dimmed + # border background text + focused_workspace $bg $bg $accent + active_workspace $dimmed $bg $dimmed + inactive_workspace $bg $bg $dimmed + urgent_workspace $bg $bg $error + } +} + +set $bar_mode "bar: (d)ock (h)ide (i)nvisible (o)verlay" +bindsym $mod+shift+b mode $bar_mode, bar mode dock + +mode $bar_mode { + bindsym d bar mode dock, mode default + bindsym h bar mode hide, mode default + bindsym i bar mode invisible, mode default + bindsym o bar mode overlay, mode default + bindsym escape mode default + bindsym $mod+escape mode default + bindsym $mod+shift+b mode default +} + +# autostart +exec swayidle +exec wlsunset -l 45 -L 15 +exec mako +exec foot --server + +# xwayland +xwayland disable + +# include +include ~/.config/sway/`hostname` diff --git a/.config/sway/torino b/.config/sway/torino new file mode 100644 index 0000000..b8c13ca --- /dev/null +++ b/.config/sway/torino @@ -0,0 +1,4 @@ +# clamshell +set $laptop LVDS-1 +bindswitch --reload --locked lid:on output $laptop disable +bindswitch --reload --locked lid:off output $laptop enable