mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Add option to show floating video on all workspaces
Option to stick the floating mode window to all workspaces. Disabled by default. Can be enabled in player preferences.
This commit is contained in:
@@ -40,6 +40,10 @@
|
|||||||
<default>'[]'</default>
|
<default>'[]'</default>
|
||||||
<summary>Data storing unfinished videos resume info</summary>
|
<summary>Data storing unfinished videos resume info</summary>
|
||||||
</key>
|
</key>
|
||||||
|
<key name="floating-stick" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Auto stick floating window to all workspaces</summary>
|
||||||
|
</key>
|
||||||
|
|
||||||
<!-- Audio -->
|
<!-- Audio -->
|
||||||
<key name="audio-offset" type="d">
|
<key name="audio-offset" type="d">
|
||||||
|
10
src/dbus.js
10
src/dbus.js
@@ -19,16 +19,16 @@ let shellProxy = new ShellProxyWrapper(
|
|||||||
Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell'
|
Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell'
|
||||||
);
|
);
|
||||||
|
|
||||||
function callMakeAbove(isAbove)
|
function shellWindowEval(fn, isEnabled)
|
||||||
{
|
{
|
||||||
const un = (isAbove) ? '' : 'un';
|
const un = (isEnabled) ? '' : 'un';
|
||||||
|
|
||||||
debug('changing window keep above');
|
debug(`changing ${fn}`);
|
||||||
shellProxy.EvalRemote(
|
shellProxy.EvalRemote(
|
||||||
`global.display.focus_window.${un}make_above()`,
|
`global.display.focus_window.${un}${fn}()`,
|
||||||
(out) => {
|
(out) => {
|
||||||
const debugMsg = (out[0])
|
const debugMsg = (out[0])
|
||||||
? `window keep above: ${isAbove}`
|
? `window ${fn}: ${isEnabled}`
|
||||||
: new Error(out[1]);
|
: new Error(out[1]);
|
||||||
|
|
||||||
debug(debugMsg);
|
debug(debugMsg);
|
||||||
|
@@ -73,6 +73,9 @@ class ClapperBehaviourPage extends PrefsBase.Grid
|
|||||||
|
|
||||||
this.addTitle('Resume');
|
this.addTitle('Resume');
|
||||||
this.addCheckButton('Ask to resume last unfinished video', 'resume-enabled');
|
this.addCheckButton('Ask to resume last unfinished video', 'resume-enabled');
|
||||||
|
|
||||||
|
this.addTitle('Floating Mode');
|
||||||
|
this.addCheckButton('Show on all workspaces', 'floating-stick');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -2,10 +2,12 @@ const { GLib, GObject, Gtk, Pango } = imports.gi;
|
|||||||
const { HeaderBar } = imports.src.headerbar;
|
const { HeaderBar } = imports.src.headerbar;
|
||||||
const Debug = imports.src.debug;
|
const Debug = imports.src.debug;
|
||||||
const DBus = imports.src.dbus;
|
const DBus = imports.src.dbus;
|
||||||
|
const Misc = imports.src.misc;
|
||||||
|
|
||||||
const REVEAL_TIME = 800;
|
const REVEAL_TIME = 800;
|
||||||
|
|
||||||
const { debug } = Debug;
|
const { debug } = Debug;
|
||||||
|
const { settings } = Misc;
|
||||||
|
|
||||||
var CustomRevealer = GObject.registerClass(
|
var CustomRevealer = GObject.registerClass(
|
||||||
class ClapperCustomRevealer extends Gtk.Revealer
|
class ClapperCustomRevealer extends Gtk.Revealer
|
||||||
@@ -266,7 +268,11 @@ class ClapperControlsRevealer extends Gtk.Revealer
|
|||||||
widget.height_request = widget.get_height();
|
widget.height_request = widget.get_height();
|
||||||
this.reveal_child ^= true;
|
this.reveal_child ^= true;
|
||||||
|
|
||||||
DBus.callMakeAbove(!this.reveal_child);
|
const isFloating = !this.reveal_child;
|
||||||
|
DBus.shellWindowEval('make_above', isFloating);
|
||||||
|
|
||||||
|
const isStick = (isFloating && settings.get_boolean('floating-stick'));
|
||||||
|
DBus.shellWindowEval('stick', isStick);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onControlsRevealed()
|
_onControlsRevealed()
|
||||||
|
Reference in New Issue
Block a user