Skip to content
svandichPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

ppu — Ping Pong URLs

ppu is a rule-based link/URI router for Linux. Set it as your default browser and it decides which actual browser (or app) opens each link, based on rules you define — e.g. work links in one Chrome profile, personal links in Firefox, and steam:// links in the Steam client itself.

How it works

  • ppu registers itself as a .desktop application handling x-scheme-handler/http, x-scheme-handler/https, and any other URI schemes you register (e.g. steam).
  • When something opens a link, the desktop environment invokes ppu <url>.
  • ppu reads its rule list (~/.config/ppu/config.toml), checks each enabled rule top-to-bottom, and launches the command from the first matching rule.
  • If no rule matches, it falls back to the configured default action.

Rules

Each rule is a glob pattern matched against the full URL/URI, plus a command to launch:

[default]
name = "Default browser"
command = "firefox"
args = ["%u"]

[[rules]]
name = "Steam links -> Steam app"
pattern = "steam://*"
command = "steam"
args = ["%u"]
enabled = true

[[rules]]
name = "YouTube -> Chrome"
pattern = "*youtube.com*"
command = "google-chrome-stable"
args = ["--profile-directory=Work", "%u"]
enabled = true
  • pattern supports *, ?, and [...] glob wildcards.
  • %u in args is replaced with the URL; if omitted, the URL is appended as the last argument.
  • Rules are evaluated in order — reorder them in the TUI to control priority.
  • Non-browser apps work the same way: point a rule's command at any executable (steam, discord, spotify, ...) and register its URI scheme with ppu register-scheme <scheme>.

Usage

ppu                       # opens the rule-editor TUI (same as `ppu edit`)
ppu edit                  # opens the rule-editor TUI (alias: `ppu gui`)
ppu <url>                 # dispatches a URL per the rules (used by the desktop file)
ppu register-scheme steam  # routes steam:// links through ppu's rules too
ppu export rules.toml      # exports the current rule set
ppu import rules.toml      # appends rules from a file to the current rule set
ppu import rules.toml -f   # replaces the current config entirely (--force)

An imported file can be a full config (what ppu export writes) or just a list of [[rules]] with no [default] section. --force replaces the whole config, so it needs the full form.

The TUI (ppu edit) lets you add/edit/reorder/delete rules, edit the default fallback action, import/export the rule file, and register additional URI schemes — all without hand-editing TOML. Press / to search rules by name, pattern, command, or args, then n/N to step through the matches; the full key list is along the bottom of the screen.

Install

From source (dev install, current user only)

./install.sh

uninstall.sh reverses it (--purge also deletes your saved rules).

Arch package

makepkg -si

Config location

~/.config/ppu/config.toml. A starter config is written there automatically the first time ppu runs.

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages