#3244·polybar

[Bug]: Bar renders at wrong width on NVIDIA output with transform/viewport (rotated, upscaled monitor)

Author: eliliamCreated Mar 23, 2026Updated Mar 23, 2026
Labelsbugneeds confirmation

Checklist

  • I have read the appropriate section in the contributing guidelines
  • I believe this issue is a problem with polybar itself and not a misconfiguration on my part
  • I have searched for other open and closed issues that may have already reported this problem
  • I have checked the known issues page for this problem.
  • I have followed the debugging guide to narrow down the problem to a minimal config.

Steps to reproduce

  1. Set up an NVIDIA GPU with Xorg.
  2. In /etc/X11/xorg.conf.d/10-nvidia.conf, configure a secondary monitor with a rotated, upscaled virtual viewport via a metamode similar to: Option "metamodes" "DP-0: 3840x2160_160 +0+840, DP-2: 1920x1080 +3840+0 {rotation=left, viewportin=2160x3840}"
  3. Use polybar -vvv to verify +randr (+monitors) support is present.
  4. Launch polybar with the config below, using width = 100% for the secondary monitor (DP-2).
  5. Observe that the bar on DP-2 only fills half (or less) of the logical screen width.
  6. Compare to xrandr/xrandr --listactivemonitors and window managers that respect the visible area.

Minimal config

dosini
[bar/main]
width = 100%
height = 45
fixed-center = false
enable-ipc = true
wm-restack = bspwm
override-redirect = true

[bar/primary]
monitor = DP-0
inherit = bar/main
tray-position = center
modules-left = bspwm
modules-right = date powermenu

[bar/right]
monitor = DP-2
inherit = bar/main
modules-left = bspwm
modules-right = date powermenu

Polybar log

notice: Parsing config file: /home/eli/.config/polybar/config.ini
- config_parser: Parsing /home/eli/.config/polybar/config.ini
- config: Inheriting keys from "bar/main" in "bar/bottom"
- config: Inheriting keys from "bar/main" in "bar/primary"
- config: Inheriting keys from "bar/main" in "bar/right"
- config: Inheriting keys from "module/xbacklight" in "module/backlight-acpi"
* Created legacy ipc fifo at '/tmp/polybar_mqueue.42425'
* Opening ipc socket at '/run/user/1000/polybar/ipc.42425.sock'
notice: Listening for IPC messages (PID: 42425)
* Loaded monitor DP-2 (1215x6827+3840+0)
* Configured DPI = 96x96
* Bar geometry: 1215x53+3840+0; Borders: 4,4,4,4
- bar: Attach X event sink
- bar: Attach signal receiver
- controller: Setup user-defined modules
notice: Loading module 'bspwm' of type 'internal/bspwm'
notice: Loading module 'date' of type 'internal/date'
notice: Loading module 'powermenu' of type 'custom/menu'
- module/powermenu: Creating menu level 0
- module/powermenu: Creating menu level item 0
- module/powermenu: Creating menu level item 1
- module/powermenu: Creating menu level item 2
- module/powermenu: Creating menu level 1
- module/powermenu: Creating menu level item 0
- module/powermenu: Creating menu level item 1
- module/powermenu: Creating menu level 2
- module/powermenu: Creating menu level item 0
- module/powermenu: Creating menu level item 1
- module/powermenu: Creating menu level 3
- module/powermenu: Creating menu level item 0
- module/powermenu: Creating menu level item 1
notice: Loaded 3 modules
* Starting application
- controller: Main thread id = 1
* Entering event loop (thread-id=1)
- bar: Create renderer
- renderer: Get TrueColor visual
* renderer: Using 32-bit TrueColor visual: 0x23
- renderer: Allocate colormap
- renderer: Allocate output window
- renderer: Allocate window pixmaps
- renderer: Allocate graphic contexts
- renderer: Allocate alignment blocks
- renderer: Allocate cairo components
- renderer: Load fonts
notice: Loaded font "misc fixed:pixelsize=18" (name=Noto Sans, offset=1, file=/usr/share/fonts/noto/NotoSans-Regular.ttf)
notice: Loaded font "unifont:fontformat=truetype:size=16:antialias=false" (name=Unifont, offset=0, file=/usr/share/fonts/Unifont/Unifont.ttf)
notice: Loaded font "siji:pixelsize=15" (name=Siji, offset=1, file=/usr/share/fonts/misc/siji.otb)
notice: Loaded font "Font Awesome 7 Free: style=Solid: pixelsize=16" (name=Font Awesome 7 Free, offset=0, file=/usr/share/fonts/WOFF2/fa-solid-900.woff2)
notice: Loaded font "Font Awesome 7 Brands: pixelsize=16" (name=Font Awesome 7 Brands, offset=0, file=/usr/share/fonts/WOFF2/fa-brands-400.woff2)
notice: Loaded font "Material Icons: style=Regular: pixelsize=16" (name=Noto Sans, offset=0, file=/usr/share/fonts/noto/NotoSans-Regular.ttf)
notice: Loaded font "FiraCode Nerd Font:style=Regular" (name=FiraCode Nerd Font, offset=0, file=/home/eli/.local/share/fonts/Unknown Vendor/TrueType/FiraCode Nerd Font/FiraCode_Nerd_Font_Regular.ttf)
* Bar window: 0x7000002
- bar: Reconfigure window
* bar: Restacking bar window relative to 0x0400003 with stacking mode ABOVE
* Successfully restacked bar window
- bar: Set window WM_NAME
- bar: Set window _NET_WM_WINDOW_TYPE
- bar: Set window _NET_WM_STATE
- bar: Set window _NET_WM_DESKTOP
- bar: Set window _NET_WM_PID
- bar: Map window
- background_manager: update_geometry
- background_manager: deactivating because there are no slices to observe
- bar: Draw empty bar
- bar: Setup tray manager
* Starting module/bspwm
* Starting module/date
* Starting module/powermenu
- module/bspwm: Thread id = 2
* module/bspwm: Parsing socket data: mDP-2:f8:f9:O0:LT:TT:G
- background_manager: update_geometry
- background_manager: deactivating because there are no slices to observe
- background_manager: update_geometry
- module/date: Thread id = 3
- background_manager: deactivating because there are no slices to observe

Expected behavior

The bar should fill the entire logical/visible area of the rotated and upscaled monitor as seen by the desktop—2160 pixels wide in this configuration—when width=100% is used in the bar config. Polybar should query the correct transformed/viewport geometry as exposed via RANDR or NVIDIA's virtual transform rather than just the CRTC mode dimensions.

Actual behavior

The bar on the transformed monitor (DP-2) only renders at the CRTC native width (1920) even though the logical desktop area is much larger (2160 pixels wide x 3840 tall after rotation+viewportin). The result is that the bar covers only half of the screen and does not match application windows or the desktop background. Manual width setting cannot adapt robustly to different transform setups.

Window Manager and Version

bspwm

Linux Distribution

Arch Linux (current with NVIDIA proprietary driver)

Polybar version

polybar 3.7.2

Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release
Compiler: /usr/bin/c++
Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/polybar/src=/usr/src/debug/polybar -flto=auto -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Wdeprecated-copy-dtor -Wsuggest-override
Linker flags: -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now          -Wl,-z,pack-relative-relocs -flto=auto -Wall -Wextra -Wpedantic -Wdeprecated-copy-dtor -Wsuggest-override  -Wall -Wextra -Wpedantic -Wdeprecated-copy-dtor -Wsuggest-override

Additional Context / Screenshots

Root cause: Polybar reads monitor geometry from the CRTC mode dimensions, ignoring any transforms such as rotation or viewport scaling set by NVIDIA's metamodes. The effective logical area is available via the CRTC transform (xcb_randr_get_crtc_transform) "output_virtual" fields, but Polybar does not check this and thus miscalculates the bar width on modern HiDPI or rotated/scaled setups.

Summary: Polybar should query and use output_virtual width/height if a transform is present, fallback to the mode width otherwise).

Screenshot showing partial width polybar on DP-2

Image