Code Monkey home page Code Monkey logo

wallutils's Introduction

Wallutils Build GoDoc License Go Report Card

  • Detect monitor resolutions and set the desktop wallpaper, for any window manager (please file an issue if your window manager is not supported yet).
  • Supports GNOME timed wallpapers, and includes a utility that can run an event loop for changing them (also supports cross fading).
  • Introduces a new file format for timed wallpapers: The Simple Timed Wallpaper format: Markdown | PDF.
  • GNOME timed wallpapers can be converted to the Simple Timed Wallpaper format with the xml2stw utility.
  • macOS dynamic wallpapers (in the HEIF format with the .heic extension) can be installed with heic-install and used with lstimed and settimed. This extracts the metadata with heic2stw (only timing information, not the azimuth and elevation for the sun, yet) and extracts the images with convert that comes with ImageMagick.

Packaging status

Timed Wallpapers

The Mojave timed wallpaper and other timed wallpapers can be set with the settimed command, and will cross fade from image to image as the day progresses:

Dynamic wallpaper example

Note that some window managers makes it hard to achieve smooth switches of desktop backgrounds, while others makes it easy.

Included utilities

  • getdpi, for retrieving the average DPI, for all monitors (use -b to see the DPI both horizontally and vertically).
  • lscollection, for listing installed wallpaper collections (use -l for also listing paths and collection names).
  • timedinfo, for showing more information about installed timed wallpapers.
  • lsmon lists the connected monitors and resolutions that are discovered by the current WM/DE (use -d for also listing DPI).
  • lstimed for listing installed timed wallpapers (use -l for also listing paths).
  • lswallpaper, for listing all installed wallpapers (use -l and -s to list more information).
  • setcollection, for setting a suitable (in terms of resolution) wallpaper from a wallpaper collection.
  • setrandom, for setting a random wallpaper.
  • settimed, for setting timed wallpapers (will continue to run, to handle time events). (This utility has recently been refactored and needs more testing).
  • setwallpaper can be used for setting a wallpaper (works both over X and the Wayland protocol).
  • wayinfo shows detailed information about the connected monitors, via Wayland.
  • xinfo shows detailed information about the current X setup.
  • xml2stw for converting GNOME timed wallpapers to the Simple Timed Wallpaper format.
  • heic2stw for extracting the timing information from macOS dynamic wallpapers (.heic files) to the Simple Timed Wallpaper format.
  • vram for finding the minimum amount of VRAM available for non-integrated GPUs (use -l to list the bus ID, a description and available VRAM for each GPU).

Included scripts

  • heic-install for installing a macOS dynamic wallpaper to /usr/share/backgrounds using both ImageMagick convert and heic2stw.

Example use of the lsmon utility

$ lsmon
0: 1920x1200
1: 1920x1200
2: 1920x1200

Installing wallutils

Arch Linux

pacman -S wallutils

Fedora

With sudo, or as root, install the required dependencies:

sudo dnf update
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install git golang ImageMagick libXcursor-devel libXmu-devel xorg-x11-xbitmaps libheif-devel wayland-devel

As a user, clone the repository and build the utilities:

git clone https://github.com/xyproto/wallutils
cd wallutils
make

Then with sudo, or as root, install the utilities:

sudo make PREFIX=/usr/local install

Debian 11

With sudo, or as root, install the required dependencies:

sudo apt install git golang imagemagick libx11-dev libxcursor-dev libxmu-dev libwayland-dev libxpm-dev xbitmaps libxmu-headers libheif-dev make

As a user, clone the repository and build the utilities:

git clone https://github.com/xyproto/wallutils
cd wallutils
make

Then with sudo, or as root, install the utilities:

sudo make PREFIX=/usr/local install

Installing a single utility

Using Go 1.17 or later, install ie. the getdpi utility:

go install github.com/xyproto/wallutils/cmd/getdpi@latest

Wayland or X only

The executables related to X can be removed after building if you only wish to keep the Wayland-related functionality. And the same for Wayland.

Example use of settimed

settimed mojave-timed

Example use of setwallpaper

setwallpaper /path/to/background/image.png

Example use of setrandom

setrandom /usr/share/pixmaps

Example use of the Go package

Retrieve monitor resolution(s)

package main

import (
    "fmt"
    "os"

    "github.com/xyproto/wallutils"
)

func main() {
    // Retrieve a slice of Monitor structs, or exit with an error
    monitors, err := wallutils.Monitors()
    if err != nil {
        fmt.Fprintf(os.Stderr, "%s\n", err)
        os.Exit(1)
    }
    // For every monitor, output the ID, width and height
    for _, monitor := range monitors {
        fmt.Printf("%d: %dx%d\n", monitor.ID, monitor.Width, monitor.Height)
    }
}

Change the wallpaper

fmt.Println("Setting background image to: " + imageFilename)
if err := wallutils.SetWallpaper(imageFilename); err != nil {
    return err
}

Build requirements

  • Go 1.11 or later. 1.17 or later is recommended.
  • A working C compiler (tested with GCC 8.2.1).
  • Header files for Wayland and X.
  • libheif for heic2stw and heic-install.

Runtime requirements

  • libwayland-client.so, for Wayland support.
  • libX11.so, for X support.
  • libheif.so for HEIF/.heic image support.

It is also possible to build with make static, to only build the utilities that does not depend on any of the above .so files, as statically compiled ELF executables.

  • swaybg and pkill for Wayland-based window managers like Labwc.

The vram utility depends on lspci (from pciutils) and also nvidia-smi for NVIDIA GPUs.

Wallpaper collections

The XML format from GNOME for specifying wallpaper collections is not yet supported (and I'm not sure if it's needed). Creating a directory with images where the filename of the images specify the resolution (like wallpaper_5639x3561.jpg) is enough for lscollection to recognize it as a collection (if the directory is placed in /usr/share/backgrounds or /usr/share/wallpapers).

Refreshing the wallpaper after waking from sleep

Send the USR1 signal to the settimed process:

pkill settimed -USR1

This should refresh the wallpaper.

A note about i3

  • When using wallutils together with i3, it works best with also having feh and imlib2 installed.

Setting a wallpaper per monitor

  • Setting a wallpaper per monitor is not supported, yet. Currently, a wallpaper is set for all monitors.

General info

wallutils's People

Contributors

dependabot[bot] avatar ethanmad avatar etienneschmitz avatar foxpy avatar kianmeng avatar xyproto 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

wallutils's Issues

Clarify C library dependencies

On Fedora 29, wallutils depends on the following non-standard packages for go get to succeed:

  • xorg-x11-xbitmaps
  • libXcursor-devel
  • libXmu-devel (which pulls in libSM, libICE and libXt as well)

It might be helpful to note any compile-time dependencies like this in the readme.

Unable to run heic-install

The following error returns when running heic-install <file.heic>:

./heic-install: line 39: heic2stw: command not found

I installed wallutils via the Ubuntu instructions. The command settimed works fine.

settimed doesn't update wallpaper

I am currently running settimed with sway on Fedora. When initialised, settimed sets the wallpaper correctly, but never updates the wallpaper again after that. When prompted with signal USR1, a line is written to the log file but the image is not changed, even hours on.

I am running settimed with the following options:

settimed /usr/share/backgrounds/eddos/mojave/mojave-timed.stw > /home/edd/wallpaper.log

With a .stw file containing:

stw: 1.0
name: mojave-timed
format: /usr/share/backgrounds/eddos/mojave/mojave_dynamic-%s0.jpg
@00:00-03:00: 000 .. 030
@03:00-06:00: 030 .. 060
@06:00-07:00: 060 .. 070
@07:00-08:00: 070 .. 080
@08:00-09:00: 080 .. 090
@09:00-10:00: 090 .. 100
@10:00-11:00: 100 .. 110
@11:00-12:00: 110 .. 120
@12:00-14:00: 120 .. 140
@14:00-15:00: 140 .. 150
@15:00-16:00: 150 .. 160
@16:00-17:00: 160 .. 170
@17:00-18:00: 170 .. 180
@18:00-19:00: 180 .. 190
@19:00-21:00: 190 .. 210
@21:00-00:00: 210 .. 000

Which outputs the following log (the time was 15:30 when prompted with the USR1 signals):

Launching event loop for: /usr/share/backgrounds/eddos/mojave/mojave-timed.stw
Using the Simple Timed Wallpaper format.
Initial transition event at 11:00 (60% complete)
Progress: 36m33s
Up to: 12:00
Window: 1h
Cooldown: 6m
Loop wait: 5s
Transition type: overlay
From filename /usr/share/backgrounds/eddos/mojave/mojave_dynamic-1100.jpg
To filename /usr/share/backgrounds/eddos/mojave/mojave_dynamic-1200.jpg
Setting /usr/share/backgrounds/eddos/mojave/mojave_dynamic-1100.jpg.
Using the Sway backend.
swaymsg output * bg /usr/share/backgrounds/eddos/mojave/mojave_dynamic-1100.jpg stretch
Crossfading between images.
Received signal user defined signal 1
Received signal user defined signal 1
Received signal user defined signal 1
Received signal user defined signal 1

Many thanks for your work on this project; I hope that I can start using it properly and not be forced to hack together a pythonic bodge instead.

Add background color support and fit mode

Hi, I am a maintainer of waypaper app, that uses wallutils as one of the backends for wallpaper setting. I have a couple of questions:

  1. While all other backends support background color (color behind the wallpaper), I can't find the option to set it here, sorry if I missed. Do you plan to support it?

  2. Classically, wallpaper mods are usually either fill, fit, center, stretch, or tile, which are all different things. However, setwallpaper --mode only supports center, stretch, scale and tile. So, what's exactly the scale mode, and could you please add one more mode to be more uniform with other wallpaper tools?

Thank you.

Rewrite the event system (used by `settimed`)

  • The event system should be refactored out from both gnometimed and simpletimed.
  • When using settimed, the transition over midnight (23:59 to 00:00) is not handled correctly.
  • The length of the cross-fade transitions are not always handled correctly (results in messages like Triggered transition event at 13:20 (277% complete)).
  • Perhaps someone have already written a great even system in Go? I considered using something like cron or the systemd trigger system instead, but I think it would be nice if everything that has t o do with events was contained within a module that could be used by the settimed application.
  • Under sway, sometimes multiple events are triggered in rapid succession, which is not correct.

Build issues on Ubuntu 19.04

Hi there - just following the instructions for the Ubuntu build and seem to have come across a problem. After installing the recommended packages the make command throws out

~/wallutils$ make
go build
xrandr.go:6:2: cannot find package "github.com/fatih/color" in any of:
/usr/lib/go-1.10/src/github.com/fatih/color (from $GOROOT)
/home/jolyon/go/src/github.com/fatih/color (from $GOPATH)
collections.go:4:2: cannot find package "github.com/stretchr/powerwalk" in any of:
/usr/lib/go-1.10/src/github.com/stretchr/powerwalk (from $GOROOT)
/home/jolyon/go/src/github.com/stretchr/powerwalk (from $GOPATH)
collections.go:5:2: cannot find package "github.com/xyproto/gnometimed" in any of:
/usr/lib/go-1.10/src/github.com/xyproto/gnometimed (from $GOROOT)
/home/jolyon/go/src/github.com/xyproto/gnometimed (from $GOPATH)
x11.go:11:2: cannot find package "github.com/xyproto/imagelib" in any of:
/usr/lib/go-1.10/src/github.com/xyproto/imagelib (from $GOROOT)
/home/jolyon/go/src/github.com/xyproto/imagelib (from $GOPATH)
collections.go:6:2: cannot find package "github.com/xyproto/simpletimed" in any of:
/usr/lib/go-1.10/src/github.com/xyproto/simpletimed (from $GOROOT)
/home/jolyon/go/src/github.com/xyproto/simpletimed (from $GOPATH)
x11.go:12:2: cannot find package "github.com/xyproto/xpm" in any of:
/usr/lib/go-1.10/src/github.com/xyproto/xpm (from $GOROOT)
/home/jolyon/go/src/github.com/xyproto/xpm (from $GOPATH)
make: *** [Makefile:7: all] Error 1

Just looking to help amend the install instructions for clueless folks like me - I'm assuming I'd need to install each one of those separately?

settimed archlinux - gives: fatal error: unexpected signal during runtime execution

Arch Linux (latest as of today)
WM: awesome

settimed archlinux as proposed by https://www.archlinux.org/packages/community/any/archlinux-wallpaper/ does not work.

Setting timed wallpaper: archlinux
Searching for wallpapers...
Filtering wallpapers by name...
Using: /usr/share/backgrounds/archlinux/archlinux.stw
Using the Simple Timed Wallpaper format.
Initial static wallpaper event at 12:00
Window: 1h35m37s
Cooldown: 1h35m37s
Filename: /usr/share/backgrounds/archlinux/archlinux-berry.jpg
Setting /usr/share/backgrounds/archlinux/archlinux-berry.jpg.
Using the X11 backend.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7f663ec17dca]

runtime stack:
runtime.throw(0x7f663f06994e, 0x2a)
        /usr/lib/go/src/runtime/panic.go:774 +0x74
runtime.sigpanic()
        /usr/lib/go/src/runtime/signal_unix.go:378 +0x480

goroutine 1 [syscall]:
runtime.cgocall(0x7f663f05dbd0, 0xc0002d91e8, 0x1e)
        /usr/lib/go/src/runtime/cgocall.go:128 +0x5d fp=0xc0002d91b8 sp=0xc0002d9180 pc=0x7f663eeb245d
github.com/xyproto/wallutils._Cfunc_SetBackground(0x7f661c000c90, 0x0)
        /tmp/go-build810405401/b067/_cgo_gotypes.go:72 +0x4b fp=0xc0002d91e8 sp=0xc0002d91b8 pc=0x7f663f05946b
github.com/xyproto/wallutils.(*X11).SetWallpaper(0x7f663f2afde0, 0xc00014e6c0, 0x34, 0x0, 0x0)
        /build/wallutils/src/wallutils/x11.go:109 +0x33a fp=0xc0002d9300 sp=0xc0002d91e8 pc=0x7f663f059b0a
github.com/xyproto/wallutils.SetWallpaperCustom(0xc00014e6c0, 0x34, 0x1, 0x7f663f06021d, 0x7, 0xc00026c5b0, 0x0)
        /build/wallutils/src/wallutils/wallpaper.go:45 +0x251 fp=0xc0002d93c8 sp=0xc0002d9300 pc=0x7f663f056dc1
github.com/xyproto/wallutils.SetWallpaperVerbose(...)
        /build/wallutils/src/wallutils/wallpaper.go:77
main.SetTimedWallpaper.func3(0xc00014e6c0, 0x34, 0x7f663f0610f3, 0xc)
        main.go:94 +0x54 fp=0xc0002d9410 sp=0xc0002d93c8 pc=0x7f663f05cac4
github.com/xyproto/simpletimed.(*Wallpaper).SetInitialWallpaper(0xc000200080, 0x7f663f15b701, 0xc000242ad0, 0x7f663f06254f, 0x12, 0xc000242ad0, 0x7f663f06254f)
        /build/wallutils/src/wallutils/vendor/github.com/xyproto/simpletimed/eventloop.go:157 +0x142c fp=0xc0002d97a0 sp=0xc0002d9410 pc=0x7f663f009d2c
github.com/xyproto/simpletimed.(*Wallpaper).EventLoop(0xc000200080, 0xc000242a01, 0xc000242ad0, 0x7f663f06254f, 0x12, 0x1, 0x1)
        /build/wallutils/src/wallutils/vendor/github.com/xyproto/simpletimed/eventloop.go:284 +0x193 fp=0xc0002d9988 sp=0xc0002d97a0 pc=0x7f663f00a493
main.SetTimedWallpaper(0x7ffe9c809d30, 0x9, 0x1, 0x7f663f06254f, 0x12, 0xc0000e5b68, 0x7f663efce20c)
        main.go:94 +0x237 fp=0xc0002d9aa0 sp=0xc0002d9988 pc=0x7f663f05b9d7
main.setTimedWallpaperAction(0xc0000ae160, 0x0, 0xc000096150)
        main.go:123 +0xc1 fp=0xc0002d9b50 sp=0xc0002d9aa0 pc=0x7f663f05c3b1
github.com/urfave/cli.HandleAction(0x7f663f1150a0, 0x7f663f15b8d8, 0xc0000ae160, 0x0, 0x0)
        /build/wallutils/src/wallutils/vendor/github.com/urfave/cli/app.go:514 +0xc0 fp=0xc0002d9b78 sp=0xc0002d9b50 pc=0x7f663efc9050
github.com/urfave/cli.(*App).Run(0xc0000de000, 0xc000096020, 0x2, 0x2, 0x0, 0x0)
        /build/wallutils/src/wallutils/vendor/github.com/urfave/cli/app.go:274 +0x5f8 fp=0xc0002d9ec0 sp=0xc0002d9b78 pc=0x7f663efc6f78
main.main()
        main.go:159 +0x26e fp=0xc0002d9f60 sp=0xc0002d9ec0 pc=0x7f663f05c86e
runtime.main()
        /usr/lib/go/src/runtime/proc.go:203 +0x226 fp=0xc0002d9fe0 sp=0xc0002d9f60 pc=0x7f663eeddfc6
runtime.goexit()
        /usr/lib/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc0002d9fe8 sp=0xc0002d9fe0 pc=0x7f663ef092a1

goroutine 19 [syscall]:
os/signal.signal_recv(0x0)
        /usr/lib/go/src/runtime/sigqueue.go:147 +0x9e
os/signal.loop()
        /usr/lib/go/src/os/signal/signal_unix.go:23 +0x24
created by os/signal.init.0
        /usr/lib/go/src/os/signal/signal_unix.go:29 +0x43

goroutine 107 [chan receive]:
github.com/xyproto/simpletimed.(*Wallpaper).EventLoop.func1(0xc00023d260, 0xc000200080, 0x1, 0xc000242ad0, 0x7f663f06254f, 0x12)
        /build/wallutils/src/wallutils/vendor/github.com/xyproto/simpletimed/eventloop.go:269 +0x10a
created by github.com/xyproto/simpletimed.(*Wallpaper).EventLoop
        /build/wallutils/src/wallutils/vendor/github.com/xyproto/simpletimed/eventloop.go:266 +0x13f

Unreasonably high memory usage on settimed

I am currently running settimed (feh backend) which was installed as part of the wallutils package (5.9.0-1) on i3-gaps (4.18.2-2) under Arch Linux. The program works as intended, fading between wallpapers throughout the day however I have noticed that the program uses an unreasonable amount of memory while running in the background regardless of if the program is launched via the i3 config file or manually.

I am using the options settimed -m zoom /usr/share/backgrounds/gnome/adwaita-timed.xml which does set the desired wallpaper however it takes up over a gigabyte of memory.
Screenshot from 2020-08-25 12-05-56

Running the program manually produces the following output

Launching event loop for: /usr/share/backgrounds/gnome/adwaita-timed.xml
Using the GNOME Timed Wallpaper format
Initial transition event at 08:00 (82% complete)
Progress: 4h7m38s
Up to: 13:00
Window: 5h
Cooldown: 30m
Loop wait: 5s
Transition type: overlay
From filename /usr/share/backgrounds/gnome/adwaita-morning.jpg
To filename /usr/share/backgrounds/gnome/adwaita-day.jpg
Setting /usr/share/backgrounds/gnome/adwaita-morning.jpg.
Using the Feh backend.
feh --bg-fill /usr/share/backgrounds/gnome/adwaita-morning.jpg
Crossfading between images.
Setting /tmp/_settimed.jpg.
Using the Feh backend.
feh --bg-fill /tmp/_settimed.jpg
Activating events in 15m

`wayland-client.h no such file or directory` but package `wayland-devel` is installed

I am on OpenSUSE Tumbleweed with wayland-devel package installed. ls /usr/lib | grep wayland shows libwayland-client.so however I still get the following compilation error with make:

$ make
go build -mod=vendor -trimpath
# github.com/xyproto/wallutils
In file included from ./wayinfo.go:4:
./include/wayinfo.h:32:10: fatal error: wayland-client.h: No such file or directory
   32 | #include <wayland-client.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:18: all] Error 1

I have tried installing qt6-waylandclient-devel, wayland-devel-32bit, xwayland-devel, libwayland-client0, libQt5WaylandClient5, libQt6WaylandClient6, and kwayland, but nothing has fixed the make error.

Change wallpaper after resume from suspend

Hi,
first - thank you for very nice collection of tools. Big plus for wayland/Sway support!

This is not classic issue, but just wanted to mention, that settimed do not recheck if change is necessary. So after you resume suspended laptop your wallpaper may be not up to current time. And this may be not necessary to do by settimed, you can solve it on system level. If you want to do so, you need to restart running settimed after wake up.

I use not very common Void Linux so I have my script in /etc/zzz.d/resume:

#!/bin/sh

APP=settimed
USER=ernie
HOMEDIR=/home/$USER

# (cl)2019ER
# restart given APP with previous params
# take full APP cmd from /proc and save in $CMD, kill process 
# and restart it with previous params.
# 
# Limitations:
# - it will not work if binary is not in the $PATH,
#   unless non-relative path is given when launching command.
# - be carreful with app params, we are cd'ing to home dir
#   to make user home relative paths work, but if not sure
#   use non-relative paths in params of originally launched command.
# - hope this is obvious ... but command (f.e.: settimed) has to be running
#   to be restarted. This script will not start it if not running before suspend.

# NOTE: 9>&- is Void Linux specific, it releases flock
#       set by zzz command.

pgrep -x $APP && \
CMD=$(xargs -0 < /proc/$(pgrep -x $APP)/cmdline) && \
pkill $APP && \
cd $HOMEDIR && su $USER -c "nohup $CMD > /dev/null 2>&1 &" 9>&- && \
logger -id $APP "Restarted on wake up."

But for mainstream distros you can find info here, look at systemd answer.

I would put it into wiki, but not enabled here. Maybe it can be in readme, or some other doc?

EDIT: fixed script.

sync /dev/stderr: invalid argument

I'm getting
Could not set wallpaper: sync /dev/stderr: invalid argument
while attempting to set a wallpaper.

sway version 1.0-rc1-170-g076257a9 (Mar 11 2019, branch 'master')

wayland 1.17.0-1

X Error of failed request: BadColor (invalid Colormap parameter)

Freshly installed computer, manually installed plasma5-wallpapers-dynamic beforehand.

Installed gnome-kde-mojave-dynamic-wallpaper and then wallutils.

Below is output from settimed mojave-timed:

Setting timed wallpaper: mojave-timed
Searching for wallpapers...
Filtering wallpapers by name...
Using: /usr/share/backgrounds/macOS/mojave-timed.xml
Using the GNOME Timed Wallpaper format
Initial static wallpaper event at 12:00
Window: 17m4s
Cooldown: 17m4s
Filename: /usr/share/backgrounds/macOS/mojave/mojave_dynamic-1200.jpg
Setting /usr/share/backgrounds/macOS/mojave/mojave_dynamic-1200.jpg.
Using the X11 backend.
X Error of failed request:  BadColor (invalid Colormap parameter)
  Major opcode of failed request:  91 (X_QueryColors)
  Resource id in failed request:  0x6002d390
  Serial number of failed request:  7
  Current serial number in output stream:  7

Arch Linux (latest from today).
WM: awesome

Fix issue with the event system

The github.com/xyproto/event package has a bug which makes the settimed command change wallpapers rapidly in a disturbing way.

As a User I would like to send an image to each monitor according to the dimensions of their screens

Hello @xyproto, I want to make a more interesting backgrounds for proportionally scaled images. I use wallutils as a backend.

To achieve this I create a wallpaper of the right proportions and then use 'fill' method to display it. All works well for one monitor, but if there are several monitors of different dimensions, 'fill' method breaks.

It would be great to have an ability to send an individually adjusted image to each monitor. Would it be possible?

Support macOS dynamic wallpapers (HEIF format with metadata and the `.heic` extension)

Howdie, thanks so much for sharing this

I was looking around for timed wallpaper sets, and came across https://dynamicwallpaper.club/ which is specifically for the Dynamic Wallpapers functionality in macOS

It looks like these are HEIC or HEIF format files, which do open in GIMP, but aren't a ZIP or compressed TAR like I was thinking at at first

Anyhow, I was wondering if you already knew how to us these with settimed, or if you'd consider adding support for this file format? Being able to access themes from other popular platforms (:sigh:) could be very useful for some

Cheers!

settimed fails to set transition wallapaper

settimed correctly sets wallpaper during the launch, but crashes in the next 20 minutes or so:

Crossfading between images.
Window: 20m
Cooldown: 2m
Loop wait: 5s
Transition type: overlay
From filename /usr/share/backgrounds/gnome/mojave/mojave_dynamic-1000.jpg
To filename /usr/share/backgrounds/gnome/mojave/mojave_dynamic-1100.jpg
Crossfading between images.
Setting /tmp/gnometimed_crossfade.png.
Using the Feh backend.
feh --bg-scale /tmp/gnometimed_crossfade.png
Setting /tmp/gnometimed_crossfade.png.
Using the Feh backend.
feh --bg-scale /tmp/gnometimed_crossfade.png
failed: feh --bg-scale /tmp/gnometimed_crossfade.png failed to run
Using the X11 backend.
convert /tmp/gnometimed_crossfade.png /tmp/_setwallpaper.xbm
failed: feh --bg-scale /tmp/gnometimed_crossfade.png failed to run
Using the X11 backend.
convert /tmp/gnometimed_crossfade.png /tmp/_setwallpaper.xbm
Setting /tmp/gnometimed_crossfade.png.
Using the Feh backend.
feh --bg-scale /tmp/gnometimed_crossfade.png
failed: feh --bg-scale /tmp/gnometimed_crossfade.png failed to run
Using the X11 backend.
convert /tmp/gnometimed_crossfade.png /tmp/_setwallpaper.xbm
malloc(): unsorted double linked list corrupted
SIGABRT: abort
...

If I then try to run feh on /tmp/gnometimed_crossfade.png :

feh --bg-scale /tmp/gnometimed_crossfade.png 
libpng error: bad adaptive filter value
feh WARNING: /tmp/gnometimed_crossfade.png - No Imlib2 loader for that file format
feh ERROR: Unable to load image /tmp/gnometimed_crossfade.png

OS: Arch Linux
WM: i3

Rewrite settimed

The event system used by settimed has issues that are there mainly because what I thought would be required functionality changed while developing.

Rewrite settimed and the event system to make it more robust.

This should resolve #9 and #10.

Fedora build procedure does not work

The commands provided in the README.md file for the Fedora build are inaccurate and should be updated.

I recently tried to compile wallutils for Fedora 37 in a clean environment inside a toolbox.
While following the provided commands, I encountered some issues during the compilation process:

  1. the package imagemagick is misspelled: the correct package name in Fedora repositories is ImageMagick;
  2. the package libheif-devel does not belong to Fedora repositories, it is instead part of rpmfusion-free repository, and this should be addressed. I am well aware that most, if not all users have rpmfusion installed, but for a build in a clean environment this is not usually the case;
  3. package wayland-devel is missing: if not installed, full compilation with make fails for file wayinfo.go with error
go build -mod=vendor -trimpath
# github.com/xyproto/wallutils
In file included from ./wayinfo.go:4:
./include/wayinfo.h:32:10: fatal error: wayland-client.h: No such file or directory
   32 | #include <wayland-client.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:18: all] Error 2

To solve this, a working command sequence could be the following:

sudo dnf update
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install git golang ImageMagick libXcursor-devel libXmu-devel xorg-x11-xbitmaps libheif-devel wayland-devel
git clone https://github.com/xyproto/wallutils
cd wallutils
make
sudo make PREFIX=/usr/local install

I tested it on a toolbox running Fedora 37.

settimed not works on hyprland

WM:
https://github.com/hyprwm/Hyprland

settimed log:

Setting timed wallpaper: mu
Searching for wallpapers...
Filtering wallpapers by name...
Using: /usr/share/backgrounds/mu/mu.stw
Using the Simple Timed Wallpaper format.
Attaching to ongoing static wallpaper event that started at 18:00
Window: 6h
Cooldown: 6h
Filename: /usr/share/backgrounds/mu/03.jpg
Setting /usr/share/backgrounds/mu/03.jpg.
Could not set wallpaper: found no working method for setting the desktop wallpaperSetting timed wallpaper: mu-timed
Searching for wallpapers...
Filtering wallpapers by name...
Could not find timed wallpaper: mu-timed

found no working method on labwc compositor

I installed wallutils from Arch Linux repository. Both of setwallpaper and setrandom didn't work. I get this ouput:

➜ setwallpaper ~/Pictures/simpledesktop/tardis.png
Could not set wallpaper: found no working method for setting the desktop wallpaper
~ 
✘1 ➜ setrandom ~/Pictures/simpledesktop/             
Found no working method for setting the desktop wallpaper.

OS : Artix Linux
Wayland compositor : labwc

It working fine when using sway. Did I miss some configuration for my compositor? Or it didn't support labwc?

[Wayland] setting the wallpaper from a systemd unit

Hey @xyproto 👋 Thanks very much for wallutils 🎉

I'm trying to set up a systemd user service unit/timer combo to change the wallpaper in my sway session (testing every minute at the moment).

I'm doing so on NixOS using a collection of the following:

  • systemd user service unit (wallpaper.service)
[Unit]
Description=Change the wallpaper every minute
PartOf=graphical-session.target

[Service]
Environment="LOCALE_ARCHIVE=<snip>/lib/locale/locale-archive"
Environment="PATH=<snip>"

ExecStart=<snip>/bin/setrandom -v <snip>/share/backgrounds/elementary

Note: I've redacted the long Nix paths here, replaced with <snip> for legibility

  • systemd user service timer (wallpaper.timer)
[Unit]

[Timer]
OnCalendar=*:0/1
  • Reaching the sway-session.target with the final line of my sway config:
exec "systemctl --user import-environment; systemctl --user start sway-session.target"

According to sway's documentation for systemd integration, this last part should copy in the user environment for user scope systemd constructs to use. And indeed it does - checking the output of systemctl --user show-environment has everything from my shell's output of env.

The problem

Sadly it seems setrandom isn't able to set the wallpaper, complaining with the following in its output (from the triggered unit):

Setting background image to: <snip>/share/backgrounds/elementary/Jonas Nilsson Lee.j>
Found no working method for setting the desktop wallpaper.

So, I was just wondering if you might be able to shed some light on this 🙏
What would setrandom need to be able to talk to the active compositor? Does it expect any environment variables or sockets?

To clarify, the command works perfectly from the shell once in the session, and also as an initial exec_always in my sway's config (to set it at start/reload).

Many thanks in advance for any help on this! 🤗

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.