summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-04-21 17:25:08 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-04-21 17:25:37 -0700
commit875c5b832eb95a01b5e59ec009a7f76ff4f43e92 (patch)
tree4b6c3dc112ad077f235122331088010dde7dc16a
parent4727e5518dc578db936b5524253c7c4eb9f3023e (diff)
downloaddotfiles-875c5b832eb95a01b5e59ec009a7f76ff4f43e92.tar.gz
update handling of wallpapers for use of Sway
-rw-r--r--.config/sway/config6
-rw-r--r--.config/sway/melete/bg13
-rwxr-xr-xbin/choose-wallpaper (renamed from bin/i3-wallpaper)10
-rw-r--r--perl5/Local/Desktop.pm2
4 files changed, 14 insertions, 17 deletions
diff --git a/.config/sway/config b/.config/sway/config
index 25ca1f01..6fe0d846 100644
--- a/.config/sway/config
+++ b/.config/sway/config
@@ -349,4 +349,10 @@ exec update-emacs-daemon-environment
exec_always fcitx5 -d --replace
+# Set solid colour as a fallback; select-wallpaper script in combination with
+# HAS-WALLPAPERS-ON-OUTPUTS Consfigurator property can be used to write
+# ~/.config/sway/$(hostname)/bg to set images on this machine's usual outputs,
+# and to start up swayidle with appropriate options.
+output * bg #FFFFF6 solid_color
+
include ~/.config/sway/$(hostname)/*
diff --git a/.config/sway/melete/bg b/.config/sway/melete/bg
deleted file mode 100644
index 53a8cdf0..00000000
--- a/.config/sway/melete/bg
+++ /dev/null
@@ -1,13 +0,0 @@
-output "eDP-1" bg $HOME/local/wallpaper.png fill
-
-# ideally we wouldn't try to call swaylock if the screen is already locked,
-# but discovering whether swaylock is already running in a way that avoids
-# races is difficult or impossible because swaylock doesn't have a mechanism
-# to report that it's successfully locked the screen other than daemonising.
-# so, until it does, the following means a lot of "failed to lock; already
-# locked?" messages on stderr.
-exec swayidle -w \
- lock 'swaylock -f' \
- before-sleep 'swaylock -f -i eDP-1:$HOME/local/wallpaper.png -s fill' \
- timeout 300 'swaylock -f -i eDP-1:$HOME/local/wallpaper.png -s fill' \
- timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
diff --git a/bin/i3-wallpaper b/bin/choose-wallpaper
index 5d5b95a6..648c1a6b 100755
--- a/bin/i3-wallpaper
+++ b/bin/choose-wallpaper
@@ -8,11 +8,13 @@ use lib "$ENV{HOME}/src/dotfiles/perl5";
use Local::Desktop;
use File::Copy;
+my $x11 = $ENV{XDG_SESSION_TYPE} && $ENV{XDG_SESSION_TYPE} eq "x11";
+
# dirs where wallpaper can be found
our @dirs = ("$ENV{HOME}/annex/wallpaper/pro");
if (@ARGV and $ARGV[0] eq "--check-have") {
- ensure_resize_for_current_outputs;
+ ensure_resize_for_current_outputs if $x11;
exit !<"$ENV{HOME}/local/wallpaper??.*">;
}
@@ -26,8 +28,10 @@ if ($ARGV[0] eq "--random") {
unshift @wallpapers, @ARGV;
select_wallpaper_files @wallpapers;
-resize_for_current_outputs;
-system "i3-startup-always"; # feh and also restart i3lock
+if ($x11) {
+ resize_for_current_outputs;
+ system "i3-startup-always"; # feh and also restart i3lock
+}
# now give develacc something
if (-e "$ENV{HOME}/local/develacc") {
diff --git a/perl5/Local/Desktop.pm b/perl5/Local/Desktop.pm
index 46a62bbf..3ca93b90 100644
--- a/perl5/Local/Desktop.pm
+++ b/perl5/Local/Desktop.pm
@@ -69,7 +69,7 @@ Returns the value of $? right after executing convert(1).
sub resize_for_current_outputs {
# note that swaybg and swaylock have per-output wallpapers built in, so
- # hopefully someday this function will be obsolete ...
+ # this function is only for X11
chomp(my @xrandr = `xrandr`);
my ($canvas_w, $canvas_h) = _get_screen_size(@xrandr);