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'"
b:8
# thumb wheel down => lower volume
"xte 'key XF86AudioLowerVolume'"
b:9
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:
Basically it generates sh
scripts such as ~/.screenlayout/00-standard.sh
:
#!/bin/sh
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/
00-standard.sh
01-single-external.sh
02-only-external.sh
03-laptop.sh
04-vertical.sh
Argos extension 🔗
With everything in place, the argos extension is just this
~/.config/argos/external_monitor.1r..sh
script:
#!/usr/bin/env bash
echo "|iconName=video-display"
echo "---"
for i in $(find ~/.screenlayout/*.sh)
do
# https://stackoverflow.com/questions/2664740/extract-file-basename-without-path-and-extension-in-bash
file="${i##*/}"
echo "${file%.*} | bash='${i}' terminal=false"
done
Which looks like:
Nice!!!