Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion packages/omamobile-shell/bin/omamobile-setup-user
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set -euo pipefail
# step the user does want can be had by removing its marker from
# ~/.local/state/omarchy/done/ before the next login.
if [[ ${1:-} == --adopt ]]; then
adopt=" omamobile-shell-profile omamobile-monitor-scale omamobile-hide-cursor omamobile-osk omamobile-screensaver omamobile-files-single-tap "
adopt=" omamobile-shell-profile omamobile-monitor-scale omamobile-hide-cursor omamobile-osk omamobile-screensaver omamobile-files-single-tap omamobile-foot-selection "
omarchy-done() {
if [[ $1 == ensure && $adopt == *" $2 "* ]]; then
command omarchy-done check "$2" 2>/dev/null || { command omarchy-done mark "$2"; echo "omamobile-setup-user: adopted $2 (marked done, not run)"; }
Expand Down Expand Up @@ -447,6 +447,35 @@ if [[ -f $foot ]] && omarchy-done ensure omamobile-foot-touch; then
fi
fi

# A selection in foot goes to the clipboard too, not only the primary
# selection: on a phone there's no middle click to paste the primary, so a
# touch selection (hold, then drag) or a search + Enter (Ctrl+Shift+R) had
# nothing to paste with Ctrl+Shift+V or another app's paste. Once, and only
# when foot.ini doesn't set selection-target itself.
if [[ -f $foot ]] && omarchy-done ensure omamobile-foot-selection; then
if ! grep -Ec '^[[:space:]]*selection-target[[:space:]]*=' "$foot" >/dev/null; then
main='^\[main\][[:space:]]*(#.*)?$'
if grep -Ec "$main" "$foot" >/dev/null; then
# sed -i writes a temp file next to foot.ini; if it can't, the step runs again next login
if ! sed -i --follow-symlinks -E "0,/$main/s//&\nselection-target=both/" "$foot"; then
rm -f "$HOME/.local/state/omarchy/done/omamobile-foot-selection"
fi
else
# Keys above the first section are foot's [main], so a [main] on top changes nothing else
# Through a temp file, written back in place so a symlinked foot.ini stays a link; a failed
# write leaves the step for the next login instead of a cut file
tmp=
if tmp=$(mktemp "${foot%/*}/.foot.ini.XXXXXX") \
&& { printf '[main]\nselection-target=both\n\n'; cat "$foot"; } >"$tmp" && cat "$tmp" >"$foot"; then
rm -f "$tmp"
else
[[ -z $tmp ]] || rm -f "$tmp"
rm -f "$HOME/.local/state/omarchy/done/omamobile-foot-selection"
fi
fi
fi
fi

# Hermes is the one agent in Omarchy's Setup > Default Agent with no aarch64
# build (hermes-desktop isn't in the aarch64 repository): hide it there and
# under Install > AI, through the menu extension file. Once.
Expand Down
32 changes: 31 additions & 1 deletion packages/omamobile-shell/test/setup-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ grep -cx 'pad=6x6' "$foot" >/dev/null && ! grep -c '^pad=14x14' "$foot" >/dev/nu
grep -cx 'multiplier=3.0' "$foot" >/dev/null || fail "foot's scrollback multiplier is 3"
[[ $(grep -c '^\[touch\]$' "$foot") == 1 && $(grep -cx 'long-press-delay=300' "$foot") == 1 ]] || fail "foot's [touch] long press is 300 ms, once"
grep -cx 'style=block' "$foot" >/dev/null || fail "the rest of foot.ini is kept"
[[ $(grep -cx 'selection-target=both' "$foot") == 1 ]] || fail "foot's selection goes to the clipboard too, once"
[[ $(sed -n '/^\[main\]$/{n;p;q}' "$foot") == selection-target=both ]] || fail "selection-target is in [main]"
# Chromium's input method flags (TOUCH-PLAN 3.1), once each
flags=$H/.config/chromium-flags.conf
for flag in --enable-wayland-ime --wayland-text-input-version=3 --force-device-scale-factor=0.83; do
Expand Down Expand Up @@ -223,7 +225,35 @@ printf '[main]\npad=10x10\n\n[scrollback]\nmultiplier=5.0\n\n[touch]\nlong-press
cp "$h/.config/foot/foot.ini" "$t/custom-foot.ini"
RUN_HOME=$h run
grep -cx 'local omarchy_gdk_scale = 2' "$h/.config/hypr/monitors.lua" >/dev/null || fail "GDK_SCALE stays with a user's own monitor scale"
cmp -s "$h/.config/foot/foot.ini" "$t/custom-foot.ini" || fail "a user's own foot values stay theirs"
grep -v '^selection-target=both$' "$h/.config/foot/foot.ini" | cmp -s - "$t/custom-foot.ini" || fail "a user's own foot values stay theirs"
# selection-target: an existing one (spaces allowed) is kept, a file without [main] gets one on top
for c in 'selection-target = primary' ' selection-target=primary'; do
hs=$t/home-sel; rm -rf "$hs"; mkdir -p "$hs/.config/hypr" "$hs/.config/omarchy" "$hs/.config/foot"
cp "$H"/.config/hypr/{looknfeel,autostart,monitors}.lua "$hs/.config/hypr/"; printf '[main]\n%s\n' "$c" >"$hs/.config/foot/foot.ini"
RUN_HOME=$hs run
[[ $(grep -c 'selection-target' "$hs/.config/foot/foot.ini") == 1 ]] || fail "an existing selection-target ($c) is kept alone"
done
hs=$t/home-sel; rm -rf "$hs"; mkdir -p "$hs/.config/hypr" "$hs/.config/omarchy" "$hs/.config/foot"
cp "$H"/.config/hypr/{looknfeel,autostart,monitors}.lua "$hs/.config/hypr/"; printf 'font=x:size=9\n\n[colors]\nalpha=1\n' >"$hs/.config/foot/foot.ini"
RUN_HOME=$hs run
[[ $(head -2 "$hs/.config/foot/foot.ini") == $'[main]\nselection-target=both' ]] && grep -cx 'font=x:size=9' "$hs/.config/foot/foot.ini" >/dev/null || fail "a foot.ini without [main] gets one on top and keeps its keys"

# A foot.ini in a read-only directory (sed -i and mktemp can't make their temp file), with
# and without [main]: nothing is written, the marker is taken back and the login goes on
if [[ $(id -u) != 0 ]]; then
for c in '[main]\nfont=x:size=9\n' 'font=x:size=9\n'; do
hs=$t/home-sel; chmod -R u+w "$hs" 2>/dev/null || true; rm -rf "$hs"
mkdir -p "$hs/.config/hypr" "$hs/.config/omarchy" "$hs/.config/foot" "$hs/.local/state/omarchy/done"
cp "$H"/.config/hypr/{looknfeel,autostart,monitors}.lua "$hs/.config/hypr/"; printf "$c" >"$hs/.config/foot/foot.ini"
: >"$hs/.local/state/omarchy/done/omamobile-screensaver"; : >"$hs/.local/state/omarchy/done/omamobile-foot-touch"
cp "$hs/.config/foot/foot.ini" "$t/ro-foot.ini"; chmod a-w "$hs/.config/foot"
RUN_HOME=$hs run || fail "a read-only foot directory doesn't stop the login ($c)"
chmod u+w "$hs/.config/foot"
cmp -s "$hs/.config/foot/foot.ini" "$t/ro-foot.ini" || fail "a failed foot write leaves foot.ini as it was ($c)"
[[ ! -e $hs/.local/state/omarchy/done/omamobile-foot-selection ]] || fail "a failed foot write leaves the step for the next login ($c)"
[[ -z $(find "$hs/.config/foot" -name '.foot.ini.*') ]] || fail "a failed foot write leaves no temp file ($c)"
done
fi
[[ -e $h/.local/state/omarchy/done/omamobile-foot-touch ]] || fail "the foot step runs once foot.ini is there"
[[ $(grep -cx -- --enable-wayland-ime "$h/.config/chromium-flags.conf") == 1 ]] || fail "a flag the user has isn't added twice"
grep -cx -- --wayland-text-input-version=3 "$h/.config/chromium-flags.conf" >/dev/null || fail "the missing flag is added"
Expand Down
2 changes: 1 addition & 1 deletion packages/omamobile-shell/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.136
0.2.137