1
0
Fork 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
parent a3f702083a
commit 8d215d604d
2 changed files with 58 additions and 58 deletions

View file

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

View file

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