For a long time my favorite Terminal program has been Guake. It is “a drop-down terminal for GNOME Desktop Environment.” It is always available and hidden when not in use. Simply press a button and it pops out from top of the screen, press again and it goes away.
To install Guake simply sudo apt-get install guake
The only problem I’ve had with it is on my desktop machine when two monitors are plugged in. Guake always defaults to the left monitor. It does a great job of determining the size of ‘monitor 1’, which in my case is a much smaller extra one to the side. To get Guake on my right-side monitor I had to tweak the source code. Here’s how you can do the same:
- Make a copy of theGuake program and put it in yourbin folder. I renamed mine toguake-dualmon but you can call it whatever you want.
1cp /usr/bin/guake ~/bin/guake-dualmon
- Edit the copy in your preferred editor.
- Find the method definition def get_final_window_rect(self):
- First we will correctly position the terminal on the right monitor. Add one line at the end, between
window_rect.y = 0 and
return window_rect . The window_rect.x and window_rect.y variables tell theGuake window where to be located. Set window_rect.x to be the width of your left monitor and window_rect.y will depend on how offset the monitors are. I had to play with the ‘y’ setting to get it just right or the text starts off the top of the screen.
12window_rect.x = 1280window_rect.y = 24
- Now Guake will be positioned on your right monitor, but it will still be the size of the left one. In my case it was sized at 1280, and I needed it to be 1920. Divide your right monitor’s width by the left monitor’s width (ie. 1920/1280 = 150). Still within
get_final_window_rect(self): you will find the line
width = 100 . This setting is a percentage of your left monitor, so set it to the answer you got by dividing one width into the other. In my case it was:
1width = 150
- That’s it! Just make sure to always run your copy of the program, or better yet add it to your autostart so it runs automatically!
Here’s the new get_final_window_rect() method looks like with edited lines highlighted:
"""Gets the final size of the main window of guake. The height
is the window_height property, width is window_width and the
horizontal alignment is given by window_alignment.
screen = self.window.get_screen()
height = self.client.get_int(KEY('/general/window_height'))
halignment = self.client.get_int(KEY('/general/window_halignment'))
# get the rectangle just from the first/default monitor in the
# future we might create a field to select which monitor you
# wanna use
window_rect = screen.get_monitor_geometry(0)
total_width = window_rect.width
window_rect.height = window_rect.height * height / 100
window_rect.width = window_rect.width * width / 100
if width < total_width:
if halignment == ALIGN_CENTER:
window_rect.x = (total_width - window_rect.width) / 2
elif halignment == ALIGN_LEFT:
window_rect.x = 0
elif halignment == ALIGN_RIGHT:
window_rect.x = total_width - window_rect.width
window_rect.y = 24
Have any questions? Feel free to ask in the comments below. Thanks for reading!