Skip to content

Commit 064d6fd

Browse files
Kabuki94claude
andcommitted
feat(configurator): .desktop + launcher -- GNOME Dock / Activities + WSLg Start Menu
Two surfaces, one .desktop file: usr/share/applications/mios-configurator.desktop Standard freedesktop.org desktop entry. On a deployed bare-metal / Hyper-V / QEMU MiOS host this surfaces in the GNOME Dock + Activities + Application Grid. On a Windows-side MiOS-DEV podman backend, WSLg auto-publishes installed .desktop files into the Windows Start Menu under "<Distro> Apps" so the same icon shows up there too. One file, two operator surfaces. usr/libexec/mios/mios-configurator-launch The Exec= target. Stages a writable mios.toml seed at ~/Downloads/mios.toml (highest layer wins: per-user > host > vendor), copies the configurator HTML to ~/Downloads/mios-configurator.html (Flatpak home-portal exposes that path), and launches: 1. Epiphany flatpak (org.gnome.Epiphany) -- best File System Access API support; WSLg routes the window to the Windows desktop on MiOS-DEV 2. xdg-open -- whatever browser the deployed-host's GNOME has registered as default 3. Plain echo of the file:// URL -- last-resort surface (operator copy/pastes into a browser manually) .gitignore: whitelist /usr/share/applications/mios-*.desktop so the new entry is tracked. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0dafe49 commit 064d6fd

3 files changed

Lines changed: 91 additions & 0 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ usr/share/doc/*
184184
!/usr/share/doc/mios/**
185185
!/usr/share/mios/
186186
!/usr/share/mios/**
187+
# Desktop-entry .desktop files for the GNOME Dock / Activities (deployed
188+
# hosts) and the WSLg-published Windows Start Menu (MiOS-DEV). Only
189+
# MiOS-owned entries are tracked.
190+
!/usr/share/applications/
191+
usr/share/applications/*
192+
!/usr/share/applications/mios-*.desktop
187193
# AI runtime state (memory, knowledge graphs, scratch) belongs in
188194
# mios-bootstrap.git -- it is per-host and seeded into /var at first
189195
# boot. The OpenAI-API surface manifests in usr/share/mios/ai/v1/
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
# /usr/libexec/mios/mios-configurator-launch -- open the MiOS HTML
3+
# configurator in a sensible browser, with the layered mios.toml
4+
# pre-staged in ~/Downloads so File System Access API can bind to it
5+
# (or fall back to the standard <input type="file">).
6+
#
7+
# Targets, in order of preference:
8+
# 1. Epiphany flatpak (org.gnome.Epiphany) -- best FSA support;
9+
# WSLg routes the window to the Windows desktop.
10+
# 2. xdg-open -- whatever the host
11+
# desktop has set as default browser.
12+
# 3. Plain echo of the URL -- last resort if
13+
# nothing else is available.
14+
#
15+
# Invoked from:
16+
# - /usr/share/applications/mios-configurator.desktop (GNOME Dock /
17+
# Activities on deployed hosts; Windows Start Menu via WSLg on
18+
# MiOS-DEV)
19+
# - Windows-side `MiOS Configurator.lnk` Start Menu / Desktop
20+
# shortcuts (which call `wsl -d podman-MiOS-DEV --exec
21+
# /usr/libexec/mios/mios-configurator-launch`)
22+
set -euo pipefail
23+
24+
HTML=/usr/share/mios/configurator/index.html
25+
DL_DIR="${HOME}/Downloads"
26+
mkdir -p "$DL_DIR"
27+
28+
# Stage a writable mios.toml seed (highest layer wins).
29+
if [[ ! -f "$DL_DIR/mios.toml" ]]; then
30+
for src in "$HOME/.config/mios/mios.toml" /etc/mios/mios.toml /usr/share/mios/mios.toml; do
31+
if [[ -r "$src" ]]; then
32+
cp "$src" "$DL_DIR/mios.toml"
33+
chmod 0644 "$DL_DIR/mios.toml"
34+
break
35+
fi
36+
done
37+
fi
38+
39+
# Stage the HTML where Flatpak's home-portal exposes it.
40+
if [[ -r "$HTML" ]]; then
41+
cp "$HTML" "$DL_DIR/mios-configurator.html"
42+
fi
43+
44+
URL="file://$DL_DIR/mios-configurator.html"
45+
[[ ! -f "$DL_DIR/mios-configurator.html" ]] && URL="file://$HTML"
46+
47+
# Try Epiphany flatpak first.
48+
if flatpak list --app --columns=application 2>/dev/null | grep -qx org.gnome.Epiphany; then
49+
exec flatpak run --system org.gnome.Epiphany "$URL" >/dev/null 2>&1 &
50+
disown
51+
echo "MiOS Configurator opened in Epiphany: $URL"
52+
exit 0
53+
fi
54+
55+
# Fall back to xdg-open (delegates to whatever browser is registered).
56+
if command -v xdg-open >/dev/null 2>&1; then
57+
exec xdg-open "$URL" >/dev/null 2>&1 &
58+
disown
59+
echo "MiOS Configurator opened via xdg-open: $URL"
60+
exit 0
61+
fi
62+
63+
# Last resort: print the URL so the operator can copy/paste.
64+
echo "MiOS Configurator URL (no browser found):"
65+
echo " $URL"
66+
echo "Edit ~/Downloads/mios.toml and re-run mios-rebuild to apply."
67+
exit 0
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Version=1.0
4+
Name=MiOS Configurator
5+
GenericName=System Configuration Editor
6+
Comment=Edit /etc/mios/mios.toml — identity, AI, packages, flatpaks, desktop
7+
Exec=/usr/libexec/mios/mios-configurator-launch
8+
Icon=preferences-system
9+
Categories=System;Settings;PackageManager;
10+
Keywords=mios;configurator;system;settings;packages;flatpak;ai;
11+
Terminal=false
12+
StartupNotify=true
13+
StartupWMClass=org.gnome.Epiphany
14+
# WSLg auto-publishes this entry to the Windows Start Menu under
15+
# "<Distro> Apps" when MiOS-DEV is the source distro, so the same
16+
# .desktop file gives Linux GNOME Dock + Activities visibility on a
17+
# deployed MiOS host AND a Windows Start Menu entry on the Win-side
18+
# dev VM. One file, two surfaces.

0 commit comments

Comments
 (0)