Compare commits

..

No commits in common. "c9e7e7022b982f0dc05f2e5c16d390c7f0c9bcb2" and "6e1fb585e30d3503dd120f19e64535005357ffc7" have entirely different histories.

7 changed files with 44 additions and 31 deletions

View file

@ -128,6 +128,7 @@ Singleton {
} }
readonly property QtObject notifs: QtObject { readonly property QtObject notifs: QtObject {
readonly property bool expire: true
readonly property int defaultExpireTimeout: 5000 readonly property int defaultExpireTimeout: 5000
readonly property real clearThreshold: 0.3 readonly property real clearThreshold: 0.3
@ -175,7 +176,7 @@ Singleton {
readonly property real buttonSize: 64 readonly property real buttonSize: 64
property list<string> logout: ["hyprctl", "dispatch", "exit"] property list<string> logout: ["hyprctl", "dispatch", "exit"]
property list<string> lock: ["hyprlock"] property list<string> lock: ["hyprlock", "--immediate"]
property list<string> suspend: ["systemctl", "suspend"] property list<string> suspend: ["systemctl", "suspend"]
property list<string> hibernate: ["systemctl", "suspend-then-hibernate"] property list<string> hibernate: ["systemctl", "suspend-then-hibernate"]
property list<string> sleep: suspend property list<string> sleep: suspend

View file

@ -23,7 +23,7 @@ ColumnLayout {
Toggle { Toggle {
label.text: qsTr("Inhibit While Playing Audio") label.text: qsTr("Inhibit While Playing Audio")
checked: Idle.inhibitPipewire checked: Idle.inhibitPipewire
toggle.onToggled: Idle.inhibitPipewire = !Idle.inhibitPipewire toggle.onToggled: Idle.toggleInhibitPipewire()
} }
component Toggle: RowLayout { component Toggle: RowLayout {

View file

@ -107,7 +107,7 @@ ColumnLayout {
Column { Column {
anchors.centerIn: parent 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 res.value1 === 0 ? Config.colors.inactive : Config.colors.primary
CustomText { CustomText {
@ -133,7 +133,7 @@ ColumnLayout {
anchors.horizontalCenterOffset: -res.thickness / 2 anchors.horizontalCenterOffset: -res.thickness / 2
anchors.topMargin: res.thickness / 2 + 5 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 res.value2 === 0 ? Config.colors.inactive : Config.colors.primary
CustomText { CustomText {

View file

@ -21,32 +21,29 @@ CustomMouseArea {
property bool dashboardShortcutActive property bool dashboardShortcutActive
anchors.fill: parent anchors.fill: parent
// HACK: Fixes weird pixel alignment issues that drop mouse events
anchors.rightMargin: -1
anchors.bottomMargin: -1
hoverEnabled: true hoverEnabled: true
function withinPanelWidth(panel: Item, x: real): bool { 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; return x >= panelX - Config.border.rounding && x <= panelX + panel.width + Config.border.rounding;
} }
function withinPanelHeight(panel: Item, y: real): bool { function withinPanelHeight(panel: Item, y: real): bool {
const panelY = panel.y + Config.bar.height; const panelY = panel.y;
return y >= panelY - Config.border.rounding && y <= panelY + panel.height + Config.border.rounding; 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 { 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 { 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 { 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 // Handling Mouse Input

View file

@ -30,7 +30,6 @@ Variants {
UIState { UIState {
id: uiState id: uiState
window: window
screen: scope.modelData screen: scope.modelData
} }

View file

@ -8,15 +8,12 @@ import Quickshell.Hyprland
Scope { Scope {
id: root id: root
required property QtObject window
required property ShellScreen screen required property ShellScreen screen
property alias uiState: uiState property alias uiState: uiState
PersistentProperties { PersistentProperties {
id: uiState id: uiState
reloadableId: `uiState-${root.screen.name}` reloadableId: `uiState-${QsWindow.window.screen.name}`
readonly property QtObject window: root.window
// Open panels // Open panels
property bool dashboard property bool dashboard

View file

@ -1,28 +1,47 @@
pragma Singleton pragma Singleton
import qs.util
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Io
import Quickshell.Services.Pipewire
Singleton { Singleton {
id: root id: root
property bool inhibit: false property alias inhibit: inhibitor.running
property bool inhibitPipewire: true property bool inhibitPipewire
IdleInhibitor { function toggleInhibitPipewire() {
id: inhibitor root.inhibitPipewire = !root.inhibitPipewire;
enabled: root.inhibit || pipewireInhibitor.running = true;
(root.inhibitPipewire &&
!!Pipewire.nodes.values.find(node => node.isSink && node.isStream))
window: null
} }
// Idle Inhibitor
Process {
id: inhibitor
command: ["wayland-idle-inhibitor"]
}
// Idle Inhibit on Pipewire
readonly property string pipewireInhibitorService: "wayland-pipewire-idle-inhibit.service"
Timer { Timer {
id: pipewireInhibitorTimer
running: true running: true
repeat: 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]
} }
} }