Add startup application picker

This commit is contained in:
Gabriel Brown
2026-08-18 12:50:42 -04:00
parent ccf46c40ef
commit 1afa41526a
7 changed files with 203 additions and 15 deletions
@@ -33,6 +33,9 @@ done
assert_contains 'title: "Default applications"'
assert_contains 'title: "User autostart"'
assert_contains 'title: "Compositor autostart"'
assert_contains 'AutostartAppPicker {'
assert_contains 'DefaultApps.addAutostart('
assert_contains 'label: "Add an application"'
assert_contains 'categories'
assert_contains 'genericName'
assert_contains '.sort('
@@ -123,4 +126,14 @@ fi
[[ "$(rg --count 'activatable:' "$page")" -ge 2 ]] \
|| fail 'default and autostart rows are not both whole-row activatable'
picker="$project_root/config/dot/quickshell/modules/settings/AutostartAppPicker.qml"
qmldir="$project_root/config/dot/quickshell/modules/settings/qmldir"
[[ -f "$picker" ]] || fail 'autostart application picker is missing'
rg -Fq 'required property var existing' "$picker" \
|| fail 'autostart picker cannot exclude existing entries'
rg -Fq 'signal picked(string id)' "$picker" \
|| fail 'autostart picker does not emit a validated desktop id'
rg -q '^AutostartAppPicker 1\.0 AutostartAppPicker\.qml$' "$qmldir" \
|| fail 'autostart picker is not registered in the Settings module'
printf 'applications settings contract: PASS\n'
+24
View File
@@ -29,6 +29,7 @@ assert_service_contains 'property string lastError'
assert_service_contains 'function refresh(): void'
assert_service_contains 'function setDefault(role: string, desktopId: string): void'
assert_service_contains 'function setAutostart(desktopId: string, enabled: bool): void'
assert_service_contains 'function addAutostart(desktopId: string): void'
assert_service_contains 'DesktopEntries.applications.values'
if rg --quiet 'command\s*:\s*"' "$service"; then
fail 'Process command must be an argument array'
@@ -227,4 +228,27 @@ if $helper set-autostart 'hyprland:1' false >/dev/null 2>&1; then
fail 'read-only compositor entry was accepted for mutation'
fi
$helper add-autostart org.mozilla.firefox.desktop
firefox_autostart="$config_home/autostart/org.mozilla.firefox.desktop"
[[ -f "$firefox_autostart" && ! -L "$firefox_autostart" ]] \
|| fail 'adding an installed application did not create a regular user autostart entry'
rg --quiet '^Name=Firefox$' "$firefox_autostart" \
|| fail 'adding an application did not preserve its desktop entry'
rg --quiet '^Hidden=false$' "$firefox_autostart" \
|| fail 'a newly added application was not enabled'
[[ "$(rg --count '^Hidden=' "$firefox_autostart")" == "1" ]] \
|| fail 'adding an application wrote more than one Hidden key'
$helper set-autostart org.mozilla.firefox.desktop false
$helper add-autostart org.mozilla.firefox.desktop
rg --quiet '^Hidden=false$' "$firefox_autostart" \
|| fail 'adding an existing disabled application did not re-enable it'
if $helper add-autostart org.example.Missing.desktop >/dev/null 2>&1; then
fail 'an undiscovered application was accepted for autostart'
fi
if $helper add-autostart ../escape.desktop >/dev/null 2>&1; then
fail 'an unsafe desktop id was accepted for autostart'
fi
printf 'default apps contract: PASS\n'