Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

It used to be that Ctrl + - and Ctrl + + would increase or decrease the text size of the terminal in earlier versions of Ubuntu, which is helpful when you're giving presentations and want to show your code in a larger size. I switched to Xubuntu 12.04, and I'm missing these keyboard shortcuts.

Is there an alternative I can use? Or if not, is there a way I can define my own shortcut to replace these?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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
share|improve this answer
    
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. –  g33kz0r Mar 10 at 16:51
    
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 –  starlocke Mar 10 at 20:09
    
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. –  g33kz0r Mar 10 at 22:29
1  
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 –  Hachi Sep 26 at 7:48
1  
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. –  Samuel Lampa Oct 3 at 14:55

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.

share|improve this answer
    
Thanks for the answer. How disappointing, though! :( –  John Feminella Oct 8 '12 at 15:00
    
Well, XFCE is supposed to be lean and fast, so naturally they had to give up on features. –  January Oct 8 '12 at 15:02
    
@January I think your answer sells this question a bit short, please see my answer below. –  g33kz0r May 30 '13 at 7:20
    
@g33kz0r nah, starlocke (the accepted answer) made already a good case. –  January Mar 10 at 9:38
    
@January, well that was posted after my answer :) –  g33kz0r Mar 10 at 16:50

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|improve this answer
    
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. –  January Mar 10 at 9:39
    
All true ... but I don't think collision is that big of a deal - if it collides, just change the shortcut ... I would also note that OP didn't ask for a terminal shortcut - he just asked generally how to do it - and your answer that "it is not possible in xfce4-terminal to change the font size with a shortcut" is inaccurate. –  g33kz0r Mar 10 at 16:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.