mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 16:31:58 +02:00
Add "Floating Window Mode"
A simple borderless window floating on desktop. Window can be resized and moved by dragging. It also has some minimalistic controls showing on top of the video when cursor is hovering over it.\n\n This was a feature originally requested by @zahid1905.
This commit is contained in:
@@ -10,6 +10,7 @@ class ClapperHeaderBar extends Gtk.HeaderBar
|
||||
});
|
||||
|
||||
this.set_title_widget(this._createWidgetForWindow(window));
|
||||
let clapperWidget = window.get_child();
|
||||
|
||||
let addMediaButton = new Gtk.MenuButton({
|
||||
icon_name: 'list-add-symbolic',
|
||||
@@ -25,11 +26,27 @@ class ClapperHeaderBar extends Gtk.HeaderBar
|
||||
openMenuButton.set_popover(settingsPopover);
|
||||
this.pack_end(openMenuButton);
|
||||
|
||||
let buttonsBox = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
});
|
||||
buttonsBox.add_css_class('linked');
|
||||
|
||||
let floatButton = new Gtk.Button({
|
||||
icon_name: 'preferences-desktop-remote-desktop-symbolic',
|
||||
});
|
||||
floatButton.connect('clicked', this._onFloatButtonClicked.bind(this));
|
||||
clapperWidget.controls.unfloatButton.bind_property('visible', this, 'visible',
|
||||
GObject.BindingFlags.INVERT_BOOLEAN
|
||||
);
|
||||
buttonsBox.append(floatButton);
|
||||
|
||||
let fullscreenButton = new Gtk.Button({
|
||||
icon_name: 'view-fullscreen-symbolic',
|
||||
});
|
||||
fullscreenButton.connect('clicked', () => this.get_parent().fullscreen());
|
||||
this.pack_end(fullscreenButton);
|
||||
fullscreenButton.connect('clicked', this._onFullscreenButtonClicked.bind(this));
|
||||
|
||||
buttonsBox.append(fullscreenButton);
|
||||
this.pack_end(buttonsBox);
|
||||
}
|
||||
|
||||
updateHeaderBar(title, subtitle)
|
||||
@@ -72,6 +89,18 @@ class ClapperHeaderBar extends Gtk.HeaderBar
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
_onFloatButtonClicked()
|
||||
{
|
||||
let clapperWidget = this.get_prev_sibling();
|
||||
clapperWidget.setFloatingMode(true);
|
||||
}
|
||||
|
||||
_onFullscreenButtonClicked()
|
||||
{
|
||||
let window = this.get_parent();
|
||||
window.fullscreen();
|
||||
}
|
||||
});
|
||||
|
||||
var HeaderBarPopover = GObject.registerClass(
|
||||
|
Reference in New Issue
Block a user