27 lines
711 B
QML
27 lines
711 B
QML
import QtQuick
|
|
import Quickshell.Io
|
|
import "." as M
|
|
|
|
M.BarIcon {
|
|
id: root
|
|
color: root.active ? (parent?.accentColor ?? M.Theme.base05) : M.Theme.base04
|
|
tooltip: "Idle inhibition: " + (root.active ? "active" : "inactive")
|
|
|
|
property bool active: false
|
|
|
|
icon: root.active ? "\uF06E" : "\uF070"
|
|
|
|
Process {
|
|
id: toggle
|
|
command: ["sh", "-c", root.active ? "pkill -x systemd-inhibit || true" : "systemd-inhibit --what=idle --who=nova-shell --why=user sleep infinity &"]
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: {
|
|
root.active = !root.active;
|
|
toggle.running = true;
|
|
}
|
|
}
|
|
}
|