-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extensible key map to configuration #248
base: master
Are you sure you want to change the base?
Add extensible key map to configuration #248
Conversation
} | ||
|
||
instance Show TMConfig where | ||
show cfg = (show . options) cfg <> (show . hooks) cfg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cdepillabout Not sure about this. Let me know what you think. Is show
used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used in the Show
instance of TMState'
.
I tested this out on my branch |
can you add support for emacs-like keybindings? like we have in xmonad myKeys =
[ (otherModMasks ++ "M-" ++ key, action tag)
| (tag, key) <- zip workspacen (words "1 2 3 4 5 6 7 8 9 0")
, (otherModMasks, action) <-
[ ("z-" , windows . W.greedyView)
, ("S-", windows . W.shift)
, ("C-", windows .copy)
]
] ++
[ ("M-d", spawn "rofi -show run")
, ("M-s", spawn "bash -c dictpopup")
, ("M-e", runOrRaise "goldendict" (className =? "GoldenDict-ng"))
, ("M-p", runOrRaise "librewolf" (className =? "librewolf-default"))
, ("M-S-g", easySwap)
, ("M-S-c", spawnAndShift "ws8" "qbittorrent")
, ("M-S-p", runOrRaise "nyxt" (className =? "Nyxt"))
, ("M-t", withFocused $ windows . W.sink) -- Toggle float for the focused window
, ("M-`", runOrRaise "emacsclient -c" (className =? "Emacs"))
, ("M-a", spawn "emacsclient -c")
, ("M-S-q", return ()) -- Unbind Mod + Shift + Q, to avoid quiting the wm.
, ("M-q", kill) -- Change the keybinding for closing windows to Mod + Q
, ("M-m", spawn "mpv --idle")
, ("M-S-d", spawn "~/.local/bin/recent_journal.py | popup")
, ("M-r", runOrRaise "~/.local/bin/run_anki.sh" (className =? "Anki"))
, ("M-g", runOrRaise "foliate" (className =? "com.github.johnfactotum.Foliate"))
, ("M-S-f", sendToEmptyWorkspace) -- View an empty workspace
, ("M-f", viewEmptyWorkspace) -- View an empty workspace
, ("M-S-w", spawn "flameshot gui --path=/mnt/Data/mpv-screenshots/screenshots")
, ("M-w", spawn "~/.local/bin/copy_image.sh")
, ("M-S-b", spawn "kill -9 $(pgrep mpv)")
, ("M-v", spawn "maim --select --hidecursor --format=png --quality 1 /tmp/manga/screenshot.png")
] |
Do you mean where you can make key bindings that require the user to press, for example, META and SHIFT at the same time as the key? I believe the data Key = Key
{ keyVal :: !Word32
, keyMods :: !(Set ModifierType)
} deriving (Eq, Ord, Show) I think the |
@dopamane Sorry for taking a while to get to this. I'm somewhat hesitant to introduce an extensible key map like this. I'd ideally like to expose an abstraction to the end-user like in:
Basically, right now Termonad has two types of keyboard shortcuts:
I'd ideally like to expose some sort of abstraction to end users to be able to configure and set both of these types of keyboard shortcuts. This PR currently only allows setting keyboard shortcuts that aren't triggered by gtk menu actions, which means we'll have to have some sort of (breaking?) change when introducing a way to for users to also manipulate keyboard shortcuts that are triggered by gtk menu actions. One thought I had was to potentially just do away with the keyboard shortcuts that aren't triggered by gtk menu actions. One positive(?) side effect of this is that all keyboard shortcuts will be much more discoverable within the UI, since all shortcut actions must be visible in the GTK menu. (Although this does feel unnecessarily limiting.) On the other hand, not having any way to set keyboard bindings is pretty limiting, and quite surprising to anyone coming from XMonad. There have been multiple people asking for this. So maybe it is a good idea to try to come up with something, even if it isn't perfect. "Don't let perfect be the enemy of good". |
Add
keys
map toTMConfig
. #83