1
0
Fork 0

add `sway` config

padova
urosm 2024-01-27 21:06:04 +01:00
parent 2cc3d733bc
commit 93769b3551
5 changed files with 254 additions and 0 deletions

190
.config/sway/config 100644
View File

@ -0,0 +1,190 @@
# variables ####################################################################
set $mod Mod4
set $left h
set $down j
set $up k
set $right l
# workspaces
set $ws1 1:www
set $ws2 2:txt
set $ws3 3:doc
set $ws4 4:pdf
set $ws5 5:cmd
set $ws6 6:cmd
set $ws7 7:cmd
set $ws8 8:cmd
set $ws9 9:cmd
set $ws0 10:rdp
# colors
set $bg #292526
set $dimmed #6185ff
set $accent #ff3e8b
set $error #ff404f
# key bindings #################################################################
bindsym $mod+return exec footclient
bindsym $mod+shift+return exec foot
bindsym $mod+w exec firefox
bindsym $mod+shift+w exec thunderbird
# fuzzel
bindsym $mod+space exec fuzzel
bindsym $mod+shift+space exec find -not -path "*/.*" | fuzzel -d | xargs -I{} xdg-open "{}"
bindsym $mod+insert exec lsblk -nrpo"name,type,mountpoint" \
| awk '$2=="part"{printf"%-12s %s\\n",$1,$3}' \
| fuzzel -d \
| awk '{printf($2=="")?"udisksctl mount -b %s":"udisksctl unmount -b %s",$1}' \
| sh \
| xargs -I{} notify-send "{}"
bindsym $mod+home exec nmcli -g "type,name,active" connection show \
| awk 'BEGIN{FS=":"}{printf($3=="yes")?"* %s\\n":" %s\\n",$2}' \
| fuzzel -d \
| awk '{printf($1=="*")?"nmcli connection down \\"%s\\"":"nmcli connection up \\"%s\\"",substr($0,3)}' \
| sh \
| xargs -I{} notify-send "{}"
bindsym $mod+shift+home exec footclient nmtui
# makoctl
bindsym $mod+x exec makoctl dismiss
bindsym $mod+shift+x exec makoctl dismiss -a
bindsym --to-code $mod+z exec makoctl restore
# screenshot
bindsym print exec grim - | wl-copy
# window management ############################################################
workspace_layout tabbed
focus_follows_mouse yes
focus_wrapping yes
floating_modifier $mod normal
# kill
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 container
bindsym $mod+shift+$up move up
bindsym $mod+shift+$down move down
bindsym $mod+shift+$left move left
bindsym $mod+shift+$right move right
# move focus workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws0
bindsym --to-code $mod+bracketleft workspace prev
bindsym --to-code $mod+bracketright workspace next
bindsym $mod+tab workspace back_and_forth
# move container workspace
bindsym $mod+shift+1 move container to workspace $ws1, workspace $ws1
bindsym $mod+shift+2 move container to workspace $ws2, workspace $ws2
bindsym $mod+shift+3 move container to workspace $ws3, workspace $ws3
bindsym $mod+shift+4 move container to workspace $ws4, workspace $ws4
bindsym $mod+shift+5 move container to workspace $ws5, workspace $ws5
bindsym $mod+shift+6 move container to workspace $ws6, workspace $ws6
bindsym $mod+shift+7 move container to workspace $ws7, workspace $ws7
bindsym $mod+shift+8 move container to workspace $ws8, workspace $ws8
bindsym $mod+shift+9 move container to workspace $ws9, workspace $ws9
bindsym $mod+shift+0 move container to workspace $ws0, workspace $ws0
bindsym --to-code $mod+shift+bracketleft move container to workspace prev, workspace prev
bindsym --to-code $mod+shift+bracketright move container to workspace next, workspace next
bindsym $mod+shift+tab move container to workspace back_and_forth, workspace back_and_forth
# 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
# layout
bindsym $mod+a focus parent
bindsym $mod+shift+a focus child
bindsym $mod+s layout toggle split
bindsym $mod+shift+s split toggle
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
bindsym $mod+period scratchpad show
bindsym $mod+shift+period move scratchpad
# laptop #######################################################################
bindsym XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+;\
exec notify-send -e -t 2000 -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 2000 -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 2000 -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 2000 -h string:x-canonical-private-synchronous:audio_source "$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)"
bindsym XF86MonBrightnessUp exec brightnessctl set "+1%";\
exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
bindsym XF86MonBrightnessDown exec brightnessctl set "1%-";\
exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
bindsym shift+XF86MonBrightnessUp exec brightnessctl set "+10%";\
exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
bindsym shift+XF86MonBrightnessDown exec brightnessctl set "10%-";\
exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
# session ######################################################################
set $session_mode "session: (r)eload (l)ock (q)uit (s)uspend re(b)oot (p)oweroff"
mode $session_mode {
bindsym r reload, mode default
bindsym l exec swaylock, mode default
bindsym q exit, mode default
bindsym s exec systemctl suspend, mode default
bindsym b exec systemctl reboot, mode default
bindsym p exec systemctl poweroff, mode default
# return
bindsym escape mode default
bindsym $mod+escape mode default
}
bindsym $mod+escape mode $session_mode, fullscreen disable
# theme ########################################################################
output * background wallpaper.svg fill $bg
seat * hide_cursor 5000
font monospace 13
default_border normal 1
default_floating_border normal 1
# class border background text indicator child_border
client.focused $accent $accent $bg $error $bg
client.focused_inactive $dimmed $dimmed $bg $bg $bg
client.unfocused $dimmed $dimmed $bg $bg $bg
client.urgent $error $error $bg $error $bg
# statusbar ####################################################################
bar {
status_command $XDG_CONFIG_HOME/sway/status.sh
separator_symbol " | "
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
}
}
# xwayland #####################################################################
xwayland disable
# autostart ####################################################################
exec swayidle
exec mako
exec wlsunset -l 45 -L 15
workspace $ws1, exec thunderbird, exec firefox
workspace $ws2, exec foot --server
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
# include ######################################################################
include $XDG_CONFIG_HOME/sway/`hostname`

View File

@ -0,0 +1,15 @@
# output
output * {
adaptive_sync on
}
# input
input "type:keyboard" {
xkb_layout gb,si
xkb_options caps:escape,grp:alt_shift_toggle
repeat_delay 200
repeat_rate 30
}
input "type:touchpad" {
tap enabled
}

View File

@ -0,0 +1,15 @@
#!/bin/sh
printf "{\"version\":1}\n"
printf "[\n"
while true
do
printf [
swaymsg -t get_inputs | jq -Mcj '[.[] | select(.type=="keyboard")][0] | {"full_text":.xkb_active_layout_name,"urgent":.xkb_active_layout_index}, ","'
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '{"full_text":.}, ","'
date +%c | jq -RMcj '{"full_text":.}, ","'
swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] | select(.name=="__i3_scratch").floating_nodes | {"full_text":length,"urgent":length}, ","'
makoctl list | jq -Mcj '.data[][0] | {"full_text":(.summary.data // 0),"urgent":((.urgency.data // 0) == 2)}, ","'
printf ],
timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null
done

View File

@ -0,0 +1,16 @@
# clamshell
set $laptop LVDS-1
bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable
# input
input "type:keyboard" {
xkb_layout us,si
xkb_options caps:escape,grp:alt_shift_toggle
xkb_numlock enabled
repeat_delay 300
repeat_rate 30
}
input "type:touchpad" {
tap enabled
}

View File

@ -0,0 +1,18 @@
<svg
width="1920"
height="1080">
<text
y="33%"
xml:space="preserve"
fill="#ff3e8b"
font-family="monospace"
font-size="13pt">
<tspan text-anchor="middle" x="50%" dy="13pt"> _____ </tspan>
<tspan text-anchor="middle" x="50%" dy="13pt"> / __ \\</tspan>
<tspan text-anchor="middle" x="50%" dy="13pt">| / |</tspan>
<tspan text-anchor="middle" x="50%" dy="13pt">| \\___-</tspan>
<tspan text-anchor="middle" x="50%" dy="13pt">-_ </tspan>
<tspan text-anchor="middle" x="50%" dy="13pt"> --_ </tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 551 B