Code Monkey home page Code Monkey logo

swaybg's Introduction

swaybg

swaybg is a wallpaper utility for Wayland compositors. It is compatible with any Wayland compositor which implements the wlr-layer-shell protocol and wl_output version 4.

See the man page, swaybg(1), for instructions on using swaybg.

Release Signatures

Releases are signed with E88F5E48 and published on GitHub. swaybg releases are managed independently of sway releases.

Installation

From Packages

swaybg is available in many distributions. Try installing the "swaybg" package for yours.

If you're interested in packaging swaybg for your distribution, stop by the IRC channel or shoot an email to [email protected] for advice.

Compiling from Source

Install dependencies:

  • meson *
  • wayland
  • wayland-protocols *
  • cairo
  • gdk-pixbuf2 (optional: image formats other than PNG)
  • scdoc (optional: man pages) *
  • git (optional: version information) *

* Compile-time dep

Run these commands:

meson build/
ninja -C build/
sudo ninja -C build/ install

swaybg's People

Contributors

acrisci avatar ammgws avatar christophgysin avatar cjbassi avatar concatime avatar ddevault avatar deathlyfrantic avatar deklov avatar elyesh avatar emersion avatar ivyl avatar jbeich avatar jdknight avatar lheckemann avatar mathstuf avatar mikkeloscar avatar minus7 avatar mstoeckl avatar myrrc avatar n3rdopolis avatar nbraud avatar progandy avatar redsoxfan avatar ryandwyer avatar seppesoete avatar trofi avatar xerpi avatar z3ntu 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  avatar  avatar  avatar

swaybg's Issues

Swaybg doesn't recognize the output name as given by swaymsg

swaybg does not seem to recognize the output name exactly as its returned by swaymsg:

❯ swaymsg -t get_outputs
Output eDP-1 'Sharp Corporation 0x1516 Unknown' (focused)
  Current mode: 3840x2400 @ 59.994 Hz
  Position: 0,0
  Scale factor: 2.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1:  
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    3840x2400 @ 59.994 Hz

Now if I run swaybg with literally the same output name, it produces the below message and does not actually set the wallpaper:

❯ swaybg -o 'Sharp Corporation 0x1516 Unknown' -i "/home/zdonca/Pictures/wallpaper/swaying_tree_to_right.png" -m fill

2022-06-26 13:54:41 - [swaybg/main.c:256] Could not find config for output eDP-1 (Sharp Corporation 0x1516)

When omitting the word "Unknown" from the name, it actually works:

❯ swaybg -o 'Sharp Corporation 0x1516' -i "/home/zdonca/Pictures/wallpaper/swaying_tree_to_right.png" -m fill
2022-06-26 13:55:38 - [swaybg/main.c:260] Found config Sharp Corporation 0x1516 for output eDP-1 (Sharp Corporation 0x1516)

Using the id of the output (eDP-1) also works. Using the name of my external displays also work (not connected above), the issue seems to be only with my laptop's built-in display's full name.

My issue comes from azote, but I think the root cause is in swaybg.

I am using Arch Linux and the AUR package swaybg-git. At the moment of writing, my build is baesd on 69c03f6.

Submit XRGB buffers when backgrounds are opaque

The wl_buffer objects that swaybg creates are always formatted as WL_SHM_FORMAT_ARGB8888 . The alpha channel is unnecessary when the background image is opaque or a background color is set.

span wallpaper across monitors

Please read the following before submitting:

  • We are not accepting any new window management features unless they get implemented by i3.
    this isn't really a wm enhancement

Please fill out the following:

  • Description: the title explains it
    Please describe in plain English what the enhancement is and what the use case is.

Feature request: HDR/color managed output

Now that Wayland compositors are slowly moving toward supporting color management and HDR, having swaybg provide color-managed buffers to the compositor will soon start to become possible. Implementing color management would permit cooler wallpapers allow for better representation of a wider range of images, specifically those with saturated colors and bright spots.

Swaybg would also be a decent client to test color management protocols on, because it is relatively simple and directly uses Wayland protocols. Support for specific input/output features can be added piece by piece, without needing to wait for toolkit support.

The main challenge appears to be that, at the moment, image library support for color management is weak, and support for color management would need to be added format by format; or one would need to move away from gdk_pixbuf+Cairo; a few alternatives, none particularly great, are noted in #32. On the other hand, just adding support for PNG images would probably be good enough to start.

One route to incrementally add color management is to start by adding support for image formats providing their colorspace as CICP, and to test with the very restricted color management protocol currently being used by Kwin and VK_hdr_layer. I've made a test branch that does this, for PNG formats; see mstoeckl/frog-v1 .

The branch mstoeckl/frog-v1 is based on top of the current 10-bit output support PR.

It takes as input PNG files which have the (draft) cICP chunk set, and furthermore use one of the few primary/transfer combinations from frog-color-management-v1 (i.e, BT709 or BT2020 primaries, and sRGB, gamma2.2, PQ, or linear transfer function.) Such images can be created with ffmpeg from a video or from a .hdr file. For example, applying the following command to one of the files from https://hdri-haven.com/
ffmpeg -i input_file.hdr -vf "libplacebo=color_primaries=bt2020:color_trc=smpte2084" -pix_fmt rgba64be output_file.png
would produce an image with a cICP chunk, like the following :
hdri

Other notes:

  • Computing eotf/transfer functions takes energy, and to minimize this when drawing backgrounds the compositor should ideally be working from a (linear space, f16) buffer with the transfer function already applied. However, there is also an energy cost from reading larger buffers. If compositors do not opt to cache transformed buffers, it might still be worth it for swaybg to do this part of the color transformation itself, and then submit buffers in the compositors preferred format (most likely linear/f16).

Swaybg opens new process instead of using existing process

I don't know how it works but when run swaybg then wallpapers changes and then again I start swaybg in another terminal then the wallpaper is set again but when I kill it. The previous wallpaper comes back so I think that swaybg opens new process everytime it runs. what I want is to replace the current process instead of opening new one

When setting a wallpaper image, the background switches to gray and then to the image

I'm moving this from the sway repository to here (since I have the same problem and am writing a program like blurwal). This issue was originally created by @xyproto. Here's what he said originally:

Hi,

I wrote a utility for being able to set Timed Wallpapers (wallpaper slideshows, with crossfade between images) that also works for Wayland/Sway.

This works nicely, but when the wallpaper is changed, the background blinks by first switching to gray and then to the selected image.

Steps to reproduce:

Install the Mojave timed wallpaper, either from GitHub or from the AUR package named gnome-mojave-timed-wallpaper (if you use Arch Linux).
Install wallutils, either from GitHub or from the AUR package named wallutils (if you use Arch Linux).
Run this command settimed mojave-timed.
Then just wait a bit, and the background will blink every few minutes.

The command being run for setting the wallpaper looks like this:

swaymsg 'output "*" background /usr/share/backgrounds/gnome/mojave/mojave_dynamic-1320.jpg fill'

This is a feature request for the background image to be switched smoothly, without the background blinking.

I'm using sway version 1.0-beta.1-245-gdbf8e1ce (Nov 27 2018, branch 'master') and have also tested with the latest master of sway (which fixes the problem with the windows blinking too).

Thanks for creating Sway!

Feature request: produce high bit depth buffers

Some wallpapers are better viewed at higher bit depths than the usual 8bpc -- for example, cameras often capture 10bpc data or higher, artwork and rendered images have >=16bpc working spaces, and the gradients in SVG images need high bit depths to avoid banding (or they must use dithering, which has other downsides). Compositors supporting wlr-layer-shell like Sway or Kwin already support 10-bit depth on supported hardware, and may use higher bit depths in the future. swaybg will need to load, process, and output high bit depth image data for the entire pipeline to work.

swaybg's current default image loading library is GdkPixbuf, which only produces 8-bpc unpremultiplied images and is unlikely to ever support anything else. To render backgrounds, it uses Cairo, which can composite images using 8-bpc, 10-bpc, and (pending 1.18.0 release, 32-bit-float-per-channel).

High bit depth inputs:

  • PNG (u16)
  • AVIF (u10)
  • EXR (fp16, fp32, u32)
  • SVG (can be rendered to anything, in theory; librsvg + Cairo can do f32)
  • TIFF (everything)

High bit depth shared memory formats that can be output:

  • u10 (XBGR2101010, ...)
  • f16 (XBGR16161616F, ...)
  • u16 (XBGR16161616, ...)

Long term, changes which make color management easier would also be nice.

Approaches:

  • Directly using PNG/EXR/SVG libraries with Pixman or Cairo: This would require specific code for each new format, but support for these can be added incrementally. Existing formats can use GdkPixbuf. Switching to composite images directly with Pixman instead of Cairo may increase the range of supported formats and avoid having to write some format conversion logic for e.g. u16->u10. Note that Cairo's higher bit depth formats (RGB30, RGB96F, RGBA128F) either have no Wayland equivalent or theirs, like XRGB2101010, is rarely available. Demo branch at mstoeckl/swaybg/pixman-3.
  • GEGL: Can load most formats, and can do rendering. Rather slow to start (gegl_init takes a full 0.1-0.2 seconds to run), and less efficient than Cairo/Pixman (sRGB<->linear conversions are expensive), but can multithread. Does have support for color spaces. Only supports byte-aligned formats, i.e., u8.u16.f16, but not u10 (although in theory any format can be be used with enough custom loading code). Demo branch at mstoeckl/swaybg/gegl.
  • VIPS: Can load most formats and do rendering. Slow to start cold due to linking with many libraries. Supports u16 as output format, but not f16 or u10. May be efficient at loading large images -- although technically users should provide properly sized images to begin with. Demo branch at mstoeckl/swaybg/vips.

Other libraries with C APIs that are used for either image loading or rendering:

  • freeimage: handles image loading and rendering, provided under GPLv2/GPLv3; does loading/writing and format conversions for u16,u32,f32, and can rescale these at precision, but FreeImage_Composite only does u8 precision
  • imlib2: context-dependent API; appears to only support 8-bit depth, no color management
  • skia: used statically for rendering by Chromium, but not otherwise in distributions; supports u10/f16/u16
  • imagemagick: with MagickCore API can load and render, supports u16,f16 and color managment, custom license
  • libplacebo: GPU oriented, handles scaling/compositing for mpv; has proper color management; unclear if CPU-only supported

High CPU usage with Wayfire

image
image
Sometimes swaybg takes up to 100% of my CPU.
It wasn't doing this with Wayfire 0.7.2.
How may I debug this further?

.svg are poorly rendered

Hi, the gradients in svg files are rendered poorly.
A workaround is to render them as png, but then it's size increases drastically (e.g. 10kb to 1.4mb (for 2.2K) or 2.1mb (for 4k) ), and it isn't really editable, so I have to keep the old (svg) copy around.

tip: The closer in you zoom, the worse you can see the difference.

Wallpaper with svg:
image

same image, but rendered out as png in inkscape:
bg

the source file (firefox/github(?) also renders it poorly, but not that bad):
bg

Feature Request: Grab random file when pointed at a directory

If I point swaybg at a directory it would be nice if it just grabbed a random file every time.
Also even better if it refreshed on a timed interval

example: new wallpaper every 30 minutes

Here is a workaround I have in my sway config

exec swaybg -i $(find ~/.local/share/wallpapers/ -type f | shuf -n1)

doesn't help with the rotating on timed interval though...

Support reloading image via SIGUSR?

Hello,

Would it make sense to support reloading the image / reset swaybg via sending a SIGUSR signal?

Currently I use a process like this:

Inspired by https://sylvaindurand.org/dynamic-wallpapers-with-sway/

#!/bin/sh
PID=`pidof swaybg`
swaybg -i $HOME/.config/sway/background-image -m fill &
sleep 1
kill -9 $PID

I have another script that randomly replaces, every hour, the symbolic link that I have at $HOME/.config/sway/background-image .

The issue with the above solution is that it sometimes fails and I get a grey screen.
Don't know why.

Nearest neighbor scaling filter

Use case: I'm trying to set my background to a 64x36 pixel art image, but the image is heavily blurred. I've since set it to an upscaled version but this seems inefficient.

Feature being requested: a setting to force aliasing so low resolution images are displayed crisply, like feh's --force-aliasing parameter.

KuroPixel
20230226_13h13m48s_grim

Wallpaper uses too much ram

I'm using sway version 1.0 on Fedora 31. I use the version from the default repos. I obtained my high resolution wallpaper from https://i.redd.it/ijsf9nney0a41.jpg using this exact command, just after a fresh install:

curl https://i.redd.it/ijsf9nney0a41.jpg > /home/arte/pictures/ijsf9nney0a41.jpg

I enabled the wallpaper in my sway config using this line:

output * bg /home/arte/pictures/ijsf9nney0a41.jpg fill

When I now boot and sway automatically starts(because I put "sway" in .bash_profile) my ram usage is over 1.5 GB. top shows this is mainly caused by a 1268 MB large process called swaybg. the full command is, according to cat /proc/1025/cmdline where 1025 is the result of pidof swaybg:

swaybg-oHDMI-A-1-i/home/arte/pictures/ijsf9nney0a41.jpg-mfill-oDVI-D-1-i/home/arte/pictures/ijsf9nney0a41.jpg-mfill-oDP-1-i/home/arte/pictures/ijsf9nney0a41.jpg-mfill-o*-i/home/arte/pictures/ijsf9nney0a41.jpg-mfill

The wallpaper shows normally, altough it takes a few seconds after starting sway before it shows up.

I couldn't attach it on github so my sway config from ~/.config/sway/config is at https://raw.githubusercontent.com/arte921/sway-configs/master/pc

Cursor does not match set cursor theme

Hi, I have set the cursor theme through environment, the gnome settings files, lxappearance, etc. to no avail. I have gotten every application to match the desired theme except for swaybg. I have even tried explicitly setting the XCURSOR_THEME variable when launching swaybg.

gdk-pixbuf fails to recognize image files when $XDG_DATA_DIR is set

Sway gives the following errors when trying to load the background image for both the default .png and the .jpg that I tested:

2023-01-19 00:40:28 - [swaybg-1.2.0/background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png”).
2023-01-19 00:40:28 - [swaybg-1.2.0/main.c:621] Failed to load image: /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
2023-01-19 00:40:28 - [swaybg-1.2.0/background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png”).
2023-01-19 00:40:28 - [swaybg-1.2.0/main.c:621] Failed to load image: /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
2023-01-19 00:40:28 - [swaybg-1.2.0/background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png”).
2023-01-19 00:40:28 - [swaybg-1.2.0/main.c:621] Failed to load image: /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png

Here is sway reading my wallpaper config:

00:00:00.253 [DEBUG] [sway/config.c:832] Read line 24: 
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 25: ### Output configuration
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 26: #
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 27: # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 28: output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [INFO] [sway/commands.c:380] Config command: output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [INFO] [sway/commands.c:400] After replacement: output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [DEBUG] [sway/commands.c:432] Subcommand: bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [DEBUG] [sway/config/output.c:236] Adding output * config
00:00:00.253 [DEBUG] [sway/config/output.c:240] Config stored for output * (enabled: -1) ([email protected] position -1,-1 scale -1.000000 subpixel unknown transform -1) (bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill) (power -1) (max render time: -1)
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[0] = swaybg
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[1] = -o
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[2] = *
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[3] = -i
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[4] = /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[5] = -m
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[6] = fill
00:00:00.255 [DEBUG] [sway/config.c:832] Read line 29: #output * bg /home/ealker/.config/sway/sun-bg.jpg fill
00:00:00.255 [DEBUG] [sway/config.c:832] Read line 30: 

The logs looked the same when I tried it with my .jpg background.

Swaybg worked perfectly for as long as I've been using sway, but I let my battery die and after charging and restarting it had a gray background.
Here the rest of the debug log file: sway.log

I am running arch linux on a Lenovo Legion 5 Pro with a Ryzen 7 5800H and RTX 3060, but I only ever run sway with my amdgpu drivers, and the issue persists after completely disabling my nvidia driver with udev rules (it is not listed is lspci).

I think it may have something to do with this line:

00:00:00.253 [DEBUG] [sway/config/output.c:240] Config stored for output * (enabled: -1) ([email protected] position -1,-1 scale -1.000000 subpixel unknown transform -1) (bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill) (power -1) (max render time: -1)

But I have no idea where to start with debugging and I found very little online to help.

enhacement: pick random image

I know there are workarounds for achieve this result (getting random image from a list), but it can be easily included in this project without much code.

-r -> pick a random wallpaper from list of files

swaybg can't open image formats

This is reproducible on git master on an Arch Linux system with gdk-pixbuf2 installed. The build fails outright with -Werror at an error about gdk-pixbuf headers, possibly indicating a change in gdk-pixbuf. Disabling -Werror results in the following issue:

  1. Sway starts with gray no-wallpaper-found background.
  2. Upon exit, the following message is found on stderr:
    [background-image.c:30] Failed to load background image (Couldn't recognize the image file format for file "/path/to/background.png").
    [main.c:438] Failed to load image: /path/to/background.png

This has been reproduced with both jpg and png wallpapers, which Sway normally supports.

Add option for swaybg

I would like to be able to script the ability to change wallpapers in a time interval. Something like:

while true; do
  for paper in $(shuf -e ~/Pictures/Wallpapers/*); do
    echo "Setting wallpaper: $paper"
    swaybg --output eDP-1 -i "$paper" -m fit
    if [ $? -ne 0 ]; then
      echo "Error setting wallpaper: $paper"
      continue
    fi
    sleep 30
  done
done

Though it seems as though swaybg itself sleeps after execution, therefore making the script pointless. If I could pass an option that would stop swaybg from sleeping, allowing it to change images, I suspect my script would work.

Otherwise, could you please just make an option that can accomplish this within the program itself. Thanks so much.

sway -C ; [main.c:521] Missing a required Wayland interface

[main.c:521] Missing a required Wayland interface
so sory for opening the issue rapidly
just getting litle red log message of sway with checking by param [-C] (validation of config file)
chop of my conf is like
output * bg $image_url/img.jpg fill

is myconf fine in format typing, coz when iam remove them. it goes fine no any _redlove_msg, or there some issues with swaybg or maybe swaywm itself ?
this is what iam used
sway version 1.2-897c36b1 (Jan 6 2020, branch 'master')
swaybg version 1.0-2-ga8f109a (Jan 3 2020, branch 'master')

is it fine ? maybe there somebody else who have some little redlove message like me

webp images yield error "Couldn’t recognize the image file format"

using any webp image:

swaybg --version
swaybg version 1.2.1
swaybg -i osu.webp
2024-06-23 13:07:02 - [main.c:282] Found config * for output eDP-1 ((null))
2024-06-23 13:07:02 - [main.c:282] Found config * for output HDMI-A-1 ((null))
2024-06-23 13:07:02 - [background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “osu.webp”).
2024-06-23 13:07:02 - [main.c:610] Failed to load image: osu.webp

c.f. #10, #22

Request video file support

I think it would be amazing if swaybg could add video file support for looping background videos, this could add a tremendous amount of value for users.

Suggested formats might include MKV and MP4.

Swaybg crashes with swaylock

Hello !
I use sway version 1.10-dev-dcdb7275 (May 12 2024, branch 'master').
I use swaylock version v1.7.2-22-gf9ce3f1 (" DATE ", branch 'master')
And I use swaybg version v1.2.1-5-g4262e01 (May 16 2024, branch 'master')

When swaylock launches wallpaper crash, can you help me ? please

WebP support

I would like to have output support WebP images. My personal use case is having wallpapers stored in a format that is reasonably cross-compatible as well as keeping good compression on both complicated and simple images; having half in PNG and half in JPEG seemed impractical. (An unexpected gain from this change was that the images compressed in half, from 3MB to 1.5MB!)

I have only tested this on 1.5.1 since 1.6 is still in the staging repositories in Arch and hence is at a significant risk of breaking the system.

Render SVG files at output resolution

At the moment, when an SVG file is loaded, it is rendered as an image at the document size; this rendered image is then up- or downscaled onto the buffer for the destination output. It would be better to render the SVG file directly onto the output's wl_buffer.

Example branch to show one way to implement this: https://github.com/mstoeckl/swaybg/tree/svg-direct

Note: At the moment, librsvg does not support image-rendering: pixelated, which could be useful as a way to display pixel art with nearest-neighbor upscaling. However, with tools like https://github.com/tinychameleon/blocky, it is still possible to emulate the nearest neighbor scaling method.

Some pictures flipped 180 only with swaybg

I have some pictures which when set as wallpaper with swaybg is shown upside down, yet it is shown right side up in both my image gallery app and file manager. Even when I rotate the image by 180 and save it so that it's now upside down in both the gallery app and file manager, swaybg still shows it upside down.

swaybg displays the image correctly when I use imagemagick's -auto-orient on the file

jhead foo.jpg shows the difference between the original and the -auto-oriented file: the former has addditional metadata: Orientation : rotate 180.

swaybg seems to not support this image orientation metadata so cannot display the image "correctly".

`swaybg` not drawing entire back

I noticed this recently - there was a pixel border showing around the bottom and right of my laptop internal display.

Confirmed today when experimenting with glpaper. Here's glpaper drawing the background, which is oddly visible despite swaybg still running.

The relevant output line is:

set $purpledark '#04000a'

output * background $purple solid_color                                                                                                                                                                                                           

Unfortunately, this is not visible with a screenshot, so this video is the best I can do: https://photos.app.goo.gl/giMEpkbx8fTstfDS7

[cole@xeep:~]$ sway --version
sway version 00cffb8e20d4bb800134f26dcda8a01afa4467d2

[cole@xeep:~]$ swaybg --version
swaybg version 25c6eaf15e64655385f01cbb98bffe28a862fe13

Feature request: randomization

Feature

The ability to chose randomly a background image from a directory or directory tree.

The problem and its context

I have a small local network with a few users and machines. In a shared file-system
there is a wallpapers directory-tree, where images are organized by categories
and subcategories (it's not a very large tree). Each user has then the
possibility to set her/his screen's background with feh, to display either

  1. a given image from the shared wallpapers directory-tree (or any image of his/her
    own);
  2. a random image from the whole wallpapers' directory-tree (or from any branch of
    that tree, or actually from any directory or directory-tree).

Now that we have decided to transition from X11 to Wayland and so we have also
moved from i3 to Sway. But given that Sway comes with its own background image
setter, we hoped not to need a replacement for feh...

Suggested usage syntax

  1. To pass the wallpaper directory, either:
    • allow the path given to the -i option to be a directory and decide automatically
      what to do based on the file-type, or
    • add a new option (perhaps -d) for that specific purpose.
  2. Add an extra option to recurse the directory-tree (perhaps -r).

Any way to determine current wallpaper?

Hello

I was trying to develop a GUI utility to set Sway wallpapers. The major hurdle at the moment is I could not find a reliable way to determine the current wallpaper.

I was hoping if a command line parameter -current with swaybg could provide the list of wallpapers set per monitor.

Thanks

Wallpaper use lots of ram

Hi,

I use a big screen layout with sway:

I use variety to set my background:

I noticed today that swaybg is using a lots of RAM:
2020-11-14T13:16:37,722896952+01:00

➜ ps aux | grep swaybg
user     1512217  0.0  9.0 736848 721596 tty1    S+   11:38   0:02 swaybg -o DP-5 -i /home/user/.config/variety/Downloaded/Unsplash/photo-1504575797-2f83688754b8.jpg -m fill -o DP-6 -i /home/user/.config/variety/Downloaded/Unsplash/photo-1504575797-2f83688754b8.jpg -m fill -o eDP-1 -i /home/user/.config/variety/Downloaded/Unsplash/photo-1504575797-2f83688754b8.jpg -m fill -o * -i /home/user/.config/variety/Downloaded/Unsplash/photo-1504575797-2f83688754b8.jpg -m fill -o DP-2 -i /home/user/.config/variety/Downloaded/Unsplash/photo-1504575797-2f83688754b8.jpg -m fill -o DP-3 -i /home/user/.config/variety/Downloaded/Unsplash/photo-1504575797-2f83688754b8.jpg -m fill
➜ swaymsg -t get_outputs
Output DP-2 'ONKYO Corporation Sound System 0x00000000'
  Current mode: 1920x1080 @ 60.000000 Hz
  Position: 3291,307
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 3
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    640x480 @ 72.808998 Hz
    640x480 @ 75.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    720x480 @ 60.000000 Hz
    720x576 @ 50.000000 Hz
    720x576 @ 50.000000 Hz
    800x600 @ 60.317001 Hz
    800x600 @ 72.188004 Hz
    800x600 @ 75.000000 Hz
    1024x768 @ 60.004002 Hz
    1024x768 @ 70.069000 Hz
    1024x768 @ 75.028999 Hz
    1024x768 @ 119.988998 Hz
    1280x720 @ 50.000000 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.910000 Hz
    1280x800 @ 119.908997 Hz
    1440x900 @ 59.901001 Hz
    1280x1024 @ 60.020000 Hz
    1280x1024 @ 75.025002 Hz
    1600x1200 @ 60.000000 Hz
    1920x1080 @ 23.976000 Hz
    1920x1080 @ 24.000000 Hz
    1920x1080 @ 25.000000 Hz
    1920x1080 @ 29.969999 Hz
    1920x1080 @ 30.000000 Hz
    1920x1080 @ 50.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz

Output DP-3 'Dell Inc. DELL P2417H CW6Y77AG05NB' (focused)
  Current mode: 1920x1080 @ 60.000000 Hz
  Position: 3291,1387
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2:
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    720x400 @ 70.082001 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 75.000000 Hz
    800x600 @ 60.317001 Hz
    800x600 @ 75.000000 Hz
    1024x768 @ 60.004002 Hz
    1024x768 @ 75.028999 Hz
    1152x864 @ 75.000000 Hz
    1280x1024 @ 60.020000 Hz
    1280x1024 @ 75.025002 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz

Output eDP-1 'Chimei Innolux Corporation 0x14D3 0x00000000'
  Current mode: 1920x1080 @ 60.007999 Hz
  Position: 5211,1694
  Scale factor: 1.400000
  Scale filter: linear
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 3:
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    1920x1080 @ 60.007999 Hz

I can see that variety run a command even of non existent monitors, i will open an issue there. But is the ram consumption related to this ?

error: macro "__DATE__" might prevent reproducible builds

i maintain a meta layer for the yocto/open-embedded cross buildsystem to provide wayland/wlroots based recipes. While switching to yocto master branch to prepare for the upcoming release and thereby also switching to gcc 11.2 , i encounter the following error:

| ../git/main.c:474:59: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
|   474 |                         fprintf(stdout, "swaybg version " SWAYBG_VERSION "\n");
|       |                                                           ^~~~~~~~~~~~~~
| cc1: all warnings being treated as errors

This can be bypassed by adding:

CFLAGS:append = " -Wno-error=date-time"

EDIT: I see the same issue if building sway

bash-completion doesn't obey prefix

casus

Trying to install as a user with meson configure --prefix ${HOME}/.local.

behaviour

Bash-completion files are still installed in system-wide folder, failing without root privilege.

desired behaviour

Bash-completion files should end up in: $HOME/.local/share/bash-completion/completions or similar.

I'm unfamiliar with Meson internals, so I don't know how

bash_comp      = dependency('bash-completion', required: false)

and

bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir')

are resolved.

Otherwise I would be happy to create a PR.

Background image not read from included config

Background

I am trying to setup a shared config file for two different computers, each should have a different background image. The dotfiles are in a shared git repository, thus I include the appropriate file with the include statement, passing the $HOST environment variable.

The Problem

swaybg does not seem to respect included config files. If I run sway -c sway_config (which includes my_config), the background image is not shown, if I run sway -c my_config it is shown.

my_config:

output LVDS-1 bg "$HOME/Pictures/Wallpaper/landscape-4114839_1920.jpg" fill

sway_config:

include "my_config.txt"

Log

When I run swaybg manually, it outputs:

2021-05-25 16:11:38 - [swaybg-1.0/main.c:295] Could not find config for output LVDS-1 (Unknown 0x03DF 0x00000000)

Cursor scaling not applied on HiDPI screen

Sway: sway version 1.1-rc1-57-g152e30c3 (Jul 9 2019, branch 'master')
Swaybg: swaybg version 1.0-1-g25c6eaf (Jul 8 2019, branch 'makepkg')

It seems that since a few updates ago, the cursor doesn't scale properly when hovering over the background, window title or swaybar. Sway scaling is set to 2x on a 4k display, while the cursor remains at 1x. I haven't updated sway for a couple months so I'm not sure which update introduced the regression but it used to scale fine at some point.

High CPU usage with wlroots 0.15

Swaybg started using up to 100% CPU after upgrading to wlroots 0.15.0-4

Also upgraded kernel:

%zsh> uname -r
5.16.2-arch1-1

Happens also after shutting down and restarting the swaybg process (with or without setsid). Doesn't seem to depend on the -m mode.

I can make it happen with simple stuff like swaybg -c #ff0000 (seems to be ~65%, rather than ~100% when using an image).

%zsh> swaybg --version
swaybg version 1.1

I'm using the dwl compositor, I'll try on sway if I get a chance.

Output of the example, for reference:

%zsh> swaybg -c #ff0000
2022-01-28 08:36:36 - [swaybg-1.1/main.c:321] Found config * for output HDMI-A-5 (Samsung Electric Company C24F390 HTPJ700036)
2022-01-28 08:36:36 - [swaybg-1.1/main.c:321] Found config * for output HDMI-A-4 (Unknown MSI MAG161V AA1H010800597)

Animated background

Hello!

I wanted to add an animated background, but I can't find the way to do it. I tried first adding a .gif image, but it renders as an static image. Also, I wasn't able to write a script to change the background image really quick.

Is it possible / could it be implemented in a future?

Thanks!

swaybg command doesn't work until killed

Any attempt to launch it results in [swaybg-1.1/main.c:321] Found config * for output LVDS-1 (Unknown 0x219D 0x00000000).

Maybe a message that only one swaybg instance is allowed would be better?

swaybg crashes when connecting/disconnecting external monitor

Hi, I am experiencing a problem with swaybg each time that I plug or unplug an external monitor. The background images simply disappear. If I run swaybg in the terminal I get the following output (with both monitors):

$ swaybg -c "#ff0000"
2022-11-07 21:15:53 - [swaybg-1.1.1/main.c:340] Found config * for output DP-1 (Dell Inc. DELL P2219H 9Y3B8W2)
2022-11-07 21:15:53 - [swaybg-1.1.1/main.c:340] Found config * for output eDP-1 (Sharp Corporation 0x1421 0x00000000)
Bus error (core dumped)

... and with one monitor only:

$ swaybg -c "#ff0000"
2022-11-07 21:29:06 - [swaybg-1.1.1/main.c:340] Found config * for output eDP-1 (Sharp Corporation 0x1421 0x00000000)
Bus error (core dumped)

I am using Archlinux. Swaybg version is 1.1.1

How can I get more useful information for debugging?

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.