I created a script to launch a session of gnome-terminal when I log into xubuntu. I specifically wanted it in a specific position on the window, and with no window borders (surprisingly, there's no easy option for this in gnome-terminal, unlike xfce4-terminal).
After a bunch of googling and trying about 10 methods that didn't work, I ended up with the following scripts, in bash and python.
My executable bash script, which I placed in $HOME/bin :
#!/bin/bash
flags[0]="--hide-menubar"
flags[1]="--geometry=80x54+0-0"
flags[2]="--window-with-profile=default2"
flags[3]="--working-directory={$HOME}"
gnome-terminal ${flags[@]} -x bash -c 'sleep 5 ;{$HOME}/bin/undecor.py ;bash'
The corresponding executable python script, in the same directory :
#!/usr/bin/python
import gtk.gdk
root_window = gtk.gdk.get_default_root_window()
root_xid = root_window.property_get("_NET_ACTIVE_WINDOW")[2][0]
w = gtk.gdk.window_foreign_new(root_xid)
w.set_decorations(False)
gtk.gdk.window_process_all_updates()
I put the flags in an array in the bash script just so I could easily tell what was going on if I need to edit the particular arrangement later. Note: I'm doing this in python 2.7.3 . I didn't test it in python 3.x
The reason for most of the weirdness in the last line of the bashscript is that I found it really difficult to run a command in a new gnome-terminal window and keep it open after the command is finished executing.
The second big issue is that on startup, without running the sleep command, my python script runs before the window is formally created (I think...) and somewhere in the python script I start getting NoneTypes instead of the real window objects, etc. and the pyscript never successfully undecorates the window.
So what I'm asking is if anyone can think of a less hacky way to do this. I'd really like to use just python, but I couldn't find an easy way to do in either the os or gtk module. I read a few other solutions that involved things like compiz or openbox, but I wanted a way to do that without installing anything new. I'm not even sure if this works in other environments.
Thanks! Sorry if this question is long, I wanted to do my homework first.
(Also, note to xubuntu users, you need to make sure you are launching GNOME services on startup)