Watch
1
0
Fork
You've already forked dotfiles
0

sway: Map some keys using “bindcode”

Map some keys using “bindcode” instead of “bindsym” to be independent
from the current keyboard layout.
This commit is contained in:
coderkun 2020-07-04 12:41:45 +02:00
commit 8d215d604d
2 changed files with 58 additions and 58 deletions

View file

@ -1,9 +1,9 @@
### Variables ### Variables
set $mod Mod4 set $mod Mod4
set $left n set $left 44
set $down r set $down 45
set $up t set $up 46
set $right d set $right 47
set $term termite set $term termite
set $menu j4-dmenu-desktop --dmenu="bemenu -i -l 10 --fn \"Dejavu Sans Mono\" 10" --no-generic --term=termite --usage-log="$HOME/.cache/j4-dmenu-desktop.log" set $menu j4-dmenu-desktop --dmenu="bemenu -i -l 10 --fn \"Dejavu Sans Mono\" 10" --no-generic --term=termite --usage-log="$HOME/.cache/j4-dmenu-desktop.log"
set $locker swaylock -f -s center -i "~/.config/sway/lockscreen.png" set $locker swaylock -f -s center -i "~/.config/sway/lockscreen.png"
@ -14,24 +14,24 @@ font pango:DejaVu Sans Mono 9
### Key bindings ### Key bindings
# Basics # Basics
bindsym $mod+Return exec $term bindsym $mod+Return exec $term
bindsym $mod+Shift+x kill bindcode $mod+Shift+24 kill
bindsym $mod+a exec $menu bindcode $mod+40 exec $menu
bindsym $mod+Shift+c reload bindcode $mod+Shift+27 reload
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
floating_modifier $mod normal floating_modifier $mod normal
# Moving around # Moving around
bindsym $mod+$left focus left bindcode $mod+$left focus left
bindsym $mod+$down focus down bindcode $mod+$down focus down
bindsym $mod+$up focus up bindcode $mod+$up focus up
bindsym $mod+$right focus right bindcode $mod+$right focus right
bindsym $mod+Left focus left bindsym $mod+Left focus left
bindsym $mod+Down focus down bindsym $mod+Down focus down
bindsym $mod+Up focus up bindsym $mod+Up focus up
bindsym $mod+Right focus right bindsym $mod+Right focus right
bindsym $mod+Shift+$left move left bindcode $mod+Shift+$left move left
bindsym $mod+Shift+$down move down bindcode $mod+Shift+$down move down
bindsym $mod+Shift+$up move up bindcode $mod+Shift+$up move up
bindsym $mod+Shift+$right move right bindcode $mod+Shift+$right move right
bindsym $mod+Shift+Left move left bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up bindsym $mod+Shift+Up move up
@ -47,16 +47,16 @@ bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8 bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9 bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10 bindsym $mod+0 workspace 10
bindsym $mod+mod3+m workspace 1 bindcode $mod+mod3+58 workspace 1
bindsym $mod+mod3+comma workspace 2 bindcode $mod+mod3+59 workspace 2
bindsym $mod+mod3+period workspace 3 bindcode $mod+mod3+60 workspace 3
bindsym $mod+mod3+n workspace 4 bindcode $mod+mod3+44 workspace 4
bindsym $mod+mod3+r workspace 5 bindcode $mod+mod3+45 workspace 5
bindsym $mod+mod3+t workspace 6 bindcode $mod+mod3+46 workspace 6
bindsym $mod+mod3+h workspace 7 bindcode $mod+mod3+30 workspace 7
bindsym $mod+mod3+g workspace 8 bindcode $mod+mod3+31 workspace 8
bindsym $mod+mod3+f workspace 9 bindcode $mod+mod3+32 workspace 9
bindsym $mod+mod3+space workspace 10 bindcode $mod+mod3+65 workspace 10
# Move focused container to workspace # Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1 bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2 bindsym $mod+Shift+2 move container to workspace 2
@ -68,35 +68,35 @@ bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8 bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9 bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10 bindsym $mod+Shift+0 move container to workspace 10
bindsym $mod+Shift+mod3+m move container to workspace 1 bindcode $mod+Shift+mod3+58 move container to workspace 1
bindsym $mod+Shift+mod3+comma move container to workspace 2 bindcode $mod+Shift+mod3+59 move container to workspace 2
bindsym $mod+Shift+mod3+period move container to workspace 3 bindcode $mod+Shift+mod3+60 move container to workspace 3
bindsym $mod+Shift+mod3+n move container to workspace 4 bindcode $mod+Shift+mod3+44 move container to workspace 4
bindsym $mod+Shift+mod3+r move container to workspace 5 bindcode $mod+Shift+mod3+45 move container to workspace 5
bindsym $mod+Shift+mod3+t move container to workspace 6 bindcode $mod+Shift+mod3+46 move container to workspace 6
bindsym $mod+Shift+mod3+h move container to workspace 7 bindcode $mod+Shift+mod3+30 move container to workspace 7
bindsym $mod+Shift+mod3+g move container to workspace 8 bindcode $mod+Shift+mod3+31 move container to workspace 8
bindsym $mod+Shift+mod3+f move container to workspace 9 bindcode $mod+Shift+mod3+32 move container to workspace 9
bindsym $mod+Shift+mod3+space move container to workspace 10 bindcode $mod+Shift+mod3+65 move container to workspace 10
# Multiple monitors # Multiple monitors
bindsym $mod+Shift+H move workspace to output left bindcode $mod+Shift+30 move workspace to output left
bindsym $mod+Shift+G move container to output left bindcode $mod+Shift+31 move container to output left
bindsym $mod+Shift+F move container to output right bindcode $mod+Shift+32 move container to output right
bindsym $mod+Shift+Q move workspace to output right bindcode $mod+Shift+33 move workspace to output right
# Layout stuff # Layout stuff
bindsym $mod+s splith bindcode $mod+43 splith
bindsym $mod+o splitv bindcode $mod+42 splitv
bindsym $mod+i layout stacking bindcode $mod+39 layout stacking
bindsym $mod+v layout tabbed bindcode $mod+25 layout tabbed
bindsym $mod+l layout toggle split bindcode $mod+26 layout toggle split
# Make the current focus fullscreen # Make the current focus fullscreen
bindsym $mod+e fullscreen bindcode $mod+41 fullscreen
# Toggle the current focus between tiling and floating mode # Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area # Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle bindsym $mod+space focus mode_toggle
# move focus to the parent container # move focus to the parent container
bindsym $mod+u focus parent bindcode $mod+38 focus parent
# Scratchpad # Scratchpad
bindsym $mod+Shift+minus move scratchpad bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show bindsym $mod+minus scratchpad show
@ -107,14 +107,14 @@ bindsym Ctrl+Shift+space exec makoctl dismiss --all
# Resizing containers # Resizing containers
mode "resize" { mode "resize" {
bindsym $left resize shrink width 80px bindcode $left resize shrink width 80px
bindsym Shift+$left resize shrink width 20px bindcode Shift+$left resize shrink width 20px
bindsym $down resize grow height 80px bindcode $down resize grow height 80px
bindsym Shift+$down resize grow height 20px bindcode Shift+$down resize grow height 20px
bindsym $up resize shrink height 80px bindcode $up resize shrink height 80px
bindsym Shift+$up resize shrink height 20px bindcode Shift+$up resize shrink height 20px
bindsym $right resize grow width 80px bindcode $right resize grow width 80px
bindsym Shift+$right resize grow width 20px bindcode Shift+$right resize grow width 20px
bindsym Left resize shrink width 80px bindsym Left resize shrink width 80px
bindsym Down resize grow height 80px bindsym Down resize grow height 80px
bindsym Up resize shrink height 80px bindsym Up resize shrink height 80px
@ -122,7 +122,7 @@ mode "resize" {
bindsym Return mode "default" bindsym Return mode "default"
bindsym Escape mode "default" bindsym Escape mode "default"
} }
bindsym $mod+c mode "resize" bindcode $mod+27 mode "resize"
# Status Bar # Status Bar
bar { bar {
@ -147,7 +147,7 @@ mode "$mode_system" {
bindsym Escape mode "default" bindsym Escape mode "default"
bindsym mod3+Escape mode "default" bindsym mod3+Escape mode "default"
} }
bindsym $mod+Shift+p mode "$mode_system" bindcode $mod+Shift+55 mode "$mode_system"
# Systemd environment # Systemd environment
exec systemctl --user import-environment exec systemctl --user import-environment

View file

@ -25,7 +25,7 @@ mode "$mode_monitor" {
bindsym Escape mode "default" bindsym Escape mode "default"
bindsym mod3+Escape mode "default" bindsym mod3+Escape mode "default"
} }
bindsym $mod+Shift+M mode "$mode_monitor" bindcode $mod+Shift+58 mode "$mode_monitor"
# Audio setup # Audio setup
set $mode_audio Audio Output (h) HDMI, (s) S/PDIF set $mode_audio Audio Output (h) HDMI, (s) S/PDIF
@ -37,4 +37,4 @@ mode "$mode_audio" {
bindsym Escape mode "default" bindsym Escape mode "default"
bindsym mod3+Escape mode "default" bindsym mod3+Escape mode "default"
} }
bindsym $mod+Shift+a mode "$mode_audio" bindcode $mod+Shift+40 mode "$mode_audio"