Automatic xrandr call when plug monitor

Lorenzo Sutton lorenzofsutton at gmail.com
Fri Dec 7 12:09:16 CET 2018


Hi,

A hack I've set-up for a similar situation (external display for my 
laptop at the office) is to symlink the script generated by arandr [1] 
in a directory which is in the path, which means I can quickly launch 
this via gmrun [2] (which I use as launcher (and have bound to ALT+F2))


#!/bin/sh
xrandr --output HDMI2 --off --output HDMI1 --off --output DP1 --mode 
1920x1080 --pos 0x0 --rotate normal --output eDP1 --primary --mode 
1366x768 --pos 1920x0 --rotate normal --output VIRTUAL1 --off
sleep 1s
killall -9 xfce4-panel

Killing xfce4-panel is needed so as to ensure each panel is displayed on 
its assigned display correctly.

Hope this helps,
Lorenzo.

[1] https://christian.amsuess.com/tools/arandr/
[2] https://sourceforge.net/projects/gmrun/

On 07/12/18 11:08, Lars Behrens wrote:
> Am 06.12.18 um 16:01 schrieb Pétùr:
> 
>> xrandr --output DP-1-2 --above eDP-1
>>
>> I would like this command to be launched each time I plug the external
>> monitor.
> Not exactly what you are looking for, but I have put the xrandr call in
> a script and assigned a hotkey via xfce4-keyboard-settings.
> 
> To be exact, I assigned different hotkeys for different xrandr settings.
> That way I can switch different settings for different situations.
> 
> Very quick and you don't have to rely on any autodetections.
> 
> HTH a bit.
> 
> Cheerz,
> Lars
> 
> 
> _______________________________________________
> Xfce mailing list
> Xfce at xfce.org
> https://mail.xfce.org/mailman/listinfo/xfce
> http://www.xfce.org
> 



More information about the Xfce mailing list