Files
dots-hyprland/dots/.config/quickshell/ii/modules/waffle/bar/WaffleBar.qml
T
2025-11-11 00:01:57 +01:00

90 lines
2.1 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Wayland
import Quickshell.Hyprland
import qs
import qs.services
import qs.modules.common
import qs.modules.common.widgets
Scope {
id: bar
property bool showBarBackground: Config.options.bar.showBackground
LazyLoader {
id: barLoader
active: GlobalStates.barOpen && !GlobalStates.screenLocked
component: Variants {
model: Quickshell.screens
delegate: PanelWindow { // Bar window
id: barRoot
required property var modelData
screen: modelData
exclusionMode: ExclusionMode.Ignore
exclusiveZone: implicitHeight
WlrLayershell.namespace: "quickshell:wBar"
anchors {
left: true
right: true
bottom: Config.options.waffles.bar.bottom
top: !Config.options.waffles.bar.bottom
}
color: "transparent"
implicitHeight: content.implicitHeight
implicitWidth: content.implicitWidth
WaffleBarContent {
id: content
anchors.fill: parent
}
}
}
}
IpcHandler {
target: "bar"
function toggle(): void {
GlobalStates.barOpen = !GlobalStates.barOpen
}
function close(): void {
GlobalStates.barOpen = false
}
function open(): void {
GlobalStates.barOpen = true
}
}
GlobalShortcut {
name: "barToggle"
description: "Toggles bar on press"
onPressed: {
GlobalStates.barOpen = !GlobalStates.barOpen;
}
}
GlobalShortcut {
name: "barOpen"
description: "Opens bar on press"
onPressed: {
GlobalStates.barOpen = true;
}
}
GlobalShortcut {
name: "barClose"
description: "Closes bar on press"
onPressed: {
GlobalStates.barOpen = false;
}
}
}