Recently, I discovered the i3 key mode feature. Immediately, I configured two scenarios for better i3 control: management of music/video and (external) screens.

The configuration for either scenario is straight forward. Here is my config for the management of music and video:

set $mode_playerctl "playerctl: [p]lay/[p]ause [n]ext [b]ack"
bindsym $mod+m mode $mode_playerctl
mode $mode_playerctl {
    bindsym p exec playerctl play-pause; mode "default"
    bindsym n exec playerctl next; mode "default"
    bindsym b exec playerctl previous; mode "default"

    bindsym Return mode "default"
    bindsym Escape mode "default"
}

As any i3 user realizes quickly, the number of shortcuts to configure with any keyboard comes with a finite number of possibilities. To tackle this problem, i3 implemented key modes. Key modes can be compared to submenus. Once a key combination is pressed, a submenu is created/opened. This creates a new context, allowing you to map keys freely and independently from any other mappings. In the example above $mod+m opens such a menu. It then allows me to press the keys p, n or b to play/pause, or jump to previous or next music/video accordingly. More information about playerctl can be found here: https://github.com/acrisci/playerctl.

Here is what the menu looks like, based on the above config:

The second menu allows me to control my external screens:

set $mode_xrandr "xrandr: [a]uto [h]ome (dock) [i]ntegrated, move workspace [u]p, [d]own, [l]eft, [r]ight"
bindsym $mod+p mode $mode_xrandr
mode $mode_xrandr {
    bindsym a exec xrandr --auto; mode "default"
    bindsym h exec /home/$USER/.screenlayout/home-dockingstation.sh; mode "default"
    bindsym i exec /home/$USER/.screenlayout/laptop.sh; mode "default"

        bindsym u move workspace to output up; mode "default"
        bindsym d move workspace to output down; mode "default"
        bindsym l move workspace to output left; mode "default"
        bindsym r move workspace to output right; mode "default"

    bindsym Return mode "default"
    bindsym Escape mode "default"
}

The use of screenlayout configurations has been documented here (my-linux-desktop, chapter “External screens”)