Skip to content

omamobile-shell: foot puts a selection on the clipboard too - #895

Open
Somnius wants to merge 3 commits into
derekross:mainfrom
Somnius:foot-selection-clipboard
Open

Somnius wants to merge 3 commits into
derekross:mainfrom
Somnius:foot-selection-clipboard

Conversation

@Somnius

@Somnius Somnius commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

On my 8 Pro I couldn't get text out of foot. A touch selection works (hold still for a moment, then drag), and so does search mode (Ctrl+Shift+R, then Enter), but both only fill the primary selection, foot's default selection-target=primary. On a phone there's no middle click to paste that, so Ctrl+Shift+V and other apps had nothing. With selection-target=both in foot.ini, search + Enter put the text on the clipboard and another paste got it.

A touch selection on the phone (the grey band is the selection):

touch select

So omamobile-setup-user now adds selection-target=both to [main] in the user's foot.ini, once (omamobile-foot-selection), next to the existing foot touch step. It leaves the file alone when it already sets selection-target (with or without spaces around =), puts a [main] on top when the file has none (keys above the first section are [main] to foot anyway), follows a symlink instead of replacing it, and a user set up by hand with --adopt keeps their foot.ini as it is.

One thing I didn't put in: the selection is hard to see with the theme colours, it's #383838 on #222222 in mine, which is probably why I first thought touch select didn't work at all. An override in foot.ini fixed it for me, but it would win over every theme, so that's a theme question and not for setup-user.

Testing: test/setup-user.sh passes with new cases for an existing selection-target (two spellings) and a foot.ini without [main], and omamobile-shell's test/all passes. The setting itself I tried on the phone by hand; the setup-user step hasn't run on a phone yet. No version bump here, since #894 takes 0.2.134; I'll set it after whichever lands first.

…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.

@derekross derekross left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Lef. This is a real gap and a tidy fix. Omarchy's foot.ini sets primary-paste=none and a phone has no middle click, so a selection in the terminal had nowhere to go. I ran the new step by hand on scratch homes with Omarchy 4.5's own foot.ini: the line lands right under [main], once; a symlinked file stays a link in both branches; and with a read-only file and no [main] nothing is written and the marker is taken back, as your last commit says.

Three things before I merge it:

  1. The screenshot. docs/screenshots/foot/touch-select.png isn't used by any document, so it is evidence for the review rather than part of the docs, and a squash would keep its 279 kB for good. Please take it out of the branch and attach it to the pull request instead (drag it into the description).

  2. One login on your 8 Pro with the package built from this branch. The setting you tried by hand; the step hasn't run. Please post pacman -Q omamobile-shell foot, uname -r, that ~/.local/state/omarchy/done/omamobile-foot-selection exists, grep -n -A1 '^\[main\]' ~/.config/foot/foot.ini, systemctl --user status omamobile-setup-user, and that a touch selection in a newly opened terminal pastes into another app.

  3. The version. You were right to leave it: seven open pull requests claim 0.2.134. I'll push the number to your branch when I merge.

One smaller thing, as you like: your last commit makes a failed write in the no-[main] branch leave the step for the next login, but the other two writes don't get that. If sed -i can't write (I tried a read-only directory), or mktemp fails, the script ends there with the marker set, so the step never runs again and the later steps are skipped for that login. The older steps around it behave the same, so I won't hold the PR for it; an if ! sed …; then rm -f the marker of the same shape would make the commit message true for all three.

On the colour of the selection: agreed that it is the theme's business and not this script's.

@Somnius
Somnius force-pushed the foot-selection-clipboard branch from cd55700 to 3078176 Compare November 18, 2026 18:50
@Somnius

Somnius commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@derekross thanks, and thanks for running it on scratch homes.

Fixed on the branch:

  • the screenshot is out of the history, no commit adds it anymore. The image in the description still points at the old commit so it keeps showing
  • the sed -i in the [main] branch and the mktemp now also take the marker back when they fail, same shape as the no-[main] branch. There's a test for it with a read-only foot dir, with and without [main]: foot.ini stays as it was, no temp file is left, the marker is gone and the login goes on

The shell's test/all passes. The login on my 8 Pro with the package from this branch comes next, I'll post the outputs you listed here.

@Somnius

Somnius commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@derekross the run from the package, on my 8 Pro:

omamobile-shell 0.2.133-1   (built from this branch, 3078176, with tools/phone-install-package)
foot 1.28.0-2
7.3.0-rc6-omamobile-push1-g0124dfcad569
~/.local/state/omarchy/done/omamobile-foot-selection   21:26
1:[main]
2-selection-target=both
omamobile-setup-user.service: inactive (dead) since 21:26:53, ExecStart=/usr/bin/omamobile-setup-user (code=exited, status=0/SUCCESS)

Before the run I took out the selection-target=both line I had added by hand, so the step itself had to add it. One thing I noticed: a log out and back in didn't run the step, because the user manager kept running, so the service didn't start again. A reboot did. The other setup-user steps work the same way, so this isn't new.

Then in a newly opened foot I ran echo hello-from-foot and selected ello-from-foo by touch (hold, then drag, leaving off the first and last letter on purpose). Ctrl+V in Omawrite pasted ello-from-foo, and wl-paste reads the same. A long-press and Paste in Omawrite didn't paste. I haven't looked into why, and it's outside this change, since the clipboard holds the text either way.

The screenshot is out of the branch; I'll drag it into the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants