Skip to content

Commit 70c5e48

Browse files
authored
Revise README with installation and usage updates
Updated installation instructions and usage details for the xonsh Flatpak package. Added information about the 'host' alias and symlinks for popular commands.
1 parent 793e38d commit 70c5e48

1 file changed

Lines changed: 23 additions & 61 deletions

File tree

README.md

Lines changed: 23 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,48 @@
22

33
Flatpak package for [xonsh](https://xon.sh/).
44

5-
## Build and Run
6-
7-
```bash
8-
sudo apt-get install -y flatpak flatpak-builder
9-
pip install .
10-
xonsh build.xsh
11-
5+
## Install and Run
6+
```xsh
7+
# Install flatpak e.g. `sudo apt-get install -y flatpak`
8+
# Download xonsh flatpak
9+
wget https://github.com/xonsh/xonsh-flatpak/releases/latest/download/xonsh.flatpak
1210
flatpak install --user xonsh.flatpak
1311
flatpak run io.github.xonsh.xonsh
1412
```
1513

16-
## Build Options
14+
## Usage
1715

18-
```bash
19-
# Default: xonsh/xonsh @ main
20-
xonsh build.xsh
21-
22-
# Custom repo and branch
23-
xonsh build.xsh --git-url https://github.com/anki-code/xonsh/tree/anki_new_start
24-
```
25-
26-
The `--git-url` flag accepts GitHub, GitLab, Codeberg URLs with branch in the path,
27-
SSH URLs (`git@github.com:owner/repo.git`), or shorthand (`owner/repo`).
28-
29-
## Host Command Forwarding
16+
### `host` alias
3017

3118
The Freedesktop runtime includes ~728 standard Unix commands (`ls`, `cat`,
3219
`grep`, `curl`, etc.), but system-specific tools like `git`, `docker`, `ssh`
3320
are not available inside the Flatpak sandbox.
3421

35-
### How it works
36-
37-
```
38-
User types "git status"
39-
→ xonsh finds /app/libexec/host-cmds/git (symlink → host-spawn)
40-
→ host-spawn runs: flatpak-spawn --host --env=TERM=... git status
41-
→ flatpak-spawn executes "git status" on the host system
42-
→ output flows back to xonsh inside the sandbox
43-
```
44-
45-
**`host-spawn`** is a single 2-line shell script:
22+
To solve this we have `host` alias in xonsh RC `flatpak.xsh`. It executes
23+
the command on the host system e.g.
4624

47-
```sh
48-
#!/bin/sh
49-
exec flatpak-spawn --host --env=TERM="${TERM:-xterm-256color}" "$(basename "$0")" "$@"
25+
```xsh
26+
host git status # `flatpak-spawn --host git status`
5027
```
5128

52-
It uses `basename "$0"` to determine which command to run — so the same script
53-
works for every command via symlinks. `$TERM` is forwarded so that ncurses
54-
applications (`htop`, `vim`, `nano`, etc.) work correctly on the host.
55-
56-
During the Flatpak build, symlinks are created for common host commands:
29+
### Symlinks to popular tools
5730

58-
```
59-
/app/libexec/host-cmds/git → /app/libexec/host-spawn
60-
/app/libexec/host-cmds/* → /app/libexec/host-spawn
61-
```
31+
In `io.github.xonsh.xonsh.yml` we have a list of popular commands
32+
(`git`, `docker`, `ssh`, `vim`, `htop`, etc). During the Flatpak build,
33+
symlinks are created for popular host commands e.g.
34+
`/app/libexec/host-cmds/git` will be the symlink to `/app/libexec/host-spawn`.
6235

63-
The directory `/app/libexec/host-cmds` is **appended** to `$PATH` (not
64-
prepended), so sandbox binaries in `/app/bin` and `/usr/bin` always take
65-
priority over host-forwarded ones.
36+
The directory `/app/libexec/host-cmds` is appended to `$PATH` with low priority.
6637

67-
### Pre-configured commands
6838

69-
`git`, `docker`, `ssh`, `vim`, `htop`, and many more (~45 total).
70-
To see the full list or add more, edit the `for cmd in ...` loop in
71-
`io.github.xonsh.xonsh.yml`.
72-
73-
### Running other host commands
74-
75-
For commands without a symlink, use `flatpak-spawn` directly:
39+
## Build
7640

7741
```bash
78-
flatpak-spawn --host mycommand --flag
79-
```
80-
81-
Or copy `flatpak-xonshrc.py` to `~/.config/xonsh/rc.d/` for the `host` alias:
82-
83-
```xonsh
84-
host mycommand --flag
42+
sudo apt-get install -y flatpak flatpak-builder
43+
pip install .
44+
xonsh build.xsh # or with GitHub/GitLab/Codeberg URL: `--git-url https://github.com/xonsh/xonsh/tree/another_branch_name`
45+
flatpak install --user xonsh.flatpak
46+
flatpak run io.github.xonsh.xonsh
8547
```
8648

8749
## Links

0 commit comments

Comments
 (0)