Coder Social home page Coder Social logo

glouw / paperview Goto Github PK

View Code? Open in Web Editor NEW
1.4K 18.0 43.0 268 KB

A high performance X11 animated wallpaper setter

Home Page: https://glouw.com/2020/08/02/Paperview.html

License: MIT License

Makefile 6.51% C 93.49%
animated wallpaper desktop linux x11 sdl2

paperview's Introduction

PAPERVIEW

Paperview is a high performance animated desktop background setter for Linux and X11.

Video of the above screenshot: https://www.youtube.com/watch?v=6ZTiA885bWM

Build

make # NOTE: SDL2 is required

Single Monitor Use

./paperview FOLDER SPEED

A lower SPEED number will result in a faster frame rate. Only BMP files are supported.

Multi Monitor Use

Paperview supports any number of monitors with its dynamic parameter list:

./paperview FOLDER SPEED X Y W H FOLDER SPEED X Y W H # ... And so on

The values X, Y, W (width), H (height) are integers and represent a rectangle with pixel dimensions specifying where the wallpaper animation will be placed. For instance, with a 1366x768 monitor on the left and a 1920x1080 monitor on the right, the following command will animate the left monitor with a cat animation, and the right, a river animation:

./paperview \
    ~/scenes/cat   5    0   0 1366  768 \
    ~/scenes/river 5 1366   0 1928 1080

Running Background Daemon

Append an (&) to a paperview command to have it run as a background process. Eg:

./paperview FOLDER SPEED &

To stop this backgroud process, use killall:

killall paperview

Creating Custom Scenes

Creating a custom BMP scene folder from a GIF requires imagemagick. For example, to create a castle scene folder from a castle.gif:

mkdir castle
mv castle.gif castle
cd castle
convert -coalesce castle.gif out.bmp
rm castle.gif

Random Animated Wallpapers at Startup

Assuming a scenes folder containing a number of scene folders is present in the home folder, run the following snippet as a background process within .xinitrc before running startx, or simply execute it after X11 is running:

while true
do
    scene=$(ls -d ~/scenes/*/ | shuf -n 1)
    timeout 600 paperview $scene 5 # See Multi-Monitor Use above for multiple monitor support
done

Performance

Running on a Thinkpad X230 from 2012 at 1920x1080 and 60fps with an integrated Intel GPU:

intel_gpu_time ./paperview castle 5

user: 1.904135s, sys: 0.357277s, elapsed: 100.458648s, CPU: 2.3%, GPU: 11.7%

Known Issues

Picom, Compton (and possibly other compositors) seem to already write to the base root X11 window which may overwrite the render done by paperview.

Alternatives

Alternatively, if SDL2 is a problem, or if you are on Windows, two workarounds are currently available:

Pure X11 (without SDL2)

https://gist.github.com/AlecsFerra/ef1cc008990319f3b676eb2d8aa89903

Windows 10

https://github.com/TrAyZeN/sdl-wallpaper

paperview's People

Contributors

glouw avatar wigust 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paperview's Issues

not work on macOS Catalina 10.15.6

Build command: gcc -std=c99 -O2 -Wall -Wextra -Wpedantic main.c -I/usr/X11R6/include -L/usr/X11R6/lib -lSDL2 -lX11 -o paperview

Run command: ./paperview cyber 5

Output:

2020-08-05 16:56:07.067 paperview[39543:6127143] -[__NSTaggedDate title]: unrecognized selector sent to instance 0x1d1
2020-08-05 16:56:07.067 paperview[39543:6127143] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSTaggedDate title]: unrecognized selector sent to instance 0x1d1'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff36cfcb57 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6f9aa5bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff36d7bbe7 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff36c613bb ___forwarding___ + 1427
	4   CoreFoundation                      0x00007fff36c60d98 _CF_forwarding_prep_0 + 120
	5   libSDL2-2.0.0.dylib                 0x0000000101047b5c Cocoa_CreateWindowFrom + 44
	6   libSDL2-2.0.0.dylib                 0x000000010101f160 SDL_CreateWindowFrom_REAL + 186
	7   paperview                           0x0000000100f998f3 main + 115
	8   libdyld.dylib                       0x00007fff70b52cc9 start + 1
	9   ???                                 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Doesn't work on Manjaro.

When I try to run the ./paperview command I get a "[1] 280403 segmentation fault (core dumped) ./paperview scenes/train/ 5" error...

Working Compositors?

Are there any known compositors that work with Paperview? I'm working on a rice that utilizes this, and I want to use a compositor to really emphasize this program, because it's stinkin' awesome!
I've tried Picom and Compton, and as I expected, both failed.

Thanks in advance!

Is there any way to support videos?

Curious if this could be done as converting even just a 30fps video loop to bmps is a bit much given the amount of data you end up with

Video Loop: 30 sec., 30fps
mp4: 3,7MB
bpms: 5,58 GB

While many are probably fine with pixel style low fps loops, I personally can't stand it ':D

paperview isn't working

hi, i've used paperview for 3 month on dwm + void linux, now i've reinstalled it and paperview isn't working. no errors, just not working.

Not working in Ubuntu 20.10

Hello.

Just compiled it and ran it on a fresh Ubuntu 20.10 install. The program is running and I could confirm that it is running the rendering functions, but the wallpaper doesn't change from the system set one.

Is it not supported? Maybe Gnome gets in the way?

paperview + compositor

Hi glouw, looking through the discussion on the non-SDL2 gist you link in the readme. I may be wrong but I'm pretty sure that if you did go down the route of using the XRender extension instead of SDL2 that this compositor issue might go away. Perhaps you could make a non-sdl2 multi monitor version of paperview using XRender instead of SDL2 and see if this works?

doesnt work on xfce unubntu 20.04 for me

I buddy! I compiled your software and tried to make it work, but it just doesnt display anything. how i could debug why isnt doing anything. it just, runs..but nothing at all..

I made a bunch of bmp from your example, place it inside a folder eample then try ./paperview example/ 3 &
just to try something..
what i am missing here?

Pause Rendering

Would it be possible to use SDL_WINDOWEVENT_HIDDEN and SDL_WINDOWEVENT_EXPOSED/SDL_WINDOWEVENT_SHOWN to pause rendering when the background isn't in view, and so save same cycles/battery?

I think it might work during the poll loop watching for the quit event, at a glance.

Not working on i3wm.

executing ./paperview train 5 just seems to refresh my monitor and doesn't change the wallpaper. Clip here
. Its a Thinkpad T450 with an integrated intel GPU if that helps.

Does not work with compton

first of all, the project is really nice, works even in a vm without problems...
but...
it does not work while compton is running.
since it hasn't commented anything in the code, i haven't figured out how it works... (well, i'm probably not very good in c...)
but i guess that it does not draw on the rootwindow...
if it would draw directly to the rootwindow it should work (I had a script which did exactly that and it worked -> but cpu on fire)

(i'm probably not very good in english to..., sry 4 that... xD)


my test-setup:

vm with 8gb ram and 16 threads (r9 3900x)
debian 10.5.0
linux 4.19.0-10
i3wm 4.16.1
compton 0.1~beta2+20150922
(wallpaper set with feh -> survives paperview)
make 4.2.1
xorg 1:7.7+19

Multi-monitor support?

Is there anyway to set different wallpapers for different monitors? I have a setup with two monitors that don't share the same resolution and the program doesn't seen to know how to deal with it.

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.