Awesome Window Manager: Part 4

Setting screen resolutions.

Awesome Window Manager: Part 4
Share on:

In part three of the “Awesome Window Manager Guide”, we covered,

  • how to add a “run launcher” for searching and loading apps,
  • adding a “hotkey daemon” for launching your favourite apps and taking screenshots,
  • how to create an “autostart script” which automatically launches apps when Awesome starts up.

In part four, we’ll look at setting a screen resolution using xrandr


Display Settings

The way in which you manage your screen resolutions when using a window manager differs slightly from what you’re used to when using Xfce. In Xfce, you most likely used the “xfce4-settings Display” app to manage setting your screen resolutions and layouts. However, since we’re using AwesomeWM and not the Xfce desktop, the “Display” app has no affect here. Therefore, we need to use something different.

ARandR

The easiest way to change your display resolutions, refresh rates and screen positions when using AwesomeWM is to use ARandR: “Another XRandR GUI” which is a GUI for xrandr.

Installing

sudo pacman -S arandr

Once you’ve installed arandr, you can run it with Rofi: Super + Space, and type “arandr”

In the arandr GUI, you can position your screens to where you want them by left-clicking and dragging them into position. You can set your screen resolution from the “Outputs” menu or by right-clicking on a screen in the window.

**arandr** is an easy way to set your screen resolutions for use with AwesomeWM.

**arandr** is an easy way to set your screen resolutions for use with AwesomeWM.

Once you’re happy with your display settings, you can press the Apply button (top left) to set it.

Set Screen Resolution On Login

In order for Awesome to use your display layout settings the next time you log in, you’ll need to save the layout configuration to a file and add the file path to your autostart.sh script.

To do this,

  • In the arandr window, go to the “Layout” menu and choose “Save As”,
  • Save the file to ~/.scripts/awesome_display_layout.sh

Ensure your scripts are executable:

chmod +x ~/.scripts/awesome_display_layout.sh

Next, open your ~/.scripts/awesome_autostart.sh file with a text editor, and on a new line, (preferably before your apps) enter:

# xrandr layout for AwesomeWM
run ~/.scripts/awesome_display_layout.sh &

Below is my autostart.sh script, so you can see how I do it:

#!/usr/bin/env bash
# .scripts/awesome_autostart.sh
# Launch Apps when AwesomeWM starts.

function run {
  if ! pgrep -f $1 ;
  then
    $@&
  fi
}

# List the apps you wish to run on startup below preceded with "run"

# Policy kit (needed for GUI apps to ask for password)
run /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 
# xrandr layout for AwesomeWM
run ~/.scripts/awesome_display_layout.sh 
# Start compositor
run picom --experimental-backend 
# sxhkd Hotkeys
run sxhkd 
# Start Volume Control applet
run volctl 
# Start Network Manager Applet 
run nm-applet 
# Set Numlock key to active.
run numlockx 
# Screensaver
run xscreensaver -no-splash 
# Pamac system update notifications
run pamac-tray 
# Start Dropbox
run dropbox 
# Bluetooth
run blueman-tray 
# MPD
run mpd ~/.config/mpd/mpd.conf 
# Unclutter - (hides mouse pointer after 5 seconds of inactivity)
run unclutter 

The next time you log in to Awesome, it will execute the awesome_display_layout.sh script and set your display configuration for you.