dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 4094e02589749e8c3d4535a4d8bcf3cd3ceeff41
parent 90588ab1e729abba09f9948c0f91188ba6935322
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 17 Jul 2019 12:37:42 +0200

Clean up xrandr-auto script and add UDEV example

Diffstat:
M.config/sxhkd/sxhkdrc | 4++--
M.local/bin/xrandr-auto | 12++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc @@ -32,9 +32,9 @@ super + Print super + {Print,Delete} dmenurecord {,kill} XF86Launch1 - xrandr --auto; xbacklight -set 100 + xrandr-auto; xbacklight -set 100 shift + XF86Launch1 - xrandr --auto; xbacklight -set 1 + xrandr-auto; xbacklight -set 1 super + F5 $TERMINAL -e nmtui-connect #$TERMINAL -e sudo wpa_cli diff --git a/.local/bin/xrandr-auto b/.local/bin/xrandr-auto @@ -1,12 +1,16 @@ #!/bin/sh +# combine with the following: /etc/udev/rules.d/95-display.rules +# ACTION=="change", SUBSYSTEM=="drm", RUN+="/bin/su ad -c 'sleep 12; /home/ad/.local/bin/xrandr-auto'" + +export DISPLAY=:0 +export XAUTHORITY=$HOME/.Xauthority + internal_screen=LVDS1 external_screen=DP3 -if (xrandr | grep "^$external_screen connected" >/dev/null); then - notify-send "${0##/*} Activating external monitor $external_screen" +if xrandr -q | grep "^$external_screen connected" >/dev/null; then xrandr --output $external_screen --auto --output $internal_screen --off else - notify-send "${0##/*} Activating internal monitor $internal_screen" - xrandr --output $external_screen --off --output $internal_screen --auto + xrandr --output $internal_screen --auto --output $external_screen --off fi