swaywm / swaybg

Wallpaper tool for Wayland compositors
MIT License
526 stars 32 forks source link

Swaybg doesn't recognize the output name as given by swaymsg #44

Open zsolt-donca opened 2 years ago

zsolt-donca commented 2 years ago

swaybg does not seem to recognize the output name exactly as its returned by swaymsg:

❯ swaymsg -t get_outputs
Output eDP-1 'Sharp Corporation 0x1516 Unknown' (focused)
  Current mode: 3840x2400 @ 59.994 Hz
  Position: 0,0
  Scale factor: 2.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1:  
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    3840x2400 @ 59.994 Hz

Now if I run swaybg with literally the same output name, it produces the below message and does not actually set the wallpaper:

❯ swaybg -o 'Sharp Corporation 0x1516 Unknown' -i "/home/zdonca/Pictures/wallpaper/swaying_tree_to_right.png" -m fill

2022-06-26 13:54:41 - [swaybg/main.c:256] Could not find config for output eDP-1 (Sharp Corporation 0x1516)

When omitting the word "Unknown" from the name, it actually works:

❯ swaybg -o 'Sharp Corporation 0x1516' -i "/home/zdonca/Pictures/wallpaper/swaying_tree_to_right.png" -m fill
2022-06-26 13:55:38 - [swaybg/main.c:260] Found config Sharp Corporation 0x1516 for output eDP-1 (Sharp Corporation 0x1516)

Using the id of the output (eDP-1) also works. Using the name of my external displays also work (not connected above), the issue seems to be only with my laptop's built-in display's full name.

My issue comes from azote, but I think the root cause is in swaybg.

I am using Arch Linux and the AUR package swaybg-git. At the moment of writing, my build is baesd on 69c03f6.

emersion commented 2 years ago

swaybg uses a hack: it matches the output description. "Unknown" serial number has been removed from the output description in wlroots recently.

gnull commented 1 year ago

It's worth noting that this bug creates an inconsistency between the output names the output command in Sway config expects depending on the options you use it with (I'm using @zsolt-donca's output names for the example):

# This works
output 'Sharp Corporation 0x1516 Unknown' scale 1.5
# But this doesn't
output 'Sharp Corporation 0x1516 Unknown' background picture.jpg
# So one has to do
output 'Sharp Corporation 0x1516' background picture.jpg