mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Option to stick the floating mode window to all workspaces. Disabled by default. Can be enabled in player preferences.
38 lines
899 B
JavaScript
38 lines
899 B
JavaScript
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 shellWindowEval(fn, isEnabled)
|
|
{
|
|
const un = (isEnabled) ? '' : 'un';
|
|
|
|
debug(`changing ${fn}`);
|
|
shellProxy.EvalRemote(
|
|
`global.display.focus_window.${un}${fn}()`,
|
|
(out) => {
|
|
const debugMsg = (out[0])
|
|
? `window ${fn}: ${isEnabled}`
|
|
: new Error(out[1]);
|
|
|
|
debug(debugMsg);
|
|
}
|
|
);
|
|
}
|