Manage external displays with Gnome and Argos extension

· 359 words · 2 minute read

I wanted to easily switch between my regular desktop configuration:


All the external displays:


To a single external display:


Or just the laptop screen:


This usually required to open gnome-control-center, then click displays, etc.


So I thought it would be nice to look for a extension in the Gnome Extensions site… but I couldn’t find any that worked as I wanted… so let’s try to do our own method! :)

Argos 🔗

Just in case you never heard of Argos, it is a Gnome ‘metaextension’ where you can create your own extensions based on scripts, commands, etc. It is inspired by, and fully compatible with, the BitBar app for OSX.

In order to install it, you just need to go to its the Gnome Extensions page and click on the “ON|OFF” button. Profit!

There are plenty of examples and useful argos/bitbar scripts out there so my recomendation is to look for ‘prior art’ to inspire yourself on creating your own extensions.

Xorg or Wayland? 🔗

I use Xorg instead of Wayland because I couldn’t find an alternative to xbindkeys for Wayland to customize my MX Master 2S mouse keys. See here for more information on how to do that, but basically, this is my ~/.xbindkeysrc:

# thumb wheel up => increase volume
"xte 'key XF86AudioRaiseVolume'"

# thumb wheel down => lower volume
"xte 'key XF86AudioLowerVolume'"

Enter xrandr and arandr 🔗

tl;dr.- xrandr is a cli tool to manage displays using xorg while arandr is a nice GUI tool to create xrandr “scripts” easily:

arandr screenshot

Basically it generates sh scripts such as ~/.screenlayout/

xrandr --output eDP-1 --mode 1920x1080 --pos 3000x420 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off --output DP-1-1 --primary --mode 1920x1080 --pos 0x420 --rotate normal --output DP-1-2 --mode 1920x1080 --pos 1920x0 --rotate left --output DP-1-3 --off

So I have a script for each of my setups:

$ ls -1 ~/.screenlayout/

Argos extension 🔗

With everything in place, the argos extension is just this ~/.config/argos/ script:

#!/usr/bin/env bash

echo "|iconName=video-display"
echo "---"

for i in $(find ~/.screenlayout/*.sh)
  echo "${file%.*} | bash='${i}' terminal=false"

Which looks like:

argos screenshot