-
-
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
figure out a way for the user to set default key bindings #83
Comments
To start of with I really like the idea for this feature. I recently came across Termonad and like using it. Then in The last thing to do is let the user define their own bindings for menu actions. This could be done by exposing a function like Where
This way I assume it is fairly easy to write a function that adds all accelerators to the application. However keep in mind I'm quite new to Haskell. |
@burumaj Thanks for thinking about this!
This sounds like a good idea. Here are a couple small additions:
I think this is a little more tricky. If all we want to do is to let the user change key bindings for menu actions, then we need a mapping like the following: data MenuAction = NewTab | CloseTab | Quit | Copy | Paste
defaultMenuActionMap :: Map MenuAction String
defaultMenuActionMap =
mapFromList
[ (NewTab, "<Shift><Ctrl>T")
, (CloseTab, "<Shift><Ctrl>W")
, ...
] This should be relatively easy to implement. However, if we also want to let the user override the actual action that is called, maybe we could have additional hooks: termonad/src/Termonad/Types.hs Lines 414 to 422 in 8d6548b
For instance, instead of: Lines 314 to 317 in 8d6548b
we could have the following code: newTabAction <- simpleActionNew "newtab" Nothing
void $ onSimpleActionActivate newTabAction $ \_ -> newTabHook
actionMapAddAction app newTabAction
applicationSetAccelsForAction app "app.newtab" ["<Shift><Ctrl>T"] I guess we could also have a function like you suggest ( This would be a little more involved then the previous change, but it would make it much more customizable for the end-user. The next step would be making it fully customizable, so that the end-user could even define which menu options are shown. Currently the menu is defined in XML here: Lines 45 to 91 in 8d6548b
This would have to be removed and redone completely in Haskell code. Then it could be made customizable and exposed to the user. I haven't given this a lot of thought, but eventually it would be nice to do. |
There is some work on extensible key maps in #248. |
It would be nice for the user to be able to set default key bindings in their
termonad.hs
configuration file.Currently there are two types of key bindings:
Key bindings to the current menu actions, like
new tab
,close tab
,copy
,paste
, etc. These are set in the following function:termonad/src/Termonad/App.hs
Line 317 in 77cb108
Other key bindings that aren't associated with a menu action, like
Alt-1
for switching to the first terminal tab. These are set in the following function:termonad/src/Termonad/Keys.hs
Line 110 in 77cb108
termonad/src/Termonad/Keys.hs
Line 63 in 77cb108
It would be nice to give the user the ability to change both of these key bindings.
That is to say, the user should be able to change the key associated with the menu actions (like
new tab
). The user should also be able to change key bindings that aren't associated with a menu action (likeAlt-1
for switching to the first terminal). Finally, the user should be able to add new key bindings that aren't associated with a menu action to call arbitrary functions they define.The text was updated successfully, but these errors were encountered: