diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-18 17:04:57 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-18 17:04:57 +0100 |
| commit | e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc (patch) | |
| tree | fee3f3ced727f01c7bc630418a6e0b47d347df40 /desktop/modules/services/ServicesPage.qml | |
| parent | 44f947c642fe842fae80c7407399265aa47e9909 (diff) | |
| download | quickshell-e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc.tar.gz quickshell-e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc.zip | |
feat(services): one drawer page to start, stop and restart services
Running things is a runtime operation, so it belongs in the drawer, not
the settings window. The drawer's deck-it tile and keystone's Shells page
become one Services tile: every quickshell shell, deck-it, and the
desktop's long-running daemons (desktop-assistant, cal-notif, tv-mpris,
mail-watcher, mail-notify, hypridle, hyprsunset, the polkit agent,
notifyd, playerctld, conky and cliphist's watcher), each with Start,
Stop and Restart.
A daemon's start command is its enabled autostart.lua line, run through
hyprctl dispatch hl.dsp.exec_cmd as Autostart's Try does, so conky keeps
its workspace rule and no command is copied out of autostart.lua.
Services.js holds only the label, the piece of the line that finds it
and the pgrep/pkill arguments. Stop waits up to 5s for the process to
exit, which hyprsunset needs to free Hyprland's CTM manager. -f patterns
bracket a letter so pgrep and pkill never match the sh that runs them.
Checked: test_services.js; the pgrep list reports all twelve daemons
running; a playerctld restart through the same command came back under
a new pid. QML's JS engine has no Array.flatMap, hence the concat.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/services/ServicesPage.qml')
| -rw-r--r-- | desktop/modules/services/ServicesPage.qml | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/desktop/modules/services/ServicesPage.qml b/desktop/modules/services/ServicesPage.qml new file mode 100644 index 0000000..cc392db --- /dev/null +++ b/desktop/modules/services/ServicesPage.qml @@ -0,0 +1,92 @@ +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +import QtQuick +import "../.." +import "../ai" +import "../deckit" +import "../qtmaildir" + +// Shells, deck-it and the daemons, one row each: Start when stopped, Stop and +// Restart when running. The desktop shell has no Stop: it draws this page. +Column { + id: page + + required property var services + + spacing: 8 + + Component.onCompleted: { page.services.watchers++; DeckIt.watchers++; page.services.refresh(); } + Component.onDestruction: { page.services.watchers--; DeckIt.watchers--; } + + Heading { text: "Shells" } + + AiRow { + width: page.width + title: "All shells" + detail: "Restarts every one, this drawer included" + on: true + action: "Restart all" + onTriggered: page.services.restartShell("") + } + + Repeater { + model: page.services.shells + + AiRow { + required property var modelData + readonly property bool self: modelData.name === "desktop" + objectName: "shell:" + modelData.name + width: page.width + title: modelData.name + on: modelData.running + detail: (modelData.running ? "Running" : "Stopped") + (self ? " · hosts this drawer" : "") + action: !modelData.running ? "Start" : self ? "" : "Stop" + restartable: modelData.running + onTriggered: modelData.running ? page.services.stopShell(modelData.name) + : page.services.restartShell(modelData.name) + onRestart: page.services.restartShell(modelData.name) + } + } + + Heading { text: "deck-it" } + + AiRow { + width: page.width + title: "deck-it" + detail: ({ start: "Starting…", stop: "Stopping…", restart: "Restarting…" })[DeckIt.busy] ?? DeckIt.summary + on: DeckIt.running + busy: DeckIt.busy !== "" + action: DeckIt.busy ? "" : DeckIt.running ? "Stop" : "Start" + restartable: DeckIt.running && !DeckIt.busy + onTriggered: DeckIt.control(DeckIt.running ? "stop" : "start") + onRestart: DeckIt.control("restart") + } + + Heading { text: "Daemons" } + + Repeater { + model: page.services.daemons + + AiRow { + required property var modelData + objectName: "daemon:" + modelData.label + width: page.width + title: modelData.label + on: modelData.running + detail: modelData.running ? "Running" : modelData.start ? "Stopped" : "Stopped · not in autostart" + action: modelData.running ? "Stop" : modelData.start ? "Start" : "" + restartable: modelData.running && modelData.start !== "" + onTriggered: page.services.daemon(modelData, modelData.running ? "stop" : "start") + onRestart: page.services.daemon(modelData, "restart") + } + } +} |
