repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by bugabinga
quickshell/nugu/Osd.qml
Rawimport QtQuick
import Quickshell
import Quickshell.Wayland
PanelWindow {
id: root
required property QtObject theme
property bool shown: false
property string message: ""
property string tone: "info"
// OSDs replace transient `hyprctl notify` calls later. Keeping this surface
// independent from notifications avoids blocking Phase 4 on DBus ownership.
visible: shown
anchors { top: true; left: true; right: true }
margins { top: 72 }
exclusiveZone: -1
implicitHeight: 48
color: "transparent"
WlrLayershell {
layer: WlrLayer.Overlay
namespace: "nugu-osd"
}
function showText(nextMessage: string, nextTone: string): string {
message = nextMessage
tone = nextTone.length > 0 ? nextTone : "info"
shown = true
hideTimer.restart()
return message
}
function hide(): void {
hideTimer.stop()
shown = false
}
function toneColor(): color {
if (tone === "error") return theme.error
if (tone === "warning") return theme.warning
if (tone === "debug") return theme.debug
return theme.info
}
Timer {
id: hideTimer
interval: 1400
onTriggered: root.shown = false
}
Rectangle {
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
width: Math.min(root.width - 32, Math.max(220, osdText.implicitWidth + 44))
height: 40
radius: 10
color: `${theme.ui.backdrop}ee`
border.width: 2
border.color: root.toneColor()
Text {
id: osdText
anchors.centerIn: parent
width: parent.width - 24
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
text: root.message
color: theme.ui.normal
font.family: "IBM Plex Sans"
font.pixelSize: 15
font.bold: true
}
}
}