gergo-salyi / multibg-sway

Set a different wallpaper for the background of each Sway workspace
Apache License 2.0
29 stars 1 forks source link

Scaling does not appear to be supported #5

Closed jdownie closed 7 months ago

jdownie commented 9 months ago

My host yancy is a laptop that I often connect to a dock which has a higher resolution display on it. To cater for this I have this in my main sway config file...

set $HOSTNAME `hostname -s`
include "~/.config/sway/config.$HOSTNAME"

...and I then have this in ~/.config/sway/config.yancy...

output DP-3 scale 1.4

The output of swaymsg -t get_outputs...

Output DP-3 'LG Electronics 27MU67 0x00001D01' (focused)
  Current mode: 3840x2160 @ 30.000 Hz
  Position: 0,0
  Scale factor: 1.400000
  Scale filter: linear
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    3840x2160 @ 30.000 Hz
    1920x1080 @ 60.000 Hz
    1920x1080 @ 60.000 Hz (16:9)
    1920x1080 @ 59.940 Hz (16:9)
    1600x900 @ 60.000 Hz
    1280x1024 @ 60.020 Hz
    1152x864 @ 59.967 Hz
    1280x720 @ 60.000 Hz
    1280x720 @ 60.000 Hz (16:9)
    1280x720 @ 59.940 Hz (16:9)
    1024x768 @ 60.004 Hz
    800x600 @ 60.317 Hz
    720x480 @ 60.000 Hz (16:9)
    720x480 @ 59.940 Hz (16:9)
    640x480 @ 60.000 Hz (4:3)
    640x480 @ 59.940 Hz
    640x480 @ 59.940 Hz (4:3)

Output eDP-1 'BOE 0x0742 Unknown' (inactive)
  Available modes:
    1920x1080 @ 60.012 Hz

Initially I had my images scaled to 2160 pixels high, but when I observed this...

wallpaperScalingIssue

I resized them to 3024 high ( 2160 * 1.4) in an attempt to compensate.

These are the files that i'm currently using.

yancy 〘 ⋯/Insync/jdownie/OneDrive/Pictures/multibg-sway/DP-3 〙 
  ▸ pwd
/home/jdownie/Insync/jdownie/OneDrive/Pictures/multibg-sway/DP-3
yancy 〘 ⋯/Insync/jdownie/OneDrive/Pictures/multibg-sway/DP-3 〙 
  ▸ file *
1.png: PNG image data, 4859 x 3024, 8-bit/color RGB, non-interlaced
2.png: PNG image data, 4859 x 3024, 8-bit/color RGB, non-interlaced
3.png: PNG image data, 4859 x 3024, 8-bit/color RGB, non-interlaced
4.png: PNG image data, 4859 x 3024, 8-bit/color RGB, non-interlaced
5.png: PNG image data, 4859 x 3024, 8-bit/color RGB, non-interlaced
yancy 〘 ⋯/Insync/jdownie/OneDrive/Pictures/multibg-sway/DP-3 〙

That background behind the multibg_sway smaller image is from this line in my main config file...

output * bg "/home/jdownie/Insync/jdownie/OneDrive/Pictures/Wallpapers/Thomas Cole/Course of Empire/3. The Consummation of Empire.jpg" fill

Can you think of any workaround that I could try ?

gergo-salyi commented 9 months ago

Thank you for the report, sadly fractional scale factors don't work currently in multibg-sway.

Version 0.1.5 dealt with integer scale factors but fractional scale factors remain to be solved.

I know swaybg can do it correctly (and maybe (?) even wpaperd has code for it with the same rust library that is used here), so...

Please give me week for this, I'll try to get fractional scaling done here too

jdownie commented 9 months ago

Thanks very much. I'm very grateful for any help you can offer. Please let me know if i can help in any way.

James Downie 0483 822 712 @.***

On Mon, 5 Feb 2024 at 18:55, Gergő Sályi @.***> wrote:

Thank you for the report, sadly fractional scale factors don't work currently in multibg-sway.

Version 0.1.5 dealt with integer scale factors but fractional scale factors remain to be solved.

I know swaybg can do it correctly (and maybe (?) even wpaperd https://github.com/danyspin97/wpaperd has code for for with the same rust library that is used here), so...

Please give me week for this, I'll try to get fractional scaling done here too

— Reply to this email directly, view it on GitHub https://github.com/gergo-salyi/multibg-sway/issues/5#issuecomment-1926493251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGD3HVX6LJUAMQBWTX777TYSCM7DAVCNFSM6AAAAABCZHNAVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRWGQ4TGMRVGE . You are receiving this because you authored the thread.Message ID: @.***>

gergo-salyi commented 7 months ago

I'm sorry for the time this took. It should be fixed now in version 0.1.6 that I just released.

If if you are still interested please test it

jdownie commented 7 months ago

Ooh, I am very interested. I'm travelling at the moment, but when I get home I am looking forward to testing your latest version. Thanks so much!

jdownie commented 7 months ago

I'm sorry to say i'm not having much luck with that build. swaymsg -t get_outputs gives...

Output eDP-1 'BOE 0x0742 Unknown' (focused)
  Current mode: 1920x1080 @ 60.012 Hz
  Position: 0,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    1920x1080 @ 60.012 Hz

...so I have a folder in my Nextcloud folder for my wallpapers...

$ pwd
/home/jdownie/Nextcloud/Pictures/multibg-sway
$ tree
.
├── DP-3
│   ├── 1.png
│   ├── 2.png
│   ├── 3.png
│   ├── 4.png
│   └── 5.png
├── DP-3.new
│   ├── 1.png
│   ├── 2.png
│   ├── 3.png
│   ├── 4.png
│   └── 5.png
├── DP-3.old
│   ├── 1.png
│   ├── 2.png
│   ├── 3.png
│   ├── 4.png
│   └── 5.png
└── eDP-1
    ├── 1.jpg
    ├── 2.jpg
    ├── 3.jpg
    ├── 4.jpg
    └── 5.jpg

5 directories, 20 files

Those files that are in the eDP-1 folder are attached...

eDP-1.zip

When I run...

$ /home/jdownie/.cargo/bin/multibg-sway /home/jdownie/Nextcloud/Pictures/multibg-sway/

Nothing happens, well nothing that I can observe. I know nothing about Rust, so maybe there's an environment variable that I can set to give you more details on what's happening on my end.

I'm running Fedora 39 Sway Atomic BTW.

Thanks again for your effort on this. I'm happy to help if you're still keen.

gergo-salyi commented 7 months ago

Nothing happens, well nothing that I can observe. I know nothing about Rust, so maybe there's an environment variable that I can set to give you more details on what's happening on my end.

Yes, run it with environment variable RUST_BACKTRACE=1 and RUST_LOG=trace set please. Does it just hang forever without a crash?

jdownie commented 7 months ago

Cool, thanks...

$ /home/jdownie/.cargo/bin/multibg-sway /home/jdownie/Nextcloud/Pictures/multibg-sway/
[2024-03-28T21:02:53Z DEBUG sctk] Bound new global [31] wp_viewporter v1
[2024-03-28T21:02:53Z DEBUG sctk] Bound new global [44] wl_output v4
[2024-03-28T21:02:53Z DEBUG sctk] Bound new global [8] zxdg_output_manager_v1 v3
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Argb8888
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Xrgb8888
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Xbgr8888
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Abgr8888
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Bgr888
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Rgbx4444
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Rgba4444
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Rgbx5551
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Rgba5551
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Rgb565
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Xbgr2101010
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Abgr2101010
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Xbgr16161616f
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Abgr16161616f
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Xbgr16161616
[2024-03-28T21:02:53Z DEBUG sctk] supported wl_shm format Abgr16161616
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] New output, name: eDP-1, resolution: 1920x1080, integer scale factor: 1, logical size: 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Output 'eDP-1' needs no scaling
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Using pixel format: Bgr888
[2024-03-28T21:02:53Z DEBUG multibg_sway::image] Resizing image '1' from 1735x1080 to 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::image] Resizing image '2' from 1735x1080 to 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::image] Resizing image '3' from 1735x1080 to 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::image] Resizing image '4' from 1735x1080 to 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::image] Resizing image '5' from 1735x1080 to 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Loaded 5 wallpapers on new output for workspaces: 1, 2, 3, 4, 5
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Shm slot pool size for output 'eDP-1' after loading wallpapers: 48600 KiB
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] New sum of shm slot pool sizes for all outputs: 48600 KiB
[2024-03-28T21:02:53Z TRACE mio::poll] registering event source with poller: token=Token(0), interests=READABLE
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Configured layer on output: eDP-1, new surface size 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Ignoring configure for already configured layer on output: eDP-1, new surface size 1920x1080
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 1
[2024-03-28T21:02:53Z DEBUG multibg_sway::wayland] Ignoring configure for already configured layer on output: eDP-1, new surface size 1920x1080
gergo-salyi commented 7 months ago

That looks normal, the same that I see.

So... If you start it like this and try switching between the ~desktops~ sway workspaces you should keep getting the Setting wallpaper on output 'eDP-1' for workspace: XXX logs, but nothing happens? The background just stays the default gray?

jdownie commented 7 months ago

Nope, i see what you're referring to...

2024-03-28T22:35:47Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 1
[2024-03-28T22:35:52Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 2
[2024-03-28T22:35:52Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 3
[2024-03-28T22:35:52Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 4
[2024-03-28T22:35:52Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 5
[2024-03-28T22:35:53Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 1

I do have a wallpaper set in my sway config. Could that be superseding your app?

jdownie commented 7 months ago

Actually, I just noticed this...

[2024-03-28T22:31:29Z DEBUG multibg_sway::wayland] Ignoring configure for already configured layer on output: eDP-1, new surface size 1920x1080

I'll comment out my wallpaper config and reload.

jdownie commented 7 months ago

I had this in my config...

output * bg "/home/jdownie/Nextcloud/Pictures/multibg-sway/eDP-1/1.png" fill

...but i've commented that out and reloaded. I'm still getting this output...

$ /home/jdownie/.cargo/bin/multibg-sway /home/jdownie/Nextcloud/Pictures/multibg-sway/
[2024-03-28T22:39:14Z DEBUG sctk] Bound new global [31] wp_viewporter v1
[2024-03-28T22:39:14Z DEBUG sctk] Bound new global [44] wl_output v4
[2024-03-28T22:39:14Z DEBUG sctk] Bound new global [8] zxdg_output_manager_v1 v3
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Argb8888
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Xrgb8888
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Xbgr8888
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Abgr8888
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Bgr888
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Rgbx4444
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Rgba4444
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Rgbx5551
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Rgba5551
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Rgb565
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Xbgr2101010
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Abgr2101010
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Xbgr16161616f
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Abgr16161616f
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Xbgr16161616
[2024-03-28T22:39:14Z DEBUG sctk] supported wl_shm format Abgr16161616
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] New output, name: eDP-1, resolution: 1920x1080, integer scale factor: 1, logical size: 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Output 'eDP-1' needs no scaling
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Using pixel format: Bgr888
[2024-03-28T22:39:14Z DEBUG multibg_sway::image] Resizing image '1' from 1735x1080 to 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::image] Resizing image '2' from 1735x1080 to 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::image] Resizing image '3' from 1735x1080 to 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::image] Resizing image '4' from 1735x1080 to 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::image] Resizing image '5' from 1735x1080 to 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Loaded 5 wallpapers on new output for workspaces: 1, 2, 3, 4, 5
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Shm slot pool size for output 'eDP-1' after loading wallpapers: 48600 KiB
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] New sum of shm slot pool sizes for all outputs: 48600 KiB
[2024-03-28T22:39:14Z TRACE mio::poll] registering event source with poller: token=Token(0), interests=READABLE
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Configured layer on output: eDP-1, new surface size 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Ignoring configure for already configured layer on output: eDP-1, new surface size 1920x1080
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 1
[2024-03-28T22:39:14Z DEBUG multibg_sway::wayland] Ignoring configure for already configured layer on output: eDP-1, new surface size 1920x1080
[2024-03-28T22:39:21Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 2
[2024-03-28T22:39:21Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 3
[2024-03-28T22:39:21Z DEBUG multibg_sway::wayland] Setting wallpaper on output 'eDP-1' for workspace: 1

Your app is displaying 1.jpg, but isn't switching to 2.jpg when I jump to workspace 2 (for example).

gergo-salyi commented 7 months ago

I hate to ask this, but all the 1.jpg ... 5.jpg that you attached here before in eDP-1.zip are the same picture as I can see. Are you sure about them?

This is my _wallpaperdir, test it please too: wallpaper.zip

gergo-salyi commented 7 months ago

Also $ pkill swaybg and verify that swaybg is not running (eg. not being restarted in a loop by some Fedora desktop config I don't know about).

Sway silently allows multiple background layers which get randomly ordered and occlude each other if they are. There must be no other wallpaper app running than 1 instance of multibg-sway

jdownie commented 7 months ago

You were right. My files were no good. So far i've just been testing on my laptop display alone. I'll let you know how I go when I get back to my dock and external display. Thanks for your patience.

jdownie commented 7 months ago

It's working perfectly! Thanks so much for all of your help.