1
0
Fork 0

Refactor sway config

main
urosm 2024-10-13 21:14:10 +02:00
parent 9a934b333c
commit 587b6d2ed9
1 changed files with 192 additions and 239 deletions

View File

@ -1,13 +1,12 @@
# set ##########################################################################
# vars #########################################################################
################################################################################
# keys
set $mod mod4
set $left h
set $down j
set $up k
set $right l
# colors
set $black #000000
set $white #e2e2e2
set $blue #856cff
@ -16,7 +15,76 @@ set $red #fa3500
set $orange #d06600
set $green #009843
# workspaces
# configuration ################################################################
################################################################################
workspace_layout tabbed
xwayland disable
# class border background text indicator
client.focused $magenta $magenta $black $red
client.focused_inactive $blue $blue $black $black
client.unfocused $blue $blue $black $black
client.urgent $red $red $black $black
default_border normal 0
default_floating_border normal 0
focus_wrapping yes
font monospace 13
input "type:keyboard" {
xkb_options caps:escape,compose:ralt
repeat_delay 200
repeat_rate 30
}
input "type:touchpad" tap enabled
seat * hide_cursor when-typing enable
output * background $black solid_color
# windows ######################################################################
################################################################################
# floating
bindsym $mod+shift+f floating toggle
# focus
bindsym $mod+$up focus up
bindsym $mod+$down focus down
bindsym $mod+$left focus left
bindsym $mod+$right focus right
bindsym $mod+a focus parent
bindsym $mod+s focus child
bindsym $mod+g focus mode_toggle
# fullscreen
bindsym $mod+f fullscreen toggle
# move
bindsym $mod+shift+$up move up
bindsym $mod+shift+$down move down
bindsym $mod+shift+$left move left
bindsym $mod+shift+$right move right
bindsym $mod+colon move scratchpad
# scratchpad
bindsym $mod+semicolon scratchpad show
# sticky
bindsym $mod+shift+g sticky toggle
# resize
bindsym $mod+control+$left resize shrink width
bindsym $mod+control+$down resize grow height
bindsym $mod+control+$up resize shrink height
bindsym $mod+control+$right resize grow width
# workspaces ###################################################################
################################################################################
set $wsq 0:q:bot
set $wsw 1:w:www
set $wse 2:e:txt
@ -28,11 +96,106 @@ set $wsi 7:i:cmd
set $wso 8:o:cmd
set $wsp 9:p:top
# modes
set $session_mode "session: (r)eload (l)ock (q)uit (s)uspend (h)ibernate re(b)oot (p)oweroff"
set $layout_mode "layout: split(h) split(v) (s)tacking (t)abbed"
bindsym $mod+tab workspace back_and_forth
bindsym $mod+q workspace $wsq
bindsym $mod+w workspace $wsw
bindsym $mod+e workspace $wse
bindsym $mod+r workspace $wsr
bindsym $mod+t workspace $wst
bindsym $mod+y workspace $wsy
bindsym $mod+u workspace $wsu
bindsym $mod+i workspace $wsi
bindsym $mod+o workspace $wso
bindsym $mod+p workspace $wsp
bindsym $mod+bracketleft workspace prev
bindsym $mod+bracketright workspace next
bindsym $mod+shift+tab move workspace back_and_forth, workspace back_and_forth
bindsym $mod+shift+q move workspace $wsq, workspace $wsq
bindsym $mod+shift+w move workspace $wsw, workspace $wsw
bindsym $mod+shift+e move workspace $wse, workspace $wse
bindsym $mod+shift+r move workspace $wsr, workspace $wsr
bindsym $mod+shift+t move workspace $wst, workspace $wst
bindsym $mod+shift+y move workspace $wsy, workspace $wsy
bindsym $mod+shift+u move workspace $wsu, workspace $wsu
bindsym $mod+shift+i move workspace $wsi, workspace $wsi
bindsym $mod+shift+o move workspace $wso, workspace $wso
bindsym $mod+shift+p move workspace $wsp, workspace $wsp
bindsym $mod+shift+bracketleft move workspace prev, workspace prev
bindsym $mod+shift+bracketright move workspace next, workspace next
# modes ########################################################################
################################################################################
set $session_mode "session: (r)eload (l)ock (q)uit (s)uspend (h)ibernate re(b)oot (p)oweroff"
mode $session_mode {
bindsym {
r reload, mode default
l exec $swaylock, mode default
q exit, mode default
s exec systemctl suspend, mode default
h exec systemctl hibernate, mode default
b exec systemctl reboot, mode default
p exec systemctl poweroff, mode default
escape mode default
}
}
bindsym $mod+escape mode $session_mode, fullscreen disable
set $layout_mode "layout: split(h) split(v) (s)tacking (t)abbed"
mode $layout_mode {
bindsym {
h layout splith, mode default
v layout splitv, mode default
s layout stacking, mode default
t layout tabbed, mode default
escape mode default
}
}
bindsym $mod+d mode $layout_mode, fullscreen disable
# laptop #######################################################################
################################################################################
set $notify_hint string:x-canonical-private-synchronous
bindsym XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+, exec notify-send -e -t 2000 -h $notify_hint:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-, exec notify-send -e -t 2000 -h $notify_hint:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle, exec notify-send -e -t 2000 -h $notify_hint:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
bindsym XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle, exec notify-send -e -t 2000 -h $notify_hint:audio "$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)"
bindsym XF86MonBrightnessUp exec brightnessctl -qn set +1%, exec notify-send -e -t 2000 -h $notify_hint:brightness "Brightness: $(brightnessctl get)"
bindsym XF86MonBrightnessDown exec brightnessctl -qn set 1%-, exec notify-send -e -t 2000 -h $notify_hint:brightness "Brightness: $(brightnessctl get)"
bindsym shift+XF86MonBrightnessUp exec brightnessctl -qn set +10%, exec notify-send -e -t 2000 -h $notify_hint:brightness "Brightness: $(brightnessctl get)"
bindsym shift+XF86MonBrightnessDown exec brightnessctl -qn set 10%-, exec notify-send -e -t 2000 -h $notify_hint:brightness "Brightness: $(brightnessctl get)"
# run ##########################################################################
################################################################################
bindsym $mod+return exec $TERMINAL
bindsym $mod+n exec makoctl dismiss
bindsym $mod+shift+n exec makoctl restore
bindsym print exec grim - | wl-copy
bindsym $mod+space exec fuzzel
set $findignore \( -path "$HOME"/.cache -o -path "$HOME"/.mozilla -o -path "$HOME"/.thunderbird -o -name .git \)
bindsym $mod+shift+space exec 'cd "$(find "$PWD" $findignore -prune -o -type d | fuzzel -dp"cd > ")" || exit; find "$PWD" $findignore -prune -o -print | fuzzel -dp"open > " | xargs -rI{} xdg-open "{}"'
# autorun ######################################################################
################################################################################
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP=sway
exec mako --max-visible=0
exec devmon --exec-on-drive 'notify-send "Mounted %f at %d"' --exec-on-unmount 'notify-send "Unmounted %f"'
exec foot -s
exec wlsunset -l 45 -L 15
# commands
set $swaylock swaylock -f \
--color=$black \
--indicator-radius 1200 \
@ -46,242 +209,32 @@ set $swaylock swaylock -f \
--text-ver-color=#00000000 \
--text-wrong-color=#00000000
exec swayidle -w \
timeout 300 'brightnessctl -s set 1%' resume 'brightnessctl -r' \
timeout 600 '$swaylock' \
timeout 900 'swaymsg -q "output * power off"' resume 'swaymsg -q "output * power on"' \
timeout 1800 'systemctl suspend-then-hibernate' \
before-sleep '$swaylock'
# bar ##########################################################################
################################################################################
bar {
separator_symbol " | "
separator_symbol " "
status_command exec swaystatus
status_edge_padding 0
status_padding 0
strip_workspace_numbers yes
wrap_scroll yes
colors {
background $black
statusline $blue
separator $blue
# border background text
focused_workspace $black $black $magenta
active_workspace $black $black $white
inactive_workspace $black $black $blue
urgent_workspace $black $black $red
background $blue
statusline $black
separator $black
# border background text
focused_workspace $magenta $magenta $black
active_workspace $white $white $black
inactive_workspace $blue $blue $black
urgent_workspace $red $red $black
}
}
# workspace_layout #############################################################
workspace_layout tabbed
# xwayland #####################################################################
# xwayland disable
# bindsym ######################################################################
# floating
bindsym $mod+shift+f floating toggle
# focus
bindsym {
$mod+$up focus up
$mod+$down focus down
$mod+$left focus left
$mod+$right focus right
$mod+a focus parent
$mod+s focus child
$mod+g focus mode_toggle
}
# fullscreen
bindsym $mod+f fullscreen toggle
# mark
bindsym {
$mod+shift+grave mark --toggle '`'
$mod+shift+1 mark --toggle '1'
$mod+shift+2 mark --toggle '2'
$mod+shift+3 mark --toggle '3'
$mod+shift+4 mark --toggle '4'
$mod+shift+5 mark --toggle '5'
$mod+shift+6 mark --toggle '6'
$mod+shift+7 mark --toggle '7'
$mod+shift+8 mark --toggle '8'
$mod+shift+9 mark --toggle '9'
$mod+shift+0 mark --toggle '0'
$mod+shift+minus mark --toggle '-'
$mod+shift+equal mark --toggle '='
}
bindsym {
$mod++grave [con_mark="`"] focus
$mod++1 [con_mark="1"] focus
$mod++2 [con_mark="2"] focus
$mod++3 [con_mark="3"] focus
$mod++4 [con_mark="4"] focus
$mod++5 [con_mark="5"] focus
$mod++6 [con_mark="6"] focus
$mod++7 [con_mark="7"] focus
$mod++8 [con_mark="8"] focus
$mod++9 [con_mark="9"] focus
$mod++0 [con_mark="0"] focus
$mod++minus [con_mark="-"] focus
$mod++equal [con_mark="="] focus
}
# mode
bindsym {
$mod+d mode $layout_mode, fullscreen disable
$mod+escape mode $session_mode, fullscreen disable
}
# move
bindsym --to-code {
$mod+shift+$up move up
$mod+shift+$down move down
$mod+shift+$left move left
$mod+shift+$right move right
$mod+shift+tab move workspace back_and_forth, workspace back_and_forth
$mod+shift+q move workspace $wsq, workspace $wsq
$mod+shift+w move workspace $wsw, workspace $wsw
$mod+shift+e move workspace $wse, workspace $wse
$mod+shift+r move workspace $wsr, workspace $wsr
$mod+shift+t move workspace $wst, workspace $wst
$mod+shift+y move workspace $wsy, workspace $wsy
$mod+shift+u move workspace $wsu, workspace $wsu
$mod+shift+i move workspace $wsi, workspace $wsi
$mod+shift+o move workspace $wso, workspace $wso
$mod+shift+p move workspace $wsp, workspace $wsp
$mod+shift+bracketleft move workspace prev, workspace prev
$mod+shift+bracketright move workspace next, workspace next
$mod+colon move scratchpad
}
# scratchpad
bindsym $mod+semicolon scratchpad show
# sticky
bindsym $mod+shift+g sticky toggle
# exec
bindsym {
$mod+return exec $TERMINAL
$mod+n exec makoctl dismiss
$mod+shift+n exec makoctl restore
print exec grim - | wl-copy
$mod+space exec fuzzel
$mod+shift+space exec 'cd $(find -type d | fuzzel -dp"cd > "); find | fuzzel -dp"open > " | xargs -rI{} xdg-open "{}"'
}
# exec (laptop)
bindsym {
XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)"
XF86MonBrightnessUp exec brightnessctl -n set +1%, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
XF86MonBrightnessDown exec brightnessctl -n set 1%-, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
shift+XF86MonBrightnessUp exec brightnessctl -n set +10%, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
shift+XF86MonBrightnessDown exec brightnessctl -n set 10%-, exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
}
# resize
bindsym {
$mod+control+$left resize shrink width
$mod+control+$down resize grow height
$mod+control+$up resize shrink height
$mod+control+$right resize grow width
}
# workspace
bindsym --to-code {
$mod+tab workspace back_and_forth
$mod+q workspace $wsq
$mod+w workspace $wsw
$mod+e workspace $wse
$mod+r workspace $wsr
$mod+t workspace $wst
$mod+y workspace $wsy
$mod+u workspace $wsu
$mod+i workspace $wsi
$mod+o workspace $wso
$mod+p workspace $wsp
$mod+bracketleft workspace prev
$mod+bracketright workspace next
}
# client.* #####################################################################
# class border background text indicator child_border
client.focused $magenta $magenta $black $red $black
client.focused_inactive $blue $blue $black $black $black
client.unfocused $blue $blue $black $black $black
client.urgent $red $red $black $black $black
# default_border ###############################################################
default_border normal 0
# default_floating_border ######################################################
default_floating_border normal 0
# exec #########################################################################
exec {
systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP=sway
swayidle -w \
timeout 300 'brightnessctl -s set 1%' resume 'brightnessctl -r' \
timeout 600 '$swaylock' \
timeout 900 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
timeout 1800 'systemctl suspend-then-hibernate' \
before-sleep '$swaylock'
wlsunset -l 45 -L 15
mako --max-visible=0
devmon --exec-on-drive 'notify-send "Mounted %f at %d"' --exec-on-unmount 'notify-send "Unmounted %f"'
foot -s
wayneko --layer overlay --type inu --background-colour 0xe2e2e2 --outline-colour 0x856cff
}
# focus_wrapping ###############################################################
focus_wrapping yes
# font #########################################################################
font monospace 13
# input ########################################################################
# keyboard
input "type:keyboard" {
xkb_layout us,si
xkb_options caps:escape,grp:alt_shift_toggle,compose:ralt
repeat_delay 200
repeat_rate 30
}
# touchpad
input "type:touchpad" tap enabled
# mode #########################################################################
# session
mode $session_mode {
bindsym {
r reload, mode default
l exec $swaylock, mode default
q exit, mode default
s exec systemctl suspend, mode default
h exec systemctl hibernate, mode default
b exec systemctl reboot, mode default
p exec systemctl poweroff, mode default
escape mode default
}
}
# layout
mode $layout_mode {
bindsym {
h layout splith, mode default
v layout splitv, mode default
s layout stacking, mode default
t layout tabbed, mode default
escape mode default
}
}
# seat #########################################################################
seat * hide_cursor 1000
# output #######################################################################
output * background $black solid_color