Last active
April 23, 2024 21:11
-
-
Save ristomatti/7295775781ad697bd274bad858427281 to your computer and use it in GitHub Desktop.
Keymapper config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Keymapper - https://github.com/houmain/keymapper | |
# | |
STATE_DIR = ~/.local/state/keymapper/virtual | |
LOG_FILE = ~/tmp/keymapper.log | |
# On startup | |
createStateDir = $(mkdir -p STATE_DIR) | |
setScrollButton = $(sleep 1 && xinput set-prop "pointer:Keymapper" "libinput Button Scrolling Button" 2) | |
enableScrollButton = $(sleep 1 && xinput set-prop "pointer:Keymapper" "libinput Scroll Method Enabled" 0, 0, 1) | |
# Context debugging | |
enter = $(log-info "[$0]" >> LOG_FILE) | |
leave = $(log-debug "[$0]" >> LOG_FILE) | |
context = 50ms enter["$0"] ^ leave["$0"] | |
# Utils | |
log = $(echo "$0" >> LOG_FILE) | |
write = $(printf "$0" >> LOG_FILE) | |
end_write = $(printf "\n" >> LOG_FILE) | |
notify = $(notify-send -t "$0" keymapper "$0") | |
# Status bar input mode indicator handling | |
auto_shift_status_on = $(touch STATE_DIR/AutoShift) | |
auto_shift_status_off = $(rm -f STATE_DIR/AutoShift) | |
direct_umlauts_status_on = $(touch STATE_DIR/DirectUmlauts) | |
direct_umlauts_status_off = $(rm -f STATE_DIR/DirectUmlauts) | |
caps_word_status_on = $(touch STATE_DIR/CapsWord) | |
caps_word_status_off = $(rm -f STATE_DIR/CapsWord) | |
keyLockOn = $(xdotool keydown $0 && touch STATE_DIR/$0Lock) | |
keyLockOff = $(xdotool keyup $0 && rm -f STATE_DIR/$0Lock) | |
keyLocksOff = $(xdotool keyup "Control" keyup "Alt" keyup "Shift" && rm -f STATE_DIR/$0Lock) | |
setKeyboardLayout = $(echo "$0" >> LOG_FILE && gsettings set "org.gnome.desktop.input-sources current" "$1") | |
# Passthrough window manager modifiers | |
MetaLeft >> MetaLeft | |
MetaRight >> MetaRight | |
# Map Alt to left side Alt to match Control and Meta | |
Alt = AltLeft | |
# Intl. layout modifiers | |
AltGr = AltRight | |
# Exact modifiers | |
_Meta = !ControlLeft !ControlRight !MetaRight !AltLeft !AltGr MetaLeft | |
_MetaRight = !ControlLeft !ControlRight !MetaLeft !AltLeft !AltGr MetaRight | |
_Alt = !ControlLeft !ControlRight !MetaLeft !MetaRight !AltGr AltLeft | |
_AltGr = !ControlLeft !ControlRight !MetaLeft !MetaRight !AltLeft AltGr | |
_Control = !ControlRight !MetaLeft !MetaRight !AltLeft !AltGr ControlLeft | |
_ControlRight = !ControlLeft !MetaLeft !MetaRight !AltLeft !AltGr ControlRight | |
_Shift = !ControlLeft !ControlRight !MetaLeft !MetaRight !AltLeft !AltGr ShiftLeft | |
_ShiftRight = !ControlLeft !ControlRight !MetaLeft !MetaRight !AltLeft !AltGr ShiftRight | |
# Modifier groups | |
EitherControl = ControlLeft | ControlRight | |
EitherAlt = AltLeft | AltGr | |
EitherMeta = MetaLeft | MetaRight | |
EitherShift = ShiftLeft | ShiftRight | |
Modifier = ControlLeft | ControlRight | MetaLeft | MetaRight | AltLeft | AltRight | ShiftLeft | ShiftRight | |
NoModifier = !ControlLeft !ControlRight !MetaLeft !MetaRight !AltLeft !AltRight !ShiftLeft !ShiftRight | |
# QMK key names | |
Exec = Open | |
Search = BrowserSearch | |
# Special keys | |
Erase = 240 | |
File = 144 | |
Menu = Props # Menu in QMK | |
Search = 217 | |
Stop = 128 | |
Back = 158 | |
Forward = 159 | |
Bookmarks = 156 | |
Refresh = 173 | |
# Logitech G502 X | |
ButtonSide = 277 | |
# AVRCP media keys | |
MediaRewind = 168 # 0x00A8 | |
MediaPlay = 200 # 0x00C8 | |
MediaPause = 201 # 0x00C9 | |
MediaFastForward = 208 # 0x00D0 | |
# Key groups | |
MouseButton = ButtonLeft | ButtonRight | ButtonMiddle | ButtonBack | ButtonForward | |
Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
Letter = A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
ArrowKey = ArrowUp | ArrowDown | ArrowLeft | ArrowRight | |
NavigationKey = ArrowKey | Home | End | PageUp | PageDown | |
FunctionKey = F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | |
NumpadDigit = Numpad0 | Numpad1 | Numpad2 | Numpad3 | Numpad4 | Numpad5 | Numpad6 | Numpad7 | Numpad8 | Numpad9 | |
NumpadSymbol = NumpadDivide | NumpadMultiply | NumpadSubtract | NumpadAdd | NumpadEnter | NumpadDecimal | |
# Function key symbols | |
FnRewind = F7 | |
FnPlayPause = F8 | |
FnFastForward = F9 | |
FnMute = F10 | |
FnVolumeDown = F11 | |
FnVolumeUp = F12 | |
# Navigation layer | |
NavUp = Numpad8 | |
NavLeft = Numpad4 | |
NavDown = Numpad2 | |
NavRight = Numpad6 | |
# Directional navigation | |
KeyUp = I | |
KeyLeft = J | |
KeyDown = K | |
KeyRight = L | |
Direction = KeyUp | KeyLeft | KeyDown | KeyRight | |
# 3rd level shifted keys for 'ä' and 'ö' | |
Adiaeresis = A | Quote | |
Odiaeresis = O | Semicolon | |
# Window manager shortcut keys | |
Workspace = Digit | M | P | Minus | |
ScratchpadBind = O | S | G | R | X | Y | H | Tab | |
WMLeaderBind = O | S | G | R | X | Y | H | V | T | W | |
WMShortcut = Workspace | ScratchpadBind | Enter | Space | Escape | Tab | C | F | R | A | Z | W | V | H | N | |
# Special keys used by the window manager | |
WMScratchpad = F13 | |
WMLeader = F15 | |
SwapKbdLayout = F16 | |
EmojiPicker = F17 | |
# Symbolic names for special keys (F13-F24, etc.) | |
Macro1 = F13 | |
Option = F18 | |
Command = F14 | |
Lock = F19 | |
AudioMicMute = F20 | |
# Virtual modifiers | |
CapsWord = Virtual1 | |
AutoShift = Virtual2 | |
DirectUmlauts = Virtual3 | |
ControlLock = Virtual4 | |
AltLock = Virtual5 | |
ShiftLock = Virtual6 | |
MouseScrollLock = Virtual7 | |
NavMode = Virtual8 | |
RofiMode = Virtual9 | |
# Device matchers | |
KeyboardIntegrated = /AT Translated Set 2 keyboard|ThinkPad Extra Buttons|Sleep Button|Power Button$/i | |
KeyboardKeychron = /Keychron/i | |
KeyboardK3Pro = /Keychron K3 Pro/i | |
KeyboardK15Pro = /Keychron K15 Pro/i | |
KeyboardK15ProMedia = /Keychron K15 Pro Consumer Control$/i | |
KeyboardK15ProSystem = /Keychron K15 Pro System Control$/i | |
KeyboardK15ProMouse = /Keychron K15 Pro Mouse$/i | |
Keyboard = KeyboardIntegrated | KeyboardKeychron | |
NumpadApayado = /SINO WEALTH Gaming (KB |KB Keyboard)$/i | |
MouseG502X = /Logitech USB Receiver|G502 X LIGHTSPEED/i | |
MouseMXAnywhere = /MX Anywhere 2S Mouse$/i | |
MouseTrackball = "Logitech USB Trackball" | |
Mouse = /Mouse|Logitech USB Receiver|G502/i | |
MediaWH1000XM3 = "WH-1000XM3 (AVRCP)" | |
MediaUgreenBTAudio = "Ugreen-70304E (AVRCP)" | |
MediaShutterButton = "BP003" | |
BarcodeReader = "OPTO-E Barcode Device" | |
# Class matchers | |
JetBrainsIDE = /jetbrains-/i | |
Chromium = /chrome|chromium|lights-ui|crx_/i | |
Terminal = /kitty|tmux/i | |
Obsidian = "obsidian" | |
Slack = "slack" | |
TeamsForLinux = "teams-for-linux" | |
TogglTrack = /crx_chpiljhfemlfpnfoohpbokdofonkiifm/i | |
VSCode = /Code/i | |
# Fast key sequences | |
Combo = $0 !250ms $1{!250ms} | |
DoubleTap = $0 !250ms $0{!250ms} | |
Tap = $0 !250ms !$0 | |
# Key sequences | |
OneShot = $0 !2000ms | |
TwoShot = $0 !2000ms $1 !1000ms | |
Hold = $0{130ms} | |
Repeat2x = $0 $0 | |
Repeat3x = $0 $0 $0 | |
Repeat4x = $0 $0 $0 $0 | |
Repeat5x = $0 $0 $0 $0 $0 | |
Repeat6x = $0 $0 $0 $0 $0 $0 | |
# Startup sequence | |
[default] | |
ContextActive >> on_startup | |
on_startup >> createStateDir setScrollButton enableScrollButton NavMode | |
# KeyLock modifiers | |
[modifier = "ControlLock"] | |
ContextActive >> context["modifier = ControlLock"] | |
Lock >> keyLocksOff ^ | |
Control >> ControlLock keyLockOff["Control"] ^ | |
[modifier = "ShiftLock"] | |
ContextActive >> context["modifier = ShiftLock"] | |
Lock >> keyLocksOff ^ | |
Shift >> ShiftLock keyLockOff["Shift"] ^ | |
[modifier = "AltLock"] | |
ContextActive >> context["modifier = ShiftLock"] | |
Lock >> keyLocksOff ^ | |
AltLeft >> AltLock keyLockOff["Alt"] ^ | |
[default] | |
ContextActive >> context["default, keylock"] | |
LockableKey = ControlLeft | AltLeft | ShiftLeft | |
Lock{Control} >> ControlLock ControlLeft ^ | |
Lock{AltLeft} >> !AltLeft AltLock ^ | |
Lock{Shift} >> ShiftLock ^ | |
ControlLock >> keyLockOn["Control"] ^ keyLockOff["Control"] | |
ShiftLock >> keyLockOn["Shift"] ^ keyLockOff["Shift"] | |
AltLock >> keyLockOn["Alt"] ^ keyLockOff["Alt"] | |
# Selectively passthrough modifiers | |
[default] | |
AltLeft >> AltLeft | |
ControlLeft >> ControlLeft | |
# TODO: Might not be needed | |
[device != KeychronK13Pro] | |
AltGr >> AltGr | |
# Passthrough if tmux is not focused | |
[class != Terminal, title != "tmux"] | |
ControlRight >> ControlRight | |
# CapsWord modifier (https://docs.qmk.fm/#/feature_caps_word) | |
[default] | |
ContextActive >> context["default, capsword"] | |
CapsWordKey = Letter | Digit | Minus | Backspace | |
Shift{200ms} >> Shift | |
(ShiftLeft ShiftRight) >> CapsWord CapsLock ^ | |
ShiftLeft >> ShiftLeft | |
ShiftRight >> ShiftRight | |
CapsWord >> caps_word_status_on ^ caps_word_status_off | |
[modifier = "CapsWord"] | |
ContextActive >> context["modifier = CapsWord"] | |
Minus >> Shift{Minus} # '_' | |
CapsWordKey >> CapsWordKey | |
Any >> CapsWord CapsLock Any ^ | |
# DirectUmlauts modifier | |
[default] | |
DirectUmlautsTitle = /Pull request|Gmail|Outlook|Slack|WhatsApp|TickTick/i | |
DirectUmlauts >> direct_umlauts_status_on ^ direct_umlauts_status_off | |
[modifier = "!Meta !Control DirectUmlauts", title = DirectUmlautsTitle] | |
Shift{Comma} >> (Shift Semicolon) | |
ShiftRight{2} >> (Shift Quote) | |
Quote{130ms} >> Quote ^ | |
Semicolon{130ms} >> Semicolon ^ | |
AltGr{Quote} >> !AltGr Quote | |
AltGr{Semicolon} >> !AltGr Semicolon | |
Quote >> AltGr{Q} | |
Semicolon >> AltGr{P} | |
# AutoShift modifier (https://docs.qmk.fm/#/feature_auto_shift) | |
[default] | |
AutoShifted = BracketLeft | BracketRight | Minus | Equal | Comma | Period | Semicolon | Slash | Quote | |
AutoShift >> auto_shift_status_on ^ auto_shift_status_off | |
[modifier = "!Meta !AltGr !Control AutoShift"] | |
Shift{AutoShifted} >> (Shift AutoShifted) | |
Digit{140ms} !Digit >> (Shift Digit) | |
AutoShifted{120ms} !AutoShifted >> (Shift AutoShifted) | |
AutoShifted{Any} >> AutoShifted Any ^ | |
AutoShifted >> AutoShifted | |
# Global mappings | |
[default] | |
Hold[F4] >> launch_hass_light_tiles | |
# Sony WH-1000XM media keys | |
[device = MediaWH1000XM3] | |
MediaPlay >> MediaPlayPause | |
MediaPause >> MediaPlayPause | |
# Ugreen Bluetooth audio | |
[device = MediaUgreenBTAudio] | |
MediaPlay >> MediaPlayPause | |
MediaPause >> MediaPlayPause | |
# Bluetooth camera shutter button (experiment) | |
[device = MediaShutterButton] | |
BTShutterButton = AudioVolumeUp | AudioVolumeDown | |
BTShutterButton >> Meta{Tab} | |
# Barcode reader (experiment) | |
[device = BarcodeReader] | |
0 >> write["0"] | |
1 >> write["1"] | |
2 >> write["2"] | |
3 >> write["3"] | |
4 >> write["4"] | |
5 >> write["5"] | |
6 >> write["6"] | |
7 >> write["7"] | |
8 >> write["8"] | |
9 >> write["9"] | |
Enter >> end_write | |
# Key definitions // Keychron keyboards | |
[device = KeyboardKeychron] | |
EscTap = Tap[Escape] | |
OptionTS = TwoShot[Option, $0] $1 | |
# Key definitions // Keychron K15 Pro | |
[device = KeyboardK15Pro] | |
SpaceLeft = MetaRight | |
# QMK mapped keys | |
K15CapsLock = ControlRight | |
# Rotary encoder | |
EncoderButton = NumpadEnter | |
EncoderRight = NumpadAdd | |
EncoderLeft = NumpadSubtract | |
# Spotify // Keychron K15 Pro | |
[device = KeyboardKeychron, class=/Spotify/i] | |
ContextActive >> context["device = KeyboardKeychron, class = /Spotify/i"] | |
FnPlayPause >> MediaPlayPause | |
FnRewind >> MediaTrackPrevious | |
FnFastForward >> MediaTrackNext | |
FnMute >> AudioVolumeMute | |
FnVolumeDown >> AudioVolumeDown | |
FnVolumeUp >> AudioVolumeUp | |
# Encoder mappings for Rofi // Keychron K15 Pro | |
[device = KeyboardK15Pro, title = /rofi/i] | |
EncoderButton >> Enter ^ | |
EncoderRight >> ArrowDown | |
EncoderLeft >> ArrowUp | |
# JetBrains IDE // Diff view // Keychron K15 Pro | |
[device = KeyboardK15Pro, class = JetBrainsIDE, modifier = "NoModifier", title=/Repository Diff: /i] | |
EncoderRight >> next_difference | |
EncoderLeft >> prev_difference | |
# JetBrains IDE's // Keychron K15 Pro | |
[device = KeyboardK15Pro, class = JetBrainsIDE] | |
# Workaround to use underline shortcuts that conflict with remaps | |
(AltLeft SpaceLeft){Letter} >> _Alt{Letter} | |
# Override WM keymap to allow eaasy access to context actions | |
(Shift SpaceLeft){Enter} >> !Shift SpaceLeft(Enter) | |
SpaceLeft{Enter} >> show_context_actions | |
# Slack // Keychron K15 Pro | |
[device = KeyboardKeychron, class = Slack] | |
Escape{K} >> slack_switch_channel | |
Escape{1} >> slack_goto_workspace1 | |
Escape{2} >> slack_goto_workspace2 | |
Escape{H} >> slack_goto_home | |
Escape{A} >> slack_goto_activity | |
Escape{D} >> slack_goto_dms | |
Escape{T} >> slack_goto_threads | |
Escape{L} >> slack_goto_later | |
Escape{U} >> slack_goto_unread | |
Escape{Space} >> slack_switch_channel | |
Escape{F} >> find | |
Escape{M} >> toggle_mic_mute | |
EscTap M >> toggle_mic_mute | |
# Browser // Azure DevOps pull request | |
[device = KeyboardKeychron, class = Chromium modifier = "NoModifier", title = /Pull request/i] | |
PageUp >> prev_change | |
PageDown >> next_change | |
NavDown >> prev_change | |
NavLeft >> next_change | |
next_change >> ^ F7 | |
prev_change >> ^ Shift{F7} | |
# Browser // Keychron keyboards | |
[device = KeyboardKeychron, class = Chromium] | |
Escape{Digit} >> AltLeft{Digit} | |
Escape{N} >> new_window | |
Escape{T} >> new_tab | |
Escape{W} >> close_tab | |
Escape{G} >> goto_location | |
Escape{Z} >> suspend_tab | |
Escape{B} >> navigate_back | |
Escape{F} >> navigate_forward | |
Escape{R} >> reload_page | |
Escape{KeyLeft} >> prev_tab | |
Escape{KeyRight} >> next_tab | |
Escape{KeyUp} >> shift_tab_left | |
Escape{KeyDown} >> shift_tab_right | |
NavLeft >> prev_tab | |
NavRight >> next_tab | |
NavUp >> shift_tab_left | |
NavDown >> shift_tab_right | |
# Defaults mappings // Thinkpad X1E Integrated | |
[device = KeyboardIntegrated] | |
ContextActive >> context["device = KeyboardIntegrated"] | |
CapsLock{120ms} >> ControlRight | |
CapsLock !75ms Letter >> ControlRight{Letter} | |
CapsLock >> Escape | |
Backquote >> WMScratchpad | |
Space{120ms} >> MetaRight | |
# Window navigation | |
MetaRight{KeyUp} >> Meta{ArrowUp} | |
MetaRight{KeyLeft} >> Meta{ArrowLeft} | |
MetaRight{KeyDown} >> Meta{ArrowDown} | |
MetaRight{KeyRight} >> Meta{ArrowRight} | |
# Mark and goto | |
(MetaRight Shift){Quote} >> wm_mark_window | |
MetaRight{Quote} >> wm_goto_mark | |
MetaRight{Comma} >> show_emoji_picker | |
MetaRight{E} >> show_emoji_picker | |
MetaRight{Q} >> wm_close_window | |
MetaRight{BracketLeft} >> launch_tmux | |
MetaRight{Backquote} >> wm_show_scratchpad | |
MetaRight >> MetaLeft | |
# Editor actions | |
AltGr{Equal} >> _Shift{Equal} | |
AltGr{Minus} >> _Shift{Minus} | |
AltGr{Backspace} >> Delete | |
# Nordic layout mappings | |
Shift{2} >> _Shift{Quote} | |
AltGr{Adiaeresis} >> _AltGr{Q} | |
AltGr{Odiaeresis} >> _AltGr{P} | |
AltGr{E} >> _AltGr{5} # '€' | |
AltGr{2} >> _Shift{2} # '@' | |
AltGr{BracketLeft} >> _Shift{9} # '(' | |
AltGr{BracketRight} >> _Shift{0} # ')' | |
# Default mappings // Keychron keyboards | |
[device = KeyboardKeychron] | |
OptionTS[B, U] >> nm_vpn_up_bg | |
OptionTS[B, D] >> nm_vpn_down_bg | |
OneShot[Option] Tab >> DirectUmlauts ^ | |
OneShot[Option] ControlRight >> AutoShift ^ | |
# Long-press shortcuts | |
Hold[Backslash] >> launch_tmux | |
Hold[Backquote] >> WMScratchpad | |
Option{Tab} >> DirectUmlauts ^ | |
Option{ControlRight} >> AutoShift ^ | |
Option{BracketLeft} >> set_keyboard_layout_us | |
Option{BracketRight} >> set_keyboard_layout_fi | |
Option{1} >> set_keyboard_layout_us | |
Option{2} >> set_keyboard_layout_fi | |
Option{Any} >> | |
Option >> | |
Command{Space} >> show_run_menu | |
Command{Tab} >> show_window_switcher | |
Command{Enter} >> launch_tmux | |
Command{O} >> launch_obsidian | |
Command{U} >> launch_openwebui | |
Command{S} >> launch_slack | |
Command{Y} >> launch_spotify | |
Command{M} >> launch_yt_music | |
Command{W} >> launch_whatsapp | |
Command{T} >> launch_telegram | |
Command{Minus} >> wm_move_to_scratchpad | |
# Editor actions | |
AltGr{Equal} >> _Shift{Equal} | |
AltGr{Minus} >> _Shift{Minus} | |
AltGr{Backspace} >> Delete | |
Shift{2} >> _Shift{Quote} | |
AltGr{Adiaeresis} >> _AltGr{Q} | |
AltGr{Odiaeresis} >> _AltGr{P} | |
AltGr{E} >> _AltGr{5} # '€' | |
AltGr{2} >> _Shift{2} # '@' | |
AltGr{BracketLeft} >> _Shift{9} # '(' | |
AltGr{BracketRight} >> _Shift{0} # ')' | |
# Default mappings // Keychron K13 Pro | |
[device = KeyboardK3Pro] | |
Backquote{120ms} >> WMScratchpad | |
Backquote >> Backquote | |
Space{120ms} >> MetaRight | |
Space{E} >> show_emoji_picker | |
Space{Q} >> wm_close_window | |
Space{BracketLeft} >> launch_tmux | |
Space{Backquote} >> wm_show_scratchpad | |
# Passtrough modifier after mappings | |
AltGr >> AltGr | |
Command{WMLeaderBind} >> WMLeader{WMLeaderBind} | |
Command >> WMLeader | |
# Default mappings // Keychron K15 Pro | |
[device = KeyboardK15Pro] | |
ContextActive >> context["device = KeyboardK15Pro"] | |
Macro1 >> show_scene_picker | |
Command{Lock} >> lock_desktop_session | |
Command{WMLeaderBind} >> WMLeader{WMLeaderBind} | |
Command >> WMLeader | |
# Encoder brigthness and color temperature control | |
ControlShiftRight = (ControlRight ShiftRight) | |
ControlShiftRight{EncoderButton} >> brightness_reset | |
ControlShiftRight{EncoderRight} >> brightness_increase | |
ControlShiftRight{EncoderLeft} >> brightness_decrease | |
ControlRight{EncoderButton} >> color_temp_reset | |
ControlRight{EncoderRight} >> color_temp_increase | |
ControlRight{EncoderLeft} >> color_temp_decrease | |
# Encoder media control | |
AltGr{EncoderButton} >> !AltGr MediaStop ^ | |
AltGr{EncoderRight} >> !AltGr MediaTrackNext | |
AltGr{EncoderLeft} >> !AltGr MediaTrackPrevious | |
# Encoder audio control | |
EncoderButton >> MediaPlayPause ^ | |
EncoderRight >> AudioVolumeUp | |
EncoderLeft >> AudioVolumeDown | |
# Directional tiled window movement | |
(SpaceLeft Shift){KeyUp} >> Meta{Shift{ArrowUp}} | |
(SpaceLeft Shift){KeyLeft} >> Meta{Shift{ArrowLeft}} | |
(SpaceLeft Shift){KeyDown} >> Meta{Shift{ArrowDown}} | |
(SpaceLeft Shift){KeyRight} >> Meta{Shift{ArrowRight}} | |
# WM shortcuts used with MetaLeft | |
SpaceLeft{WMShortcut} >> Meta{WMShortcut} | |
# Window navigation | |
SpaceLeft{KeyUp} >> Meta{ArrowUp} | |
SpaceLeft{KeyLeft} >> Meta{ArrowLeft} | |
SpaceLeft{KeyDown} >> Meta{ArrowDown} | |
SpaceLeft{KeyRight} >> Meta{ArrowRight} | |
# Mark and goto | |
SpaceLeft{Quote} >> wm_mark_window | |
Quote{120ms} >> wm_goto_mark | |
SpaceLeft{Comma} >> show_emoji_picker | |
SpaceLeft{E} >> show_emoji_picker | |
SpaceLeft{Q} >> wm_close_window | |
SpaceLeft{BracketLeft} >> launch_tmux | |
SpaceLeft{Backquote} >> wm_show_scratchpad | |
SpaceLeft{U} >> launch_openwebui | |
# Apayado K33 Numpad | |
[modifier = "NavMode RofiMode"] | |
ArrowLeft >> Escape RofiMode | |
ArrowRight >> Shift{Delete} RofiMode | |
NavigationKey >> NavigationKey | |
Delete >> Delete | |
Backspace >> Shift{Delete} RofiMode | |
Enter >> Enter RofiMode | |
Escape >> Escape RofiMode | |
[device = NumpadApayado, class = "gnome-calculator"] | |
ContextActive >> context["device = NumpadApayado, class = gnome-calculator"] | |
NumLock >> wm_close_window | |
ScrollLock >> wm_close_window | |
[device = NumpadApayado, modifier = "NavMode", class != "gnome-calculator"] | |
ContextActive >> context["device = NumpadApayado, modifier = NavMode"] | |
# Switch to workspaces | |
Numpad0 >> Meta{0} | |
Numpad1 >> Meta{1} | |
Numpad2 >> Meta{2} | |
Numpad3 >> Meta{3} | |
Numpad4 >> Meta{4} | |
Numpad5 >> Meta{5} | |
Numpad6 >> Meta{6} | |
Numpad7 >> Meta{7} | |
Numpad8 >> Meta{8} | |
Numpad9 >> Meta{9} | |
NumpadDecimal >> Meta{M} | |
NumpadAdd >> Meta{Equal} | |
NumpadEnter >> Meta{P} | |
# Scratchpad windows | |
Home >> Meta{BracketLeft} # show/hide tmux | |
End >> Meta{G} # show/hide Toggl Track | |
Insert >> Meta{O} # show/hide Obsidian | |
Delete >> Meta{S} # show/hide Slack | |
PageUp >> $(i3-msg "scratchpad show") # show/hide scratchpad | |
PageDown >> $(i3-msg "scratchpad show scratchpad show") # show next scratchpad | |
# Rofication menu | |
ArrowUp >> Escape RofiMode Meta{N} # open notifications, RofiMode on | |
ArrowDown >> Meta{N} ^ Escape # peek notifications | |
# Goto previous/next workspace | |
ArrowLeft >> Meta{Shift{Tab}} | |
ArrowRight >> Meta{Tab} | |
[device = NumpadApayado] | |
ContextActive >> context["device = NumpadApayado"] | |
NumpadSymbol >> NumpadSymbol | |
NumpadDigit >> NumpadDigit | |
# Use as a calculator | |
NumLock >> launch_calculator | |
# Toggle workspace navigation mode | |
ScrollLock >> NavMode | |
# Mouse buttons // Meta modifier | |
[device = Mouse, modifier = "Meta"] | |
ContextActive >> context['device = Mouse, modifier = "Meta"'] | |
ButtonLeft >> wm_float_window | |
ButtonRight >> wm_move_to_scratchpad | |
ButtonMiddle >> wm_close_window | |
# Mouse buttons // Logitech G502 X | |
[device = MouseG502X] | |
ContextActive >> context['device = MouseG502X'] | |
ButtonForward{150ms} >> mouse_drag | |
ButtonBack{150ms} >> mouse_drag_resize | |
ButtonBack{150ms} >> mouse_drag_resize | |
[device = MouseG502X, modifier = "ButtonSide"] | |
ContextActive >> context['device = MouseG502X, modifier = "ButtonSide"'] | |
DoubleTap[ButtonLeft] >> wm_resize_window | |
DoubleTap[ButtonRight] >> wm_close_window | |
Hold[ButtonMiddle] >> wm_sticky_toggle | |
ButtonLeft >> wm_center_window | |
ButtonRight >> wm_resize_window_wide | |
ButtonMiddle >> wm_float_window | |
# Mouse buttons // Logitech MX Anywhere 2S | |
[device = MouseMXAnywhere] | |
ButtonMiddle{150ms} >> wm_float_window | |
# Mouse scroll lock // Logitech Trackball (note, this affects all pointer devices) | |
[modifier = MouseScrollLock] | |
ContextActive >> context["modifier = MouseScrollLock"] | |
MouseButton >> MouseScrollLock | |
[default] | |
MouseScrollLock >> ButtonMiddle | |
# Mouse Buttons // Logitech Trackball | |
[device = MouseTrackball] | |
ContextActive >> context["device = MouseTrackball"] | |
DoubleTap[ButtonLeft] >> ButtonBack | |
DoubleTap[ButtonRight] >> ButtonForward | |
(ButtonLeft ButtonRight) >> MouseScrollLock | |
ButtonLeft >> ButtonRight | |
ButtonRight >> ButtonLeft | |
ButtonForward >> ButtonMiddle | |
# Terminal // Tmux | |
[class = Terminal, title = "tmux"] | |
ContextActive >> context["class = Terminal, title = tmux"] | |
TmuxMod = Tab | |
TmuxTap = Tap[Control] | |
TmuxBinding = Direction | Digit | C | N | P | O | W | Z | Backslash | BracketLeft | BracketRight | Comma | Minus | Period | Semicolon | Slash | |
TmuxPrefix = !TmuxMod (ControlRight A){10ms} 10ms $0 | |
Shift{T} >> Shift{T} | |
TmuxMod{TmuxBinding} >> TmuxPrefix[TmuxBinding] | |
TmuxTap TmuxBinding >> TmuxPrefix[TmuxBinding] | |
ControlRight >> ControlRight | |
# Terminal // Default mappings | |
[class = Terminal] | |
NavUp >> ArrowUp | |
NavLeft >> ArrowLeft | |
NavDown >> ArrowDown | |
NavRight >> ArrowRight | |
# Esc as Meta | |
Escape !150ms Any >> !Escape AltLeft{Any} | |
Escape{Any} >> !Escape AltLeft{Any} | |
# JetBrains IDE // Aliases | |
[class = JetBrainsIDE] | |
TabFocus = U | O | |
Esc_G = OneShot[Escape{G}] $0 | |
# JetBrains IDE // Diff view | |
[class = JetBrainsIDE, modifier = "!EitherControl !AltLeft !AltGr", title = /Repository Diff/i] | |
ContextActive >> context["class = JetBrainsIDE, modifier = \"!EitherControl !AltLeft !AltGr\", title = /Repository Diff/i"] | |
J >> next_difference | |
K >> prev_difference | |
N >> compare_next_file | |
B >> compare_prev_file | |
D >> goto_declaration | |
DoubleTap[Escape] >> Escape | |
Escape >> | |
# JetBrains IDE // Pull request, commit or stash diff view | |
[class = JetBrainsIDE, title = /Diff for Pull Request |Commit: |Shelved: |History: |Changes: /i] | |
ContextActive >> context["class = JetBrainsIDE, title = /Diff for Pull Request |Commit: |Shelved: |History: |Changes: /i"] | |
NavLeft >> next_difference | |
NavDown >> prev_difference | |
Forward >> compare_next_file | |
Back >> compare_prev_file | |
Control{J} >> next_difference | |
Control{K} >> prev_difference | |
Control{N} >> compare_next_file | |
Control{P} >> compare_prev_file | |
DoubleTap[Escape] >> Escape | |
Escape >> | |
# JetBrains IDE // VCS changes | |
[class = JetBrainsIDE, modifier = "!AltGr", title = /Settings|Commit Changes|Commit: /i] | |
ContextActive >> context["class = JetBrainsIDE, modifier = \"!AltGr\", title=/Settings|Commit Changes|Commit: /i"] | |
Control{J} >> next_difference | |
Control{K} >> prev_difference | |
Control{N} >> compare_next_file | |
Control{Shift{N}} >> compare_prev_file | |
# JetBrains IDE // Keychron K15 Pro mappings | |
[class = JetBrainsIDE, device = KeyboardKeychron] | |
ContextActive >> context["class = JetBrainsIDE, device = KeyboardKeychron, keymaps"] | |
Shift{Find} >> replace_in_files | |
Find >> find_in_files | |
Help >> show_hover_info | |
Exec >> prefix_git_action | |
Erase >> rollback_change | |
AltGr{Shift{Delete}} >> cut_to_line_end | |
AltGr{Delete} >> delete_to_line_end | |
# JetBrains IDE // Default mappings | |
[class = JetBrainsIDE] | |
ContextActive >> context["class = JetBrainsIDE, keymaps"] | |
# Use numpad as arrow keys | |
NavUp >> ArrowUp | |
NavLeft >> ArrowLeft | |
NavDown >> ArrowDown | |
NavRight >> ArrowRight | |
# Tool window shortcuts | |
Hold[Digit] >> AltLeft{Digit} ^ | |
# Function key shortcuts | |
Hold[FunctionKey] >> Control{FunctionKey} ^ | |
(Control AltLeft){Any} >> (Control AltLeft){Any} | |
EscTap Direction >> (Control AltGr){Direction} | |
EscTap TabFocus >> (Control AltGr){TabFocus} | |
AltLeft{Direction} >> (AltLeft AltGr){Direction} | |
ControlRight{Direction} >> (Control AltGr){Direction} | |
EscTap Shift{Slash} >> toggle_block_comment | |
EscTap Slash >> toggle_comment | |
_Shift{Escape} >> close_tool_window | |
BrowserBack >> navigate_back | |
BrowserForward >> navigate_forward | |
Control{BracketLeft} >> Control{BracketLeft} # move caret to previous paragraph | |
Control{BracketRight} >> Control{BracketRight} # move caret to next paragraph | |
KJump = Combo[Escape, Space] | |
JTarget = I | M | L | W | J | A | B | T | D | Space | Comma | Enter | |
KJump Shift{JTarget} >> Control{Comma} Shift{JTarget} | |
KJump JTarget >> Control{Comma} JTarget | |
Esc_G[T] >> jump_to_top | |
Esc_G[B] >> jump_to_bottom | |
Esc_G[I] >> jump_to_text_start | |
Esc_G[K] >> jump_to_text_end | |
Esc_G[L] >> jump_to_line | |
Esc_G[W] >> jump_to_word | |
Esc_G[C] >> jump_to_character | |
Esc_G[P] >> toggle_problems | |
Escape{F} >> find | |
Escape{R} >> replace | |
Escape{W} >> close_tab | |
Escape{T} >> toggle_terminal | |
Escape{A} >> show_actions | |
Escape{Q} >> show_quick_documentation | |
F1 >> show_hover_info | |
Escape{D} >> goto_declaration | |
Escape{Y} >> goto_type_declaration | |
Escape{B} >> goto_implementation | |
Escape{P} >> goto_file | |
Escape{S} >> goto_symbol | |
Escape{Semicolon} >> jump_to_line | |
Escape{5} >> jump_to_matching_brace | |
Escape{Quote} >> jump_to_last_edit_loc | |
Escape{N} >> next_difference | |
Escape{E} >> next_error | |
Escape{J} >> join_lines | |
Escape{Z} >> rollback_change | |
Escape >> Escape | |
BracketLeft{BracketRight} >> BracketLeft BracketRight | |
BracketLeft{100ms} >> | |
BracketLeft{E} >> prev_error | |
BracketLeft{C} >> prev_change | |
BracketLeft{F} >> prev_function | |
BracketLeft{Any} >> | |
BracketRight{100ms} >> | |
BracketRight{E} >> next_error | |
BracketRight{C} >> next_change | |
BracketRight{F} >> next_function | |
BracketRight{Any} >> | |
AltGr{Enter} >> extend_selection | |
(Shift AltGr){Enter} >> shrink_selection | |
# JetBrainsIDE // IDE actions | |
[class = JetBrainsIDE] | |
ContextActive >> context["class = JetBrainsIDE, actions"] | |
prefix_git_action >> _Alt{G} | |
close_tab >> AltLeft{W} | |
close_tool_window >> Shift{Escape} | |
find >> Control{F} | |
find_in_files >> (Control Shift){F} | |
replace >> Control{R} | |
replace_in_files >> (Control Shift){R} | |
show_actions >> _Alt{A} | |
show_context_actions >> _Alt{Enter} | |
show_hover_info >> Control{F1} | |
show_quick_documentation >> Control{Q} | |
toggle_terminal >> ^ AltLeft{T} | |
toggle_problems >> ^ AltLeft{8} | |
goto_file >> AltLeft{P} | |
goto_symbol >> AltLeft{S} | |
goto_declaration >> Control{B} | |
goto_type_declaration >> (Control Shift){B} | |
goto_implementation >> Control{AltLeft{B}} | |
jump_to_text_start >> Control{Home} | |
jump_to_text_end >> Control{End} | |
jump_to_top >> Control{PageUp} | |
jump_to_bottom >> Control{PageDown} | |
jump_to_line >> Control{G} | |
jump_to_character >> AltLeft{Comma} | |
jump_to_word >> Control{Comma} | |
jump_to_matching_brace >> Control{Shift{M}} | |
jump_to_last_edit_loc >> AltLeft{Shift{E}} | |
next_error >> !Escape _Alt{Escape} | |
prev_error >> !Escape _Alt{Shift{Escape}} | |
next_function >> _Alt{ArrowDown} | |
prev_function >> _Alt{ArrowUp} | |
rollback_change >> (Control AltLeft){Z} | |
next_change >> (Control AltLeft){ArrowDown} | |
prev_change >> (Control AltLeft){ArrowUp} | |
next_difference >> (Control AltLeft){ArrowDown} | |
prev_difference >> (Control AltLeft){ArrowUp} | |
compare_next_file >> (AltLeft Shift){N} | |
compare_prev_file >> (AltLeft Shift){J} | |
extend_selection >> _Alt{W} | |
shrink_selection >> _Alt{Shift{W}} | |
cut_to_line_end >> !AltGr (Shift Control AltLeft){Delete} | |
delete_to_line_end >> !AltGr (Control AltLeft){Delete} | |
join_lines >> _Control{J} | |
toggle_comment >> !Escape _Control{7} | |
toggle_block_comment >> !Escape _Control{Shift{7}} | |
# Visual Studio Code | |
[class = VSCode] | |
# Use numpad as arrow keys | |
NavUp >> ArrowUp | |
NavLeft >> ArrowLeft | |
NavDown >> ArrowDown | |
NavRight >> ArrowRight | |
Escape{S} >> goto_workspace_symbol | |
Escape{W} >> close_tab | |
Escape{T} >> toggle_terminal | |
Escape{E} >> next_error | |
(Control AltLeft){Any} >> (Control AltLeft){Any} | |
(Shift AltGr){Enter} >> shrink_selection | |
AltGr{Enter} >> expand_selection | |
(Shift AltLeft){W} >> shrink_selection | |
AltLeft{W} >> expand_selection | |
AltLeft{S} >> goto_workspace_symbol | |
AltLeft{Any} >> AltLeft{Any} | |
AltLeft >> | |
Escape !250ms Any >> Control{K} Any | |
BracketRight{100ms} >> | |
BracketRight{E} >> next_error | |
BracketRight{Any} >> | |
BracketLeft{100ms} >> | |
BracketLeft{E} >> prev_error | |
BracketLeft{Any} >> | |
goto_workspace_symbol >> _Control{T} | |
next_error >> _Alt{F8} | |
prev_error >> _Alt{Shift{F8}} | |
toggle_terminal >> _Alt{T} | |
expand_selection >> _Alt{Shift{ArrowRight}} | |
shrink_selection >> _Alt{Shift{ArrowLeft}} | |
# Obsidian | |
[class = Obsidian] | |
ContextActive >> context["class = Obsidian"] | |
AltRight{Any} >> (ControlLeft AltLeft ShiftLeft){Any} | |
Escape{W} >> close_tab | |
Escape{P} >> _Control{P} | |
Escape{Direction} >> _Alt{Direction} | |
Escape{Comma} >> toggle_left_sidebar | |
Escape{Period} >> toggle_right_sidebar | |
Escape >> Escape | |
toggle_left_sidebar >> _Alt{Comma} | |
toggle_right_sidebar >> _Alt{Period} | |
# Teams for Linux | |
[class = TeamsForLinux] | |
ContextActive >> context["class = TeamsForLinux"] | |
AltOrEsc = AltLeft | AltRight | Escape | |
AppMod = !Meta !Control AltOrEsc | |
Escape{M} >> toggle_mic_mute | |
Escape{H} >> toggle_raised_hand | |
Escape{L} >> leave_call | |
EscTap M >> toggle_mic_mute | |
EscTap H >> toggle_raised_hand | |
EscTap L >> leave_call | |
AltGr{M} >> toggle_mic_mute | |
AltGr{H} >> toggle_raised_hand | |
AltGr{L} >> leave_call | |
toggle_mic_mute >> ^ _Control{Shift{M}} | |
toggle_raised_hand >> ^ _Control{Shift{K}} | |
leave_call >> ^ _Control{Shift{H}} | |
# Browser defaults | |
[class = Chromium] | |
ContextActive >> context["class = Chromium"] | |
# Mouse wheel zoom from either Control | |
ControlRight >> ControlLeft | |
EitherAlt{N} >> new_window | |
EitherAlt{T} >> new_tab | |
EitherAlt{W} >> close_tab | |
AltGr{R} >> reload_page | |
AltGr{P} >> pin_tab | |
AltGr{Z} >> suspend_tab | |
AltGr{S} >> suspend_tab_pause | |
Alt{Shift{KeyLeft}} >> shift_tab_left | |
Alt{Shift{KeyRight}} >> shift_tab_right | |
Alt{KeyLeft} >> prev_tab | |
Alt{KeyRight} >> next_tab | |
Alt{KeyUp} >> scroll_up | |
Alt{KeyDown} >> scroll_down | |
goto_location >> _Control{L} | |
shift_tab_left >> !Alt Control{Shift{PageUp}} | |
shift_tab_right >> !Alt Control{Shift{PageDown}} | |
pin_tab >> !AltGr AltLeft{P} | |
reload_page >> _Control{R} | |
scroll_up >> !Alt Repeat6x[ArrowUp] | |
scroll_down >> !Alt Repeat6x[ArrowDown] | |
suspend_tab >> !AltGr AltLeft{Z} | |
suspend_tab_pause >> !AltGr AltLeft{Shift{Z}} | |
# Slack commands | |
[class = Slack] | |
Hold[1] >> slack_goto_workspace1 | |
Hold[2] >> slack_goto_workspace2 | |
EitherAlt{Space} >> slack_switch_channel | |
EitherAlt{1} >> slack_goto_workspace1 | |
EitherAlt{2} >> slack_goto_workspace2 | |
EitherAlt{M} >> toggle_mic_mute | |
Alt{Tab} >> slack_next_section | |
Alt{Shift{Tab}} >> slack_prev_section | |
Alt{KeyUp} >> slack_prev_chat | |
Alt{KeyDown} >> slack_next_chat | |
Alt{KeyLeft} >> navigate_back | |
Alt{KeyRight} >> navigate_forward | |
slack_goto_home >> (Control Shift){1} | |
slack_goto_dms >> (Control Shift){2} | |
slack_goto_activity >> (Control Shift){3} | |
slack_goto_later >> (Control Shift){4} | |
slack_goto_threads >> (Control Shift){T} | |
slack_goto_unread >> (Control Shift){A} | |
slack_switch_channel >> Control{K} | |
slack_next_chat >> AltLeft{ArrowDown} | |
slack_prev_chat >> AltLeft{ArrowUp} | |
slack_goto_workspace1 >> Control{1} | |
slack_goto_workspace2 >> Control{2} | |
slack_next_section >> F6 | |
slack_prev_section >> Shift{F6} | |
toggle_mic_mute >> (Control Shift){Space} | |
[device = KeyboardKeychron] | |
ContextActive >> context["device = KeyboardKeychron"] | |
# Editor actions from nav/edit layer | |
Cut >> edit_cut | |
Copy >> edit_copy | |
Paste >> edit_paste | |
Undo >> edit_undo | |
Again >> edit_redo | |
# Default abstract commands | |
[default] | |
Cut >> edit_cut | |
Copy >> edit_copy | |
Paste >> edit_paste | |
Undo >> edit_undo | |
Again >> edit_redo | |
edit_copy >> _Control{C} | |
edit_paste >> _Control{V} | |
edit_cut >> _Control{X} | |
edit_undo >> _Control{Z} | |
edit_redo >> _Control{Y} | |
find >> _Control{F} | |
new_window >> _Control{N} | |
new_tab >> _Control{T} | |
close_tab >> _Control{W} | |
prev_tab >> _Control{PageUp} | |
next_tab >> _Control{PageDown} | |
navigate_back >> _Alt{ArrowLeft} | |
navigate_forward >> _Alt{ArrowRight} | |
# Network manager | |
nm_vpn_up_bg >> $(nmcli connection up BG) | |
nm_vpn_down_bg >> $(nmcli connection down BG) | |
show_emoji_picker >> $(rofimoji --skin-tone neutral --prompt emoji --keybinding-copy Control-c) ^ | |
show_scene_picker >> $(~/.config/regolith/rofi/rofi-hass-scene.sh) ^ | |
show_window_switcher >> $(rofi -show window) ^ | |
show_run_menu >> $(rofi -normal-window -show run) ^ | |
brightness_decrease >> $(redshiftctl brightness -) | |
brightness_increase >> $(redshiftctl brightness +) | |
brightness_reset >> $(redshiftctl brightness =) ^ | |
color_temp_decrease >> $(redshiftctl temperature -) | |
color_temp_increase >> $(redshiftctl temperature +) | |
color_temp_reset >> $(redshiftctl temperature =) ^ | |
mouse_drag >> (AltLeft ButtonLeft) | |
mouse_drag_resize >> (AltLeft ButtonRight) | |
launch_calculator >> $(i3-open -c gnome-calculator "gnome-calculator") ^ | |
launch_obsidian >> $(i3-open -s -c obsidian "xdg-open obsidian://") ^ | |
launch_slack >> $(i3-open -s -c Slack "gtk-launch slack-readable") ^ | |
launch_spotify >> $(i3-open -s -c Spotify "exec spotify") ^ | |
launch_tmux >> $(i3-open -s -c tmux "kitty --single-instance --class tmux tmux-session scratch") ^ | |
launch_yt_music >> $(i3-open -i music.youtube.com "gtk-launch youtube-music") ^ | |
launch_hass_light_tiles >> $(i3-open -t "^Lights " "gtk-launch home-assistant-lights") ^ | |
launch_openwebui >> $(i3-open -s -c "Chromium-browser" -t "^Open WebUI" gtk-launch $(basename $(rg -l "Open WebUI" ~/.local/share/applications))) | |
launch_telegram >> $(i3-open -c Telegram gtk-launch $(basename $(rg -l Telegram ~/.local/share/applications))) | |
launch_whatsapp >> $(i3-open -t WhatsApp gtk-launch $(basename $(rg -l WhatsApp ~/.local/share/applications))) | |
wm_resize_window >> $(i3-msg "resize set 1000px 1200px") ^ | |
wm_resize_window_wide >> $(i3-msg "resize set 1800px 1200px") ^ | |
wm_center_window >> $(i3-msg "move absolute position center") ^ | |
wm_show_scratchpad >> $(i3-msg "scratchpad show") ^ | |
wm_close_window >> $(i3-msg '[con_id="__focused__"] kill') ^ | |
wm_float_window >> $(i3-msg "floating toggle") ^ | |
wm_sticky_toggle >> $(i3-msg "sticky toggle") ^ | |
wm_move_to_scratchpad >> $(i3-msg "move to scratchpad") ^ | |
wm_mark_window >> $(i3-input -F "mark %s" -l 1 -P "Mark: ") ^ | |
wm_goto_mark >> $(i3-input -F '[con_mark="^%s"] focus' -l 1 -P "Goto: ") ^ | |
set_keyboard_layout_fi >> $(gsettings set org.gnome.desktop.input-sources current GnomeInputSourceFI) | |
set_keyboard_layout_us >> $(gsettings set org.gnome.desktop.input-sources current GnomeInputSourceUS) | |
lock_desktop_session >> $(dbus-send --type=method_call --dest=org.gnome.ScreenSaver "/org/gnome/ScreenSaver" "org.gnome.ScreenSaver.Lock") ^ | |
# vim: ft=ini sw=2 ts=2 sts=2 expandtab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment