Thursday, June 24, 2010

Opening Terminal with preset size / fixed geometry

There are many different terminal programs for Linux, and they all have some similar features.

I am familiar with Gnome terminal and Konsole, but choose Xfce terminal because I feel it is a closer match to my needs.


Opening Terminal with a fixed geometry:

--geometry=160x50

( Geometry in this context means the number of rows and columns )

The geometry I have given looks good on a 24" screen but smaller screen sizes might want to experiment with any of the following:

  • --geometry=80x24
  • --geometry=80x30
  • --geometry=80x40
In full you might enter something like the following in a panel item/command launcher:
'/usr/bin/xfce4-terminal' --geometry=80x24

Or for something that is more generic*, perhaps...
xfce4-terminal --geometry=80x24

*Depending on your Linux system, xfce4-terminal might alternatively be in /usr/local/bin/ or /opt/local/bin/

*The single quoting (') in command launchers, is something I see in Xfce, but do not recall seeing elsewhere.






Opening Terminal with fixed location:

For xfce4-terminal, I was able to set a default position by editing MiscDefaultGeometry in the file ~/.config/Terminal/terminalrc as shown in this diff:


To tell xfce4-terminal to have a default geometry of 160x50 and a default position of 150 pixels from the left, and 0 pixels from the top use:


MiscDefaultGeometry=160x50+150+0


Xfce Program Launchers:

In Xfce adding a 'New Item' to a panel brings up a selection list with 'Launcher' as the first entry.

Selecting 'Launcher' will bring up a screen like the following:



Here is one that my system has (and it uses exo-open):



The Command field contains:

exo-open --launch TerminalEmulator

...and there is no mention of xfce4-terminal (explanation later)

Here is the Launcher that I created for the Midori web browser:


Use startup notification (quoted directly from Xfce manual):
... means that the window manager can show an hourglass while the program is loading
( You might want to tick 'Use startup notification' on older systems with significant startup times )


What is this exo-open --launch about?:

Xfce has a 'preferred applications' system. It allows you to select your preferred application in 3 categories WebBrowser, MailReader, TerminalEmulator


I repeat again directly from the manpage for clarity:
--launch category parameters...
           Launch the preferred application for the given category with the optional parameters..., where category is either WebBrowser, MailReader or TerminalEmulator.

This preferred applications system is a bit like Debian update-alternatives but specifically for desktop preferences. Here is the control screen if you want to have a tinker with it:



...and the 'Utilities' tab now:


If you have not bothered setting your preferences, or want to bypass the preferences and simply call a particular browser, then there is no need then to bother with exo-open


Mnemonics - convenient or not - you decide:

If you find that commands/menu are being selected by mistake in your Terminal, it could be, that you have Mnemonics in GTK enabled and might prefer to switch them off.

ShortcutsNoMnemonics=TRUE

To read more about GTK and Mnemonics try this link.

The file ~/.config/Terminal/terminalrc is where you would set ShortcutsNoMnemonics

(This is an xfce4-terminal specific configuration option, I am sure there are ways of achieving the same in Gnome Terminal or similar )


Making changes to ~/.config/Terminal/terminalrc and future upgrades:

When upgrading your system to a new Linux release, it may be that a newer version of xfce4-terminal chokes on your terminalrc file ( It has happened to me in upgrading Ubuntu desktops )

Symptom: clicking xfce4-terminal launcher briefly flashes up the terminal but then it disappears

Solution: remove ~/.config/Terminal/terminalrc and retry


Gnome Terminal and Konsole:

Both of these terminal programs work well, and it may be that these are your favourite programs.

The great thing about weblogs is that anyone can write an article expounding their favourite Terminal program.

Rather than tell me how much better Gnome Terminal or Konsole are in your eyes, please instead write an article yourself and if you link to this article in it's comments, then I will happily reciprocate :)


Further reading and links:

Xfce4 manual section on Launchers (version 4.0 of Xfce)


Final tip for people who are wanting to remove Preferred Applications they may have set:


Setting a MailReader in Preferred Applications generates a file at...

~/.local/share/xfce4/helpers/custom-MailReader.desktop

If you no longer want any Preferred Application set for MailReader then perhaps...
...remove the custom-MailReader.desktop file.

2 comments:

Unknown said...

Hi,
Thanks for the tips.
I have been using xfce-terminal (Terminal on Fedora) for some time, one thing I mis from konsole is the ability to hide tabs from the window. That is, remove tab bar from the view.
I have tried to hack the config file "terminalrc" but could not find the right command for that.
Do you have suggestions

nobody said...

Wonderful!