anufrievroman / waypaper

GUI wallpaper manager for Wayland and Xorg Linux systems
https://anufrievroman.gitbook.io/waypaper
GNU General Public License v3.0
338 stars 18 forks source link

Support for Hyprpaper #7

Closed polonel closed 3 months ago

polonel commented 1 year ago

Any ETA on support for Hyprpaper?

anufrievroman commented 1 year ago

Hi, while Hyprland user myself, I have several problems with hyprpaper. Basically, this tool is very different from all other wallpaper tools, and frankly is pretty weird! For example, "A Wallpaper cannot be applied without preloading. The config is not reloaded dynamically". So, there are a few problems it creates:

1) hyprpaper does not even start without user first making proper config. 2) It can only load wallpapers 'preloaded' from that config, i.e. we cannot just pass any image path. 3) There is no interface like hyprland imagepath.jpg to set a wallpaper, so waypaper can't really use it like all other wallpaper tools. Instead, I'd need to edit user's config files to make it work, or something like that.

So, as far as I understand, hyprpaper is a truly minimalist tool for loading specific wallpapers to specific workspaces at the start of Hyprland and is not really meant to change wallpapers on the flight. If I misunderstand something here, please correct me :)

mindstormjak commented 1 year ago

Hi, while Hyprland user myself, I have several problems with hyprpaper. Basically, this tool is very different from all other wallpaper tools, and frankly is pretty weird! For example, "A Wallpaper cannot be applied without preloading. The config is not reloaded dynamically". So, there are a few problems it creates:

  1. hyprpaper does not even start without user first making proper config.
  2. It can only load wallpapers 'preloaded' from that config, i.e. we cannot just pass any image path.
  3. There is no interface like hyprland imagepath.jpg to set a wallpaper, so waypaper can't really use it like all other wallpaper tools. Instead, I'd need to edit user's config files to make it work, or something like that.

So, as far as I understand, hyprpaper is a truly minimalist tool for loading specific wallpapers to specific workspaces at the start of Hyprland and is not really meant to change wallpapers on the flight. If I misunderstand something here, please correct me :)

@anufrievroman You can use hyprctl or other hyprland ipc interface to load/unload and set a wallpaper (speeking as a hyprland and hyprpaper user). For example with hyprctl, use this to change to a new wallpaper and unload the previous one:

hyprctl hyprpaper preload /path/to/wallpaper
hyprctl hyprpaper wallpaper MONITOR,/path/to/wallpaper
hyprctl hyprpaper unload /path/to/wallpaper

To set a wallpaper for all monitors remove the monitor part in the command, to list all monitor names use hyprctl monitors

polonel commented 1 year ago

I'm currently doing this with scripts, but I wanted a GUI to select the wallpaper.

anufrievroman commented 1 year ago

Hmm, that's interesting, thank you, I'll take a look then. But, this will only work on hyprland, right? I mean only when hyprctl is available?

xz-dev commented 1 year ago

Hmm, that's interesting, thank you, I'll take a look then. But, this will only work on hyprland, right? I mean only when hyprctl is available?

Perhaps no one use hyprpaper in other window manager or desktop environment

anufrievroman commented 1 year ago

I tested it a bit, and so far I see a few problems: 1) hyprpaper does not start without a config file and it does not work without a proper (non-empty) config file. So the user would have to configure it with at least one wall paper before using waypaper. I'd much prefer if hyprpaper could start the demon without config file, but I guess we can live with that. 2) I was unable to run it without specifying a monitor DP-1. @mindstormjak mentioned that you can set wallpaper for all monitors, but I tried many versions of the command and only hyprctl hyprpaper wallpaper DP-1,/path/to/wallpaper worked for me. Am I missing something? 3) It's less important, but hyprpaper does not seem to support neither fitting options (fill, fit, etc) nor backgound color like other backends. So again the experience is somewhat inferior.

If anyone has any comments, especially about first two issues, please :)

RyanOrigens commented 12 months ago

I'm also waiting for it, you could try to ask the devs of hyprland maybe they can implement it or make a pull request yourself.

anufrievroman commented 12 months ago

It is possible, of course, to work with hyprpaper to make it more usable, but may I ask everybody, is there any specific reason you prefer to use hyprpaper and not swww or swaybg? I mean, it's not even ships with Hyprland, you need to install it separately, so why not simply install swww, which has support for many things and works pretty well. Is it about the per workspace wallpapers?

RyanOrigens commented 12 months ago

It may well be because of the name, it seems like it is the package was supposed to be used on hyprland, and also everybody seems to be willing to lose their time trying to figure out a way to use it with hyprpaper rather than just switch to one of those. Who will understand the human being!

anufrievroman commented 3 months ago

Thanks to @nikolaizombie1 preliminary work to make hyprpaper work is done. I think now the version in main should support setting wallpapers. Here a few remaining problems:

  1. Selection of monitor is currently available only if swww is installed, because it's done via swww-daemon. Need to make it independent, perhaps via hyprctl
  2. As I understand, fill types, background colors etc are not supported by hyprpaper. Need to remove those buttons when this backend is selected.
  3. Creating a config file is needed for hyprpaper to work, so maybe there could be a popup message about it or something like that.
nikolaizombie1 commented 3 months ago

Hello and thank you accepting my pull request @anufrievroman .

  1. Selection of monitor is currently available only if swww is installed, because it's done via swww-daemon. Need to make it independent, perhaps via hyprctl

I just created a new pull request separating the hyprpaper backend from sww.

  1. As I understand, fill types, background colors etc are not supported by hyprpaper. Need to remove those buttons when this backend is selected.

This is correct. hyprpaper only supports display names and images, no fill options or colors.

  1. Creating a config file is needed for hyprpaper to work, so maybe there could be a popup message about it or something like that.

This isn't strictly necessary. Although the hyprpaper documentation does not explicitly mention using hyprpaper without hyprpaper.conf I tested this on my Arch installationand it worked just fine. hyprpaper.conf only is there to set the wallpapers without invoking hyprctl hyprpaper directly.

anufrievroman commented 3 months ago

I see, okay. Thank you very much for PR, sorry I wasn't able to check it today, I'll try to get to it as soon as I can.

nikolaizombie1 commented 3 months ago

It's all good. You can check on them whenever you can.

Also I did some more research and there are some options that cannot be set using hrprctl hrprpaper, those being

  1. splash
  2. splash_offset
  3. splash_color
  4. ipc

At the very least a note in the should be added that that these options are only available in the config file.

anufrievroman commented 3 months ago

Thank you again for the latest commits, it seems to work, but for me it does not really work "out of the box", I'm getting some hyprpaper error and I wonder if that just lacks this library, or it's something else:

hyprpaper: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by hyprpaper)
hyprpaper: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by hyprpaper)
hyprpaper: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /usr/lib/libhyprlang.so.2)
Couldn't connect to /tmp/hypr/f27873a6f06dc2f87600edb890f3c38298bfb55f_1716422609/.hyprpaper.sock. (3)
Couldn't connect to /tmp/hypr/f27873a6f06dc2f87600edb890f3c38298bfb55f_1716422609/.hyprpaper.sock. (3)
nikolaizombie1 commented 3 months ago

That’s odd. What distribution are you using to run hyprland and hyprpaper? I did my testing on Arch and it worked fine. I’m going to test it on Nixos tomorrow and see if I can replicate the error.

anufrievroman commented 3 months ago

Actually it turned out to be a global problem on my system, so disregard.

anufrievroman commented 3 months ago

So, now the hyprpaper works for me, but not really :D If I naively run waypaper it doesn't change the wallpaper due to:

Couldn't connect to /tmp/hypr/84ab8d11e8951a6551d1e1bf87796a8589da6d47_1716165482/.hyprpaper.sock. (3)
Couldn't connect to /tmp/hypr/84ab8d11e8951a6551d1e1bf87796a8589da6d47_1716165482/.hyprpaper.sock. (3)

which I suppose is a common issue with hyprpaper.

I investigated and if I create a proper config of hyprpaper it launches and sets the wallpaper, but it reports that:

[ERR] Couldn't listen on the hyprpaper Socket. (3) IPC will not work.

So, without IPC, the changing wallpaper vie hyprctl doesn't work, so waypaper doesn't work. I understand that it's my personal problem with hyprpaper at this point, but would be nice to know what is the reason and maybe mention it in the documentation before we officially release hyprpaper support.

anufrievroman commented 3 months ago

On the sidenote, I noticed that while hyprpaper is running, if we change backend to swww, we can't set the wallpaper (or it remains behind the hyprpaper one), so will need add killall hyprpaper to the swww part of the changer.py, similar to how we deal with killing swaybg.

nikolaizombie1 commented 3 months ago

Thank you again for the latest commits, it seems to work, but for me it does not really work "out of the box", I'm getting some hyprpaper error and I wonder if that just lacks this library, or it's something else:

hyprpaper: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by hyprpaper)
hyprpaper: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by hyprpaper)
hyprpaper: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /usr/lib/libhyprlang.so.2)
Couldn't connect to /tmp/hypr/f27873a6f06dc2f87600edb890f3c38298bfb55f_1716422609/.hyprpaper.sock. (3)
Couldn't connect to /tmp/hypr/f27873a6f06dc2f87600edb890f3c38298bfb55f_1716422609/.hyprpaper.sock. (3)

This would be great to document in a troubleshooting section of the README. A user might encounter the same problem and think that waypaper is defective.

So, without IPC, the changing wallpaper vie hyprctl doesn't work, so waypaper doesn't work. I understand that it's my personal problem with hyprpaper at this point, but would be nice to know what is the reason and maybe mention it in the documentation before we officially release hyprpaper support.

I see, having inter process communication (IPC) enabled is required for hyprctl to communicate with hyprpaper. Having a troubleshooting section in the README to ensure that IPC enabled when using the hyprpaper backend would allow users to manually enable the feature without forcing a config file that we would choose.

On the sidenote, I noticed that while hyprpaper is running, if we change backend to swww, we can't set the wallpaper (or it remains behind the hyprpaper one), so will need add killall hyprpaper to the swww part of the changer.py, similar to how we deal with killing swaybg.

I will quickly implement this fix as well.

anufrievroman commented 3 months ago

Also, if I understood correctly, currently, we are preloading and setting wallpapers but never unloading them, so the hyprpaper just keeps them in RAM. I guess after setting new wallpaper we can try to unload previous wallpaper for the given monitor. Is it just hyprctl hyprpaper unload all?

anufrievroman commented 3 months ago

I did the killall hyprpaper fix as well as options hiding on hyprpaper and unloading old wallpapers. Still, I have this bug, so I can't really test hyprpaper backend. Please report if that work for you. Would be nice to know that it works for many people before we officially release this feature.

Edit: Personally, I always have this issue with hyprpaper. Supposed to be fixed in the next version.

nikolaizombie1 commented 3 months ago

I did the killall hyprpaper fix as well as options hiding on hyprpaper and unloading old wallpapers. Still, I have this bug, so I can't really test hyprpaper backend. Please report if that work for you. Would be nice to know that it works for many people before we officially release this feature.

Will do.

anufrievroman commented 3 months ago

Finally, I made it work (with all the updates of all systems), but the only remaining issue that I experience is that the wallpaper changes only if I select the monitor (eDP-1), while if I keep it "All" the wall paper does not change. Does it work for you?

In the code everything seems fine, we set it as "" if monitor is "All", so it should work...

Edit: I tested and basically command hyprctl hyprpaper wallpaper ",~/image.jpg" simply doesn't work (like that), only with specific monitor name. Is it just on my system or someone else can confirm that?

fabiomatos999 commented 3 months ago

Finally, I made it work (with all the updates of all systems), but the only remaining issue that I experience is that the wallpaper changes only if I select the monitor (eDP-1), while if I keep it "All" the wall paper does not change. Does it work for you?

As far as I remember it did function correctly but I'll check first thing tomorrow and see if it works as intended.

anufrievroman commented 3 months ago

I did more testing on another machine and with multiple monitors. Basically, sometimes it works, sometimes it fails randomly. I think at least part of the problem is that I often get ICP message that:

wallpaper failed (not preloaded)

This probably means that it has not enough time to preload. So, we should either increase sleep time, or even better, somehow make sure that it's preloaded before requesting the change. Maybe we can simply sequence preload && change commands?

nikolaizombie1 commented 3 months ago

Finally, I made it work (with all the updates of all systems), but the only remaining issue that I experience is that the wallpaper changes only if I select the monitor (eDP-1), while if I keep it "All" the wall paper does not change. Does it work for you?

In the code everything seems fine, we set it as "" if monitor is "All", so it should work...

Edit: I tested and basically command hyprctl hyprpaper wallpaper ",~/image.jpg" simply doesn't work (like that), only with specific monitor name. Is it just on my system or someone else can confirm that?

I've tracked down the source of the bug. Here are the steps to reproduce:

  1. Turn on waypaper
  2. Select a wallpaper for All monitors
  3. Switch to a specific monitor in the drop down
  4. Change the wallpaper on that specific monitor
  5. Switch back to the All option
  6. Try to change wallpaper
  7. Wallpaper fails to set on the monitor that was changed individually

The bug is caused by hyprpaper and not waypaper. If you look at the output of hyprpaper in the console after reproducing the bug, the wallpaper is being preloaded but not set for the monitor that was addressed individually. It works for the other ones that were not addressed individually but not for the ones that were addressed individually. I do not know if this is intended behavior on the part of hyprpaper. A potential fix is to kill hyprpaper each time a wallpaper is set but that is not ideal in the slightest. I will report this bug to hyprpaper and see if this is intented behavior.

Edit: I raised the issue with hyprpaper here.

nikolaizombie1 commented 3 months ago

A hyprpaper contributor responded and said that the it is indeed intended behavior. The ,WALLPAPER syntax is a fallback only and is meant to be overwritten. I suggest removing the All option for monitors for waypaper on the hyprpaper backend since hyprpaper does not officially support it.

anufrievroman commented 3 months ago

Thank you for investigation! I see, it's weird but okay, if Vaxry says so ¯⁠\⁠⁠(⁠ツ⁠)⁠⁠/⁠¯. Then yes, let's just remove All from options. I'll try to look into it today or tomorrow. If you know how to do it (it's when we check for available monitors) feel free to add it to the current PR.

anufrievroman commented 3 months ago

Thanks to all the efforts by @nikolaizombie1 I am happy to announce that hyprpaper support seems to be fully functional in current main branch. I'll make some minor refactoring and we can publish this release 🎉