Schlagwort: i3

  • Focus

    Here’s a solution for a problem I have been unable to find anything about on the net, so I would like to share it with you.
    It results from a particular combination of choices that are not exactly mainstream, so it is probably quite rare:

    Setup

    First, I use the i3 window manager. Like many of the more usual window managers, it supports the notion of work spaces. I also use multiple monitors, and this is where i3 is different: instead of building up a huge desktop stretching over all monitors (and changing its contents via workspaces), each monitor is taken seperately; and each can be assigned one or more workspaces.You start working on a different workspace either by moving the mouse pointer, or by a key combination.

    Here’s where factor number three comes in: I use an absolute pointing device, namely a Wacom Intuos3. By default, the tablet maps to the whole screen area — treating it as a single desktop,
    conceptually very diferent from i3’s approach.

    Culture Clash

    This shows: when I switch to a different screen, i3 has the ability to warp the mouse pointer, i.e. make it jump to the newly focused window. This is a nice touch for an ordinary (relative) mouse, but an absolute mouse will jump right back. You have to manually move it over.
    It might seem like a good idea to switch screens using the mouse instead, but this does not work well if you need a workspace that lingers at the back of your other monitor — you have to click on a tiny icon at the bottom. Besides, using the mouse to switch workspaces does feels wrong with keyboard-centric i3.
    I ended up using a key combination and moving the mouse over, which feels redundant and annoying.

    I looked for a way to confine my Intuos to just the active monitor, but have been unsuccessful until recently. Here’s my setup:

    Solution

    First, bund workspaces to monitors:
    workspace 1 output HDMI-0
    workspace 2 output HDMI-0
    workspace 3 output HDMI-0
    workspace 4 output HDMI-0
    workspace 5 output HDMI-0
    workspace 6 output DVI-I-1
    workspace 7 output DVI-I-1
    workspace 8 output DVI-I-1
    workspace 9 output DVI-I-1

    Then, replace the ordinary workspace-switching key combinations by extended ones that also remap the input device:

    bindsym $mod+1 exec --no-startup-id " i3-msg workspace 1; exec $HOME/bin/wacom-left"
    bindsym $mod+2 exec --no-startup-id " i3-msg workspace 2; exec $HOME/bin/wacom-left"
    bindsym $mod+3 exec --no-startup-id " i3-msg workspace 3; exec $HOME/bin/wacom-left"
    bindsym $mod+4 exec --no-startup-id " i3-msg workspace 4; exec $HOME/bin/wacom-left"
    bindsym $mod+5 exec --no-startup-id " i3-msg workspace 5; exec $HOME/bin/wacom-left"
    bindsym $mod+6 exec --no-startup-id " i3-msg workspace 6; exec $HOME/bin/wacom-right"
    bindsym $mod+7 exec --no-startup-id " i3-msg workspace 7; exec $HOME/bin/wacom-right"
    bindsym $mod+8 exec --no-startup-id " i3-msg workspace 8; exec $HOME/bin/wacom-right"
    bindsym $mod+9 exec --no-startup-id " i3-msg workspace 9; exec $HOME/bin/wacom-right"
    bindsym $mod+0 exec --no-startup-id " i3-msg workspace 10; exec $HOME/bin/wacom-right"

    Note the double quotes — single quotes get messed up in some internal shell call and lead to weird error messages.
    The remap scripts apply a coordinate transformation matrix that depends on your monitor setup and sizes.
    #!/bin/bash -x
    xinput set-prop "Wacom Intuos3 6x8 stylus" --type=float \
    "Coordinate Transformation Matrix" 0.6 0 0 0 1 0 0 0 1

    For some hints on how to calculate the proper matrices, see the linuxwacom wiki.