Auto set floating mode window to be always above

This commit is contained in:
Rafał Dzięgiel
2021-02-14 21:35:16 +01:00
parent baa5053446
commit 6448012edd
3 changed files with 41 additions and 0 deletions

37
src/dbus.js Normal file
View File

@@ -0,0 +1,37 @@
const { Gio } = imports.gi;
const Debug = imports.src.debug;
const { debug } = Debug;
const ShellProxyWrapper = Gio.DBusProxy.makeProxyWrapper(`
<node>
<interface name="org.gnome.Shell">
<method name="Eval">
<arg type="s" direction="in" name="script"/>
<arg type="b" direction="out" name="success"/>
<arg type="s" direction="out" name="result"/>
</method>
</interface>
</node>`
);
let shellProxy = new ShellProxyWrapper(
Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell'
);
function callMakeAbove(isAbove)
{
const un = (isAbove) ? '' : 'un';
debug('changing window keep above');
shellProxy.EvalRemote(
`global.display.focus_window.${un}make_above()`,
(out) => {
const debugMsg = (out[0])
? `window keep above: ${isAbove}`
: new Error(out[1]);
debug(debugMsg);
}
);
}

View File

@@ -1,6 +1,7 @@
const { GLib, GObject, Gtk, Pango } = imports.gi;
const { HeaderBar } = imports.src.headerbar;
const Debug = imports.src.debug;
const DBus = imports.src.dbus;
const REVEAL_TIME = 800;
@@ -264,6 +265,8 @@ class ClapperControlsRevealer extends Gtk.Revealer
widget.height_request = widget.get_height();
this.reveal_child ^= true;
DBus.callMakeAbove(!this.reveal_child);
}
_onControlsRevealed()