Giter VIP home page Giter VIP logo

lwp's Introduction

Layered WallPaper

Layered WallPaper allows You to create multi-layered parallax wallpapers.
Each layer moves with Your mouse cursor, creating this beautiful effect.

InstallationConfigurationCreating Wallpapers

a.mp4

Installation

Linux

Dependencies

  • Install SDL2 using Your package manager
  • If You are using Wayland, You also must install XWayland

Installation steps

  • Download .tar.gz package from releases
  • Extract the content to /usr/local:
sudo tar -o -xvf [archive name].tar.gz --directory /usr/local
  • Note that if You install lwp somewhere else than /usr/local, You need to set LWP_PREFIX env before running lwp.
  • Test Layered WallPaper by running lwp
  • Run lwp, then run it again to open the configuration window. Select wallpaper for each monitor.
  • If You can't see any wallpaper try setting Draw on root window in application settings. This may be necessary on some distributions for Layered WallPaper to work properly (see configuration)
  • To make Layered WallPaper run on startup, add lwp & command to Your desktop enviroment .rc file

Build from source instead

  • In some distributions SDL2 doesn't contain development files, so it may be also necessary to install development version of SDL2
  • Install CMake
  • Clone the repository and prepare a build directory:
git clone https://github.com/jszczerbinsky/lwp
cd lwp
mkdir build
cd build
  • Compile the project and generate a .tar.gz package
cmake ../
cmake --build .
cpack
  • After this .tar.gz package should appear. Follow the installation steps
Windows

Installation steps

  • Download and run the installer from releases
  • Layered WallPaper should run immediately after the installation
  • Click the tray icon on the right side of Your taskbar to show the configuration window. Set the wallpapers for each monitor

Build from source instead

To compile Layered WallPaper on Windows you need to install MSYS2. After the installation follow the guide for setting up GTK development enviroment. From now on continue using MSYS2 MinGW terminal (make sure you're using MSYS2 MINGW64/MSYS2 MINGW32 instead of MSYS2).

Install the remaining dependencies
# For 64bit:
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2 mingw-w64-x86_64-gcc mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libconfig

# For 32bit:
pacman -S mingw-w64-i686-cmake mingw-w64-x86_i686-SDL2 mingw-w64-x86_i686-gcc mingw-w64-x86_i686-gtk3 mingw-w64-x86_i686-libconfig
Clone the repository
git clone https://github.com/jszczerbinsky/lwp
cd lwp
mkdir build
cd build
Compile and install
  • Download SDL2 runtime package and unpack it.
  • Compile the program
# Remember to use unix path format (instead of C:/path/to/dir use /c/path/to/dir)
cmake -DSDL2_RUNTIME_DIR=/path/to/dir ../
cmake --build .
# Prepare the DLLs, that will be shipped with the program.
# The script is going to ask you which version of gdbus.exe should it use (32bit or 64bit)
../distributeDLLs.sh
cpack

After this the installer should appear in the current directory.

Configuration

Open configuration window

  • On Linux when lwp is already running in the background, run lwp again to show the window.
  • On Windows You can click the icon on the right side of the task bar.

Installing wallpapers

  • To install wallpaper, copy the directory to %LOCALAPPDATA%\lwp\wallpapers\

Creating Wallpapers

Want to share Your wallpaper? Join our discord!

Parallax wallpapers are not popular. Because of this if You want some cool parallax wallpaper, You have to either find a parallax game background on the internet and use it as a wallpaper or cut some real wallpaper into layers using Gimp or Photoshop.

How to create a wallpaper for Layered WallPaper

  • Create a directory for Your wallpaper
  • Save each layer to this directory as .bmp file and name them 1.bmp, 2.bmp ... (1.bmp is bottom most layer)
  • Create a wallpaper config file and name it wallpaper.cfg (You can make a copy from C:\Program Files\lwp\wallpapers\default-fullhd\wallpaper.cfg)

Example:

File structure:

C:
 └  MyCoolWallpaperDirectory
         └  wallpaper.cfg
         └  1.bmp
         └  2.bmp
         └  3.bmp

Config file:

Type Name Description
int count Wallpaper layers count
float movement_x Mouse sensitivity in X axis
float movement_y Mouse sensitivity in Y axis
int repeat_x Repeat the wallpaper in X axis
int repeat_y Repeat the wallpaper in Y axis

License

MIT License

Copyright (c) 2022 Jakub Szczerbiński

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

lwp's People

Contributors

hoellwerth avatar jszczerbinsky avatar mshockwave avatar raiondesu avatar splittydev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lwp's Issues

Add possibility to use images "larger" than screen

I'm making a wallpaper with images that are 2700x1080, but my screen is 1920x1080, so the layers get squeezed a bit and break all the parallax effect because the "edges" of each layer appears and get also repeated

This is what the wallpaper looks like
image

This is how it should look
Scharnhorst_960

is this even doable with windows ?

Doesn`t work (windows 10)

After installation I should immediately get a parallax wallpaper, right? Or do I need to configure something first depending on the screen? Program immediately starts, but without paralax wallpaper

Windows 11 config file problem

image
The essence of the problem is shown in the picture. I run the program through the standard settings of your configuration file and the parser of your program does not read the configuration file, freezing at a certain moment. For clarity, I ran it through bash, but it also freezes during normal launches. Installed your program through the Windows installer

Renders above desktop icons in KDE Plasma

Had to use display manager x11 since wayland does not work (see other issue). But As title said, desktop icons disappear. I found a similar repo that enables live wallpapers, and to fix this they used this command.
gsettings set org.gnome.desktop.background show-desktop-icons true || true
gsettings set org.nemo.desktop show-desktop-icons true || true

However, I am on x11 kde not using gnome. So, I tried to remake this command for this display manager by asking chatgpt since i know nothing about this section myself lol. Anyways, the command actually seemed to work surprisingly. here it is.

kwriteconfig5 --file ~/.config/plasma-org.kde.plasma.desktop-appletsrc --group Containments --group 1 --group General --group ShortcutsContainment --group ActionPlugins --group 0 --group Shortcuts --group 49 --group Data --key enabled --type bool true || true
Anyways, help would be appreciated!

Does not seem to work for me

Hello, seems to be a very cool project.

But does not work for me at all neither in Ubuntu nor in Windows 11.
I mean the program is launched but wallpaper not changed.

PS : I'm in multiple monitors

macOS Support

Hey, it seems that macOS support was removed in 8ff13a4. Is there a specific reason for that?
Just curious, as I'm the guy who added support for macOS in the first place in February 2023.

Larger default wallpaper

My monitor is 5120x1440. I really like the default wallpaper, but when I scale up the default wallpaper in the config, it looks stretched and pixelated:

image

I realize my display is much wider than most have (it's the same physical size as two 27" monitors side-by-side though), so I wouldn't mind if the image gets cropped. But it'd be nice if it wasn't pixelated. Any thoughts?

PS. This is a fun project, and was so easy to set up and use. Thanks!

Make smoothing work on a sub-pixel level.

Movements are choppy for layers with low movement speeds, and move full pixels at a time when you move the mouse slowly.

The primary reason I installed this was just to have one background layer that moves a few pixels as you move the mouse across the screen, but I discovered that the movements are not smooth and instead snap to the nearest pixel.

Smoothing doesn't really help, since it actually speeds up movement, and requires a base speed to be decently high enough to work. It doesn't do any processing on a sub pixel level to keep things looking nice.

Would you like some more demos?

Cool project! I saw on hacker news, thought it was really cool and had a play around. I made some wallpapers; one using an underwater photo that I took and one with corporate branding...

I wondered if you would like either of these as demos?

This is a small version of the original file, fish float around in the wallpaper:
RIMG3269-sml

not covering the full desktop

see my desktop

Its not covering the whole desktop area, also provide the instructions to remove this program from the computer(btw I've already done, just suggesting you).

Mouse position is off by 390 px from the left

Now that my wallpaper is working properly, i noticed the "correct" values it's supposed to work within (0, 1920) doesn't start at position 0 but at 390 px, i do not know if it's related to the "monintorX_1=-390" value,

is this a mistake from my part ?

GUI Tab to download user created Wallpapers

So on some site with free host of files there could be user hosted images like .bmp and one for preview with all layers merged so it can be shown in the GUI of app.
I gues it is a must since there are not much parallax images out there in internet. And most of it directs to android apps or sizes.
I see it just like KDE backgrounds from users.

How much .bmp are supported?

So how much images I can stuck on top of each other? Is it going to reduce performance or there is limit on them, or it will just crash an app after some amount?

Fix MSVC incompatibilities

When compiling with MSVC there are some bugs like not working escape sequences and debug console impossible to hide

Automatic Parallax

Context

This may be a far-fetched idea, given that I am unaware of the technical challenges involved. However, I believe that this project's ease of use would greatly improve by adding parallax effects to the image input automatically.

The process of creating parallax wallpapers is time-consuming and varies depending on the wallpaper. It also requires a high level of skill from the user.

An example of such a project would be Lively Wallpaper, which is using machine learning (Midas) combined with parallax.js to accomplish that. The user just needs to specify the image and the software does everything else.

Commands

lwp img file.png // this should automatically add the parallax and set the wallpaper
lwp init | lwp start
lwp kill | lwp end

Support for Wayland

Cool project!

You mentioned on HN that it doesn't support Wayland yet, but you're planning to add that support at some point.

Just creating an issue to track it :)

Fix parser bugs

When monitor1_wallpaper_x line is present before monitor1_wallpaper, then its value is set for monitor1_wallpaper

does not work with picom

Black screen when started with picom.
i3,
arch 6.2.7-arch1-1,
picom version: vgit-b700a
picom without configuration

Movement "multiplier"

After testing the sensitivity per layer, i noticed that i need to divide the value i had by a 1000

Could it be possible to have a "movementMultiplier" for all the movements, so my script can just write the same value without dividing

Doesn’t automatically works on Gnome DEs.

So to make it work we need to change reload_rootwindow to 1. Could your app autodetect which DE is used and then change config on it’s own, or place needed default config. Like 2 configs to choose in the moment of install one with reload_rootwindow set to 0 and other where it is 1. The if DE is known to cause this issue you place needed config. DE can be detected by neofetch so I gues it is easy task to do.

Make mouse position stop at screen edge

I have two screens and when the mouse goes to the other screen, the mouse position is now too high for my wallpaper to "work"
could it be possible to limit the position between the xywh values of each monitor (no overflow)

So putting the mouse between the two screen would make my left screen "look" right, and the right one "look" left, but not further

Layer with same sensitivity doesn't move the same distance

Two of my layers have the same sensitivity value, but one move more than the other

It seem that each sensitivity "depend" of another at some point, because this is what the wallpaper is supposed to look like

mouse on the left edge
image
mouse on the right edge
image

And this is the result i get
https://cdn.discordapp.com/attachments/879979752658718760/1074277420020023316/2023-02-12_11-34-22.mp4
You can see the tips of this water spall is moving compared to the "matt" of the ship behind, Those two layers, 10 and 17 both have a sensitivity of -0.001, so they should move the same amount right ?

Optimisation

Just installed, and loving it ! Seriously it rocks good job.

However in VB I got a high cpu usage (40-50%), got to try an install on my laptop to see if it's better. Though a little about it, and wanted to ask if you ever thought to replace in main.c

SDL_Delay(1000 / cfg.targetFPS); by SDL_WaitEvent

to reduce gpu use when we don't use our mouse (knowing that we implement your solution on rice, with a lot of control keys, we don't use the mouse this much).

Also a friend of mine pointed out that the overuse of call on root window may not be for the best. Don't know the options on this, but if we can make use of the GPU, this should optimise and decrement cpu usage again.

Going to fork this and try to implement it later on with a PR, let me now if that sounds right, or if you already inspected those options and they are pointless.

Easier wallpaper "selection"

Instead of using 1 config file to select the image folder and list the settings, it would be better to have 1 config file "for" the wallpaper, like sensitivity, count and smooth.

And a "general" config that would say what wallpaper goes where, the dimension of the monitors and their count.

the general one would contain the path for the wallpaper config file (which is in the same folders as the images it needs)

Add possibility for multiple "sensitivity"

I am trying to make some parallax wallpapers, i have a dozen layers per wallpaper, but each one of them have a different "sensitivity"
i found the exact "formula" for the position of each image according to the mouse position.

the formula i use for the x position of the upper left corner of each image is (screenWidth * (cursorPosXPercent - 50) / 100 * sensitivity)

Could it be possible to add a way to give each layer a number ?

Linux installation

Hi, I've stumbled across this tool, and it works really well for what it does. Thanks a lot for making it, there's a serious lack of good wallpaper engines on linux in general.

However, I have a bit of a problem with the installation instructions. I know distribution on linux is complicated, especially for people who aren't too familiar with the ecosystem, but there's a few rules that should be kept in mind, and I hope you don't mind me explaining.

Primarily, unzipping files straight into / is just a bad idea. This is for the same reason that running things like sudo pip install is: The /usr structure is supposed to only be managed by the system's package manager, and installing files that could conflict with, or overwrite files managed by it can lead to breakage, and long nights spent troubleshooting. This program is relatively innocuous, as it doesn't install things in key directories that change system behavior, and finding its files for removal isn't too difficult, but there's designated places to install user-provided software not managed by the package manager, such as /opt and /usr/local, so it'd be better to make use of those. More and more distributions are making /usr read-only for this reason.

Aside from that, I've noticed that both /etc and $HOME/.config are hardcoded. While these locations are conventional, there's conventions to provide methods of modifying them, as well. For /etc it's usually a sysconfdir variable in makefiles, -DCMAKE_INSTALL_SYSCONFDIR in cmake, and --sysconfdir in both autotools and meson. Doing so would allow someone to use /usr/local/etc to install the default config file and keep this package completely separate. For $HOME/.config, there's the relatively small XDG base directory specification, which recommends trying $XDG_CONFIG_HOME before falling back to $HOME/.config (it's completely OK, and even preferable to use getenv("HOME") for this).

And lastly, a side-note about the current makefile build system, it's generally recommended to use pkg-config to query information about linker paths and filenames, for example through pkg-config --cflags --libs sdl2. This is due to the fact that libraries might be installed in non-standard locations, and require certain compiler options to function correctly. Additionally, hardcoding gcc is discouraged as the user may use a different compiler, or even try to cross-compile, and make already initializes the $(CC) variable properly, which you should use. There's this and many other similar subtleties that may make a project more difficult to compile or package in linux distributions.

Thankfully, modern build systems take care of all of this these days, so I've written a simple meson.build script that solves all of the concerns above, and allows you to use the SYSCONFDIR define to find the default configuration file, and very likely works on windows without modifications:

project('lwp', 'c',
  version : '1.5')

deps = []
deps += dependency('sdl2')
deps += dependency('x11')

c_args = []
c_args += '-DSYSCONFDIR=' + (get_option('prefix') / get_option('sysconfdir'))

executable('lwp',
  'main.c',
  'wallpaper.c',
  'window.c',
  'parser.c',
  'debug.c',
  c_args : c_args,
  dependencies : deps,
  install : true)

install_data('default.cfg',
  rename : 'lwp.cfg',
  install_dir : get_option('sysconfdir'))
install_subdir('wallpapers',
  install_dir : get_option('datadir') / meson.project_name())

By default, this installs everything to /usr/local, but allows anyone to pick an installation location through the meson setup --prefix parameter. The big advantage of having this is that meson provides a high guarantee that software built with it can be packaged effortlessly for different distributions, as they commonly have well supported presets for meson projects. Of course, CMake works too, if you prefer something that's better supported in the windows world.

If you use configure_file() you may even generate the correct wallpaper path inside lwp.cfg at build time.

Can't run on Fedora 37 (GNOME, Wayland)

I extracted files by guide and after lwp I'm getting:

INFO: Starting Layered WallPaper
INFO: Loading config file
INFO: User config file not found, opening default config instead
INFO:   monitors: 1
INFO:   smooth: 8.000000
INFO:   target_fps: 60
INFO:   reload_rootwindow: 0
INFO:           monitor1_x: 0
INFO:           monitor1_y: 0
INFO:           monitor1_w: 1920
INFO:           monitor1_h: 1080
INFO:           monitor1_wallpaper_x: 0
INFO:           monitor1_wallpaper_y: 0
INFO:           monitor1_wallpaper_w: 1920
INFO:           monitor1_wallpaper_h: 1080
INFO:   monitor1_wallpaper: /usr/local/share/lwp/wallpapers/default-fullhd
INFO: Config file loaded
ERROR: That operation is not supported
ERROR: Parameter 'window' is invalid
` ``

Nothing seems to happen on the GNOME 42 desktop

Even with disabling GNOME extensions, running lwp produces no parallax effect or any effect. It emits no messages. The installation process went smoothly and without incident or error.

I do have a wallpaper of my own set.

My system is PopOS 22.04 with the GNOME desktop. It's an Ubuntu derivative. The CPU/GPU is AMD Ryzen 5 2550H with Radeon Vega Mobile Gfx graphics.

Is lwp intended for more basic desktop environment perhaps?

Update. It seems so. When I login with the fvwm desktop environment lwp works exactly as intended. Other than the mouse disappearing when its not inside another application window.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.