gdk.window set_decorations works in python not javascript bindings (v3.0)



Hi all,

I sent this to both gtk-list and gnome-shell-list because I think my
question is relevant to both subjects - I'm sorry if this was the
wrong etiquette (also, if you think there is a mailing list this is
more suited to, please let me know).

I'm trying to remove the window decorations on the active window.

Using pygobject:

from gi.repository import Gdk # Gdk.__file__ verifies it's 3.0

curwin = Gdk.Screen.get_default().get_active_window()
curwin.set_decorations(0)
curwin.maximize()
curwin.process_all_updates()

When I execute this code (from python terminal/script), the current
window (terminal) is undecorated correctly and maximised as I expect
(I'm basically writing something to remove window decoration from
maximised windows).

Then I try this from the javascript bindings:

const Gdk = imports.gi.Gdk;
var curwin = Gdk.Screen.get_default().get_active_window();
curwin.set_decorations(0);
curwin.maximize();
curwin.process_all_updates();

When I execute this code from the GNOME interactive gjs interpreter
(looking glass), when I execute `curwin.set_decorations(0)` the window
in question closes itself. For example, if the current window is a
terminal and it has a process running in it I'll get the "Running
process in terminal; are you sure you want to quit?" dialog, from
which I can select Cancel (window will be maximised/undecorated as I
wish). If there are no processes running in the terminal, it will
simply quit!

However, if execute this using the `gjs` binary (whether running
GNOME-shell or unity+metacity) I get "ERROR: Gdk.Screen.get_default()
is null" -- some environment variable not set up properly?? $DISPLAY
is :0 as normal. So I'm only actually able to test the javascript
version in GNOME-shell.

If it's relevant, I'm using GNOME-shell 3.4 which uses Mutter
(metacity + clutter) for the window manager.

Does anyone know :
1) Why the javascript version quits the program whereas the python
version doesn't?
2) How to make the javascript version work (i.e. not quit the window)?
3) If not any of the above, how I may debug this further/ whether &
where to submit a bug report?


I'd be grateful for any insight you have. I prefer to do this from
javascript (since in the end it'll be put into a GNOME-shell
extension), but I suppose as a last resort workaround I can call the
python script from within the javascript to execute the code.

Thank you very much!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]