Manage screen layout for laptop connected to external display

Last updated on 2022-01-23 Tagged under  # python  # programming  # linux

My Thinkpad X230 has a 12.5" 1366x768 display, and at home I connect to a 32" 2560x1440 external display positioned behind and above the laptop. I'm using Openbox as the window manager, which does not include a built-in utility for configuring a multi-monitor layout.

I created dual_display.py to enable or disable an extended desktop from the two displays. Used with the --above option, the external display is set as primary and above the laptop display. That is, the taskbar is displayed solely on the primary, external display, and windows and the cursor pass through the bottom-left side of the display to the secondary, laptop display and back up again ...

$ dual_display.py -h
usage: dual_display.py [-h] [-a] [-l] [-r] [-o OFF]

Enable|disable a dual-display layout.

optional arguments:
  -h, --help         show this help message and exit
  -a, --above        primary display positioned ABOVE secondary display
  -l, --left         primary display positioned LEFT of secondary display
  -r, --right        primary display positioned RIGHT of secondary display
  -o OFF, --off OFF  turn OFF display (where OFF is 0 or 1)

I use Python's subprocess module to run shell commands that use xrandr to retrieve display names, and set position of the primary display relative to the secondary display.

Sources: dual_display.py and autostart


» Later: Generate a list of installed Debian packages on one device (and install on another)

« Earlier: Dot bashrc