feat: remove the stolen screen space

This commit is contained in:
ferreo 2025-07-16 12:19:34 +01:00
parent e065742352
commit f4eef3c7a7
2 changed files with 197 additions and 153 deletions

View file

@ -32,47 +32,13 @@ Scope {
id: panel id: panel
screen: modelData screen: modelData
color: "transparent" color: "transparent"
implicitHeight: barBackground.height + 24 implicitHeight: barBackground.height
anchors.top: true anchors.top: true
anchors.left: true anchors.left: true
anchors.right: true anchors.right: true
visible: true visible: true
property string lastFocusedWindowTitle: ""
property bool activeWindowVisible: false
property string displayedWindowTitle: ""
onLastFocusedWindowTitleChanged: {
displayedWindowTitle = (lastFocusedWindowTitle === "(No active window)") ? "" : lastFocusedWindowTitle
}
Timer {
id: hideTimer
interval: 4000
repeat: false
onTriggered: panel.activeWindowVisible = false
}
Connections {
target: Niri
function onFocusedWindowTitleChanged() {
var newTitle = Niri.focusedWindowTitle
if (newTitle !== panel.lastFocusedWindowTitle) {
panel.lastFocusedWindowTitle = newTitle
if (newTitle === "(No active window)") {
panel.activeWindowVisible = false
hideTimer.stop()
} else {
panel.activeWindowVisible = true
hideTimer.restart()
}
}
}
}
Rectangle { Rectangle {
id: barBackground id: barBackground
width: parent.width width: parent.width
@ -98,7 +64,9 @@ Scope {
} }
} }
ActiveWindow {} ActiveWindow {
screen: modelData
}
Workspace { Workspace {
id: workspace id: workspace
@ -153,6 +121,25 @@ Scope {
} }
} }
Background {}
Overview {}
}
PanelWindow {
id: topCornerPanel
anchors.top: true
anchors.left: true
anchors.right: true
color: "transparent"
screen: modelData
margins.top: 36
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: true
implicitHeight: 24
Corners { Corners {
id: topleftCorner id: topleftCorner
position: "bottomleft" position: "bottomleft"
@ -160,7 +147,7 @@ Scope {
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: -39 offsetX: -39
offsetY: 0 offsetY: 0
anchors.top: barBackground.bottom anchors.top: parent.top
} }
Corners { Corners {
@ -170,14 +157,56 @@ Scope {
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: 39 offsetX: 39
offsetY: 0 offsetY: 0
anchors.top: barBackground.bottom anchors.top: parent.top
} }
}
Background {} PanelWindow {
Overview {} id: bottomLeftPanel
anchors.bottom: true
anchors.left: true
color: "transparent"
screen: modelData
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: true
implicitHeight: 24
Corners {
id: bottomLeftCorner
position: "topleft"
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: -39
offsetY: 0
anchors.top: parent.top
}
}
PanelWindow {
id: bottomRightCornerPanel
anchors.bottom: true
anchors.right: true
color: "transparent"
screen: modelData
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: true
implicitHeight: 24
Corners {
id: bottomRightCorner
position: "topright"
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: 39
offsetY: 0
anchors.top: parent.top
}
} }
} }
} }
} }
// This alias exposes the visual bar's visibility to the outside world // This alias exposes the visual bar's visibility to the outside world

View file

@ -5,132 +5,147 @@ import qs.Settings
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
Item { PanelWindow {
id: activeWindowWrapper id: activeWindowPanel
width: parent.width screen: (typeof modelData !== 'undefined' ? modelData : null)
property int fullHeight: activeWindowTitleContainer.height WlrLayershell.exclusionMode: ExclusionMode.Ignore
property bool shouldShow: false anchors.top: true
anchors.left: true
Timer { anchors.right: true
id: visibilityTimer margins.top: barHeight
interval: 4000 visible: activeWindowWrapper.shouldShow
running: false implicitHeight: activeWindowTitleContainer.height
onTriggered: { property int barHeight: 36
activeWindowWrapper.shouldShow = false color: "transparent"
function getIcon() {
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true);
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId, true);
}
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title, true);
}
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title.toLowerCase(), "application-x-executable");
}
return icon;
} }
}
Item {
Connections { id: activeWindowWrapper
target: ToplevelManager width: parent.width
function onActiveToplevelChanged() { property int fullHeight: activeWindowTitleContainer.height
if (ToplevelManager.activeToplevel?.appId) { property bool shouldShow: false
activeWindowWrapper.shouldShow = true
visibilityTimer.restart() Timer {
} else { id: visibilityTimer
activeWindowWrapper.shouldShow = false interval: 4000
visibilityTimer.stop() running: false
onTriggered: {
activeWindowWrapper.shouldShow = false;
} }
} }
}
y: shouldShow ? barBackground.height : barBackground.height - fullHeight Connections {
height: shouldShow ? fullHeight : 1 target: ToplevelManager
opacity: shouldShow ? 1 : 0 function onActiveToplevelChanged() {
clip: true if (ToplevelManager.activeToplevel?.appId) {
activeWindowWrapper.shouldShow = true;
function getIcon() { visibilityTimer.restart();
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true); } else {
if (!icon) { activeWindowWrapper.shouldShow = false;
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId, true); visibilityTimer.stop();
} }
if (!icon) { }
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title, true);
}
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title.toLowerCase(), "application-x-executable");
} }
return icon; y: shouldShow ? 0 : -activeWindowPanel.barHeight
} height: shouldShow ? fullHeight : 1
opacity: shouldShow ? 1 : 0
clip: true
Behavior on height {
NumberAnimation {
duration: 300 Behavior on height {
easing.type: Easing.OutQuad NumberAnimation {
duration: 300
easing.type: Easing.OutQuad
}
} }
} Behavior on y {
Behavior on y { NumberAnimation {
NumberAnimation { duration: 300
duration: 300 easing.type: Easing.OutQuad
easing.type: Easing.OutQuad }
} }
} Behavior on opacity {
Behavior on opacity { NumberAnimation {
NumberAnimation { duration: 250
duration: 250 }
}
}
Rectangle {
id: activeWindowTitleContainer
color: Theme.backgroundPrimary
bottomLeftRadius: Math.max(0, width / 2)
bottomRightRadius: Math.max(0, width / 2)
width: Math.min(barBackground.width - 200, activeWindowTitle.implicitWidth + (Settings.showActiveWindowIcon ? 28 : 22))
height: activeWindowTitle.implicitHeight + 12
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
IconImage {
id: icon
width: 12
height: 12
anchors.left: parent.left
anchors.leftMargin: 6
anchors.verticalCenter: parent.verticalCenter
source: ToplevelManager?.activeToplevel ? getIcon() : ""
visible: Settings.showActiveWindowIcon
anchors.verticalCenterOffset: -3
} }
Text { Rectangle {
id: activeWindowTitle id: activeWindowTitleContainer
text: ToplevelManager?.activeToplevel?.title && ToplevelManager?.activeToplevel?.title.length > 60 ? ToplevelManager?.activeToplevel?.title.substring(0, 60) + "..." : ToplevelManager?.activeToplevel?.title || "" color: Theme.backgroundPrimary
font.pixelSize: 12 bottomLeftRadius: Math.max(0, width / 2)
color: Theme.textSecondary bottomRightRadius: Math.max(0, width / 2)
elide: Text.ElideRight
anchors.left: icon.right width: Math.min(barBackground.width - 200, activeWindowTitle.implicitWidth + (Settings.showActiveWindowIcon ? 28 : 22))
anchors.leftMargin: Settings.showActiveWindowIcon ? 4 : 6 height: activeWindowTitle.implicitHeight + 12
anchors.right: parent.right
anchors.rightMargin: 6 anchors.top: parent.top
anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenterOffset: -3
horizontalAlignment: Settings.showActiveWindowIcon ? Text.AlignRight : Text.AlignHCenter IconImage {
verticalAlignment: Text.AlignVCenter id: icon
maximumLineCount: 1 width: 12
height: 12
anchors.left: parent.left
anchors.leftMargin: 6
anchors.verticalCenter: parent.verticalCenter
source: ToplevelManager?.activeToplevel ? getIcon() : ""
visible: Settings.showActiveWindowIcon
anchors.verticalCenterOffset: -3
}
Text {
id: activeWindowTitle
text: ToplevelManager?.activeToplevel?.title && ToplevelManager?.activeToplevel?.title.length > 60 ? ToplevelManager?.activeToplevel?.title.substring(0, 60) + "..." : ToplevelManager?.activeToplevel?.title || ""
font.pixelSize: 12
color: Theme.textSecondary
elide: Text.ElideRight
anchors.left: icon.right
anchors.leftMargin: Settings.showActiveWindowIcon ? 4 : 6
anchors.right: parent.right
anchors.rightMargin: 6
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -3
horizontalAlignment: Settings.showActiveWindowIcon ? Text.AlignRight : Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
maximumLineCount: 1
}
} }
}
Corners { Corners {
id: activeCornerRight id: activeCornerRight
position: "bottomleft" position: "bottomleft"
size: 1.1 size: 1.1
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
offsetX: activeWindowTitleContainer.x + activeWindowTitleContainer.width - 34 offsetX: activeWindowTitleContainer.x + activeWindowTitleContainer.width - 34
offsetY: -1 offsetY: -1
anchors.top: activeWindowTitleContainer.top anchors.top: activeWindowTitleContainer.top
} }
Corners { Corners {
id: activeCornerLeft id: activeCornerLeft
position: "bottomright" position: "bottomright"
size: 1.1 size: 1.1
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
anchors.top: activeWindowTitleContainer.top anchors.top: activeWindowTitleContainer.top
x: activeWindowTitleContainer.x + 34 - width x: activeWindowTitleContainer.x + 34 - width
offsetY: -1 offsetY: -1
}
} }
} }