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.

I'd like to prevent any of my Terminator terminals from being smaller than 80x24. That is, I'd be prevented from resizing a terminal to below that size, and if I tried to split a terminal that would be too small, either the existing terminals would be shrunk to fit or the parent and child terminals would be moved to a new window.

I'm willing to change terminal programs if needed, although a good tiling solution like Terminator's is preferable.

share|improve this question

6 Answers 6

up vote 4 down vote accepted

To accomplish what you want, you'll have to edit the source code for gnome-terminal and rebuild it yourself, as the minimum window size is hard-coded into the terminal application. To do this, follow these steps.

First, go to https://launchpad.net/ubuntu/+source/gnome-terminal/3.6.1-0ubuntu4 and download the source files (the file is gnome-terminal_3.6.1.orig.tar.xz). Download this to your ~/Downloads folder.

Then, open a terminal and type the following commands:

cd ~/Downloads

tar -xJf gnome-terminal_3.6.1.orig.tar.xz

This will extract the source. Now, open up your favourite text editor and edit the file ~/Downloads/gnome-terminal-3.6.1/src/terminal-window.c. Navigate to line 3107, where you will find the variables MIN_WIDTH_CHARS and MIN_HEIGHT_CHARS. Edit these, these are the minimum height and width of your terminal window expressed in characters (i.e. a MIN_WIDTH_CHARS of 20 will mean that you can no longer resize the width of the window to below 20 character widths)

Then, to build, in a terminal type cd ~/Downloads/gnome-terminal-3.6.1. Then, run ./configure to generate the makefile (if it complains about any missing packages, install them using apt-get (e.g. if it says "package foo not found" or similar, use sudo apt-get install foo). You can also try installing auto-apt and using sudo auto-apt run ./configure (this will attempt to install all dependencies), but when I tried this it didn't quite catch everything (run standard ./configure afterwards) This may take a few attempts, depending on how many packages are missing.

Once it has generated the makefiles simply type make, followed by sudo make install. This should rebuild the terminal program. Close all terminal windows, and then the next one you start will respect the minimum size you set in the source (i.e. will not resize below the values you defined there).

share|improve this answer
    
An even more complete method would be to do exactly as you have stated, but go the additional step of the user creating their own PPA so as to build a .deb that they can maintain and/or lock-in so as to not cause issues when upgrading the rest of the system. In this way, the package manager is still managing packages, but the user maintains control over just the one in their PPA without compromising the intended functionality of the package manager. Mentioning as much would (I think) solidify yours as the "go to" answer. –  darthlukan Jun 26 '13 at 11:10
    
@darthlukan Interesting point. I hadn't actually thought of this (perhaps I should have before going through this myself to test it) and in fact am not sure how one would go about doing that / apply any package updates while keeping their changes intact... I also just noticed that the question refers specifically to Terminator whereas this solution is for gnome-terminal, so... –  Jez W Jun 26 '13 at 13:11
    
Regardless of whether it's gnome-terminal or Terminator (actually, Terminator displays multiple gnome-terminals and gnome-terminal is a dependency of terminator), your solution is still right on. The user can do much the same thing in Terminator, they'll just have to pay attention to variable names that may be different and differing filenames, but the steps are all the same (main content). When you create a custom .deb package and attach your PPA to Apt, your package will override so long as you lock the version. –  darthlukan Jun 27 '13 at 19:34
  1. Press the super key to open the search lens and look for: main menu
  2. Once the "Main Menu" application is running select "Accessories" on the left menu and then select "Terminal" on the second menu.
  3. Once you have the "Terminal" options is selected press the "Properties" button on the right. A new window will open with the terminal Launcher properties.
  4. Go to the "Command" entry and add this to the end of the entry:

    --geometry=132x24
    

    The finished entry should be:

    gnome-terminal --geometry=132x24
    

That's it. Close the windows and next time you launch the terminal the window will be resized. You may have to logout and log back in to work properly.

(132x24 is just an example, you can use whatever resolution you want)

share|improve this answer
2  
This only affects the starting geometry, it doesn't prevent the terminal from being resized below the given size. –  Nicholas Jun 20 '13 at 21:24

Well, as far as I know, you can't, the resolution of a Terminal window is based on the proportions of the characters... So if you change the size of the font, the Terminal window will resize to fit the proportion of that font...

It sounds a bit silly at first, but given that a terminal simply displays only text characters, it makes sense, if a window is sized by pixels, you'd often end up with wasted space when the size of the window doesn't exactly match a character boundary...

share|improve this answer

If you're in an older version of Ubuntu, in the right click -> properties window, the first tab has two fields in which you can edit the rows and columns of the terminal.

Otherwise, you can use the command-input referred to in answer one.

--geometry=132x24
share|improve this answer
    
This also only affects the initial geometry. –  Nicholas Jun 20 '13 at 21:25

The little trick about default size was topic here. There, user viscount solved it by creating a script and place it in /usr/bin/gnome-terminal like this (I assume you use gnome as window-manager):

#!/bin/sh
gnome-terminal --geometry=132x24

You also can right click on the gnome-terminal icon on your task bar, select properties, then change there the command to different command like:

gnome-terminal --working-directory=%f --geometry=132x24

This way you have your own-defined default-size.

share|improve this answer

Have a look here:

Change default width of gnome-terminal and terminator windows

Hopefully it helps.

share|improve this answer

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.