What keyboard shortcut changes the `xfce4-terminal` terminal text size?

86

Solution 1

Update: as of this commit, resizing is now supported with Ctrl++ and Ctrl+-, which obsoletes my question.

The other answers in this thread are still valuable if you're using older versions of xfce4-terminal.

Solution 2

Instead of relying on Python and missing modules, as in Noah K. Tilton's github solution, I drafted up a bash script that's a step closer to being more portable (at least, for installations using the most generic, default paths).

You may need to tweak the script to setup your xfce configuration path, your favourite font, etc.

Just 2 files, dropped into my home's ~/bin folder, "zoomin" and "zoomout". I didn't go further than making short commands that I can type quickly, so I don't have a clue how I'd be able to configure these scripts to respond ONLY when I'm inside of xfce4-terminal -- meaning that I gave up thinking about how to get the keybindings made for Ctrl+- and Ctrl++ because I currently only know about global keyboard bindings and didn't want to override those Keypress Combos since other applications will need them (ex: web browser, text editor).

I also thought about having "zoommin" and "zoommax", to jump to my smallest and biggest fonts when needed, typically when I need to see tons of text VS when I need to show a colleague something on my screen. I'll leave those two scripts up to your imagination on how to create :P

~/bin/zoomin

#!/bin/bash
SIZE=`grep 'FontName' ~/.config/xfce4/terminal/terminalrc | cut -d' ' -f 2`
NEWSIZE=$((SIZE + 2))
REGEXPR='s/FontName.*/FontName=Monospace '$NEWSIZE'/g'
sed -i "$REGEXPR" ~/.config/xfce4/terminal/terminalrc

~/bin/zoomout

#!/bin/bash
SIZE=`grep 'FontName' ~/.config/xfce4/terminal/terminalrc | cut -d' ' -f 2`
NEWSIZE=$((SIZE - 2))
REGEXPR='s/FontName.*/FontName=Monospace '$NEWSIZE'/g'
sed -i "$REGEXPR" ~/.config/xfce4/terminal/terminalrc

Solution 3

The shortcuts you mention are for gnome-terminal, the default terminal used by gnome (and, what follows, by standard Ubuntu). XFCE, which is the main environment in Xubuntu, has its own terminal implementation. However, as far as I can tell, it is not possible in xfce4-terminal to change the font size with a shortcut (you can see the list of possible shortcuts when you go to Edit->Preferences->Shortcuts).

If you rely on this feature, you can install gnome-terminal, but since the whole point of using XFCE is often that it does not involve the somewhat heavy Gnome libraries, this might be a little unproductive.

Solution 4

While the rest of the answers here require you to create some type of 'hack' using custom scripts, which may or may not break when doing upgrades to your system, the actual/other answer was found in a StackOverflow question here:

Can vim zoom in and out?

By user: Chenming Zhang

Edit > Preferences > Appearance

You will see the option: Font

Which contains both the chosen font and the size of the font-text.

I know that you are looking for a 'shortcut', but all the other options seem to require lots of customization, whereas going this route will ensure that you don't screw up your Terminal with any customizations.

This answer is also being posted here for anybody that needs an alternate option to ctrl +- for zooming in/out.

Solution 5

It is possible, though not through xfce4 proper, using this workaround:

https://github.com/noah/xfce4-terminal-font

(requires python).

I use it in awesome window manager like this:

awful.key({ "Control", "Shift" }, "Up", function () awful.util.spawn(script_dir .. "/xfce4-terminal-font +", false)end),
awful.key({ "Control", "Shift" }, "Down", function () awful.util.spawn(script_dir .. "/xfce4-terminal-font -", false)end),

It's a bit of a hack, but it works.

Share:
86

Related videos on Youtube

user2904796
Author by

user2904796

Updated on September 18, 2022

Comments

  • user2904796
    user2904796 almost 2 years

    I have been stuck on this for a while now.

    list= [['a', 'b', 'c', 'd'], ['a', 'a', 'b', 'c'], ['a', 'b', 'c', 'd'], ['a', 'a', 'b', 'c'], ['a', 'b', 'c', 'd']]    
    

    How would I find the largest number of recurring elements? For instance for the list above, this would be 3 because there are three instances of [a,b,c,d] in the list.

    Thanks a lot

  • John Feminella
    John Feminella over 11 years
    Thanks for the answer. How disappointing, though! :(
  • January
    January over 11 years
    Well, XFCE is supposed to be lean and fast, so naturally they had to give up on features.
  • user2904796
    user2904796 over 10 years
    Thanks a lot. Can't believe I didn't think of this myself.
  • January
    January over 10 years
    @g33kz0r nah, starlocke (the accepted answer) made already a good case.
  • January
    January over 10 years
    This has the same drawback as the answer from @starlocke (who also mentioned that it is Noah's solution): it creates a windowmanager shortcut, not a terminal shortcut. Since ctrl-shift-up or ctrl-shift-down are fairly common key combinations (not to mention the more typical ctrl + and ctrl - shortcuts used to change font size for example in gnome-terminal), it might lead to shortcut collisions and / or lack of consistency.
  • bogren
    bogren over 10 years
    @January, well that was posted after my answer :)
  • Admin
    Admin over 10 years
    Not sure I follow what you mean by "missing modules" - my python script uses the standard library. I think bash/python portability is a toss-up. However, yours might be more performant - at the cost of some readability.
  • starlocke
    starlocke over 10 years
    I experienced this among other things. Noah K was, all fairness granted, against tweaking his script to make life easier for *buntu users. I simply reverse-engineered the thing to be a little more universal, removing the python requirement altogether. :3
  • Admin
    Admin over 10 years
    you reported a bug on XDG_CONFIG_PATH - a string that doesn't appear in my script. Huh? Assuming you meant XDG_CONFIG_HOME, which does appear in my script, you might want to check out superuser.com/questions/365847/… which basically says it's up to the user to define it. Not sure what the "other things" were :) Opinions may differ, but I think 1 parameterized python script is a little cleaner than 2 bash scripts.
  • Hachi
    Hachi almost 10 years
    it it's about a short readable text change I would suggest perl perl -pi -e 's/(FontName.*)(\d+)/$1.($2+2)/e' ~/.config/xfce4/terminal/terminalrc rather than fiddling with the bash
  • Matt Coats
    Matt Coats over 9 years
    Cool, based on this, I created three methods which I add in my ~/.bash_aliases file: zi, zo and z, which each takes as first argument either steps to zoom (zi and zo), or destination font size (z): gist.github.com/samuell/107a498821c88426fa5a . So, to set text size to 12, I would do z 12, and to zoom in one step, I would do zi 1.
  • Adam Katz
    Adam Katz over 6 years
    On an en_US keyboard, you need Ctrl+Shift+= to get bigger and Ctrl+- to get smaller. Neither Ctrl+= nor Ctrl+Shift+- will work, nor will the keypad + and -, which is too bad.
  • Adam Katz
    Adam Katz almost 4 years
    Update: xfce4-terminal issue 55 requests support for Ctrl+= and the keypad variations of +, -, and 0. I encourage folks to log in with a Github or Gitlab.com (or local XFCE Gitlab) account and upvote it (but let's not pollute it with comments).