Skip to content
tobi-wan-kenobi edited this page Nov 9, 2018 · 2 revisions

The xrandr module is a bit complex and warrants its own help page:

The module will display all of your attached displays (i.e. if you connect or disconnect an external monitor, the widget changes size).

If you click on the widget of an enabled display, it will get switched off (careful, don't click on that last active display...). If you left-click on the widget of an disabled display, it will be activated as the left-most display. Similarily, if you right-click instead, it will be activated as the right-most display.

Also, there's a bit of "magic" attached to the module with regards to i3 configuration (starting with 1.7.2, this only happens if you have the parameter xrandr.overwrite_i3config set to "true" explicitly):

If you have a file called ~/.i3/config.template, it will be used as basis for your i3 configuration whenever the display configuration changes (i.e. it will override the previous configuration!). After that, it will search for any files that either match the pattern ~/.i3/config.<this display>-<other displays> or ~/.i3/config.<this display> and append it to the i3 configuration template.

That way, you can change the configuration (e.g. of the status bars) depending on the number of displays attached.

To clarify, here is my setup:

tobiwan@tesla:.i3 $ pwd
/home/tobiwan/.i3/
tobiwan@tesla:.i3 $ ls config*
config  config.DP1-1  config.DP1-2  config.DP1-3  config.eDP1  config.eDP1-DP1-3  config.eDP1-HDMI1  config.HDMI1  config.template  config.VGA1  config.VGA1-eDP1
  • config: Currently active config
  • config.template: Base configuration
  • config.eDP1: i3bar configuration when only the laptop monitor is active
  • config.eDP1-DP1-3: i3bar configuration for eDP1 when also DP1-3 is active

E.g.:

tobiwan@tesla: $ cat ~/.i3/config.eDP1
bar {
        output eDP1
        font pango:Inconsolata 11
        position top
        tray_output none
        status_command ~/.i3/bumblebee-status/bumblebee-status -m nic load cpu battery pasink pasource brightness dnf -t solarized-powerline 

        colors {
                focused_workspace               $base1  $base02 $base1
                active_workspace                $base01 $base03 $base01
                inactive_workspace              $base03 $base03 $base01
                urgent_workspace                $base03 $yellow $base03

                statusline                              $base00
                background                              $base03
                separator                               $yellow
        }
}

bar {
        output eDP1
        font pango:Inconsolata 11
        position bottom
        tray_output None

        status_command ~/.i3/bumblebee-status/bumblebee-status -m redshift time xrandr -p time.format="%H:%M" -t solarized-powerline

        colors {
                focused_workspace               $base1  $base02 $base1
                active_workspace                $base01 $base03 $base01
                inactive_workspace              $base03 $base03 $base01
                urgent_workspace                $base03 $yellow $base03

                statusline                              $base00
                background                              $base03
                separator                               $yellow
        }
}
Clone this wiki locally