{"id":14235592,"url":"https://github.com/chmln/handlr","last_synced_at":"2025-04-04T16:13:16.541Z","repository":{"id":38838413,"uuid":"253335769","full_name":"chmln/handlr","owner":"chmln","description":"A better xdg-utils","archived":false,"fork":false,"pushed_at":"2023-04-30T07:25:01.000Z","size":320,"stargazers_count":630,"open_issues_count":35,"forks_count":24,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-14T13:50:43.054Z","etag":null,"topics":["cli","command-line","dmenu","linux","rofi","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chmln.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-04-05T21:29:39.000Z","updated_at":"2024-10-10T21:55:28.000Z","dependencies_parsed_at":"2024-02-01T17:48:00.710Z","dependency_job_id":null,"html_url":"https://github.com/chmln/handlr","commit_stats":{"total_commits":114,"total_committers":11,"mean_commits":"10.363636363636363","dds":"0.24561403508771928","last_synced_commit":"90e78ba92d0355cb523abf268858f3123fd81238"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmln%2Fhandlr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmln%2Fhandlr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmln%2Fhandlr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmln%2Fhandlr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chmln","download_url":"https://codeload.github.com/chmln/handlr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208139,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","dmenu","linux","rofi","rust"],"created_at":"2024-08-20T21:02:07.938Z","updated_at":"2025-04-04T16:13:16.524Z","avatar_url":"https://github.com/chmln.png","language":"Rust","readme":"\u003ch1 align=center\u003e \u003cimg src=\"https://user-images.githubusercontent.com/11352152/82113733-3f9c9800-9726-11ea-977d-a2f43e5d392e.png\" width=64 align=top /\u003e\u003cbr/\u003ehandlr\u003c/h1\u003e\n\nManage your default applications with ease using `handlr`!\n\n## Features\n\n- Set default handler by extension or mime-type\n- Intelligent mime type detection from files based on extension and content\n- Open multiple files at once\n- Set multiple handlers for mime/extension and use `rofi`/`dmenu` to pick one\n- Wildcard support like `text/*`\n- Automatically removes invalid/wrong `.desktop` entries from `mimeapps.list`\n- Helper commands like `launch`, `get --json` for your scripting needs\n- Unnecessarily fast (written in Rust)\n- Single compiled binary with no dependencies\n\n## Usage\n\n```sh\n# Open a file/URL\nhandlr open ~/.dotfiles/pacman/packages.txt\nhandlr open https://google.ca\n\n# Set default handler for png files\nhandlr set .png feh.desktop\n\n# Set wildcard handler for all text files\nhandlr set 'text/*' nvim.desktop\n\n# Set default handler based on mime\nhandlr set application/pdf evince.desktop\n\n# List default apps\nhandlr list\n\n# Get the handler for a mime/extension\n$ handlr get .png\nfeh.desktop\n\n# Launch a handler with given path/URL\nhandlr launch x-scheme-handler/https -- https://google.ca\n```\n\n## Compared to `xdg-utils`\n\n- Can open multiple files/URLs at once\n- Can have multiple handlers and use rofi/dmenu to pick one at runtime\n- Far easier to use with simple commands like `get`, `set`, `list`\n- Can operate on extensions, **no need to look up or remember mime types**\n  - useful for common tasks like setting a handler for png/docx/etc files\n- Superb autocomplete (currently fish, zsh and bash), including mimes, extensions, and `.desktop` files\n- Optional json output for scripting\n- Properly supports `Terminal=true` entries\n\n## Setting default terminal \n\nUnfortunately, there isn't an XDG spec and thus a standardized way for `handlr` to get your default terminal emulator to run `Terminal=true` desktop entries. There was a proposal floating around a few years ago to use `x-scheme-handler/terminal` for this purpose. It seems to me the least worst option, compared to handling quirks of N+1 distros or using a handlr-specific config option. \n\nNow if `x-scheme-handler/terminal` is present, `handlr` will use it. \n\nOtherwise, `handlr` will:\n1. Find an app with `TerminalEmulator` category\n2. Set it as the default for `x-scheme-handler/terminal`\n3. Send you a notification to let you know it guessed your terminal and provide instructions to change it if necessary\n\nOn the upside, `Terminal=true` entries will now work outside of interactive terminals, unlike `xdg-utils`.\n\n## Setting multiple handlers\n\n1) Open `~/.config/handlr/handlr.toml` and set `enable_selector = true`. Optionally, you can also tweak the `selector` to your selector command (using e.g. rofi or dmenu).\n\n2) Add a second/third/whatever handler using `handlr add`, for example\n```\nhandlr add x-scheme-handler/https firefox-developer-edition.desktop\n```\n\n3) Now in this example when you open a URL, you will be prompted to select the desired application.\n\n![](https://user-images.githubusercontent.com/11352152/85187445-c4bb2580-b26d-11ea-80a6-679e494ab062.png)\n\n## Screenshots\n\n\u003ctable\u003e\u003ctr\u003e\u003ctd\u003e\n\u003cimg src=https://user-images.githubusercontent.com/11352152/82159698-2434a880-985e-11ea-95c7-a07694ea9691.png width=500\u003e\n\u003c/td\u003e\u003ctd\u003e\n\u003cimg width=450 src=https://user-images.githubusercontent.com/11352152/82159699-2434a880-985e-11ea-9493-c21773093c38.png\u003e\n\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n## Installation\n\n### Arch Linux\n\n```sh\nyay -S handlr-bin\n```\n\nOptionally you can also install `xdg-utils-handlr` to replace `xdg-open`:\n\n```sh\nyay -S xdg-utils-handlr\n```\n\n### Rust/Cargo\n\n```sh\ncargo install handlr\n```\n\n### Binaries\n\n1. Download the latest [release binary](https://github.com/chmln/handlr/releases) and put it somewhere in `$PATH`\n2. Download completions for fish:\n```sh\ncurl https://raw.githubusercontent.com/chmln/handlr/master/completions/handlr.fish --create-dirs -o ~/.config/fish/completions/handlr.fish\n```\n\n## Attribution\nIcons made by \u003ca href=\"https://www.flaticon.com/authors/eucalyp\" title=\"Eucalyp\"\u003eEucalyp\u003c/a\u003e from \u003ca href=\"https://www.flaticon.com/\" title=\"Flaticon\"\u003e www.flaticon.com\u003c/a\u003e\n\nCover photo by [creativebloq.com](https://creativebloq.com)\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchmln%2Fhandlr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchmln%2Fhandlr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchmln%2Fhandlr/lists"}