#4520·niri

Rofi sometimes loses interaction if launched using niri keybind

Author: bczhcCreated Sep 3, 2026Updated Sep 23, 2026
Labelsarea:input

I'm using Mod+V to launch rofi which shows my clipboard. Sometimes I find after I launch it I can't interact with it at all (keys, mouse clicks/wheels).

Demonstration video:

https://github.com/user-attachments/assets/1ed0237e-a018-496d-8e13-2f0503a53827

The key sequence is Mod (left meta key)-down, V-down, V-up, Mod-up. On V-down, rofi starts. When the bug happens, WAYLAND_DEBUG=1 rofi shows that rofi does not receive a "Mod-up" event. Here's a demonstration wl log:

log
-- Normal
[02:06:33.044550] {Default Queue}  -> wl_seat#10.get_keyboard(new id wl_keyboard#13)
[02:06:33.057900] {Default Queue} wl_keyboard#13.keymap(1, fd 9, 35572)
[02:06:33.058504] {Default Queue} wl_keyboard#13.repeat_info(25, 600)
[02:06:33.079799] {Default Queue} wl_keyboard#13.enter(78072, wl_surface#3, array[4])
[02:06:33.079807] {Default Queue} wl_keyboard#13.modifiers(78072, 64, 0, 16, 0)
[02:06:33.082355] {Default Queue} wl_keyboard#13.key(78076, 25354336, 125, 0) -- META UP
[02:06:33.082359] {Default Queue} wl_keyboard#13.modifiers(78076, 0, 0, 16, 0)
[02:06:33.280047] {Default Queue} wl_keyboard#13.key(78077, 25354533, 108, 1) -- ArrowDown down
[02:06:33.351970] {Default Queue} wl_keyboard#13.key(78078, 25354605, 108, 0)
[02:06:33.458689] {Default Queue} wl_keyboard#13.key(78079, 25354712, 108, 1)
[02:06:33.540060] {Default Queue} wl_keyboard#13.key(78080, 25354793, 108, 0)
[02:06:33.603933] {Default Queue} wl_keyboard#13.key(78081, 25354857, 15, 1)

-- Bug happens
[02:06:33.890237] {Default Queue}  -> wl_seat#10.get_keyboard(new id wl_keyboard#13)
[02:06:33.909478] {Default Queue} wl_keyboard#13.keymap(1, fd 9, 35572)
[02:06:33.910107] {Default Queue} wl_keyboard#13.repeat_info(25, 600)
[02:06:33.940968] {Default Queue} wl_keyboard#13.enter(78100, wl_surface#3, array[4])
[02:06:33.940977] {Default Queue} wl_keyboard#13.modifiers(78100, 64, 0, 16, 0) -- Notice here below, the "META UP" is lost so rofi thinks the Meta key is always pressed, exhibiting the bug
[02:06:34.141962] {Default Queue} wl_keyboard#13.key(78105, 25355395, 108, 1) -- ArrowDown down
[02:06:34.223063] {Default Queue} wl_keyboard#13.key(78106, 25355476, 108, 0)
[02:06:34.347059] {Default Queue} wl_keyboard#13.key(78107, 25355600, 108, 1)
[02:06:34.420184] {Default Queue} wl_keyboard#13.key(78108, 25355673, 108, 0)
[02:06:34.518160] {Default Queue} wl_keyboard#13.key(78109, 25355771, 108, 1)
[02:06:34.598066] {Default Queue} wl_keyboard#13.key(78110, 25355851, 108, 0)
[02:06:34.718900] {Default Queue} wl_keyboard#13.key(78111, 25355972, 108, 1)
[02:06:34.796115] {Default Queue} wl_keyboard#13.key(78112, 25356049, 108, 0)
[02:06:36.296172] {Default Queue} wl_keyboard#13.modifiers(78121, 4, 0, 16, 0)
[02:06:36.402185] {Default Queue} wl_keyboard#13.key(78122, 25357655, 29, 0)
[02:06:36.402224] {Default Queue} wl_keyboard#13.modifiers(78122, 0, 0, 16, 0)
[02:06:36.595068] {Default Queue} wl_keyboard#13.key(78123, 25357848, 1, 1)
Config
kdl
// This config is in the KDL format: https://kdl.dev
// "/-" comments out the following node.
// Check the wiki for a full description of the configuration:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Introduction
config-notification {
    disable-failed
}
// Outputs from existing configuration
output "eDP-1" {
    /*
       This is SO SILLY.

       20260518

       Comment from https://github.com/niri-wm/niri/issues/3997#issuecomment-4475713110:

       Somewhat similar.. it's a drama; I needed to use my laptop portably today so I disconnected the daily external monitor and brought the laptop with me. Later when I started it in tty, in a class, niri just started as a black screen. Removing extra drm devices, checking journalctl, eliminating unneeded services and spawn-at-startup, tweaking here and there, in a hurry, ... but found nothing special. I also tested Hyprland and i3wm, and they all work.

Finally it turned out that I had an off in the config output "eDP-1" which I added it before for some debugging purposes.. So silly am i.
    */
    // off
    scale 1.75
    //scale 1
    mode "[email protected]"
}
output "HEADLESS-1" {
    scale 1.5
    position x=1920 y=0
}
output "DP-2" {
    // Uncomment this line to disable this output.
    // off

    // Resolution and, optionally, refresh rate of the output.
    // The format is "<width>x<height>" or "<width>x<height>@<refresh rate>".
    // If the refresh rate is omitted, niri will pick the highest refresh rate
    // for the resolution.
    // If the mode is omitted altogether or is invalid, niri will pick one automatically.
    // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
    mode "[email protected]"
    //mode "[email protected]"
    //mode "640x480"
    //mode "2560x1440@60"

    // You can use integer or fractional scale, for example use 1.5 for 150% scale.
    //scale 1.333333333333333333
    scale 1.33333333
    //scale 1
    //scale 3

    // Transform allows to rotate the output counter-clockwise, valid values are:
    // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270.
    transform "normal"

    // Position of the output in the global coordinate space.
    // This affects directional monitor actions like "focus-monitor-left", and cursor movement.
    // The cursor can only move between directly adjacent outputs.
    // Output scale and rotation has to be taken into account for positioning:
    // outputs are sized in logical, or scaled, pixels.
    // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080,
    // so to put another output directly adjacent to it on the right, set its x to 1920.
    // If the position is unset or results in an overlap, the output is instead placed
    // automatically.
    //position x=1920 y=0
    position x=0 y=0

    //max-bpc 10
}

spawn-at-startup "wl-clip-persist" "--clipboard" "regular" "--all-mime-type-regex" r#"(?i)^(?!image/x-inkscape-svg).+"#
spawn-at-startup "wl-paste" "--type" "text" "--watch" "cliphist" "store"
spawn-at-startup "wl-paste" "--type" "image" "--watch" "cliphist" "store"
spawn-at-startup "bash" "-c" r##"sleep 5 && fcitx5"##
spawn-at-startup "bash" "-c" r##"echo $NIRI_SOCKET > /tmp/niri-socket.txt"##
spawn-at-startup "bash" "-c" r##"sleep 1; pgrep gsr-ui || gsr-ui"##
spawn-at-startup "bash" "-c" r##"$HOMESCRIPT_DIR/niri/desktop-alacritty"##
spawn-at-startup "bash" "-c" r##"sleep 5 && systemctl --user restart xdg-desktop-portal"##

gestures {
    // Enable this to open niri overview on mouse moved to the top-left corner.
    hot-corners {
        off
    }
}

// Input device configuration.
// Find the full list of options on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Input
input {
    keyboard {
        xkb {
            // You can set rules, model, layout, variant and options.
            // For more information, see xkeyboard-config(7).

            // For example:
            // layout "us,ru"
            // options "grp:win_space_toggle,compose:ralt,ctrl:nocaps"

            // If this section is empty, niri will fetch xkb settings
            // from org.freedesktop.locale1. You can control these using
            // localectl set-x11-keymap.
        }

        // Enable numlock on startup, omitting this setting disables it.
        numlock

        //repeat-delay 10000
        //repeat-rate 25
    }

    // Next sections include libinput settings.
    // Omitting settings disables them, or leaves them at their default values.
    // All commented-out settings here are examples, not defaults.
    touchpad {
        // off
        tap
        // dwt
        // dwtp
        // drag false
        // drag-lock
        natural-scroll
        // accel-speed 0.2
        // accel-profile "flat"
        // scroll-method "two-finger"
        // disabled-on-external-mouse
    }

    mouse {
        // off
        // natural-scroll
        // accel-speed 0.2
        // accel-profile "flat"
        // scroll-method "no-scroll"
        accel-profile "adaptive"
        accel-speed 0.2
        //accel-speed -0.7891238
    }

    trackpoint {
        // off
        // natural-scroll
        // accel-speed 0.2
        // accel-profile "flat"
        // scroll-method "on-button-down"
        // scroll-button 273
        // scroll-button-lock
        // middle-emulation
    }

    // Uncomment this to make the mouse warp to the center of newly focused windows.
    //warp-mouse-to-focus

    // Focus windows and outputs automatically when moving the mouse into them.
    // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen.
    // focus-follows-mouse max-scroll-amount="95%"
    //focus-follows-mouse
}
// You can configure outputs by their name, which you can find
// by running `niri msg outputs` while inside a niri instance.
// The built-in laptop monitor is usually called "eDP-1".
// Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs
// Remember to uncomment the node by removing "/-"!

// Settings that influence how windows are positioned and sized.
// Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout
layout {
    //always-center-single-column
    // Set gaps around windows in logical pixels.
    background-color "transparent"
    // When to center a column when changing focus, options are:
    // - "never", default behavior, focusing an off-screen column will keep at the left
    //   or right edge of the screen.
    // - "always", the focused column will always be centered.
    // - "on-overflow", focusing a column will center it if it doesn't fit
    //   together with the previously focused column.
    center-focused-column "never"
    // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
    preset-column-widths {
        // Proportion sets the width as a fraction of the output width, taking gaps into account.
        // For example, you can perfectly fit four windows sized "proportion 0.25" on an output.
        // The default preset widths are 1/3, 1/2 and 2/3 of the output.
        proportion 0.33333
        proportion 0.5
        proportion 0.66667
        // Fixed sets the width in logical pixels exactly.
        // fixed 1920
    }
    // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between.
    // preset-window-heights { }
    // You can change the default width of the new windows.
    default-column-width { proportion 0.5; }
    // If you leave the brackets empty, the windows themselves will decide their initial width.
    // default-column-width {}
    // By default focus ring and border are rendered as a solid background rectangle
    // behind windows. That is, they will show up through semitransparent windows.
    // This is because windows using client-side decorations can have an arbitrary shape.
    //
    // If you don't like that, you should uncomment `prefer-no-csd` below.
    // Niri will draw focus ring and border *around* windows that agree to omit their
    // client-side decorations.
    //
    // Alternatively, you can override it with a window rule called
    // `draw-border-with-background`.
    focus-ring {
        //active-color   "#ff0000"
        //inactive-color "#72777f"
        //urgent-color   "#b3261e"
      width 8
      active-gradient from="#ff007f" to="#ff80bf" angle=45
      inactive-gradient from="#402030" to="#603045" angle=45 in="srgb-linear"
      urgent-gradient from="#ff0000" to="#ff00ff" angle=45
    }
    border {
        off
        width 4
        active-color   "#707070"      // Neutral gray
        inactive-color "#d0d0d0"      // Light gray
        urgent-color   "#cc4444"      // Softer red
    }
    shadow {
        softness 30
        spread 5
        offset x=0 y=5
        color "#0007"
    }
    tab-indicator {
        active-color   "#ffffff"
        inactive-color "#72777f"
        urgent-color   "#b3261e"
    }
    insert-hint {
        // off
        //color "#ffc87f80"
        //gradient from="#ffbb6680" to="#ffc88080" angle=45 relative-to="workspace-view"
    }
    struts {
        left 0
        right 0
        top 0
        bottom 0
    }
}

// 'Background' layer-shell (aka. the Wallpaper) of DMS
layer-rule {
    match namespace="^quickshell$"
    place-within-backdrop true
}

overview {
    workspace-shadow {
        off
    }
    //zoom 0.25
    backdrop-color "#777777"
}
// Add lines like this to spawn processes at startup.
// Note that running niri as a session supports xdg-desktop-autostart,
// which may be more convenient to use.
// See the binds section below for more spawn examples.
// This line starts waybar, a commonly used bar for Wayland compositors.
environment {
    // IME
    XMODIFIERS "@im=fcitx"
    QT_IM_MODULES "wayland;fcitx"

    // XDG
    XDG_CURRENT_DESKTOP "niri"
    XDG_CONFIG_HOME "/home/bczhc/.config"
    XDG_DATA_DIRS "/home/bczhc/.local/xdg-override:/home/bczhc/.local/share:/usr/local/share:/usr/share"
    XDG_STATE_HOME "/home/bczhc/.local/state"
    // For screencasting
    //XDG_CURRENT_DESKTOP "niri:GNOME"
    XDG_CURRENT_DESKTOP "niri"

    QUIRK_APP_DIR "/home/bczhc/bin/scripts/exec-override"

    // NVIDIA driver
    __GL_SHADER_DISK_CACHE_SIZE "100000000000"
    __GL_SHADER_DISK_CACHE_SKIP_CLEANUP "1"

    // Wayland hint
    ELECTRON_OZONE_PLATFORM_HINT "auto"
    GDK_BACKEND "wayland"

    NIRI_SPAWN_FLAG "1"
}
hotkey-overlay {
    skip-at-startup
}
prefer-no-csd
animations {
    workspace-switch {
        spring damping-ratio=0.80 stiffness=5000 epsilon=0.00001
        //off
    }
    horizontal-view-movement {
        spring damping-ratio=0.85 stiffness=5000 epsilon=0.0001
        //off
    }
    window-movement {
        spring damping-ratio=0.75 stiffness=2000 epsilon=0.0001
    }
    config-notification-open-close {
        spring damping-ratio=0.65 stiffness=2000 epsilon=0.001
    }
    screenshot-ui-open {
        duration-ms 200
        curve "ease-out-quad"
        //off
    }
    overview-open-close {
        spring damping-ratio=0.85 stiffness=2000 epsilon=0.0001
        //off
    }
}
include "animations/glide.kdl"
// Window rules let you adjust behavior for individual windows.
// Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules
// Work around WezTerm's initial configure bug
// by setting an empty default-column-width.
window-rule {
    // This regular expression is intentionally made as specific as possible,
    // since this is the default config, and we want no false positives.
    // You can get away with just app-id="wezterm" if you want.
    match app-id=r#"^org\.wezfurlong\.wezterm$"#
    default-column-width {}
}
window-rule {
    match app-id=r#"^org\.gnome\."#
    draw-border-with-background false
    geometry-corner-radius 12
    clip-to-geometry true
}
window-rule {
    match app-id=r#"^gnome-control-center$"#
    match app-id=r#"^pavucontrol$"#
    match app-id=r#"^nm-connection-editor$"#
    default-column-width { proportion 0.5; }
    open-floating false
}
window-rule {
    match app-id=r#"^gnome-calculator$"#
    match app-id=r#"^galculator$"#
    match app-id=r#"^blueman-manager$"#
    match app-id=r#"^org\.gnome\.Nautilus$"#
    match app-id=r#"^xdg-desktop-portal$"#
    open-floating true
}
window-rule {
    match app-id=r#"^steam$"# title=r#"^notificationtoasts_\d+_desktop$"#
    default-floating-position x=10 y=10 relative-to="bottom-right"
    open-focused false
}
window-rule {
    match app-id=r#"^org\.wezfurlong\.wezterm$"#
    match app-id="Alacritty"
    match app-id="zen"
    match app-id="com.mitchellh.ghostty"
    match app-id="kitty"
    draw-border-with-background false
}
window-rule {
    match app-id=r#"firefox$"# title="^Picture-in-Picture$"
    match app-id="zoom"
    open-floating true
}
// Open dms windows as floating by default
window-rule {
    match app-id=r#"org.quickshell$"#
    match app-id=r#"com.danklinux.dms$"#
    open-floating true
}

debug {
    honor-xdg-activation-with-invalid-serial
    //disable-cursor-plane
    //disable-direct-scanout
    wait-for-frame-completion-before-queueing 
    //disable-resize-throttling
}

recent-windows {
    binds {
        Alt+Tab         { next-window scope="output"; }
        Alt+Shift+Tab   { previous-window scope="output"; }
        //Alt+grave       { next-window filter="app-id"; }
        //Alt+Shift+grave { previous-window filter="app-id"; }
    }

    debounce-ms 1000

    open-delay-ms 100

    highlight {
        active-color "#999999ff"
        urgent-color "#ff9999ff"
        padding 30
        corner-radius 0
    }

    previews {
        max-height 480
        max-scale 0.35
    }
}

// cursor-zoom feature branch
zoom {
   movement-mode "cursor-follow" // "on-edge" or "centered"
   increment-type "exponential" // "exponential"
   max-zoom 20.0
   pinch-sensitivity 1.0
}

cursor {
    scale-with-zoom;
    shake {
        on
        max-multiplier 4.0
        behavior "hold"
        shake-interval-ms 300
        min-diagonal 100.0
        sensitivity 2.0
    }
}

// Include dms files
//include "dms/colors.kdl"
include "dms/layout.kdl"
include "dms/alttab.kdl"
include "dms/binds.kdl"
include "dms/outputs.kdl"
include "dms/cursor.kdl"
include "dms/windowrules.kdl"

System Information

  • niri version: latest dd75865f547f0eac0e9b6c4d86d2cd00c0744252
  • Distro: Arch rolling

This is originally reported at https://github.com/davatorium/rofi/discussions/2330.

Hyprland, sway and cosmic-comp do not show the issue, even with fcitx5 running.