-
Notifications
You must be signed in to change notification settings - Fork 614
Themes
The official repository for themes can be found here.
Rofi themes use the .rasi
file extension. The format is similar to .css
. You can find documentation on the .rasi
format here.
Generate a default configuration file
mkdir -p ~/.config/rofi
rofi -dump-config > ~/.config/rofi/config.rasi
This creates a file called config.rasi
in the ~/.config/rofi/
folder. You can modify this file to set configuration settings and modify themes. config.rasi
is the file rofi looks to by default.
It is possible to live reload rofi as you edit and save your the theme you're working on.
Take the following script called run_rofi.sh
:
#!/usr/bin/env bash
options="one
two
three"
theme=${1:-$HOME/.config/rofi/config.rasi}
selection=$(echo -e "${options}" | rofi -dmenu -config $theme)
case "${selection}" in
"one")
notify-send "run_rofi.sh" "one";;
"two")
notify-send "run_rofi.sh" "two";;
"three")
notify-send "run_rofi.sh" "three";;
esac
You can run the following:
cd ~/.config/rofi
ls | entr -r $HOME/.config/rofi/run_rofi.sh
Which effectively re-runs run_rofi.sh
whenever a file in ~/.config/rofi
is modified.
You will notice that this places rofi in the foreground whenever you save a file, forcing you to press Escape to close it to get back to your editor. An alternative is to pass the -normal-window
flag to rofi, which in this case is called in run_rofi.sh
. This will place rofi in a normal window. It still steals focus from your editor, but you can alt+tab back to your editor, or if you use a tiling window manager, move focus to the adjacent window (your editor) via your normal key commands (for me, in i3, it is $mod+j
). This will leave rofi open and may be preferable.
If anyone finds out a way to run rofi without it taking cursor focus, please document it here!
If you have your own custom theme other than what's defined in config.rasi
you can use the -theme {name}
flag when running rofi. The {name} handed to the themes folder is the name of the .rasi
file in ~/.config/rofi/
that you want to use instead.
Example:
Running rofi with a custom theme file ~/.config/rofi/mytheme.rasi
.
rofi -show drun -theme mytheme
Example:
Reference the theme by name in your config.rasi
.
configuration {
...
theme: "mytheme";
...
}
Icon themes must be located in ~/.local/share/icons/
or ~/.icons/
. Also -drun
needs to be used instead of -run
.
Set icons via rofi commands:
rofi -show drun -show-icons -icon-theme MY_ICON_THEME
Set icons via .rasi:
configuration {
show-icons: true;
icon-theme: "MY_ICON_THEME";
}
Add the following to the bottom of your .rasi
file.
Usually these syntax highlighting indicators are put at the beginning of the file, but rofi will fail to load the theme if it's not at the bottom of the file.
/* vim:ft=css
Or in your vimrc:
au BufNewFile,BufRead /*.rasi setf css
This should go at the beginning of the file.
/*-*- mode: css; -*-*/