AnyEvent-I3X-Workspace-OnDemand
view release on metacpan or search on metacpan
# DESCRIPTION
Workspace switcher for i3.
This module listens to tick events which are named `group:$name` where the
name corresponds to the workspace groups you have defined. When you send a tick
event the current workspaces get renamed to `$former_group:$workspace_name` and leaves new workspaces for the ones you have defined.
In your `.config/i3/config` you can set something like this to switch
groups:
bindsym $mod+w mode "Activities"
mode "Activities" {
bindsym 0 exec i3-msg -t send_tick group:foo; mode default
bindsym 9 exec i3-msg -t send_tick group:bar; mode default
bindsym 8 exec i3-msg -t send_tick group:baz; mode default
bindsym Return mode "default"
lib/AnyEvent/I3X/Workspace/OnDemand.pm view on Meta::CPAN
my $qr = qr/^$group\:.+/;
my @available = grep { /^$qr/ } map { $_->{name} } @$x;
foreach my $name (keys %workspace) {
my $ws = $workspace{$name};
next unless exists $ws->{group};
if (any { $name eq $_->{name}} @current_workspaces) {
if ($self->_is_in_group($name, $current_group)) {
$self->workspace($name, "rename workspace to $current_group:$name");
}
}
if (any { "$group:$name" eq $_ } @available) {
$self->workspace("$group:$name", "rename workspace to $name");
}
}
$current_group = $group;
$self->workspace($cur);
}
);
}
lib/AnyEvent/I3X/Workspace/OnDemand.pm view on Meta::CPAN
}
my @any = qw(any *);
method on_workspace ($name, $type, $sub) {
if (ref $sub ne 'CODE') {
croak("Please supply a code ref!");
}
state @actions = qw(init focus empty urgent reload rename restored move);
if (any { $_ eq $type } @any) {
$workspace{$name}{$_} = $sub for @actions;
}
elsif (any { $_ eq $type } @actions) {
$workspace{$name}{$type} = $sub;
}
else {
croak("Unsupported action '$type', please use any of the following:"
. join(", ", @actions));
lib/AnyEvent/I3X/Workspace/OnDemand.pm view on Meta::CPAN
}
],
);
=head1 DESCRIPTION
Workspace switcher for i3.
This module listens to tick events which are named C<< group:$name >> where the
name corresponds to the workspace groups you have defined. When you send a tick
event the current workspaces get renamed to C<< $former_group:$workspace_name
>> and leaves new workspaces for the ones you have defined.
In your C<< .config/i3/config >> you can set something like this to switch
groups:
bindsym $mod+w mode "Activities"
mode "Activities" {
bindsym 0 exec i3-msg -t send_tick group:foo; mode default
bindsym 9 exec i3-msg -t send_tick group:bar; mode default
bindsym 8 exec i3-msg -t send_tick group:baz; mode default
( run in 0.267 second using v1.01-cache-2.11-cpan-131fc08a04b )