omarchy-config/README.md

340 lines
13 KiB
Markdown

# omarchy-config
<table>
<tr>
<td width="40%" align="center">
<h3>omarchy-config</h3>
<p>Post-installation setup notes and helper scripts for an Omarchy 4 (Arch Linux + Hyprland) desktop.</p>
</td>
<td width="60%">
## Table of Contents
- [Overview](#overview)
- [Configurator](#configurator)
- [Default browser](#default-browser)
- [NVIDIA](#nvidia)
- [Steam](#steam)
- [Hyprland](#hyprland)
- [Monitors](#monitors)
- [Starship prompt](#starship-prompt)
- [Repository layout](#repository-layout)
- [How this repo was written](#how-this-repo-was-written)
- [License](#license)
</td>
</tr>
</table>
## Overview
A reproducible record of the steps and tweaks used to bring a fresh
[Omarchy](https://omarchy.org/) 4 "Quattro" install (Arch Linux + Hyprland) to
a working daily-driver state: trimming bundled apps and web apps, installing
desktop and developer tools (including a Rust + Python toolchain), configuring the browser, NVIDIA power
management, Steam, multi-monitor output, and the shell prompt.
Omarchy 4 configures Hyprland in Lua (`~/.config/hypr/*.lua`), so the snippets
below use the `hl.*` API rather than the old `hyprland.conf` syntax.
> Commands below are recorded as run on the author's machine. Verify package
> names and paths against your own hardware before applying.
Quick start:
```bash
./config_installer.sh --dry-run # preview: changes nothing
./config_installer.sh # step 1: remove, step 2: add
```
## Configurator
`config_installer.sh` runs two steps. Each one asks first, so either can be
skipped, and every item can be ticked or unticked in a menu. Re-running is
safe: anything already in the desired state is left alone.
### Step 1 — Remove
Omarchy 4 preinstalls web apps (Basecamp, Discord, Google Contacts / Maps /
Messages / Photos, HEY, WhatsApp, X, YouTube, Zoom) and desktop apps (Aether,
cliamp, Omacalc, Omacut, Omawrite, Pinta, …). To drop all of them at once,
Omarchy provides `omarchy-remove-preinstalls`. Step 1 lets you pick:
- installed packages from the `REMOVABLE_PACKAGES` list at the top of the
script (uncomment entries to offer more), plus every installed web app
launcher — including ones you created yourself. Nothing is preselected;
- packages are removed with `pacman -Rns`, web apps with `omarchy-webapp-remove`;
- it offers to disable the default shortcuts that launch removed items by
appending `hl.unbind("…")` lines to `~/.config/hypr/bindings.lua` (a backup
is made first). Omarchy's defaults live in
`/usr/share/omarchy/default/hypr/bindings/applications.lua` and must not be
edited directly.
Adapted from [omarchy-cleaner](https://github.com/maxart/omarchy-cleaner).
> Web apps open in Chromium unless the default browser is Chromium-based
> (Chrome, Brave, Edge, Vivaldi, Opera, Helium). Removing `chromium` while
> keeping web apps leaves them unable to launch — the script warns about this.
### Step 2 — Add
Everything is preselected; untick what you do not want. The list lives in the
`CATALOGUE` array at the top of the script.
| Group | Item | Installed via |
| --- | --- | --- |
| Desktop | [LibreWolf](https://librewolf.net/) | AUR `librewolf-bin` (binary, much faster than building `librewolf`) |
| System | [herdr](https://github.com/herdrdev/herdr) (terminal workspace for AI agents), [caligula](https://github.com/ifd3f/caligula) (disk image writer) | pacman |
| Dev CLI | [just](https://just.systems/), [uv](https://docs.astral.sh/uv/), [ty](https://docs.astral.sh/ty/), [jj](https://jj-vcs.github.io/jj/), [pi](https://github.com/earendil-works/pi) coding agent, [hunk](https://github.com/modem-dev/hunk) diff viewer | `mise use -g` |
| Rust + Python | [rustup](https://rustup.rs/) + `rust-analyzer`, `clippy`, `rustfmt` | pacman, then `rustup` |
| Rust + Python | [maturin](https://www.maturin.rs/) | `uv tool install` |
| Rust + Python | `cmake`, `pkgconf` (for `-sys` crates such as `rust-htslib`) | pacman |
| Profiling | `cargo-binstall`, `perf` | pacman |
| Profiling | [py-spy](https://github.com/benfred/py-spy) (`py-spy record --native` shows Rust frames) | `uv tool install` |
Why these sources:
- **mise for dev CLIs** — upstream's prebuilt binaries on release day,
per-project pinning via `mise.toml`, no sudo, and it is how Omarchy already
ships its AI/dev CLIs. Update with `mise up`. ty is still beta (0.0.x), so
release-day updates matter most there. Omarchy's lazy `~/.local/bin/pi` and
`~/.local/bin/hunk` stubs use the same backends and keep working.
- **pacman for system tools** — updated by `omarchy-update`.
- **No `cargo install`** — just, uv, ty and jj ship prebuilt binaries;
compiling them needs the Rust toolchain and gets no automatic updates.
- **rustup instead of Arch's `rust`** — per-project `rust-toolchain.toml`,
nightly for `miri`, extra targets for manylinux/musllinux wheels and
`llvm-tools` for PGO. Replacing the `rust` package is asked first.
- **uv for Python-side tools** — maturin and py-spy ship as wheels with the
binary inside. Manage Python versions with `uv python install`.
Before installing a mise tool, the script looks for other copies on `PATH`
(cargo installs, AUR `-git` packages such as `jujutsu-git`, npm globals,
standalone installers). If a copy is older than the version mise would install,
it offers to remove it so it cannot shadow the new one. Copies of unknown
origin are left alone.
### Summary
The run ends with a table:
| item | status | action verified |
| --- | --- | --- |
| tool or app name | `installed`, `removed` or `kept` | `yes` / `no` |
`kept` covers unselected items, items already in place, declined prompts and
failures. *Action verified* re-checks the result (package or command present,
or gone after removal); a failed action shows `kept` / `no`.
### Dry run
`--dry-run` walks both steps and prints every command it would run plus the
summary, changing nothing (*action verified* is always `no`). Without a
terminal it selects every item and answers every prompt with yes, so the full
path can be checked unattended:
```bash
./config_installer.sh --dry-run < /dev/null
```
## Default browser
LibreWolf is installed by [step 2](#step-2--add). Make it the default
browser — this is what the browser keybindings (`SUPER + SHIFT + B`,
`SUPER + SHIFT + RETURN`) and links opened from other apps use
(`omarchy-launch-browser` reads `xdg-settings` and explicitly ignores
`$BROWSER`). The Omarchy menu's *Setup > Defaults > Browser* does not list
LibreWolf, so set it directly. `xdg-settings` refuses to change anything while
`$BROWSER` is set ("$BROWSER is set and can't be changed with xdg-settings"),
so unset it for the command, as `omarchy-default-browser` does:
```bash
env -u BROWSER xdg-settings set default-web-browser librewolf.desktop
env -u BROWSER xdg-settings get default-web-browser # librewolf.desktop
```
Optionally, also export `BROWSER` for terminal tools that read it (e.g. `gh`).
Add the line once — appending blindly duplicates it on every run:
```bash
grep -qx 'export BROWSER=librewolf' ~/.config/uwsm/default ||
echo 'export BROWSER=librewolf' >> ~/.config/uwsm/default
```
### Allow AI websites
claude.ai and chatgpt.com can hang LibreWolf with its fingerprinting
protection's timer jitter enabled. In `about:config`, set
`privacy.resistFingerprinting.reduceTimerPrecision.jitter` to `false`.
The second match in `about:config`,
`services.sync.prefs.sync.privacy.resistFingerprinting.reduceTimerPrecision.jitter`,
only controls whether Firefox Sync copies the setting to other devices; it
does not affect the hang.
## NVIDIA
The Omarchy 4 installer already detects the GPU and installs the matching
driver (`nvidia-open-dkms` for GSP-capable cards, `nvidia-580xx-dkms`
otherwise), writes `options nvidia_drm modeset=1` to
`/etc/modprobe.d/nvidia.conf` on fresh installs (`nvidia-drm` and `nvidia_drm`
are equivalent to modprobe), loads the modules early via
`/etc/mkinitcpio.conf.d/nvidia.conf`, and sets the Hyprland NVIDIA environment
variables. The 32-bit libraries are added by the Steam installer below. What
remains is power management.
### Power management
This setup keeps the GPU **always on** (no runtime power-off), which avoids
wake-up glitches at the cost of battery life.
**Kernel command-line parameters (Limine).** `+=` appends to the current
kernel settings. Modesetting is already enabled through modprobe, so only
`pcie_aspm=off` is needed here:
```bash
sudo nvim /etc/default/limine
# add this line to the file:
KERNEL_CMDLINE[default]+="pcie_aspm=off"
```
**Driver options:**
```bash
sudo nvim /etc/modprobe.d/nvidia.conf
# keep the existing modeset line and add:
options nvidia NVreg_DynamicPowerManagement=0x00
```
`0x00` disables runtime D3 power-off, matching the always-on udev rule below
(`0x02` would let the GPU power off when idle, which the rule then blocks).
> Video memory across suspend: with the open kernel modules
> (`nvidia-open-dkms`) the driver preserves it automatically through kernel
> suspend notifiers (`NVreg_UseKernelSuspendNotifiers=1`; check with
> `grep UseKernelSuspendNotifiers /proc/driver/nvidia/params`). Only with the
> proprietary `nvidia-580xx-dkms` driver add
> `NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp` to
> the line above **and** enable the services it requires:
> `sudo systemctl enable nvidia-suspend nvidia-resume nvidia-hibernate`.
> See "Power Management" in `/usr/share/doc/nvidia/README`.
**Apply both changes.** With Limine, `mkinitcpio -P` alone does not update the
boot entries — `limine-update` regenerates the initramfs/UKI and the entries
from `/etc/default/limine`:
```bash
sudo limine-update
```
**Force the GPU always on** with a udev rule:
```bash
sudo nvim /etc/udev/rules.d/80-nvidia-pm.rules
```
Add this to the file:
```
# Keep NVIDIA GPU always on
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", ATTR{power/control}="on"
```
`0x030000` matches a GPU wired as a VGA controller; hybrid laptops where the
NVIDIA GPU is a "3D controller" need `0x030200` (check with `lspci -nn | grep -i nvidia`).
**Make persistence mode permanent:**
```bash
sudo systemctl enable --now nvidia-persistenced
sudo reboot
```
## Steam
Omarchy runs Wayland with the Hyprland tiling compositor. X11 apps run
through Xwayland rather than as native Wayland windows, so games may need X11
forced explicitly (see the launch option below). Install Steam with
Omarchy's installer (also *Install > Gaming > Steam* in the Omarchy menu),
which adds the 32-bit graphics drivers for the detected GPU, plus `gamescope`:
```bash
omarchy-install-gaming-steam
omarchy-pkg-add gamescope
```
Run games with the launch option:
```
GDK_BACKEND=x11 SDL_VIDEODRIVER=x11 %command%
```
## Hyprland
Back up the existing config before editing:
```bash
cp ~/.config/hypr/hyprland.lua ~/.config/hypr/hyprland.lua.backup
```
Add the Steam scaling variable at the end of `hyprland.lua`. X11 is forced
per game by the Steam launch option above; setting `GDK_BACKEND` or
`SDL_VIDEODRIVER` here would push every GTK and SDL app through Xwayland and
override Omarchy's `GDK_BACKEND=wayland,x11,*` default:
```lua
hl.env("STEAM_FORCE_DESKTOPUI_SCALING", "1")
-- NVIDIA cursor lag fix (add only if you experience lag)
hl.config({ cursor = { no_hardware_cursors = true } })
```
## Monitors
Configure displays for optimal frame rate in `~/.config/hypr/monitors.lua`
(see the [Hyprland monitors guide](https://wiki.hypr.land/Configuring/Basics/Monitors/);
list outputs with `hyprctl monitors all`). Replace the default `GDK_SCALE` and
catch-all `hl.monitor` lines Omarchy wrote with:
```lua
hl.env("GDK_SCALE", "2")
-- Laptop screen (2560x1600 @ 240Hz, scaled 1.6x)
hl.monitor({ output = "eDP-2", mode = "2560x1600@240", position = "0x0", scale = 1.6 })
-- BenQ 4K external (3840x2160 @ 60Hz, no scaling, VRR enabled)
hl.monitor({ output = "DP-1", mode = "3840x2160@60", position = "1600x0", scale = 1, vrr = 1 })
-- Fallback for any other monitors
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = "auto" })
```
## Starship prompt
Omarchy ships its own Starship config; replace it with the bundled
[Starship](https://starship.rs/) config:
```bash
cp src/starship.toml ~/.config/
```
## Repository layout
```
config_installer.sh # step 1: remove preinstalled apps/web apps; step 2: add tools
src/
starship.toml # Starship shell-prompt config (copy to ~/.config/)
LICENSE # MIT
README.md # this guide
```
## How this repo was written
I always write the first draft myself. Some refinements, such as
refactoring, documentation and formatting, were done with LLMs using the
Octobot framework. I prefer to stay in charge: I keep my own judgement and
review every line the AI writes.
## License
omarchy-config is licensed under the MIT License. See [LICENSE](LICENSE).