Created
January 4, 2016 04:09
-
-
Save devdsp/fe0ed3a63e4511461aed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use AnyEvent::I3 qw(:all); | |
my $i3 = i3(); | |
$i3->connect->recv or die "Error connecting to i3"; | |
my $output = undef; | |
sub proc { | |
my ($self) = @_; | |
if( $self->{'type'} eq 'output' ) { $output = $self->{'name'}; } | |
if( $self->{'focused'} == 1 ) { | |
system( "xsetwacom set 'Wacom Intuos4 6x9 Pen stylus' MapToOutput $output"); | |
} else { | |
map {proc( $_ )} @{$self->{'nodes'}}; | |
} | |
} | |
$i3->subscribe({ workspace => sub { $i3->get_tree->cb( sub { map {proc($_)} @{$_[0]->{'_ae_sent'}}; }); } | |
})->recv->{success} or die "Error subscrubing to events"; | |
AE::cv->recv; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment