Skip to content
NullString1 edited this page Jan 13, 2026 · 1 revision

Rofi Configuration

Rofi is the application launcher used in NullOS, providing a fast and customizable way to launch applications and run commands.

Overview

Configuration Files:

  • home/rofi/default.nix - Main configuration
  • home/rofi/rofi.nix - Rofi settings
  • home/rofi/config-long.nix - Alternative layout

Launch: SUPER + SHIFT + Return or tap SUPER twice


Basic Usage

Launching Applications

  1. Press SUPER + SHIFT + Return
  2. Type application name
  3. Press Enter to launch

Search Features

  • Fuzzy search - Type partial names (e.g., "fire" matches Firefox)
  • Navigate - Arrow keys or Vim keys (j/k)
  • Launch - Enter
  • Cancel - Escape

Modes

Rofi supports different modes:

  • drun - Desktop applications (default)
  • run - All executables in PATH
  • window - Switch between open windows
  • ssh - SSH to configured hosts

Switch modes with Shift + Arrow Left/Right


Configuration

Basic Settings

programs.rofi = {
  enable = true;
  package = pkgs.rofi-wayland;
  
  font = "JetBrainsMono Nerd Font 12";
  
  terminal = "${pkgs.ghostty}/bin/ghostty";
  
  extraConfig = {
    modi = "drun,run,window,ssh";
    show-icons = true;
    icon-theme = "Papirus";
    display-drun = " Apps";
    display-run = " Run";
    display-window = " Windows";
    drun-display-format = "{name}";
    kb-row-up = "Up,Control+k";
    kb-row-down = "Down,Control+j";
  };
};

Layout Options

extraConfig = {
  # Window width
  width = 50;  # Percentage
  
  # Number of lines
  lines = 10;
  
  # Columns for grid layout
  columns = 1;
  
  # Show/hide scrollbar
  hide-scrollbar = true;
  
  # Case sensitivity
  case-sensitive = false;
  
  # Sidebar mode selector
  sidebar-mode = true;
};

Theming

Using Stylix

Rofi is automatically themed by Stylix in NullOS.

# In home/stylix.nix
stylix.targets.rofi.enable = true;

Custom Theme

Disable Stylix and create custom theme:

stylix.targets.rofi.enable = false;

programs.rofi.theme = {
  "*" = {
    background = "#1e1e2e";
    foreground = "#cdd6f4";
    selected-background = "#89b4fa";
    selected-foreground = "#1e1e2e";
  };
  
  window = {
    background-color = "@background";
    border = 2;
    border-color = "@selected-background";
    border-radius = 10;
    padding = 10;
  };
  
  inputbar = {
    background-color = "@background";
    text-color = "@foreground";
    padding = 5;
    border-radius = 5;
  };
  
  listview = {
    background-color = "@background";
    columns = 1;
    lines = 8;
    spacing = 5;
    padding = 5;
  };
  
  element = {
    background-color = "transparent";
    text-color = "@foreground";
    padding = 5;
    border-radius = 5;
  };
  
  "element selected" = {
    background-color = "@selected-background";
    text-color = "@selected-foreground";
  };
};

Pre-made Themes

Use community themes:

rofi-theme-selector

Or manually:

programs.rofi.theme = "/path/to/theme.rasi";

Custom Scripts

Launcher Script

NullOS includes a custom launcher script:

File: home/scripts/rofi-launcher.nix

#!/usr/bin/env bash
rofi -show drun \
  -theme-str 'window {width: 35%;}' \
  -theme-str 'listview {lines: 8;}'

Power Menu

Create a power menu:

#!/usr/bin/env bash

options="⏻ Shutdown\n⏾ Reboot\n⏸ Suspend\n Lock"

chosen=$(echo -e "$options" | rofi -dmenu -p "Power Menu")

case $chosen in
  "⏻ Shutdown")
    systemctl poweroff
    ;;
  "⏾ Reboot")
    systemctl reboot
    ;;
  "⏸ Suspend")
    systemctl suspend
    ;;
  " Lock")
    hyprlock
    ;;
esac

Add to configuration:

home.file.".local/bin/rofi-power" = {
  executable = true;
  text = ''
    #!/usr/bin/env bash
    # Script above
  '';
};

Bind to key:

# In Hyprland binds
bind = SUPER SHIFT, P, exec, rofi-power

Clipboard Manager

With cliphist:

#!/usr/bin/env bash
cliphist list | rofi -dmenu | cliphist decode | wl-copy

Advanced Features

Custom Modi

Create custom modes for Rofi:

# Emoji selector
"custom/emoji" = {
  script = "rofi-emoji";
  entry = " Emoji";
};

File Browser

extraConfig = {
  modi = "drun,filebrowser";
  filebrowser = {
    directory = "/home/${username}";
  };
};

Calculator Mode

extraConfig = {
  modi = "drun,calc";
};

Install calculator:

home.packages = [ pkgs.rofi-calc ];

Keybindings

Navigation

Key Action
/ Navigate up/down
Ctrl+j/k Navigate (Vim style)
Tab Next entry
Shift+Tab Previous entry
Enter Select
Esc Cancel

Mode Switching

Key Action
Shift+← Previous mode
Shift+→ Next mode

Custom Keybindings

extraConfig = {
  kb-accept-entry = "Return,KP_Enter";
  kb-remove-to-eol = "";
  kb-mode-next = "Shift+Right,Control+Tab";
  kb-mode-previous = "Shift+Left,Control+ISO_Left_Tab";
  kb-row-up = "Up,Control+k,Shift+Tab,Shift+ISO_Left_Tab";
  kb-row-down = "Down,Control+j";
};

Integration with Hyprland

Launch Keybindings

# In home/hyprland/binds.nix
bind = [
  "SUPER SHIFT, Return, exec, rofi -show drun"
  "SUPER, D, exec, rofi -show run"
  "SUPER, Tab, exec, rofi -show window"
];

# Tap Super twice for launcher
bindr = [
  "SUPER, SUPER_L, exec, rofi -show drun"
];

Tips & Tricks

Match Hyprland Colors

Use same colors as Hyprland border:

programs.rofi.theme = {
  "*" = {
    selected-background = config.wayland.windowManager.hyprland.settings.general."col.active_border";
  };
};

Show Keybindings

Create script to show Hyprland keybindings in Rofi:

#!/usr/bin/env bash
hyprctl binds | rofi -dmenu -p "Keybindings"

Quick Actions

#!/usr/bin/env bash

options="Screenshot\nScreen Record\nColor Picker\nWallpaper"

chosen=$(echo -e "$options" | rofi -dmenu -p "Quick Actions")

case $chosen in
  "Screenshot")
    screenshotin
    ;;
  "Screen Record")
    wf-recorder
    ;;
  "Color Picker")
    hyprpicker | wl-copy
    ;;
  "Wallpaper")
    wallsetter
    ;;
esac

Troubleshooting

Rofi Not Launching

Check if installed:

which rofi

Run manually to see errors:

rofi -show drun

Icons Not Showing

Enable icons:

extraConfig = {
  show-icons = true;
  icon-theme = "Papirus";
};

Install icon theme:

home.packages = [ pkgs.papirus-icon-theme ];

Wrong Applications

Update desktop database:

update-desktop-database ~/.local/share/applications

Performance Issues

Reduce displayed items:

extraConfig = {
  lines = 8;  # Reduce number of lines
  lazy-grab = true;  # Improve performance
};

Alternatives

Wofi

Lighter alternative to Rofi:

programs.wofi = {
  enable = true;
  settings = {
    width = 600;
    height = 400;
    show = "drun";
  };
};

Fuzzel

Minimal launcher:

programs.fuzzel = {
  enable = true;
  settings = {
    main = {
      terminal = "${pkgs.ghostty}/bin/ghostty";
      font = "JetBrainsMono Nerd Font:size=12";
    };
  };
};

Next Steps

Clone this wiki locally