Add upgrade safeguards, hardware setup, sign-in options and Taildrop from Omarchy
shellcheck / shellcheck (push) Failing after 19s
shellcheck / shellcheck (push) Failing after 19s
Adapted from Omarchy (github.com/omacom/omarchy) for Arch with GNOME: - A pacman hook stops a full upgrade run without update (pacman -Syu, yay -Syu), which would skip the snapshot and update's checks. update and install.sh set COREDESKTOP_ALLOW_PACMAN=1, which the hook finds on pacman or any process above it; you can set it too. - When the Arch upgrade stops on files no package owns, update lists them and asks to move them to /var/lib/coredesktop/replaced and try again, putting back what the retry didn't replace. When packages conflict, it runs pacman again so you can choose. - update and install keep the computer from sleeping until they finish. - system/hardware.sh (install, and a migration): the Wi-Fi country from the time zone, thermald and intel-lpmd on Intel laptops, and Wi-Fi 6 on Intel BE200/BE211 cards, whose driver gets Wi-Fi 7 wrong. - configure security-key and configure fingerprint: touch a FIDO2 key or a finger instead of typing your password for sudo and polkit, falling back to the password. Each shows only when the hardware is there. The fingerprint skips to the password with the lid shut. - webapp: put a website in the app grid as its own app window. - Taildrop: Files' Scripts > Send with Tailscale, and a user service that saves files sent here to Downloads, started when configure tailscale joins. - A NetworkManager dispatcher script pauses a Tailscale exit node while you sign in to a captive portal, and resumes it once online. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
common_setup
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
export XDG_DATA_DIRS="$BATS_TEST_TMPDIR/share"
|
||||
APPS="$XDG_DATA_HOME/applications"
|
||||
mkdir -p "$XDG_DATA_DIRS/applications"
|
||||
printf '[Desktop Entry]\nExec=test-chromium %%U\n' > "$XDG_DATA_DIRS/applications/helium.desktop"
|
||||
printf '[Desktop Entry]\nExec=/usr/lib/firefox/firefox %%u\n' > "$XDG_DATA_DIRS/applications/firefox.desktop"
|
||||
stub xdg-settings 'echo "${DEFAULT_BROWSER:-helium.desktop}"'
|
||||
export WEBAPP_BROWSERS="test-chromium"
|
||||
stub test-chromium
|
||||
stub xdg-open
|
||||
stub update-desktop-database
|
||||
stub gtk-update-icon-cache
|
||||
# No icon to be had
|
||||
stub curl 'exit 22'
|
||||
}
|
||||
|
||||
@test "webapp add makes a launcher that opens the site as an app" {
|
||||
run bash "$REPO/webapp" add "Nextcloud" https://nextcloud.example.com/apps/files
|
||||
[ "$status" -eq 0 ]
|
||||
local file="$APPS/webapp-nextcloud.desktop"
|
||||
grep -qx 'Name=Nextcloud' "$file"
|
||||
grep -qx "Exec=\"$HOME/.local/bin/webapp\" open \"https://nextcloud.example.com/apps/files\"" "$file"
|
||||
grep -qx 'StartupWMClass=chrome-nextcloud.example.com__apps_files-Default' "$file"
|
||||
grep -qx 'Icon=applications-internet' "$file"
|
||||
}
|
||||
|
||||
@test "webapp add quotes a URL's special characters for the launcher" {
|
||||
run bash "$REPO/webapp" add "Search" 'https://example.com/?q=a%20b&x=$y'
|
||||
[ "$status" -eq 0 ]
|
||||
grep -qxF 'Exec="'"$HOME"'/.local/bin/webapp" open "https://example.com/?q=a%%20b&x=\\$y"' "$APPS/webapp-search.desktop"
|
||||
}
|
||||
|
||||
@test "webapp add refuses addresses that aren't http(s)" {
|
||||
for url in "javascript:alert(1)" "file:///etc/passwd" "example.com" "https://a b"; do
|
||||
run bash "$REPO/webapp" add "Bad" "$url"
|
||||
[ "$status" -eq 1 ]
|
||||
done
|
||||
[ ! -e "$APPS/webapp-bad.desktop" ]
|
||||
}
|
||||
|
||||
@test "webapp add takes an icon from a file" {
|
||||
# A 1x1 PNG
|
||||
base64 -d > "$BATS_TEST_TMPDIR/icon.png" <<< \
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGNgYGD4DwABBAEAwS2OUAAAAABJRU5ErkJggg==
|
||||
run bash "$REPO/webapp" add "My App" https://app.example.com "$BATS_TEST_TMPDIR/icon.png"
|
||||
[ "$status" -eq 0 ]
|
||||
local icon="$XDG_DATA_HOME/icons/hicolor/256x256/apps/webapp-my-app.png"
|
||||
[ -f "$icon" ]
|
||||
grep -qx "Icon=$icon" "$APPS/webapp-my-app.desktop"
|
||||
}
|
||||
|
||||
@test "webapp list and remove handle only web apps" {
|
||||
bash "$REPO/webapp" add "Nextcloud" https://nextcloud.example.com
|
||||
printf '[Desktop Entry]\nName=Other\n' > "$APPS/webapp-other.desktop"
|
||||
run bash "$REPO/webapp" list
|
||||
[[ "$output" == "Nextcloud"*"https://nextcloud.example.com" ]]
|
||||
run bash "$REPO/webapp" remove Other
|
||||
[ "$status" -eq 1 ]
|
||||
[ -f "$APPS/webapp-other.desktop" ]
|
||||
run bash "$REPO/webapp" remove Nextcloud
|
||||
[ "$status" -eq 0 ]
|
||||
[ ! -e "$APPS/webapp-nextcloud.desktop" ]
|
||||
}
|
||||
|
||||
@test "webapp open uses the default browser when it's Chromium-based" {
|
||||
run bash "$REPO/webapp" open https://example.com
|
||||
[ "$status" -eq 0 ]
|
||||
called test-chromium --app=https://example.com
|
||||
}
|
||||
|
||||
@test "webapp open falls back to an installed Chromium-based browser" {
|
||||
DEFAULT_BROWSER=firefox.desktop run bash "$REPO/webapp" open https://example.com
|
||||
[ "$status" -eq 0 ]
|
||||
called test-chromium --app=https://example.com
|
||||
}
|
||||
|
||||
@test "webapp open uses the browser when there's no Chromium-based one" {
|
||||
rm "$STUB_BIN/test-chromium"
|
||||
DEFAULT_BROWSER=firefox.desktop run bash "$REPO/webapp" open https://example.com
|
||||
[ "$status" -eq 0 ]
|
||||
called xdg-open https://example.com
|
||||
}
|
||||
Reference in New Issue
Block a user