mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
Auto set floating mode window to be always above
This commit is contained in:
37
src/dbus.js
Normal file
37
src/dbus.js
Normal 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);
|
||||
}
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user