Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wallpaper per workspace
# example
/path/to/wallpaper.pl | while read num; do echo "feh --bg-scale /path/to/wallpaper$num.png"; done
# produces
# feh --bg-scale /path/to/wallpaper3.png
# feh --bg-scale /path/to/wallpaper1.png
# ...
#!/usr/bin/env perl
BEGIN { $| = 1 }
use strict;
use warnings;
use AnyEvent::I3;
use v5.10;
my $i3 = i3();
die "failed to connect to i3" unless $i3->connect->recv;
die "failed to subscribe to event" unless $i3->subscribe({
workspace => sub {
my ($msg) = @_;
return unless $msg->{change} eq 'focus';
print $msg->{current}->{num} . "\n";
}
})->recv->{success};
AE::cv->recv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment