AnyEvent-I3X-Workspace-OnDemand

 view release on metacpan or  search on metacpan

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

        personal:

  # i3 config
  set $dev "dev"
  set $debug "dbg"
  bindsym $mod+1 workspace $dev
  bindsym $mod+2 workspace $debug
  bindsym $mod+Shift+1 move container to workspace $dev
  bindsym $mod+Shift+2 move container to workspace $debug

  # Dynamic workspaces
  bindsym $mod+w mode "Dynamic workspaces"
  mode "Dynamic workspaces" {
    bindsym 0 exec i3-msg -t send_tick group:personal; mode default
    bindsym 9 exec i3-msg -t send_tick group:work; mode default
    bindsym Return mode "default"
    bindsym Escape mode "default"
  }

=head2 Layout Management

Now you need to create layouts for your workspaces, for this please refer to
the L<i3 website|https://i3wm.org/docs/layout-saving.html>. They have excellent
documenation and allows you to play a bit with your layout(s) before
configuring them: C<i3-msg "workspace foo; append_layout /path/to/layout.json">

You can store your layouts in C<$HOME/.config/i3>, or put them elsewhere and
configure a path for it:

  # wod.conf
  layout_path: /path/to/layouts

Once you are happy with your layout you can configure them in C<wod.conf>:

  workspace:
    dev:
      layout: dev.json
      group:
        work:
          layout: dev-work.json 
        personal:

And as you see, you can override a layout for a specific group.
You can also disable a workspace for a group, C<dev> now isn't part of
C<personal>:

  workspace:
    dev:
      layout: dev.json
      group:
        work:

And to make a workspace available in all groups:

  workspace:
    dev:
      layout: dev.json
      group:
        all:

To have a workspace available in only one group, don't define a global layout,
just on the group itself

 media:
  group:
    personal:
      layout: media.json

There is one take-home message here:
A workspace is considered active when it is assigned to a group.
A layout is optional — if one is present (either globally or under the group),
it will be applied.

If no layout is found, the workspace will still be available, but nothing will
be appended or launched.

=head2 Application Launching

Applications are automatically launched based on the swallow construct on the
layout:

  - cmd: --no-startup-id kitty
    match:
      class: ^kitty$

Here you see that kitty is started on the class kitty.
But you can start a specific thunderbird profile on the group C<work> when your
layout has a class C<thunderbird-default>, but starts another instance when you
are on either a different workspace or group:

  - cmd: tb-work
    on:
      group: work
    match:
      class: ^thunderbird-default$

  - cmd: tb-private
    on:
      workspace: area51
    match:
      class: ^thunderbird-default$

The same can be done for browsers:

  - cmd: firefox-nightly
    on:
      group: personal
    match:
      window_role: ^browser$

  - cmd: --no-startup-id start-chrome work
    on:
      group: work
    match:
      window_role: ^browser$

This allows you to tweak all the startup applications you have defined in the
layout without having to start them when you open i3. Closing an empty
workspace and reopening it will result in an C<init> action by i3 and gives you
a fresh layout start.

=head2 i3 Integration

Use to ensure i3-wod is always running correctly, even after reloading i3:

  exec_always --no-startup-id "i3-wod &"

As shown earlier you can use regular C<bindsym>s to trigger group or context
changes. Modes are the preferred way:

  # Dynamic workspaces



( run in 0.559 second using v1.01-cache-2.11-cpan-7fcb06a456a )