AnyEvent-I3X-Workspace-OnDemand

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
      bindsym 8 exec i3-msg -t send_tick group:baz; mode default
      bindsym Return mode "default"
      bindsym Escape mode "default"
    }
 
# SYNOPSIS
 
 
    my $i3 = AnyEvent::I3X::Workspace::OnDemand->new(
        debug => 0,
        layout_path => "$ENV{HOME}/.config/i3",
        workspaces => {
            foo => {
                layout => 'foo.json',
            },
            bar => {
                layout => 'bar.json',
                groups => {
                    foo => undef,
                    # Override the layout for group bar

README.md  view on Meta::CPAN

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
## $self->get\_i3
 
Get the [AnyEvent::I3](https://metacpan.org/pod/AnyEvent%3A%3AI3) instance
 
## $self->command(@args)
 
Execute a command, the command can be in scalar or list context.
 
See also ["command" in AnyEvent::I3](https://metacpan.org/pod/AnyEvent%3A%3AI3#command).
 
## $self->debug(1)
 
Enable or disable debug
 
## $self->log($msg)
 
Print warns when debug is enabled
 
## $self->on\_tick($payload, $sub)
 
Subscribe to a tick event with `$payload` and perform the action. Your sub
needs to support the following prototype:
 
    sub foo($self, $i3, $event) {
        print "Yay processed foo tick";
    }

bin/i3-ipc  view on Meta::CPAN

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use EV;
use File::Spec::Functions qw(catfile);
use Pod::Usage qw(pod2usage);
 
 
my %options = (
  logfile => catfile($ENV{HOME}, qw(.config i3 i3-ipc-events.log)),
);
 
GetOptions(\%options, qw(debug help man logfile=s socket=s));
 
if ($options{help}) {
    pod2usage(-verbose => 1);
}
if ($options{man}) {
    pod2usage(-verbose => 2);
}
 
my $i3 = AnyEvent::I3X::Workspace::OnDemand->new(
  debug          => $options{debug} // 0,
  socket         => $options{socket},
  log_all_events => $options{logfile},
);
 
EV::loop;
AE::cv->recv;
 
exit 0;
 
__END__

lib/AnyEvent/I3X/Workspace/OnDemand.pm  view on Meta::CPAN

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use File::Spec::Functions qw(catfile);
 
field $i3;
field $layout_path : param = catfile($ENV{HOME}, qw(.config i3));
 
field @groups;
field $starting_group :param = undef;
field $starting_workspace :param = undef;
field $debug :param          = 0;
 
field $log_all_events :param = undef;
 
field $socket :param = undef;
 
field %workspace;
field %output;
field %mode;
field %window;
field %barconfig_update;

lib/AnyEvent/I3X/Workspace/OnDemand.pm  view on Meta::CPAN

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
field @swallows;
field $c;
 
field $current_group;
field $current_workspace;
 
ADJUSTPARAMS {
  my $args = shift;
 
  $debug = 1 if $log_all_events;
 
  # i3
  %workspace = %{ delete $args->{workspace} }
    if ref $args->{workspace} eq 'HASH';
  %barconfig_update = %{ delete $args->{barconfig_update} }
    if ref $args->{barconfig_update} eq 'HASH';
 
  %tick     = %{ delete $args->{tick} }     if ref $args->{tick} eq 'HASH';
  %shutdown = %{ delete $args->{shutdown} } if ref $args->{shutdown} eq 'HASH';
  %output   = %{ delete $args->{output} }   if ref $args->{output} eq 'HASH';

lib/AnyEvent/I3X/Workspace/OnDemand.pm  view on Meta::CPAN

305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
      $current_group = $group;
      $self->workspace($cur);
    }
  );
 
 
}
 
method log ($msg) {
  return unless $debug;
  warn $msg, $/;
  return;
}
 
method debug ($d = undef) {
  return $debug unless defined $d;
  $debug = $d;
}
 
my @any = qw(any *);
 
method on_workspace ($name, $type, $sub) {
 
  if (ref $sub ne 'CODE') {
    croak("Please supply a code ref!");
  }

lib/AnyEvent/I3X/Workspace/OnDemand.pm  view on Meta::CPAN

463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
=head1 VERSION
 
version 0.004
 
=head1 SYNOPSIS
 
    use AnyEvent::I3X::Workspace::OnDemand;
 
    my $i3 = AnyEvent::I3X::Workspace::OnDemand->new(
        debug => 0,
        layout_path => "$ENV{HOME}/.config/i3",
        workspaces => {
            foo => {
                layout => 'foo.json',
            },
            bar => {
                layout => 'bar.json',
                groups => {
                    foo => undef,
                    # Override the layout for group bar

lib/AnyEvent/I3X/Workspace/OnDemand.pm  view on Meta::CPAN

553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
=head2 $self->get_i3
 
Get the L<AnyEvent::I3> instance
 
=head2 $self->command(@args)
 
Execute a command, the command can be in scalar or list context.
 
See also L<AnyEvent::I3/command>.
 
=head2 $self->debug(1)
 
Enable or disable debug
 
=head2 $self->log($msg)
 
Print warns when debug is enabled
 
=head2 $self->on_tick($payload, $sub)
 
Subscribe to a tick event with C<< $payload >> and perform the action. Your sub
needs to support the following prototype:
 
    sub foo($self, $i3, $event) {
        print "Yay processed foo tick";
    }



( run in 0.644 second using v1.01-cache-2.11-cpan-26ccb49234f )