I do a lot of source code editing. Have multiple files opened is common. I used to open multiple gnome-terminals, each one with one file opened. In this way, a lot of screen
space was wasted by the gnome-terminal title bar and the window’s borders. Another way is to use split windows in vim. But still, some space was wasted (split window’s orders) and mouse selection (terminal mouse support, not the vim mouse support) does not work well. If you have vertical-split windows and try to select more than one line of text, you’ll end up selecting texts from both windows. Some time ago, I tried tmux. I didn’t use the session detach feature but the window spliting was great. The window borders were only one pixel, no space wasted. However, the terminal mouse selection problem remained.
Yesterday, I spent a few hours searching the internet and found a way to use gnome-terminal + vim without wasting precious screen space: Awesome + Xephyr + Devil’s Pie.
The concept is easy, I set up a second desktop (xserver) using Xephyr (my main xserver is running gnome desktop + metacity). In this second desktop, I run the Awesome
window manager. I run all the gnome-terminal + vim inside the second xserver. The Awesome window manager is really awesome. There’s no window decoration for gnome-terminal so, no space wasted. I can resize all gnome-terminal and swap their position on the screen easily. Terminal mouse selection is also working as desired. But then, the second xserver is running inside a window under metacity. Thus, It has a title bar and window borders. To remove the window decoration, I use Devil’s Pie.
Install all the software packages (as root):
# aptitude install awesome devilspie
Create a second xserver (as normal user):
$ DISPLAY=:0 Xephyr -keybd ephyr,,,xkbmodel=evdev -ac -screen 1280x776 -br -reset -terminate :1 2> /dev/null &
- You may want to change to screen size to your need.
- The second xserver will be using the DISPLAY=:1
- `-keybd ephyr,,,xkbmodel=evdev’ is required to workaround keymap bug. See links below:
Start the awesome window manager in the second xserver:
$ DISPLAY=:1 awesome &
- Now you should see the initially black window of the second xserver comes alive. The awesome window manager is quite different from the metacity, so a bit of learning how-to-use is needed.
Remove the title bar of the second xserver:
$ mkdir ~/.devilspie
$ cat >~/.devilspie/Xephyr.ds <<EOF
(is (window_class) "Xephyr")
$ devilspie -a &
- The window containing the second xserver has the window_class “Xephyr”.
- You may want to change the geometry to fit the screen size when firing up the second xserver.
- The geometry “…+0+24” is to reposition the window after removing the title bar.
So now, I’m using the following script to fire up my source code editing session:
devilspie ~/.devilspie/Xephyr.ds &
DISPLAY=:0 Xephyr -keybd ephyr,,,xkbmodel=evdev -ac -screen 1280x776 -br -reset -terminate :1 2> /dev/null &
sleep 2 # wait for the xserver to come up.
DISPLAY=:1 awesome &