From 4f1ef8d95f02307280cafe341aaf500592459fcf Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 20 May 2026 14:03:56 +0200 Subject: [PATCH] Give services their own place --- migrations/1779277899.sh | 4 +++- shell/README.md | 3 +++ shell/plugins/README.md | 4 ++-- .../battery}/Service.qml | 2 +- .../battery}/manifest.json | 4 ++-- shell/plugins/{ => services}/idle/Service.qml | 0 .../plugins/{ => services}/idle/manifest.json | 2 +- shell/services/PluginRegistry.qml | 21 +++++++++++++------ 8 files changed, 27 insertions(+), 13 deletions(-) rename shell/plugins/{battery-monitor => services/battery}/Service.qml (97%) rename shell/plugins/{battery-monitor => services/battery}/manifest.json (76%) rename shell/plugins/{ => services}/idle/Service.qml (100%) rename shell/plugins/{ => services}/idle/manifest.json (91%) diff --git a/migrations/1779277899.sh b/migrations/1779277899.sh index 1aa494cb..5309ab11 100644 --- a/migrations/1779277899.sh +++ b/migrations/1779277899.sh @@ -1,4 +1,4 @@ -echo "Rename app launcher shell plugin to launcher" +echo "Rename shell plugins" config_files=( "$HOME/.config/hypr/bindings/utilities.lua" @@ -12,7 +12,9 @@ for config_file in "${config_files[@]}"; do if [[ -f $config_file ]]; then sed -i \ -e 's/omarchy\.app-launcher/omarchy.launcher/g' \ + -e 's/omarchy\.battery-monitor/omarchy.battery/g' \ -e 's/omarchy-app-launcher/omarchy-launcher/g' \ + -e 's/omarchy-battery-monitor/omarchy-battery/g' \ -e 's/\[app-launcher\]/[launcher]/g' \ -e 's/app-launcher\./launcher./g' \ "$config_file" diff --git a/shell/README.md b/shell/README.md index 09020e2d..f121370a 100644 --- a/shell/README.md +++ b/shell/README.md @@ -33,6 +33,9 @@ shell/ image-picker/ menu/ notifications/ + services/ + battery/ + idle/ osd/ polkit/ ``` diff --git a/shell/plugins/README.md b/shell/plugins/README.md index 3d7fdf35..c1bf80b9 100644 --- a/shell/plugins/README.md +++ b/shell/plugins/README.md @@ -19,8 +19,8 @@ User-installed plugins live alongside these conceptually but on disk under | Clipboard mgr | `omarchy.clipboard-picker`| `overlay` | `clipboard-picker/ClipboardPicker.qml`| | Omarchy menu | `omarchy.menu` | `menu` | `menu/Menu.qml` | | Notifications | `omarchy.notifications` | `service` | `notifications/Service.qml` | -| Battery mon. | `omarchy.battery-monitor` | `service` | `battery-monitor/Service.qml` | -| Idle monitor | `omarchy.idle` | `service` | `idle/Service.qml` | +| Battery | `omarchy.battery` | `service` | `services/battery/Service.qml` | +| Idle | `omarchy.idle` | `service` | `services/idle/Service.qml` | | Lock screen | `omarchy.lock` | `service` | `lock/Service.qml` | | OSD | `omarchy.osd` | `panel` | `osd/Osd.qml` | | Polkit agent | `omarchy.polkit` | `service` | `polkit/PolkitAgent.qml` | diff --git a/shell/plugins/battery-monitor/Service.qml b/shell/plugins/services/battery/Service.qml similarity index 97% rename from shell/plugins/battery-monitor/Service.qml rename to shell/plugins/services/battery/Service.qml index c0459800..26796882 100644 --- a/shell/plugins/battery-monitor/Service.qml +++ b/shell/plugins/services/battery/Service.qml @@ -13,7 +13,7 @@ Item { PersistentProperties { id: persisted - reloadableId: "omarchy-battery-monitor" + reloadableId: "omarchy-battery" property bool notifiedLowBattery: false } diff --git a/shell/plugins/battery-monitor/manifest.json b/shell/plugins/services/battery/manifest.json similarity index 76% rename from shell/plugins/battery-monitor/manifest.json rename to shell/plugins/services/battery/manifest.json index 69ac4a14..1dc2e731 100644 --- a/shell/plugins/battery-monitor/manifest.json +++ b/shell/plugins/services/battery/manifest.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, - "id": "omarchy.battery-monitor", - "name": "Battery Monitor", + "id": "omarchy.battery", + "name": "Battery", "version": "1.0.0", "author": "Omarchy", "description": "Low battery warning service", diff --git a/shell/plugins/idle/Service.qml b/shell/plugins/services/idle/Service.qml similarity index 100% rename from shell/plugins/idle/Service.qml rename to shell/plugins/services/idle/Service.qml diff --git a/shell/plugins/idle/manifest.json b/shell/plugins/services/idle/manifest.json similarity index 91% rename from shell/plugins/idle/manifest.json rename to shell/plugins/services/idle/manifest.json index 83ce7fac..65b777b3 100644 --- a/shell/plugins/idle/manifest.json +++ b/shell/plugins/services/idle/manifest.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "omarchy.idle", - "name": "Idle Monitor", + "name": "Idle", "version": "1.0.0", "author": "Omarchy", "description": "Quickshell-based idle detection for screensaver, lock, and display wake.", diff --git a/shell/services/PluginRegistry.qml b/shell/services/PluginRegistry.qml index 559424ff..a2bf5f7e 100644 --- a/shell/services/PluginRegistry.qml +++ b/shell/services/PluginRegistry.qml @@ -264,18 +264,27 @@ QtObject { if (scanning) return scanning = true // $0 = first-party dir, $1 = third-party dir. Some bash versions need the explicit -- separator. + // First-party plugins may be grouped one level deeper, e.g. services/battery. + // Third-party plugins stay at the top level of ~/.config/omarchy/plugins. var script = "" - + "scan() { local dir=\"$1\"; local kind=\"$2\"; " + + "emit_manifest() { local kind=\"$1\"; local manifest=\"$2\"; local sub=\"${manifest%/manifest.json}\"; " + + " printf '===%s::%s===\\n' \"$kind\" \"$sub\"; " + + " cat \"$manifest\"; " + + " printf '\\n=== EOM ===\\n'; " + + "}; " + + "scan_firstparty() { local dir=\"$1\"; " + + " [[ -d \"$dir\" ]] || return 0; " + + " while IFS= read -r manifest; do emit_manifest firstparty \"$manifest\"; done < <(find \"$dir\" -mindepth 2 -maxdepth 3 -name manifest.json -type f | sort); " + + "}; " + + "scan_thirdparty() { local dir=\"$1\"; " + " [[ -d \"$dir\" ]] || return 0; " + " for sub in \"$dir\"/*/; do " + " [[ -f \"$sub/manifest.json\" ]] || continue; " - + " printf '===%s::%s===\\n' \"$kind\" \"$sub\"; " - + " cat \"$sub/manifest.json\"; " - + " printf '\\n=== EOM ===\\n'; " + + " emit_manifest thirdparty \"$sub/manifest.json\"; " + " done; " + "}; " - + "scan \"$0\" firstparty; " - + "scan \"$1\" thirdparty" + + "scan_firstparty \"$0\"; " + + "scan_thirdparty \"$1\"" scanProcess.command = ["bash", "-c", script, registry.firstPartyDir, registry.pluginsDir] scanProcess.running = true }