Skip to content

Rolv-Apneseth/rgd

Repository files navigation

rgd

Installed game detection utility for Linux. Built to be simple and scriptable.

License: AGPL v3 version Crates.io Version AUR version

rgd demo

Can you tell I'm not a graphic designer?

About

This utility is a CLI front-end for lib_game_detector. It is intended to be used in scripts, especially with picker programs (e.g. rofi, dmenu, fzf, etc.) in order to launch games, or perform some other action with the game's details.

Why

I find that searching for games from different sources (e.g. Steam, Heroic, Lutris) is slow, as is just visually searching through a UI. However, detecting games with this tool is fast (~3ms on my machine™), as is searching through those games using fuzzy search. This allows me to waste less time looking for what game I want to play, and more time actually playing.

This program in particular is made as a more basic alternative to another project of mine, rofi-games, making it more universally useful. It is very scriptable and can be used with any picker. Check out the extras directory for some examples.

Name

Simply named for the short acronym that isn't used by anything else I'm familiar with: Rolv's Game Detector.

Installation

Cargo
cargo install rgd --locked

Or, directly from source:

cargo install --git https://github.com/rolv-apneseth/rgd --locked
AUR
paru -S rgd
Manual
  1. Download the tarball corresponding to your computer's architecture (probably x86_64) from the releases page

  2. Unpack the tarball, e.g.:

    tar -xf rgd-x86_64-unknown-linux-gnu.tar.gz
  3. Place the rgd binary in your $PATH

Usage

CLI demo GIF

List the titles and launch commands of all detected games

rgd list

List all detected games, showing only their titles

rgd list --fields="title"

List all detected games from Steam, along with the paths to their icons

rgd list --fields="title,path-icon" --source "steam"

List details for all detected games as prettified JSON

rgd list --json | jq

Launch a game selected through fzf

sh -c "$(rgd list | fzf -d $'\t' --with-nth 1 | cut -d$'\t' -f2)"

Open the root directory for a game with a given title

rgd get --fields="path-game-dir" "the finals" | xdg-open

Note: the matching is case-insensitive

Additional information

  • Logs are written to $XDG_STATE_HOME/rgd/logs
  • Log level can be changed using the RUST_LOG env var, e.g. RUST_LOG="trace"

Picker Examples

Examples of basic setups to launch games with different picker programs. You can find more useful scripts in the extras directory - treat the below as a quickstart.

dmenu
sh -c "$(rgd list --fields="title" | dmenu -i | rgd get --fields="launch-command")"
fzf
sh -c "$(rgd list | fzf -d $'\t' --with-nth 1 | cut -d$'\t' -f2)"
rofi
sh -c "$(rgd list | rofi -dmenu -display-columns 1 -i | cut -d$'\t' -f2)"
fuzzel
sh -c "$(rgd list | fuzzel --dmenu --counter --with-nth 1 | cut -d$'\t' -f2)"
wofi
sh -c "$(rgd list | wofi -i --dmenu --pre-display-cmd="echo \"text:%s:\" | cut -f1" | cut -f2)"
bemenu
sh -c "$(rgd list --fields="title" | bemenu --list 10 --ignorecase | rgd get --fields="launch-command")"
tofi
sh -c "$(rgd list --fields="title" | tofi | rgd get --fields="launch-command")"
yofi
sh -c "$(rgd list --fields="title" | yofi dialog | rgd get --fields="launch-command")"

Contributing

All contributions are welcome. If you run into any problems, or have any suggestions/feedback, feel free to open an issue.

Note, however, that for e.g. support for additional launchers/sources, or game(s) not being detected, lib_game_detector is the correct place to open an issue.

Building

This project is written in Rust, so for contributing features / fixes:

  1. Ensure rustup is installed - this project uses the stable toolchain for most things, but nightly for the formatting.

  2. Make your changes and ensure they work as expected - cargo run -- your_args_here.

  3. Lint + format + run tests:

    cargo clippy --all -- -W clippy::all && cargo +nightly fmt && cargo test

I like just, so I keep some utility commands in the justfile. Check that out for additional checks which are run in the CI.

Similar programs

  • rofi-games: if you use rofi, it's worth checking out. Additional features include sorting based on access and a full configuration file for modifying detected games, or adding fully custom entries to the list.

Acknowledgements

License

This code is licensed under the AGPLv3.

See the LICENSE file for more details.