Keymapper - Linux

Keymapper is a context-aware key remapper that can be used for system wide or per application shortcuts, it gives me a somewhat close experience to that of autohotkey’s system wide and context aware hotkeys.

  • https://github.com/houmain/keymapper

  • Symlink Keymapper config to Syncthing Folder

# Create symbolic link to configuration file in Syncthing Configs folder
ln -s /home/yuriy/Syncthing/Configurations/keymapper/keymapper.conf /home/yuriy/.config/keymapper.conf

# Enable & Start the keymapper daemon service
systemctl enable keymapperd ; systemctl start keymapperd
  • Configuration Backup
#

# add mappings in context which is active when boss key is not pressed
#[modifier="!Boss"]
# map Capslock to Control
CapsLock{Control} >> CapsLock
CapsLock          >> Control

[system="Linux" class="fsearch"]
Control{P} >> $(/home/yuriy/Syncthing/Configurations/keymapper/Shortcuts_Fsearch.sh "fullfilepath")
AltLeft{O} >> $(/home/yuriy/Syncthing/Configurations/keymapper/Shortcuts_Fsearch.sh "opendir")
AltLeft{E} >> $(/home/yuriy/Syncthing/Configurations/keymapper/Shortcuts_Fsearch.sh "edit")


#####################################
# Dolphin
[system="Linux" title="Dolphin"]
(Control){P} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Dolphin.sh "getfilepath")
Control {Shift P} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Dolphin.sh "getdir")
AltLeft{E} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Dolphin.sh "edit")
# AltLeft{C} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Dolphin.sh "chmod")
AltLeft{S} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Dolphin.sh "save")
#AltLeft{Z} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Dolphin.sh "zip")
#AltLeft{3} >> $(xdotool keydown ctrl key 1 keyup ctrl)
#AltLeft{1} >> $(xdotool keydown ctrl key 3 keyup ctrl)
#AltLeft{n} >> $(xdotool keydown alt key n keyup ctrl)


#####################################
# Sublime
# [system="Linux" title="Sublime Text"]
[title="Subl"]
#AltLeft{B} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "newbashscript")
# (Control AltLeft){B} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "newbashscriptnamed")
#AltLeft{P} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "newpythonscript")
# (Control AltLeft){P} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "newpythonscriptnamed")
AltLeft{O} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "opendir")
#AltLeft{I} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "reindent")
#AltLeft{O} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "opendir")
Meta{Z} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Sublime.sh "kosole-dir")


#####################################
# Kate
[system="Linux" title="Kate"]
(Control Shift){N} >> $(kate -n --start General &)
AltLeft{B} >> $(/home/yuriy/Syncthing/Scripts/Bash/Tools/Shortcuts_Kate.sh "newbashscript")
(AltLeft Shift){B} >> $(/home/yuriy/Syncthing/Scripts/Bash/Tools/Shortcuts_Kate.sh "backup")
AltLeft{P} >> $(/home/yuriy/Syncthing/Scripts/Bash/Tools/Shortcuts_Kate.sh "newpythonscript")
(Control Shift){P} >> $(/home/yuriy/Syncthing/Scripts/Bash/Tools/Shortcuts_Kate.sh "copyfilename")





#####################################
# Browsers
[system="Linux" title=/Librewolf|Chromium|Brave|FiredDragon/i]
(AltLeft){A} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "archiveorg")
AltLeft{B} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "brave")
AltLeft{Z} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "braveincognito")
AltLeft{W} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "librewolf")
(AltLeft Shift){C} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "chromium")
AltLeft{C} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "chromiumincognito")
#AltLeft{X} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "clipboardurl")
#AltLeft{M} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "mpv720")
#AltLeft{O} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "KDEConnectDeviceOne")
AltLeft{O} >> $(/home/yuriy/Syncthing/Python/Tools/Shortcuts_Browser.py "OP7")
(AltLeft Shift){O} >> $(/home/yuriy/Syncthing/Python/Tools/Shortcuts_Browser.py "S4")
#(AltLeft Shift){O} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "KDEConnectDeviceTwo")
AltLeft{Q} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "BrowserShortcutsMessage")
#AltLeft{W} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "closeothertabs")
AltLeft{Y} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "ytdlp_video")
AltLeft(Shift){Y} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "ytdlp_videokeepconsole")
AltLeft{U} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "ytdlp_audio")
AltLeft(Shift){U} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "ytdlp_audiokeepconsole")
AltLeft{ArrowRight} >> BrowserForward
AltLeft{ArrowLeft} >> BrowserBack
Control{D} >> (AltLeft Shift){L} # for bookmarking with linkding
AltLeft{D} >> (AltLeft Shift){L} # for bookmarking with linkding
AltLeft{7} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "OpenURL7Pro")
AltLeft{4} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "OpenURLS4")
AltLeft{T} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "telegram")
AltLeft{P} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "wallabag")
AltLeft{Digit9} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "ntfy-OP9")
AltLeft{Digit6} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_Browser.sh "ntfy-S6")
(Control Shift){W} >> (AltLeft Shift){W} # Close Other Tabs

#####################################
# General
[system="Linux"]
F3 >> $(jumpapp fsearch; wmctrl -r "fsearch" -b add,maximized)
#F4 >> $(konsole --hold -e everything; sleep .25 ; xdotool type "fo" ; xdotool key enter)

Meta{B} >> $(jumpapp -f brave)
Meta{C} >> $(jumpapp -f chromium)
(Meta AltLeft){C} >> $(chromium --incognito)
Meta{E} >> $(wmctrl -a "discord" 2>/dev/null || { 'com.discordapp.Discord' &>/dev/null & }; wmctrl -r "discord" -b add,maximized)
# Meta{E} >> $(flatpak run com.discordapp.Discord)
#Meta{G} >> $(wmctrl -a "OpenPlayground")
Meta{G} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "Poe")
Meta Shift{G} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "gitea-freedomain")
Meta{A} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "AdguardHome")
(Meta AltLeft){G} >> $(jumpapp -f gimp)
Meta{J} >> $(wmctrl -a "Joplin" 2>/dev/null || { "joplin-desktop" &>/dev/null & };)
Meta AltLeft{J} >> $(/home/yuriy/Executables/Joplin_Journal/Joplin-2.3.5.AppImage)
Meta{K} >> $(jumpapp -f keepassxc)
Meta AltLeft{L} >> $(systemctl suspend)
Meta Shift{T} >> $(jumpapp -f telegram-desktop)
(Meta AltLeft){N} >> $(jumpapp kate)
Meta{M} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "MeshCentral")
Meta{N} >> $(jumpapp -f  subl)
Meta Shift{N} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "ntfy")
Meta{I} >> $(jumpapp -f  kate)
(Meta AltLeft){I} >> $(~/Syncthing/Configurations/keymapper/Close_Windows.sh)
Meta{Q} >> $(jumpapp -f thunderbird)
(Meta AltLeft){S} >> $(/home/yuriy/Syncthing/Scripts/Bash/Tools/GetActiveWindowTitle.sh)
(Meta Control){S} >> $(/home/yuriy/Syncthing/Scripts/Bash/Tools/SetPermissionForBashAndPythonFiles.sh)
#Meta{S} >> $(jumpapp -f elisa)
Meta{S} >> $(jumpapp -f sonixd)
#Meta{S} >> $(jumpapp -f deadbeef)
Meta{T} >> $(wmctrl -a "sleek" 2>/dev/null || { "/home/yuriy/Executables/sleek-1.3.2-rc.1.AppImage" &>/dev/null & }; wmctrl -r "sleek" -b add,maximized)
Meta{P} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "proxmox")
Meta Shift{P} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "Unraid")
Meta{H} >> $(~/Syncthing/Configurations/keymapper/Shortcuts_wmctrl.sh "home")
Meta{W} >> $(jumpapp -f librewolf)
Meta{X} >> $(jumpapp -f dolphin)
Meta{Z} >> $(jumpapp -f konsole)
#(AltLeft {1}) >> $(sh /home/yuriy/Syncthing/Bash/Testing/gscan_clickScanButton.sh)
#(AltLeft {2}) >> $(sh /home/yuriy/Syncthing/Bash/Testing/gscan_clearScans.sh)
#(AltLeft {S}) >> $(sh /home/yuriy/Syncthing/Bash/Testing/gscan_clicksave.sh)


AltLeft{X} >> $(dbus-send --type=method_call --dest=com.georgefb.quickaccess /QuickAccess com.georgefb.QuickAccess.showMenu)

(CapsLock){D} >> $(/home/yuriy/Syncthing/Scripts/Bash/Tools/Rofi/FolderLauncher/FolderLauncher.sh)

AltLeft{Home} >> $(python "/home/yuriy/Syncthing/Freedomtn/RandomPodcast/PodcastOfTheDay.py")

# PrintScreen >> $(ksnip -r)
F11 >> $(flameshot gui -p /home/yuriy/Syncthing/Pictures/Screenshots/ --pin)
PrintScreen >> $(flameshot gui -c --accept-on-select -p /home/yuriy/Syncthing/Pictures/Screenshots/)
Insert >> $(flameshot gui -c --accept-on-select -p /home/yuriy/Syncthing/Pictures/Screenshots/)
F10 >> $(flameshot gui -c --accept-on-select -p /home/yuriy/Syncthing/Pictures/Screenshots/)
LaunchApp2 >> $(flameshot gui -c --accept-on-select -p /home/yuriy/Syncthing/Pictures/Screenshots/)
# F10 >> $(flameshot -pin --accept-on-select -p /home/yuriy/Syncthing/Pictures/Screenshots/)
#148 >> $(flameshot gui -c -p /home/yuriy/Syncthing/Pictures/Screenshots/)

AltLeft{ArrowUp} >> $(qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume")
AltRight{ArrowUp} >> $(qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume")
AltLeft{ArrowDown} >> $(qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume")
AltRight{ArrowDown} >> $(qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume")
MediaTrackNext >> $(qdbus org.kde.kglobalaccel /component/mediacontrol invokeShortcut "nextmedia")
MediaTrackPrevious >> $(qdbus org.kde.kglobalaccel /component/mediacontrol invokeShortcut "previousmedia")
MediaPlayPause >> $(qdbus org.kde.kglobalaccel /component/mediacontrol invokeShortcut "playpausemedia")

AltLeft{ArrowUp} >> AudioVolumeUp
AltLeft{ArrowDown} >> AudioVolumeDown
AltLeft{ArrowRight} >> MediaTrackNext
AltLeft{ArrowLeft} >> MediaTrackPrevious
NumpadAdd  >> AudioVolumeDown
NumpadSubtract  >> AudioVolumeUp

# https://unix.stackexchange.com/questions/21089/how-to-use-command-line-to-change-volume
#AltLeft{ArrowUp} >> $(amixer set Master 5%+)
#AltLeft{ArrowDown} >> $(amixer set Master 5%-)






Last updated on July 17, 2024. For any questions/feedback, email me at blog@zinchuk.xyz.