diff --git a/config/Config.qml b/config/Config.qml index d8b9e22..9050fa0 100644 --- a/config/Config.qml +++ b/config/Config.qml @@ -128,6 +128,7 @@ Singleton { } readonly property QtObject notifs: QtObject { + readonly property bool expire: true readonly property int defaultExpireTimeout: 5000 readonly property real clearThreshold: 0.3 @@ -175,7 +176,7 @@ Singleton { readonly property real buttonSize: 64 property list logout: ["hyprctl", "dispatch", "exit"] - property list lock: ["hyprlock"] + property list lock: ["hyprlock", "--immediate"] property list suspend: ["systemctl", "suspend"] property list hibernate: ["systemctl", "suspend-then-hibernate"] property list sleep: suspend diff --git a/modules/bar/popouts/IdleInhibit.qml b/modules/bar/popouts/IdleInhibit.qml index f154dd1..68ab17c 100644 --- a/modules/bar/popouts/IdleInhibit.qml +++ b/modules/bar/popouts/IdleInhibit.qml @@ -23,7 +23,7 @@ ColumnLayout { Toggle { label.text: qsTr("Inhibit While Playing Audio") checked: Idle.inhibitPipewire - toggle.onToggled: Idle.inhibitPipewire = !Idle.inhibitPipewire + toggle.onToggled: Idle.toggleInhibitPipewire() } component Toggle: RowLayout { diff --git a/modules/dashboard/Performance.qml b/modules/dashboard/Performance.qml index 5e7afab..39c51d4 100644 --- a/modules/dashboard/Performance.qml +++ b/modules/dashboard/Performance.qml @@ -107,7 +107,7 @@ ColumnLayout { Column { anchors.centerIn: parent - readonly property color color: res.warning1 ? Color.mute(Config.colors.error, 1.2, 1.1) : + readonly property color color: res.warning1 ? Color.mute(Config.colors.error, 1.3, 1.2) : res.value1 === 0 ? Config.colors.inactive : Config.colors.primary CustomText { @@ -133,7 +133,7 @@ ColumnLayout { anchors.horizontalCenterOffset: -res.thickness / 2 anchors.topMargin: res.thickness / 2 + 5 - readonly property color color: res.warning2 ? Color.mute(Config.colors.error, 1.2, 1.1) : + readonly property color color: res.warning2 ? Color.mute(Config.colors.error, 1.3, 1.2) : res.value2 === 0 ? Config.colors.inactive : Config.colors.primary CustomText { diff --git a/modules/ui/Interactions.qml b/modules/ui/Interactions.qml index f3d601e..980dae2 100644 --- a/modules/ui/Interactions.qml +++ b/modules/ui/Interactions.qml @@ -21,32 +21,29 @@ CustomMouseArea { property bool dashboardShortcutActive anchors.fill: parent - // HACK: Fixes weird pixel alignment issues that drop mouse events - anchors.rightMargin: -1 - anchors.bottomMargin: -1 - hoverEnabled: true function withinPanelWidth(panel: Item, x: real): bool { - const panelX = panel.x + Config.border.thickness; + const panelX = panel.x; return x >= panelX - Config.border.rounding && x <= panelX + panel.width + Config.border.rounding; } function withinPanelHeight(panel: Item, y: real): bool { - const panelY = panel.y + Config.bar.height; - return y >= panelY - Config.border.rounding && y <= panelY + panel.height + Config.border.rounding; + const panelY = panel.y; + return y >= panelY + Config.bar.height - Config.border.rounding + && y <= panelY + panel.height + Config.bar.height + Config.border.rounding; } function inBottomPanel(panel: Item, x: real, y: real): bool { - return y > panel.y + Config.bar.height && withinPanelWidth(panel, x); + return y > root.height - Config.border.thickness - panel.height - Config.border.rounding && withinPanelWidth(panel, x); } function inLeftPanel(panel: Item, x: real, y: real): bool { - return x < panel.x + panel.width + Config.border.thickness && withinPanelHeight(panel, y); + return x < Config.border.thickness + panel.x + panel.width && withinPanelHeight(panel, y); } function inRightPanel(panel: Item, x: real, y: real): bool { - return x > panel.x + Config.border.thickness && withinPanelHeight(panel, y); + return x > Config.border.thickness + panel.x && withinPanelHeight(panel, y); } // Handling Mouse Input diff --git a/modules/ui/UI.qml b/modules/ui/UI.qml index cb7ee66..7eb2f11 100644 --- a/modules/ui/UI.qml +++ b/modules/ui/UI.qml @@ -30,7 +30,6 @@ Variants { UIState { id: uiState - window: window screen: scope.modelData } diff --git a/modules/ui/UIState.qml b/modules/ui/UIState.qml index 038b3fc..52c8e5e 100644 --- a/modules/ui/UIState.qml +++ b/modules/ui/UIState.qml @@ -8,15 +8,12 @@ import Quickshell.Hyprland Scope { id: root - required property QtObject window required property ShellScreen screen property alias uiState: uiState PersistentProperties { id: uiState - reloadableId: `uiState-${root.screen.name}` - - readonly property QtObject window: root.window + reloadableId: `uiState-${QsWindow.window.screen.name}` // Open panels property bool dashboard diff --git a/services/Idle.qml b/services/Idle.qml index c5bc5fc..794e715 100644 --- a/services/Idle.qml +++ b/services/Idle.qml @@ -1,28 +1,47 @@ pragma Singleton -import qs.util import QtQuick import Quickshell -import Quickshell.Wayland -import Quickshell.Services.Pipewire +import Quickshell.Io Singleton { id: root - property bool inhibit: false - property bool inhibitPipewire: true + property alias inhibit: inhibitor.running + property bool inhibitPipewire - IdleInhibitor { - id: inhibitor - enabled: root.inhibit || - (root.inhibitPipewire && - !!Pipewire.nodes.values.find(node => node.isSink && node.isStream)) - window: null + function toggleInhibitPipewire() { + root.inhibitPipewire = !root.inhibitPipewire; + pipewireInhibitor.running = true; } + // Idle Inhibitor + + Process { + id: inhibitor + command: ["wayland-idle-inhibitor"] + } + + // Idle Inhibit on Pipewire + + readonly property string pipewireInhibitorService: "wayland-pipewire-idle-inhibit.service" + Timer { + id: pipewireInhibitorTimer running: true repeat: true - onTriggered: inhibitor.window = States.screens.values().next()?.value?.window + triggeredOnStart: true + onTriggered: pipewireInhibitorCheck.running = true + } + + Process { + id: pipewireInhibitorCheck + command: ["systemctl", "status", "--user", root.pipewireInhibitorService] + onExited: (code, _) => root.inhibitPipewire = (code === 0) + } + + Process { + id: pipewireInhibitor + command: ["systemctl", root.inhibitPipewire ? "start" : "stop", "--user", root.pipewireInhibitorService] } }