mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
56
.config/quickshell/caelestia/services/IdleInhibitor.qml
Normal file
56
.config/quickshell/caelestia/services/IdleInhibitor.qml
Normal file
@@ -0,0 +1,56 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property alias enabled: props.enabled
|
||||
readonly property alias enabledSince: props.enabledSince
|
||||
|
||||
onEnabledChanged: {
|
||||
if (enabled)
|
||||
props.enabledSince = new Date();
|
||||
}
|
||||
|
||||
PersistentProperties {
|
||||
id: props
|
||||
|
||||
property bool enabled
|
||||
property date enabledSince
|
||||
|
||||
reloadableId: "idleInhibitor"
|
||||
}
|
||||
|
||||
IdleInhibitor {
|
||||
enabled: props.enabled
|
||||
window: PanelWindow {
|
||||
implicitWidth: 0
|
||||
implicitHeight: 0
|
||||
color: "transparent"
|
||||
mask: Region {}
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "idleInhibitor"
|
||||
|
||||
function isEnabled(): bool {
|
||||
return props.enabled;
|
||||
}
|
||||
|
||||
function toggle(): void {
|
||||
props.enabled = !props.enabled;
|
||||
}
|
||||
|
||||
function enable(): void {
|
||||
props.enabled = true;
|
||||
}
|
||||
|
||||
function disable(): void {
|
||||
props.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user