BlinkBP / walkpaper

Gnome-shell extension allowing user to set up different wallpapers for each workspace.
GNU General Public License v3.0
32 stars 21 forks source link

GNOME 42 Support #18

Open mlmilliman opened 2 years ago

mlmilliman commented 2 years ago

I ported walkpaper to GNOME 42 by adding '42' to the shell-version list. It functions properly as long as the appearance style is light. If you chose a dark style, then the wallpaper will not change when changing workspaces. The reason for this is that the gsetting for the wallpaper is dependent on the appearance style.

GNOME 42 added the gsetting org.gnome.desktop.background.picture-uri-dark for the path of the wallpaper when the theme is set to dark. GNOME 42's workspace manager will use that setting when the workspaces are changed with a dark theme. A new gsetting org.gnome.desktop.interface.color-scheme is used to determine the theme shade. There are two settings: prefer-light and prefer-dark. When prefer-light is set, then GNOME uses the gsetting org.gnome.desktop.background.picture-uri for selecting the wallpaper. Likewise when prefer-dark is set, then GNOME uses gsetting org.gnome.desktop.background.picture-uri-dark for selecting the wallpaper. This method allows for flexibility when creating desktop themes. Eventually themes will be switched based on time-of-day, and this setting will be useful.

In the mean time, walkpaper will not work well with dark mode themes. Simply adding logic to read org.gnome.desktop.interface.color-scheme to set the variable CURRENT_WALLPAPER_KEY to 'picture-uri' or 'picture-uri-dark' is not a complete fix because it will apply the same wallpapers no matter what theme is being used.

A better fix would be to read org.gnome.desktop.interface.color-scheme each time the function _changeWallpaper is called to determine the proper URI to set and read the path of the wallpaper from one of two arrays containing wallpaper preferences for light and dark modes. The code change to the extension is only a couple of lines but the prefs will require a bigger change to display the array of wallpapers.

Apacelus commented 2 years ago

@BlinkBP sorry for the ping, but this is still not fixed... Could you maybe archive this repo if you dont plan on continuing support?

mlmilliman commented 2 years ago

If I knew JavaScript, I'd make the change. It is pretty easy because BlinkBP wrote some clean code. I'd create an array in settings for the light and dark modes decided by the user setting. Most of the existing code remains the same. I just don't know how to create a settings GUI in JavaScript. I'd use the existing table layout except create columns for previews and paths for light and dark modes. Also I'd shorten the middle of the path name depending on the settings window size. I'm sure that there is a string function to do that in JS.

All of his logic remains as long as you decide which mode to use when you init the extension and change the wallpaper. You need to check mode whenever you change screens in case the user changed the mode just before the screen change.

Apacelus commented 2 years ago

I have a better idea. I forked the repo and replaced all the names to dark. So its dark mode only. A temporary solution until @BlinkBP fixes this repo

mlmilliman commented 2 years ago

That's one way to do it if you want to stay in dark mode. I have a service that changes the mode at sunrise and sunset. When I enable the service, I get the wrong desktop wallpapers half the time. Frankly GNOME should have supported this capability a long time ago. macOS and Windows 11 each handle different wallpapers on virtual desktops.