Skip to content

Instantly share code, notes, and snippets.

@Airblader
Created July 17, 2015 09:39
Show Gist options
  • Save Airblader/d1375fde12d1135daca9 to your computer and use it in GitHub Desktop.
Save Airblader/d1375fde12d1135daca9 to your computer and use it in GitHub Desktop.
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