cdepillabout / cdepillabout/termonad

Dynamically Toggle Between Colour Schemes in Existing Tabs and Windows Without Recompiling

Open
#104 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Haskell
Stars
418
Forks
51
PR merge metrics
No merged PRs in 30d

Description

I've been wondering about how to load the Solarized themes and switch between light and dark with a key stroke toggle.

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:

https://github.com/cdepillabout/termonad/blob/db185e34a4b678183d8d1b1ce0be4c8bf3532fc8/src/Termonad/App.hs#L421-L422

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

https://github.com/cdepillabout/termonad/blob/db185e34a4b678183d8d1b1ce0be4c8bf3532fc8/src/Termonad/Term.hs#L345-L346

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:

https://github.com/cdepillabout/termonad/blob/db185e34a4b678183d8d1b1ce0be4c8bf3532fc8/src/Termonad/Config/Colour.hs#L453-L479

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):

https://github.com/cdepillabout/termonad/blob/db185e34a4b678183d8d1b1ce0be4c8bf3532fc8/src/Termonad/App.hs#L192-L199

Originally posted by @cdepillabout in https://github.com/cdepillabout/termonad/issues/94#issuecomment-450806022

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the hook in src/Termonad/Types.hs and its launch point in src/Termonad/App.hs first, then inspect key bindings in src/Termonad/Keys.hs and src/Termonad/Term.hs. Compare the single-terminal color update in src/Termonad/Config/Colour.hs with the tab loop in src/Termonad/App.hs; done means a configurable key binding can switch colors across all open tabs and windows without recompiling.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.