Rofi Configuration Files

Table of Contents

A dmenu replacement, it can act as a window switcher, or an application launcher. Very scriptable, I've use it to create a window switcher, greenclip clipboard, and as an application chooser.

rofi-menu-2025-04-24_01-33.png

rofi-window-2025-04-24_01-34.png

rofi-greenclip-2025-04-24_01-38.png

config.rasi

The main configuration, the only dependency needed here is the JetBrain Mono font, provided by the ttf-jetbrains-mono-nerd package in archlinux.

configuration {
    modi: "window,drun,run,ssh,combi,emoji";
    show-icons: true;
    font: "JetBrainsMonoNL Nerd Font Mono 8";
    line-margin: 10;
    display-ssh:    "";
    display-run:    "";
    display-drun:   "";
    display-window: "";
    display-combi:  "";
    show-icons:     true;
}
@theme "nord"

listview {
    lines: 6;
    columns: 2;
}

window {
    width: 30%;
}

Themes

nord

The only colorscheme I need!

/* -*-css-*- */
/**
 * Nordic rofi theme
 * Adapted by undiabler <undiabler@gmail.com>
 *
 * Nord Color palette imported from https://www.nordtheme.com/
 *
 */


* {
    nord0: #2e3440;
    nord1: #3b4252;
    nord2: #434c5e;
    nord3: #4c566a;

    nord4: #d8dee9;
    nord5: #e5e9f0;
    nord6: #eceff4;

    nord7: #8fbcbb;
    nord8: #88c0d0;
    nord9: #81a1c1;
    nord10: #5e81ac;
    nord11: #bf616a;

    nord12: #d08770;
    nord13: #ebcb8b;
    nord14: #a3be8c;
    nord15: #b48ead;

    foreground:  @nord9;
    backlight:   #ccffeedd;
    background-color:  transparent;

    highlight:     underline bold #eceff4;

    transparent: rgba(46,52,64,0);
}

window {
    location: center;
    anchor:   center;
    transparency: "screenshot";
    padding: 10px;
    border:  0px;
    border-radius: 6px;

    background-color: @transparent;
    spacing: 0;
    children:  [mainbox];
    orientation: horizontal;
}

mainbox {
    spacing: 0;
    children: [ inputbar, message, listview ];
}

message {
    color: @nord0;
    padding: 5;
    border-color: @foreground;
    border:  0px 2px 2px 2px;
    background-color: @nord7;
}

inputbar {
    color: @nord6;
    padding: 11px;
    background-color: #3b4252;

    border: 1px;
    border-radius:  6px 6px 0px 0px;
    border-color: @nord10;
}

entry, prompt, case-indicator {
    text-font: inherit;
    text-color:inherit;
}

prompt {
    margin: 0px 1em 0em 0em ;
}

listview {
    padding: 8px;
    border-radius: 0px 0px 6px 6px;
    border-color: @nord10;
    border: 0px 1px 1px 1px;
    background-color: rgba(46,52,64,0.9);
    dynamic: false;
}

element {
    padding: 3px;
    vertical-align: 0.5;
    border-radius: 4px;
    background-color: transparent;
    color: @foreground;
    text-color: rgb(216, 222, 233);
}

element selected.normal {
    background-color: @nord7;
    text-color: #2e3440;
}

element-text, element-icon {
    background-color: inherit;
    text-color:       inherit;
}

button {
    padding: 6px;
    color: @foreground;
    horizontal-align: 0.5;

    border: 2px 0px 2px 2px;
    border-radius: 4px 0px 0px 4px;
    border-color: @foreground;
}

button selected normal {
    border: 2px 0px 2px 2px;
    border-color: @foreground;
}

Scripts

rofi-logout

rofi-logout-2025-04-24_01-33.png

This script can be used in various window manager. No option for suspend and hibernate, since suspend mostly used on laptops, and it can be achieve by simply closing the monitor lid, this also for hibernate, I'll let the system handle it.

THEME=${1:-logout}

question=$(echo "󰌾 lock|󰍃 logout|󰜉 reboot|󰐥 shutdown" | rofi -sep "|" \
    -dmenu -i -p 'System: ' "" \
    -hide-scrollbar \
    -eh 1 \
    -color-enabled true \
    -theme "$THEME")

case $question in
    *lock)
        # use lowercase only
        case "${XDG_CURRENT_DESKTOP,,}" in
            hyprland)
                hyprctl dispatch exit
                ;;
            *)
                if [ "$(pgrep -x lightdm)" ] && [ "$(command -v light-locker)" ]; then
                    light-locker-command -l
                fi
                ;;
        esac
        ;;
    *logout)
        case "${XDG_CURRENT_DESKTOP,,}" in
            hyprland)
                hyprctl dispatch exit
                ;;
            openbox)
                openbox --exit
                ;;
            i3)
                i3-msg exit
                ;;
            qtile)
                qtile cmd-obj -o cmd -f shutdown
                ;;
        esac
        ;;
    *reboot)
        if [[ $(command -v systemctl) ]]; then
            systemctl reboot
        else
            shutdown -r now
        fi
        ;;
    *shutdown)
        if [[ $(command -v systemctl) ]]; then
            systemctl poweroff
        else
            poweroff
        fi
        ;;
    *)
        exit 0  # do nothing on wrong response
        ;;
esac

Date: 2024-10-25 Fri 00:00

Author: Kristian Alexander P

Created: 2025-05-16 Fri 14:19