-
-
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
Dynamically Toggle Between Colour Schemes in Existing Tabs and Windows Without Recompiling #104
Comments
For the record, I am happy to work on this (probably as soon as next week), I just felt a new issue was appropriate as I felt we'd strayed from the original issue's remit, @cdepillabout |
@craigem Thanks for copying this issue over! I'd definitely accept something like this if you wanted to take a shot at implementing it. Looking forward to the PR! |
First of all, @cdepillabout thanks for making termonad, its awesome and I use it every day 🚀 . I came across this issue because I need to switch backgrounds due to coding indoors, outdoors, day and night. I took a crack at it here. I'm happy because it works fine for my needs. I figured I'd share and maybe get some feedback on how I could extend it and eventually get it mergeable. Maybe it will give an idea about how to adjust termonad to make it more extensible too. I skipped the key binding hook because I thought it was an orthogonal issue. A key binding hook would be very useful, and my foray into termonad today has given me a better idea of how to do so! I skipped the looping through all tabs because I don't use tabs, but it seems straightforward. Sorry. I'll need to go back and fix that to make it mergeable. I'm not sure how to handle multiple colour configurations. In my personal termonad config I use |
I'll give #83 a shot today, adding extensible keys, then come back to dynamic color configurations. |
#248 Adds basic key map configuration. Then I leveraged the key map to toggle between two themes here dopamane#2 Its extensible, unlike my earlier toggle solution. |
This should be possible, but will require changing a few things.
You'll have to send a PR to add a hook that gets called right as Termonad is about to launch. Probably around here:
termonad/src/Termonad/App.hs
Lines 421 to 422 in db185e3
In your own config, you'll have to override that hook to define a new key binding for each existing terminal.
Here's an example of defining a key binding (this code defines the
Alt-1
,Alt-2
, etc bindings for switching tabs):https://github.com/cdepillabout/termonad/blob/db185e34a4b678183d8d1b1ce0be4c8bf3532fc8/src/Termonad/Keys.hs
termonad/src/Termonad/Term.hs
Lines 345 to 346 in db185e3
Your key binding will have to call a function that loops through all the open tabs and sets the colors for the terminal.
Here's where that is currently being done:
termonad/src/Termonad/Config/Colour.hs
Lines 453 to 479 in db185e3
This is only setting colors for a single terminal, so you'll have to change it so it loops through all tabs.
Here's a function that loops through all tabs (although this is changing the font size):
termonad/src/Termonad/App.hs
Lines 192 to 199 in db185e3
Originally posted by @cdepillabout in #94 (comment)
The text was updated successfully, but these errors were encountered: