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
screen: modelData
color: "transparent"
implicitHeight: barBackground.height + 24
implicitHeight: barBackground.height
anchors.top: true
anchors.left: true
anchors.right: 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 {
id: barBackground
width: parent.width
@ -98,7 +64,9 @@ Scope {
}
}
ActiveWindow {}
ActiveWindow {
screen: modelData
}
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 {
id: topleftCorner
position: "bottomleft"
@ -160,7 +147,7 @@ Scope {
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: -39
offsetY: 0
anchors.top: barBackground.bottom
anchors.top: parent.top
}
Corners {
@ -170,16 +157,58 @@ Scope {
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: 39
offsetY: 0
anchors.top: barBackground.bottom
anchors.top: parent.top
}
}
Background {}
Overview {}
PanelWindow {
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
property alias visible: barRootItem.visible
}

View file

@ -5,38 +5,18 @@ import qs.Settings
import Quickshell.Wayland
import Quickshell.Widgets
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 ? barBackground.height : barBackground.height - fullHeight
height: shouldShow ? fullHeight : 1
opacity: shouldShow ? 1 : 0
clip: true
PanelWindow {
id: activeWindowPanel
screen: (typeof modelData !== 'undefined' ? modelData : null)
WlrLayershell.exclusionMode: ExclusionMode.Ignore
anchors.top: true
anchors.left: true
anchors.right: true
margins.top: barHeight
visible: activeWindowWrapper.shouldShow
implicitHeight: activeWindowTitleContainer.height
property int barHeight: 36
color: "transparent"
function getIcon() {
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true);
@ -53,6 +33,41 @@ Item {
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 {
NumberAnimation {
duration: 300
@ -133,4 +148,4 @@ Item {
offsetY: -1
}
}
}