Giter Site home page Giter Site logo

jncrmx / dynamicwallpaper Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 0.0 3 MB

Color-changing live wallpaper with Java and OpenGL.

License: MIT License

Java 98.53% GLSL 1.47%
dynamic-wallpaper wallpaper wallpaper-app wallpaper-engine wallpaperengine animation java opengl live-wallpaper

dynamicwallpaper's Introduction

DynamicWallpaper

DynamicWallpaper is a small Java program for playing a video as a wallpaper and settings up dynamic colors (e.g. based on your open processes or windows).

Example GIF

Example of a color changing wave as wallpaper

Installation

First of all make sure that your platform is supported (or just don't care and go experiment a bit 😉).

Supported platforms

OS 32-bit 64-bit
Windows 10 ❓not tried ✔️yes
Windows 8 ❓not tried ✔️mostly
Linux (KDE Plasma) ❓not tried ⚠️not really
Linux (GNOME) ❓not tried no

Note: It's not very likely that it will work on 32-bit systems if it doesn't work on 64-bit systems.

Build from source

To build the application from source make sure you have a JDK (at least 8) installed and properly set up. It's all just about Gradle working well, so don't worry.

Now, download the source from GitHub using git clone (alternatively you could also download and extract a zipped version of the repository):

git clone https://github.com/JnCrMx/DynamicWallpaper

Then build the application using Gradle:

Windows (in CMD)

gradlew.bat build

Unix (in bash)

chmod +x gradlew
./gradlew build

Launching the application

There are different ways to launch the application Gradle has built in the previous step.

Use a shadowJar

You can find the shadowJar in build/libs/DynamicWallpaper-<version>-all.jar. It already contains all required libraries. Simply copy it to any location you like and double-click it to launch.

Use a distribution

Besides the shadowJar there are also distribution archives. Those also contain all libraries, but must be extracted before using the application.

You can find them in build/distributions/DynamicWallpaper-1.0.zip or build/distributions/DynamicWallpaper-1.0.tar. Just extract them to any directory you want.

After extracting them, just open the bin/-directory and then execute DynamicWallpaper.bat (for Windows) or DynamicWallpaper (for Unix).

Use Gradle

You can also ask Gradle to run the application:

Windows (in CMD)

gradlew.bat run

Unix (in bash)

chmod +x gradlew
./gradlew run

If you use this way, you don't need to rebuild the program if the source changes. Building the program is included in this command.

Usage

After launching the application, just left-click the icon in your system tray to open the configuration window.

Now you can configure your wallpaper. A good first step is to select a video file (or URL). More information about the color modes and different configurations will be provided soon, so for now you need to experiment a bit 😄.

Remember to click "Apply" to save and apply your configuration. Using "Exit" will also allow you to save the configuration; just don't terminate the application forcefully.

Development

How does it work?

The basic idea is to put a window between your desktop background and the desktop symbols. In this window we can then do basically anything we want.

On Windows there is a window called "WorkerW" which can be used as a parent for our window.

WorkerW

Screenshot from WinSpy with WorkerW and our frame highlighted

The whole procedure is from a very similar project I really recommend having a look at: https://github.com/Francesco149/weebp

This program just replicates the steps in Java using JNA to invoke the required native functions.

For code and detailed information have a look at src/main/java/de/jcm/dynamicwallpaper/Utils.java.

Why doesn't it work well on Linux?

I've experimented a bit on Linux and searched for ways to put a window as a wallpaper, but at least with KDE Plasma none of them really worked.

This is because the desktop background and the desktop icons appear to be in the same windows. Hence, it seems to be impossible to put a window between them.

We change the property _NET_WM_WINDOW_TYPE of our window to _NET_WM_WINDOW_TYPE_DESKTOP which makes it appear as the desktop window. Sadly our window is still above the original desktop window and therefore covers all symbols and prevents you from interacting with your desktop.

Making sure our window is below the desktop seems hard and wouldn't really help, because then the desktop window (which included the desktop background) would cover our window instead.

I need to experiment a bit more; maybe setting a transparent wallpaper could fix this.

What's the problem on GNOME/Ubuntu?

The application uses an icon in the system tray which you can click to open or close the configuration window.

Ubuntu/GNOME does not support the system tray anymore.

There might be some plugins providing a system tray, but I haven't tested them yet.

dynamicwallpaper's People

Contributors

jncrmx avatar

Stargazers

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

Watchers

 avatar  avatar

dynamicwallpaper's Issues

DiscordOverlay can crash with java.util.ConcurrentModificationException

This happens if the onlineUsers Map is modified while render(double) iterates over it.

Stacktrace:

Exception in thread "main" java.util.ConcurrentModificationException
	at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445)
	at java.util.HashMap$EntryIterator.next(HashMap.java:1479)
	at java.util.HashMap$EntryIterator.next(HashMap.java:1477)
	at de.jcm.dynamicwallpaper.extra.DiscordOverlay.render(DiscordOverlay.java:306)
	at de.jcm.dynamicwallpaper.DynamicWallpaper.loop(DynamicWallpaper.java:632)
	at de.jcm.dynamicwallpaper.DynamicWallpaper.run(DynamicWallpaper.java:171)
	at de.jcm.dynamicwallpaper.DynamicWallpaper.main(DynamicWallpaper.java:816)

Ideas:

  • work synchronized
  • clone the Map before iterating over it
  • Is there an Iterator that is separated from the Map?

Discord Game SDK does not work on 32-bit systems

Two reasons:

  1. We don't load Discord's 32-bit library. We need to change de.jcm.dynamicwallpaper.extra.DiscordOverlay#downloadDiscordLibrary to fix this.
  2. The Java binding library has no 32-bit native libraries. I need to update the library to load 32-bit natives, and actually build and upload those.

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.