Files
Luxferre 09c1e2ad36 Backport WM/dmenu xerror & UTF-8 fixes, add wallpaper manager, and set Anodized default
- wm,dmenu: backport ANODE a92e196 fixes for xerror recursion guards, non-fatal RENDER error suppression, bounded getservertime() polling, pointer ungrab/AsyncBoth/GrabModeAsync grab safety, FC_COLOR=FcFalse substitution, and UTF-8 sanitization + Pango ellipsization in drw.c
- wallpaper: port native X11 + Cairo wallpaper engine (geminux-wallpaper.h, geminux-wallpaper-x11.h) with pure-C gdk-pixbuf/PNG/JPEG/WebP/magick decoding, Wallpaper tab + CLI in geminux-themes, geminux-apply-wallpaper helper, and session/theme/HDMI/launcher hooks
- theme: set Anodized as default theme in /etc/skel/.Xresources and compiled-in/script fallbacks across libgemui, dwm, dmenu, st, webarchy, geminux-sync-gtk-theme, and geminux-sync-dunst-theme
- verify: extend check-rebuild.sh and test-theme-dunst-sync.py, prune stale skel theme artifacts in apply-geminux-overlay.sh, and rebuild prebuilt binaries
2026-11-27 17:13:35 +02:00

91 lines
2.8 KiB
Bash
Executable File

#!/bin/sh
# Geminux application and quick-action launcher using Pango/HarfBuzz dmenu.
set -eu
LOCK_DIR="/tmp/geminux-launcher-${USER:-user}.lock"
if ! mkdir "$LOCK_DIR" 2>/dev/null; then
oldpid="$(cat "$LOCK_DIR/pid" 2>/dev/null || true)"
if [ -n "$oldpid" ] && kill -0 "$oldpid" 2>/dev/null; then
exit 0
fi
rm -rf "$LOCK_DIR"
mkdir "$LOCK_DIR" 2>/dev/null || exit 0
fi
printf '%s\n' "$$" > "$LOCK_DIR/pid"
trap 'rm -rf "$LOCK_DIR"' EXIT INT TERM HUP
if pidof dmenu >/dev/null 2>&1; then
exit 0
fi
LAUNCHER_LIST="
 Terminal|st
󰚩 Bantam AI agent|st -t 'Bantam AI agent' -e /bin/bash -lc 'exec bantam'
󰖟 Webarchy Browser|webarchy
󰖟 Lynx Web Browser|st -e sh -c 'exec lynx -cfg="$HOME/.lynx.cfg"'
 Dialer|geminux-dialer
󰍩 SMS Messages|geminux-sms
 Contacts|geminux-contacts
󰖩 Network & Radios|geminux-net
󰕾 Sound & Mixer|geminux-audio
 Camera|geminux-camera
 Control Center|geminux-control
󰥔 Date & Timezone|geminux-datetime
 Themes|geminux-themes
󰸉 Wallpaper|geminux-themes --wallpaper
 Lock Screen|geminux-lock
󰤄 Suspend Now|doas /usr/bin/geminux-power-ctl suspend
"
build_menu() {
printf '%s\n' "$LAUNCHER_LIST" | sed '/^[[:space:]]*$/d' | cut -d'|' -f1
for dir in /usr/share/applications /usr/local/share/applications "${HOME:-/home/user}/.local/share/applications"; do
[ -d "$dir" ] || continue
for df in "$dir"/*.desktop; do
[ -f "$df" ] || continue
grep -q '^NoDisplay=true' "$df" 2>/dev/null && continue
name="$(awk -F= '/^Name=/{print $2; exit}' "$df")"
[ -n "$name" ] && printf ' %s\n' "$name"
done
done | sort -u
if command -v dmenu_path >/dev/null 2>&1; then
dmenu_path
fi
}
choice="$(build_menu | awk '!seen[$0]++' | dmenu -f -i -p 'Geminux:')"
[ -n "$choice" ] || exit 0
pinned_cmd="$(printf '%s\n' "$LAUNCHER_LIST" | awk -F'|' -v sel="$choice" '$1 == sel {print $2; exit}')"
if [ -n "$pinned_cmd" ]; then
setsid sh -c "$pinned_cmd" >/dev/null 2>&1 </dev/null &
exit 0
fi
case "$choice" in
" "*)
app_name="${choice# }"
for dir in /usr/share/applications /usr/local/share/applications "${HOME:-/home/user}/.local/share/applications"; do
[ -d "$dir" ] || continue
for df in "$dir"/*.desktop; do
[ -f "$df" ] || continue
n="$(awk -F= '/^Name=/{print $2; exit}' "$df")"
if [ "$n" = "$app_name" ]; then
ex="$(awk -F= '/^Exec=/{print $2; exit}' "$df" | sed 's/ %[fFuUdDnNickvm]//g')"
if [ -n "$ex" ]; then
if grep -qi '^Terminal=true' "$df" 2>/dev/null; then
setsid st -e /bin/sh -c "$ex" >/dev/null 2>&1 </dev/null &
else
setsid sh -c "$ex" >/dev/null 2>&1 </dev/null &
fi
exit 0
fi
fi
done
done
;;
*)
setsid sh -c "$choice" >/dev/null 2>&1 </dev/null &
;;
esac