From 10eb8428a5ef757ef1fed72c1ae799e97c65d8fb Mon Sep 17 00:00:00 2001 From: Lef Date: Wed, 18 Nov 2026 18:14:43 +0200 Subject: [PATCH 1/4] shell: foot puts a selection on the clipboard too, once, unless foot.ini sets selection-target foot's selection-target defaults to primary. On a phone there's no middle click, so a touch selection or a search + Enter left nothing for Ctrl+Shift+V or another app to paste. Tried on the 8 Pro: with selection-target=both, search + Enter put the text on the clipboard. A user set up by hand (--adopt) keeps their foot.ini. --- .../omamobile-shell/bin/omamobile-setup-user | 20 ++++++++++++++++++- packages/omamobile-shell/test/setup-user.sh | 16 ++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index a8e0ba60a..2a872d65b 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -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)"; } @@ -447,6 +447,24 @@ 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 --follow-symlinks -E "0,/$main/s//&\nselection-target=both/" "$foot" + else + # Keys above the first section are foot's [main], so a [main] on top changes nothing else + { printf '[main]\nselection-target=both\n\n'; cat "$foot"; } >"$foot.omamobile-tmp" \ + && cat "$foot.omamobile-tmp" >"$foot"; rm -f "$foot.omamobile-tmp" + 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. diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index 5642ed59b..abe035b8b 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -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 @@ -223,7 +225,19 @@ 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" + [[ -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" From bc182adcc85766f3a192b4332c181e5d1739b49a Mon Sep 17 00:00:00 2001 From: Lef Date: Wed, 18 Nov 2026 18:35:22 +0200 Subject: [PATCH 2/4] shell: the foot step's rewrite without [main] goes through mktemp and runs again after a failed write --- packages/omamobile-shell/bin/omamobile-setup-user | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 2a872d65b..0b9bcf758 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -459,8 +459,14 @@ if [[ -f $foot ]] && omarchy-done ensure omamobile-foot-selection; then sed -i --follow-symlinks -E "0,/$main/s//&\nselection-target=both/" "$foot" else # Keys above the first section are foot's [main], so a [main] on top changes nothing else - { printf '[main]\nselection-target=both\n\n'; cat "$foot"; } >"$foot.omamobile-tmp" \ - && cat "$foot.omamobile-tmp" >"$foot"; rm -f "$foot.omamobile-tmp" + # 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=$(mktemp "${foot%/*}/.foot.ini.XXXXXX") + if { printf '[main]\nselection-target=both\n\n'; cat "$foot"; } >"$tmp" && cat "$tmp" >"$foot"; then + rm -f "$tmp" + else + rm -f "$tmp" "$HOME/.local/state/omarchy/done/omamobile-foot-selection" + fi fi fi fi From 3078176427c1a3f329014e14e650afd2026f4093 Mon Sep 17 00:00:00 2001 From: Lef Date: Wed, 18 Nov 2026 20:42:24 +0200 Subject: [PATCH 3/4] shell: the foot step's other two writes (sed -i with [main], mktemp) also run again after a failure --- .../omamobile-shell/bin/omamobile-setup-user | 13 +++++++++---- packages/omamobile-shell/test/setup-user.sh | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 0b9bcf758..90d7f7450 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -456,16 +456,21 @@ 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 --follow-symlinks -E "0,/$main/s//&\nselection-target=both/" "$foot" + # 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=$(mktemp "${foot%/*}/.foot.ini.XXXXXX") - if { printf '[main]\nselection-target=both\n\n'; cat "$foot"; } >"$tmp" && cat "$tmp" >"$foot"; then + 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 - rm -f "$tmp" "$HOME/.local/state/omarchy/done/omamobile-foot-selection" + [[ -z $tmp ]] || rm -f "$tmp" + rm -f "$HOME/.local/state/omarchy/done/omamobile-foot-selection" fi fi fi diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index abe035b8b..73913ab81 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -238,6 +238,22 @@ cp "$H"/.config/hypr/{looknfeel,autostart,monitors}.lua "$hs/.config/hypr/"; pri 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" From 9212cb8d96d72151d3fd55ba57b680e7968e63e9 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Fri, 20 Nov 2026 19:25:25 -0500 Subject: [PATCH 4/4] omamobile-shell 0.2.137: the version for the foot selection change main is 0.2.136 since #911; this takes the next number. Co-Authored-By: Claude Fable 5.2 --- packages/omamobile-shell/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index b99740362..058eafbc1 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.136 +0.2.137