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 a way to enlarge font with key combination #10

Open
cdepillabout opened this Issue Aug 26, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@cdepillabout
Owner

cdepillabout commented Aug 26, 2018

Currently Termonad doesn't have any way to enlarge the font with a key combination. You have to edit the ~/.config/termonad/termonad.hs file and restart Termonad. This is pretty annoying and should be fixed.

I used to use the terminal emulator Roxterm. Roxterm has font resizing options like the following ("Zoom In", "Zoom Out", "Normal Size"):

file2

It would be great to have similar options for Termonad. Adding this would require the following steps:

  1. Add a new menu entry for enlarging and shrinking here.

  2. Setup the callbacks for the options in the second half of this function.

  3. Within the callbacks, create a new FontDescription, and then loop through the existing terminals and update their FontDescription.

  4. Bonus points if you change it so that a FontDescription is actually associated with a single terminal instead of the entire application. That way the font size for a single terminal would be able to be increased instead of increasing the font sizes for all terminals.

  5. Extra bonus points if you add a configuration option that the user can set that says whether they want the Increase Font Size / Decrease Font Size buttons to change the font size of ALL terminals, or just the focused on. Or, maybe add an extra button that increases the fontsize for all terminals??

@emmanueldenloye

This comment has been minimized.

emmanueldenloye commented Nov 15, 2018

I just took a look at your code. Even though you've imported lenses, do you think that make lenses (or prisms) out of the data structures TMConfig, ConfigOptions, and ConfigHooks would make this easier?

EDIT: I thought you weren't using the lens package. I spoke too soon.

@cdepillabout

This comment has been minimized.

Owner

cdepillabout commented Nov 15, 2018

Thanks for taking a look at this @emmanueldenloye!

Yeah, there should be lenses available in the Termonad.Lenses module. If you notice any record fields that don't have lenses, this would be considered a bug!

@emmanueldenloye

This comment has been minimized.

emmanueldenloye commented Nov 15, 2018

I didn't realize you could make lenses in that way. That is rather convienent.

To make the font changes I was considering using a config hook. I could use a hook similar to:

createTermHook :: TMState -> Terminal -> IO ()

or even that one. I'll cook up something and see what shakes out.

@cdepillabout

This comment has been minimized.

Owner

cdepillabout commented Nov 15, 2018

To make the font changes I was considering using a config hook.

I don't think this would necessarily require using the config hook.

I think basically you just need to add a new menu entry for shrinking and enlarging the current font size. A new menu entry should be added here and here.

In the callback for when you click on the menu entry, you need to take the current list of terminals, and loop over them setting the new font size.

An example of looping over existing terminals can be found here.

Here's the code that initially sets the font size:

terminalSetFont vteTerm (Just tmStateFontDesc)

Creating the original font description can be found here:

createFontDesc :: TMConfig -> IO FontDescription

You may have to refactor the code a little to make re-creating the font description easy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment