running gnome-terminal with no window border on startup in xubuntu 12.10

8,983

You can do that stuff with devilspie. Install the devilspie package, and write the following configfile (save as ~/.devilspie/gnome-terminal.ds)

(if (is (window_role) "borderless") 
  (begin
    (geometry "+0+0")
    (maximize_vertically)
    (undecorate)
  )
)

Now you just run devilspie when you log in (e.g. by adding it to startup applications), then whenever a window with the role "borderless" appears, it will be moved to position (0,0), maximized vertically, and decorations removed.

You specify the role of gnome-terminal with the --role option.

gnome-terminal --role=borderless
Share:
8,983

Related videos on Youtube

lxvk
Author by

lxvk

Updated on September 18, 2022

Comments

  • lxvk
    lxvk almost 2 years

    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)

  • lxvk
    lxvk about 11 years
    This seems like a helpful, stable solution. I'll look into it. Unfortunately, I didn't see your answer until just now. I did however end up creating a modified version of my python script that I execute with a keybinding that toggles decoration. That, along with my startup script, really solved my only issues with XFCE/XFWM in general. That said, if I have to do anything like this again, I will likely use devilspie.