Rofi Prefixer is a Go-based utility that enhances the functionality of Rofi by adding customizable prefixes for quick actions and searches.
- Customizable command prefixes
- Integration with various search engines and websites
- Workspace switching capability
- Go 1.23.1 or higher
- Rofi
- Hyprland (for workspace switching)
-
Clone the repository:
git clone https://github.com/vivalchemy/rofi-prefixer.git cd rofi-prefixer
-
Build the project:
make build # if not using make, you can also run `go build -o ./build/rofi-prefixer ./main.go`
-
The binary will be available in the
./build/
directory.
-
Run the
rofi-prefixer
binary:./build/rofi-prefixer
-
This will open a Rofi menu with all available prefixes. You can interact with it in several ways:
- Select a prefix from the list to execute the associated command.
- Type a prefix followed by a query: Example: "g how to use rofi" (searches Google for "how to use rofi")
- Type just the prefix: Example: g (opens anothe rofi instance, prompting for input only if the command uses %s)
- Use special prefixes:
- "=" for calculator mode
- "w" for window switcher
- "a" for application launcher
Edit the ROFI_CMDS
slice in main.go
to customize your prefixes and commands. Each command is defined as a Cmd
struct with the following fields:
Command
: The command to executeName
: A friendly name for the commandBrowser
: Set totrue
if the command should be opened in a browserPrefix
: The prefix to trigger this commandWorkspace
: The workspace number to switch to after executing the command (0 for no switch)
Example:
{
Browser: true,
Command: "https://www.google.com/search?q=%s",
Name: `Google`,
Prefix: `g`,
Workspace: 2,
},
Note
The Command
field supports placeholders. You can use %s
to represent the search query. For example, the Command
field for the Google search could be https://www.google.com/search?q=%s
. To use a literal %s
in the Command
field, you can escape it with a backslash \%s
. Using %s in the Command field prompts for input if no query is provided after the prefix.
- Go 1.23.1 or higher
- Make (optional)
make help
: Print available commandsmake build
: Build the applicationmake run
: Run the applicationmake run/live
: Run the application with live reloadingmake test
: Run all testsmake audit
: Run quality control checksmake tidy
: Tidy modfiles and format Go files
For a complete list of available commands, run make help
.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.