Append "PiP" suffix to window title when in floating mode

We are gonna take advantage of this simple change elsewhere
This commit is contained in:
Rafał Dzięgiel
2021-12-15 12:44:23 +01:00
parent 0c561ab4b3
commit 5e4dfb322c
2 changed files with 19 additions and 4 deletions

View File

@@ -325,15 +325,17 @@ class ClapperControlsRevealer extends Gtk.Revealer
_onControlsRevealed()
{
if(this.child_revealed) {
const clapperWidget = this.root.child;
if(!clapperWidget) return;
const clapperWidget = this.root.child;
if(!clapperWidget) return;
if(this.child_revealed) {
const [width, height] = this.root.get_default_size();
clapperWidget.player.widget.height_request = -1;
this.root.set_default_size(width, height);
}
clapperWidget.refreshWindowTitle(this.root.title);
}
_onUnrevealTick(playerWidget, width, height)

View File

@@ -319,11 +319,24 @@ class ClapperWidget extends Gtk.Grid
title = item.filename;
}
this.root.title = title;
this.refreshWindowTitle(title);
this.revealerTop.title = title;
this.revealerTop.showTitle = true;
}
refreshWindowTitle(title)
{
const isFloating = !this.controlsRevealer.child_revealed;
const pipSuffix = ' - PiP';
const hasPipSuffix = title.endsWith(pipSuffix);
this.root.title = (isFloating && !hasPipSuffix)
? title + pipSuffix
: (!isFloating && hasPipSuffix)
? title.substring(0, title.length - pipSuffix.length)
: title;
}
updateTime()
{
if(