Sway : Refactor keybinds to support cyrillic and add extra mouse actions.

This commit is contained in:
Dmitry Voronin 2024-07-28 03:51:41 +03:00
parent f0cc9e0d11
commit 648d22cb42
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
13 changed files with 78 additions and 79 deletions

View file

@ -22,6 +22,7 @@
./module/Keyd.nix
./module/Waybar.nix
./module/System.nix
./module/Mouse.nix
] args;
in {
text = (util.trimTabs ''

View file

@ -0,0 +1,7 @@
{ ... }: {
text = ''
bindsym --whole-window $mod+button2 kill
bindsym --whole-window $mod+button8 floating toggle
bindsym --whole-window $mod+button9 fullscreen
'';
}

View file

@ -1,22 +1,16 @@
{ ... }: {
text = ''
# Navigation keys.
set $down s
set $left a
set $right d
set $up w
# Move focus.
bindsym $mod+$down focus down
bindsym $mod+$left focus left
bindsym $mod+$right focus right
bindsym $mod+$up focus up
bindsym --to-code $mod+a focus left
bindsym --to-code $mod+d focus right
bindsym --to-code $mod+s focus down
bindsym --to-code $mod+w focus up
# Move the focused window.
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$right move right
bindsym $mod+Shift+$up move up
bindsym --to-code $mod+Shift+a move left
bindsym --to-code $mod+Shift+d move right
bindsym --to-code $mod+Shift+s move down
bindsym --to-code $mod+Shift+w move up
# Focus mouse following.
focus_follows_mouse yes

View file

@ -1,9 +1,9 @@
{ ... }: {
text = ''
# Show last notification.
bindsym $mod+n exec makoctl restore
bindsym --to-code $mod+n exec makoctl restore
# Hide all notifications.
bindsym $mod+shift+N exec makoctl dismiss --all
bindsym --to-code $mod+shift+N exec makoctl dismiss --all
'';
}

View file

@ -3,9 +3,9 @@
stepHorizontal = 10;
in {
text = ''
bindsym $mod+j resize grow height ${toString stepVertical}px
bindsym $mod+k resize shrink height ${toString stepVertical}px
bindsym $mod+h resize shrink width ${toString stepHorizontal}px
bindsym $mod+l resize grow width ${toString stepHorizontal}px
bindsym --to-code $mod+j resize grow height ${toString stepVertical}px
bindsym --to-code $mod+k resize shrink height ${toString stepVertical}px
bindsym --to-code $mod+h resize shrink width ${toString stepHorizontal}px
bindsym --to-code $mod+l resize grow width ${toString stepHorizontal}px
'';
}

View file

@ -1,9 +1,9 @@
{ ... }: {
text = ''
# Fullscreen screenshot.
bindsym $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
bindsym --to-code $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
# Select screenshot.
bindsym $mod+v exec grim -g "$(slurp -d)" - | wl-copy
bindsym --to-code $mod+v exec grim -g "$(slurp -d)" - | wl-copy
'';
}

View file

@ -2,7 +2,7 @@
lock = "swaylock -f -F -c 000000 -k --font \"${config.style.font.serif.name}\" --font-size ${toString config.style.font.size.desktop}";
in {
text = ''
bindsym $mod+z exec '_twice 1 ${lock}'
bindsym $mod+Shift+Z exec _twice 1 bash -c '${lock}; systemctl suspend -i'
bindsym --to-code $mod+z exec '_twice 1 ${lock}'
bindsym --to-code $mod+Shift+Z exec _twice 1 bash -c '${lock}; systemctl suspend -i'
'';
}

View file

@ -3,17 +3,17 @@
step_music = config.setting.step.media;
in {
text = ''
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%'
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -${toString step_volume}%'
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
bindsym --to-code XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%'
bindsym --to-code XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -${toString step_volume}%'
bindsym --to-code XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
bindsym XF86AudioPlay exec 'playerctl play-pause'
bindsym XF86AudioPause exec 'playerctl pause'
bindsym XF86AudioStop exec 'playerctl stop'
bindsym XF86AudioNext exec 'playerctl next'
bindsym XF86AudioPrev exec 'playerctl previous'
bindsym XF86Forward exec 'playerctl position ${toString step_music}+'
bindsym XF86Back exec 'playerctl position ${toString step_music}-'
bindsym XF86Eject exec 'swayscript sound_output_cycle'
bindsym --to-code XF86AudioPlay exec 'playerctl play-pause'
bindsym --to-code XF86AudioPause exec 'playerctl pause'
bindsym --to-code XF86AudioStop exec 'playerctl stop'
bindsym --to-code XF86AudioNext exec 'playerctl next'
bindsym --to-code XF86AudioPrev exec 'playerctl previous'
bindsym --to-code XF86Forward exec 'playerctl position ${toString step_music}+'
bindsym --to-code XF86Back exec 'playerctl position ${toString step_music}-'
bindsym --to-code XF86Eject exec 'swayscript sound_output_cycle'
'';
}

View file

@ -2,13 +2,13 @@
mod = config.setting.sysctrl;
in {
text = ''
bindsym ${mod}+c exec 'systemctl reboot -i'
bindsym ${mod}+g exec 'swayscript gamingtoggle'
bindsym ${mod}+l exec 'powerlimit toggle'
bindsym ${mod}+m exec 'swayscript montoggle'
bindsym ${mod}+p exec 'powersave toggle'
bindsym ${mod}+v exec 'swayscript vpntoggle'
bindsym ${mod}+x exec 'systemctl poweroff -i'
bindsym ${mod}+z exec 'systemctl suspend -i'
bindsym --to-code ${mod}+c exec 'systemctl reboot -i'
bindsym --to-code ${mod}+g exec 'swayscript gamingtoggle'
bindsym --to-code ${mod}+l exec 'powerlimit toggle'
bindsym --to-code ${mod}+m exec 'swayscript montoggle'
bindsym --to-code ${mod}+p exec 'powersave toggle'
bindsym --to-code ${mod}+v exec 'swayscript vpntoggle'
bindsym --to-code ${mod}+x exec 'systemctl poweroff -i'
bindsym --to-code ${mod}+z exec 'systemctl suspend -i'
'';
}

View file

@ -2,6 +2,6 @@
text = ''
set $term ${config.setting.terminal.bin}
bindsym $mod+Escape exec $term -e bash -c "tmux new-session -A -s $USER; bash"
bindsym --to-code $mod+Escape exec $term -e bash -c "tmux new-session -A -s $USER; bash"
'';
}

View file

@ -1,23 +1,20 @@
{ config, ... }: {
text = ''
# Toggle tiling.
bindsym $mod+shift+f floating toggle
bindsym --to-code $mod+shift+f floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+r focus mode_toggle
# Move focus to the parent container
# bindsym $mod+a focus parent
bindsym --to-code $mod+r focus mode_toggle
# Split directions.
bindsym $mod+backslash splith
bindsym $mod+minus splitv
bindsym --to-code $mod+backslash splith
bindsym --to-code $mod+minus splitv
# Switch the current container between different layout styles.
bindsym $mod+Tab layout toggle split tabbed
bindsym --to-code $mod+Tab layout toggle split tabbed
# Fullscreen.
bindsym $mod+f fullscreen
bindsym --to-code $mod+f fullscreen
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
@ -27,7 +24,7 @@
floating_modifier $mod normal
# Kill focused window.
bindsym $mod+x kill
bindsym --to-code $mod+x kill
# Add gaps.
gaps inner ${toString config.style.window.gap}

View file

@ -1,6 +1,6 @@
{ ... }: {
text = ''
bindsym $mod+shift+r exec 'pkill -SIGUSR1 waybar || waybar'
bindsym --to-code $mod+shift+r exec 'pkill -SIGUSR1 waybar || waybar'
exec waybar
exec nm-applet
'';

View file

@ -1,37 +1,37 @@
{ ... }: {
text = ''
# 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 --to-code $mod+1 workspace number 1
bindsym --to-code $mod+2 workspace number 2
bindsym --to-code $mod+3 workspace number 3
bindsym --to-code $mod+4 workspace number 4
bindsym --to-code $mod+5 workspace number 5
bindsym --to-code $mod+6 workspace number 6
bindsym --to-code $mod+7 workspace number 7
bindsym --to-code $mod+8 workspace number 8
bindsym --to-code $mod+9 workspace number 9
bindsym --to-code $mod+0 workspace number 10
# Move focused container to workspace.
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
bindsym --to-code $mod+Shift+1 move container to workspace number 1
bindsym --to-code $mod+Shift+2 move container to workspace number 2
bindsym --to-code $mod+Shift+3 move container to workspace number 3
bindsym --to-code $mod+Shift+4 move container to workspace number 4
bindsym --to-code $mod+Shift+5 move container to workspace number 5
bindsym --to-code $mod+Shift+6 move container to workspace number 6
bindsym --to-code $mod+Shift+7 move container to workspace number 7
bindsym --to-code $mod+Shift+8 move container to workspace number 8
bindsym --to-code $mod+Shift+9 move container to workspace number 9
bindsym --to-code $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
# Switch left-right.
bindsym $mod+e workspace next
bindsym $mod+q workspace prev
bindsym --to-code $mod+e workspace next
bindsym --to-code $mod+q workspace prev
# Move left-right.
bindsym $mod+Shift+e move container to workspace next
bindsym $mod+Shift+q move container to workspace prev
bindsym --to-code $mod+Shift+e move container to workspace next
bindsym --to-code $mod+Shift+q move container to workspace prev
'';
}