Run or raise implemented for Hyprland. It will raise window if it exists, or cycle to next window if current window matches class to focus. Otherwise it will launch new window.
$ raise
Usage: raise [-c <class>] [--tag <tag>] [--xdgtag <tag>] -e <launch> [-m <field[:method]=pattern>...]
Raise window if it exists, otherwise launch new window.
Options:
-c, --class class to focus (shorthand for `--match class=...`)
--tag window tag to match (repeatable; shorthand for `--match tag=...`)
--xdgtag XDG surface tag to match (repeatable; shorthand for `--match xdgtag=...`)
-e, --launch command to launch
-m, --match additional matcher in the form field[:method]=pattern
--help display usage information
The --match flag allows choosing how a window should be selected. Each
matcher uses the format field[:method]=pattern and multiple matchers can be
combined; they all have to match for a window to qualify.
Supported fields:
class— current window class reported by Hyprlandinitial-class— class when the window was first createdtitle— current window titleinitial-title— original title assigned on window creationtag— window tag assigned via dynamic tagsxdgtag— XDG surface tag (xdgTaginhyprctl clients)
Aliases: you can also use the short forms c, initialClass, initialTitle, and xdg-tag.
Supported methods (default is equals):
equals/eqcontains/substrprefix/starts-withsuffix/ends-withregex/re
Examples:
raise --launch firefox --match class=firefox
raise --launch alacritty --match title:contains=notes
raise --launch slack --match class=Slack --match title:regex="(?i)daily"
# Shorthands for tags:
raise --launch floorp --tag web
raise --launch mpv --tag vid
raise --launch obsidian --tag notes
There are multiple ways to install this:
- Go to releases
cargo install --git https://github.com/svelterust/raise- Add
github:svelterust/raiseas a flake to your NixOS configuration
For NixOS, add raise to your flake inputs:
inputs = {
raise.url = "github:svelterust/raise";
};Then add it to your system, for instance: environment.systemPackages = [raise.defaultPackage.x86_64-linux];
I like having Super + <key> bound to run or raise, and Super + Shift + <key> to launch application regularly.
bind = SUPER, V, exec, raise --class "Alacritty" --launch "alacritty"
bind = SUPER_SHIFT, V, exec, alacritty
bind = SUPER, C, exec, raise --class "firefox" --launch "firefox"
bind = SUPER_SHIFT, C, exec, firefox
bind = SUPER, F, exec, raise --class "emacs" --launch "emacsclient --create-frame"
bind = SUPER_SHIFT, F, exec, emacsclient --create-frame
Run hyprctl clients while window is open, and look for class: <class>.