• Stars
    star
    164
  • Rank 230,032 (Top 5 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created almost 9 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bash script for applying a pre-defined Xorg monitor layout. Useful for tiling window manager users.

display-visor

i3 does not manage displays and I move my laptop around a lot. This little script fills a much needed gap in my tiling window manager setup.

How it works

When executed, it checks the available and connected display outputs and sets the optimal resolution for each (as determined by xrandr). It can then also reset the wallpaper. The script then waits for a signal to restart the procedure.

At the moment I have three outputs defined: LVDS1, HDMI1 and VGA1. For now, layout configuration is hard-coded. I am hoping to make this more dynamic.

When lid is open (-l): LVDS (Primary) on left with HDMI or VGA on right. My laptop can only handle two displays at a time, so if both HDMI and VGA are present, or...

When lid is closed: HDMI (Primary) on left with VGA on right.

If you prefer, you could of course use arandr to generate layout scripts and replace my xrandr lines with those.

How to use it

Usage: display-visor [-f] [-i] [-l [switch]]

	-f, --feh	Run feh bg script.
                         Executes ~/.fehbg upon completion.
	-i, --i3	Test for i3wm instance.
                         For avoiding conflict with multiple environments.
	-l, --lid	Check laptop lid status.
                         Ignored/Assumed closed if not given. 
                         It is possible to specify switch. Defaults to 'LID0'
                         If unsure, look under /proc/acpi/button/lid/...
	-v, --version	Print version info.
Start:

Simply set the script to start upon login.

i3wm config example:

exec --no-startup-id display-visor -f -l
Signal:

The script waits for a RTMIN+5 real-time signal. This can be sent with pkill like so:

pkill -x -RTMIN+5 display-visor
Events:

Some default event signallers are included.

  • udev - A hotplug rule for when cables are (dis)connected.
  • acpid - A lid switch event action. Useful when -l argument is used. [1]
  • systemd-sleep - A wake-up hook. [2]

Installation

  • Arch Linux - Available on the AUR as display-visor

Or manually with:

$ sudo make (un)install

Dependencies

Notes

[1] Remember to restart acpid service for this to take effect. [2] Please see Issue #8


####Credits I shamelessly stole some base functionality from codingtony. Thank you, kind sir.