niri
Clone
https://git.tahinli.com/Tahinli/niri.git
0 watching·0 forks·Rust·GPL-3.0·12.1 MiB·9d8f4f8·Ivan Molodetskikh·1 month ago·2997 commits
| 1 | ### How to disable client-side decorations/make windows rectangular? |
| 2 | |
| 3 | Uncomment the [`prefer-no-csd` setting](./Configuration:-Miscellaneous.md#prefer-no-csd) at the top level of the config, and then restart your apps. |
| 4 | Then niri will ask windows to omit client-side decorations, and also inform them that they are being tiled (which makes some windows rectangular, even if they cannot omit the decorations). |
| 5 | |
| 6 | Note that currently this will prevent edge window resize handles from showing up. |
| 7 | You can still resize windows by holding <kbd>Mod</kbd> and the right mouse button. |
| 8 | |
| 9 | ### Why are transparent windows tinted? / Why is the border/focus ring showing up through semitransparent windows? |
| 10 | |
| 11 | Uncomment the [`prefer-no-csd` setting](./Configuration:-Miscellaneous.md#prefer-no-csd) at the top level of the config, and then restart your apps. |
| 12 | Niri will draw focus rings and borders *around* windows that agree to omit their client-side decorations. |
| 13 | |
| 14 | By default, focus ring and border are rendered as a solid background rectangle behind windows. |
| 15 | That is, they will show up through semitransparent windows. |
| 16 | This is because windows using client-side decorations can have an arbitrary shape. |
| 17 | |
| 18 | You can also override this behavior with the [`draw-border-with-background` window rule](./Configuration:-Window-Rules.md#draw-border-with-background). |
| 19 | |
| 20 | ### How to enable rounded corners for all windows? |
| 21 | |
| 22 | Put this window rule in your config: |
| 23 | |
| 24 | ```kdl |
| 25 | window-rule { |
| 26 | geometry-corner-radius 12 |
| 27 | clip-to-geometry true |
| 28 | } |
| 29 | ``` |
| 30 | |
| 31 | For more information, check the [`geometry-corner-radius` window rule](./Configuration:-Window-Rules.md#geometry-corner-radius). |
| 32 | |
| 33 | ### How to hide the "Important Hotkeys" pop-up at the start? |
| 34 | |
| 35 | Put this into your config: |
| 36 | |
| 37 | ```kdl |
| 38 | hotkey-overlay { |
| 39 | skip-at-startup |
| 40 | } |
| 41 | ``` |
| 42 | |
| 43 | ### How to fix lag on external monitors connected to a hybrid GPU laptop? |
| 44 | |
| 45 | Hybrid GPU laptops (which have both an integrated and a discrete GPU) generally connect the external monitor port to the discrete GPU. |
| 46 | Meanwhile, the built-in monitor is connected to the integrated GPU, and the integrated GPU is used for rendering by default. |
| 47 | |
| 48 | This is good and expected because the integrated GPU uses significantly less battery compared to the discrete GPU. |
| 49 | However, this means that niri has to render the external monitor contents on the integrated GPU, then copy them over to the discrete GPU for display. |
| 50 | On some laptops this can cause lag and stuttering (it gets worse with monitor resolution and refresh rate). |
| 51 | |
| 52 | If your laptop has a MUX switch—usually a GPU toggle in the UEFI settings—then you can switch it to use the discrete GPU, then niri will render on the discrete GPU, and the external monitor won't lag. |
| 53 | Otherwise, you can try configuring niri to render on the discrete GPU via the [`render-drm-device`](./Configuration:-Debug-Options.md#render-drm-device) debug option. |
| 54 | |
| 55 | Keep in mind that using the discrete GPU for rendering will make the laptop's battery deplete much faster. |
| 56 | |
| 57 | ### How to run X11 apps like Steam or Discord? |
| 58 | |
| 59 | To run X11 apps, you can use [xwayland-satellite](https://github.com/Supreeeme/xwayland-satellite). |
| 60 | Check [the Xwayland wiki page](./Xwayland.md) for instructions. |
| 61 | |
| 62 | Keep in mind that you can run many Electron apps such as VSCode or Discord natively on Wayland by passing the right flags, as described [here](./Application-Issues.md#electron-applications). |
| 63 | |
| 64 | ### Why doesn't niri integrate Xwayland like other compositors? |
| 65 | |
| 66 | A combination of factors: |
| 67 | |
| 68 | - Integrating Xwayland is quite a bit of work, as the compositor needs to implement parts of an X11 window manager. |
| 69 | - You need to appease the X11 ideas of windowing, whereas for niri I want to have the best code for Wayland. |
| 70 | - niri doesn't have a good global coordinate system required by X11. |
| 71 | - You tend to get an endless stream of X11 bugs that take further time and effort away from other tasks. |
| 72 | - There aren't actually that many X11-only clients nowadays, and xwayland-satellite takes perfect care of most of those. |
| 73 | - niri isn't a Big Serious Desktop Environment which Must Support All Use Cases (and is Backed By Some Corporation). |
| 74 | |
| 75 | All in all, the situation works out in favor of avoiding Xwayland integration. |
| 76 | |
| 77 | <sup>Since: 25.08</sup> niri has seamless built-in xwayland-satellite integration that by and large works as well as built-in Xwayland in other compositors, solving the hurdle of having to set it up manually. |
| 78 | |
| 79 | I wouldn't be too surprised if, down the road, xwayland-satellite becomes the standard way of integrating Xwayland into new compositors, since it takes on the bulk of the annoying work, and isolates the compositor from misbehaving clients. |
| 80 | |
| 81 | ### Can I enable blur behind semitransparent windows? |
| 82 | |
| 83 | <sup>Since: 26.04</sup> Yes. |
| 84 | See the [window effects](./Window-Effects.md) wiki page. |
| 85 | |
| 86 | ### Can I make a window sticky / pinned / always on top / appear on all workspaces? |
| 87 | |
| 88 | Not yet, follow/upvote [this issue](https://github.com/niri-wm/niri/issues/932). |
| 89 | |
| 90 | You can emulate this with a script that uses the niri IPC. |
| 91 | For example, [nirius](https://git.sr.ht/~tsdh/nirius) seems to have this feature (`toggle-follow-mode`). |
| 92 | |
| 93 | ### How do I make the Bitwarden window in Firefox open as floating? |
| 94 | |
| 95 | Firefox seems to first open the Bitwarden window with a generic Firefox title, and only later change the window title to Bitwarden, so you can't effectively target it with an `open-floating` window rule. |
| 96 | |
| 97 | You'll need to use a script, for example [this one](https://github.com/niri-wm/niri/discussions/1599) or other ones (search niri issues and discussions for Bitwarden). |
| 98 | |
| 99 | ### Can I open a window directly in the current column / in the same column as another window? |
| 100 | |
| 101 | No, but you can script the behavior you want with the [niri IPC](./IPC.md). |
| 102 | Listen to the event stream for a new window opening, then call an action like `consume-or-expel-window-left`. |
| 103 | |
| 104 | Adding this directly to niri is challenging: |
| 105 | |
| 106 | - The act of "opening a window directly in some column" by itself is quite involved. Niri will have to compute the exact initial window size provided how other windows in a column would resize in response. This logic exists, but it isn't directly pluggable to the code computing a size for a new window. Then, it'll need to handle all sorts of edge cases like the column disappearing, or new windows getting added to the column, before the target window had a chance to appear. |
| 107 | - How do you indicate if a new window should spawn in an existing column (and in which one), as opposed to a new column? Different people seem to have different needs here (including very complex rules based on parent PID, etc.), and it's very unclear design-wise what kind of (simple) setting is actually needed and would be useful. See also https://github.com/niri-wm/niri/discussions/1125. |
| 108 | |
| 109 | ### Why does moving the mouse against a monitor edge focus the next window, but only sometimes? |
| 110 | |
| 111 | This can happen with [`focus-follows-mouse`](./Configuration:-Input.md#focus-follows-mouse). |
| 112 | When using client-side decorations, windows are supposed to have some margins outside their geometry for the mouse resizing handles. |
| 113 | These margins "peek out" of the monitor edges since they're outside the window geometry, and `focus-follows-mouse` triggers when the mouse crosses them. |
| 114 | |
| 115 | It doesn't always happen: |
| 116 | |
| 117 | - Some toolkits don't put resize handles outside the window geometry. Then there's no input area outside, so nowhere for `focus-follows-mouse` to trigger. |
| 118 | - If the current window has its own margin for resizing, and it extends all the way to the monitor edge, then `focus-follows-mouse` won't trigger because the mouse will never leave the current window. |
| 119 | |
| 120 | To fix this, you can: |
| 121 | |
| 122 | - Use `focus-follows-mouse max-scroll-amount="0%"`, which will prevent `focus-follows-mouse` from triggering when it would cause scrolling. |
| 123 | - Set `prefer-no-csd` which will generally cause clients to remove those resizing margins. |
| 124 | |
| 125 | ### How do I recover from a dead screen locker / from a red screen? |
| 126 | |
| 127 | When your screen locker dies, you will be left with a red screen. |
| 128 | This is niri's locked session background. |
| 129 | |
| 130 | You can recover from this by spawning a new screen locker. |
| 131 | One way is to switch to a different TTY (with a shortcut like <kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>F3</kbd>) and spawning a screen locker to niri's Wayland display, e.g. `WAYLAND_DISPLAY=wayland-1 swaylock`. |
| 132 | |
| 133 | Another way is to set `allow-when-locked=true` on your screen locker bind, then you can press it on the red screen to get a fresh screen locker. |
| 134 | ```kdl |
| 135 | binds { |
| 136 | Super+Alt+L allow-when-locked=true { spawn "swaylock"; } |
| 137 | } |
| 138 | ``` |
| 139 | |
| 140 | ### How do I change output configuration based on connected monitors? |
| 141 | |
| 142 | If you require different output configurations depending on what outputs are connected then you can use [Kanshi](https://gitlab.freedesktop.org/emersion/kanshi). |
| 143 | |
| 144 | Kanshi has its own simple configuration and communicates with niri via IPC. You may want to launch kanshi from the niri config.kdl e.g. `spawn-at-startup "/usr/bin/kanshi"` |
| 145 | |
| 146 | For example, if you wish to scale your laptop display differently when an external monitor is connected, you might use a Kanshi config like this: |
| 147 | ``` |
| 148 | profile { |
| 149 | output eDP-1 enable scale 1.0 |
| 150 | } |
| 151 | |
| 152 | profile { |
| 153 | output HDMI-A-1 enable scale 1.0 position 0,0 |
| 154 | output eDP-1 enable scale 1.25 position 1920,0 |
| 155 | } |
| 156 | ``` |
| 157 | |
| 158 | ### Why does Firefox or Thunderbird have 1 px smaller border? |
| 159 | |
| 160 | They draw their own 1 px dark border around the window, which obscures one pixel of niri's border. |
| 161 | If you don't like this, set the [`clip-to-geometry true` window rule](./Configuration:-Window-Rules.md#clip-to-geometry). |