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,16 +157,58 @@ 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
property alias visible: barRootItem.visible property alias visible: barRootItem.visible
} }

View file

@ -5,38 +5,18 @@ 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"
}
}
Connections {
target: ToplevelManager
function onActiveToplevelChanged() {
if (ToplevelManager.activeToplevel?.appId) {
activeWindowWrapper.shouldShow = true
visibilityTimer.restart()
} else {
activeWindowWrapper.shouldShow = false
visibilityTimer.stop()
}
}
}
y: shouldShow ? barBackground.height : barBackground.height - fullHeight
height: shouldShow ? fullHeight : 1
opacity: shouldShow ? 1 : 0
clip: true
function getIcon() { function getIcon() {
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true); var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true);
@ -53,6 +33,41 @@ Item {
return icon; return icon;
} }
Item {
id: activeWindowWrapper
width: parent.width
property int fullHeight: activeWindowTitleContainer.height
property bool shouldShow: false
Timer {
id: visibilityTimer
interval: 4000
running: false
onTriggered: {
activeWindowWrapper.shouldShow = false;
}
}
Connections {
target: ToplevelManager
function onActiveToplevelChanged() {
if (ToplevelManager.activeToplevel?.appId) {
activeWindowWrapper.shouldShow = true;
visibilityTimer.restart();
} else {
activeWindowWrapper.shouldShow = false;
visibilityTimer.stop();
}
}
}
y: shouldShow ? 0 : -activeWindowPanel.barHeight
height: shouldShow ? fullHeight : 1
opacity: shouldShow ? 1 : 0
clip: true
Behavior on height { Behavior on height {
NumberAnimation { NumberAnimation {
duration: 300 duration: 300
@ -132,5 +147,5 @@ Item {
x: activeWindowTitleContainer.x + 34 - width x: activeWindowTitleContainer.x + 34 - width
offsetY: -1 offsetY: -1
} }
}
} }