Generate a star map using Stellarium and set it as the wallpaper of your Sway desktop.
-
sway
- the compositor. -
swww
- wallpaper manager, to be able to change the wallpaper dynamically. -
stellarium
- astronomy software, to generate the star map. -
ImageMagick
- theconvert
utility is used to chop the star map screenshot into the individual wallpapers for each output. -
cpulimit
- limits Stellarium's CPU usage so that it is not noticeable while it runs in the background. -
gojq
orjq
- JSON processing utility, to munge the output ofswaymsg
.
-
sway-wallpaper-stellarium.env
- Environment file for the Stellarium script. Edit it to contain your location's latitude and longitude. -
sway-wallpaper-stellarium.sh
- Wallpaper script. It runsstellarium
, waits for the star map screenshot to be taken, usesconvert
to create the individual wallpapers for each output, and usesswww
to update the wallpapers of each output. -
wallpaper.ssc
- Stellarium script to generate the star map screenshot. -
sway-wallpaper-stellarium.service
- User-session systemd service unit to run the wallpaper script. Invoked by the timer unit. -
sway-wallpaper-stellarium.timer
- User-session systemd timer unit to run the wallpaper service once every 15 minutes. -
swww.service
- User-session systemd service unit to runswww
daemon.
make install
will install all files to the appropriate directories and enable the systemd units.
Make sure to edit ~/.config/sway-wallpaper-stellarium.env
to contain your latitude and longitude.
The systemd units assume the existence of sway-session.target
and graphical-session.target
. Edit them as you need if your Sway setup does not use those targets.
Sway-specific things:
-
sway-wallpaper-stellarium.sh
usesswaymsg -t get_outputs
to discover the output names and dimensions. Something based onzxdg_output_manager_v1
would be more compositor-agnostic. -
sway-wallpaper-stellarium.sh
usesswaymsg
to run Stellarium in the background, to move it to the scratchpad, and to resize it to the size required for the screenshot. If Stellarium ever provides a way to take screenshots headlessly, this would not be necessary. Alternatively one could have a nested headless compositor and runstellarium
against itsWAYLAND_DISPLAY
instead.
Wayland-specific things:
swww
only supports Wayland compositors, specifically those that support the xdg-output-unstable-v1 and wlr-layer-shell-unstable-v1 protocols.
systemd-specific things:
- The service and timer units. They don't do anything complicated and can be trivially replaced with your service manager's equivalents.
I'm open to PRs to make it more general.
Yeah I spent a few hours implementing this and then realized it's not actually useful to me :V
AGPL-3.0-only
sway-wallpaper-stellarium
https://github.com/Arnavion/sway-wallpaper-stellarium
Copyright 2023 Arnav Singh
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, version 3 of the
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.