Created
February 4, 2018 16:17
-
-
Save abraverm/f86c19322f3297de1a5948df4880a514 to your computer and use it in GitHub Desktop.
Hot plug monitor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /etc/udev/rules.d/95-monitor-hotplug.rules | |
| IMPORT{program}="/usr/bin/xpub", ACTION=="change", SUBSYSTEM=="drm", KERNEL=="card0", RUN+="/bin/su $env{XUSER} -c /home/$env{XUSER}/bin/screen_layout.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone https://github.com/Ventto/xpub | |
| sudo ln -s $PWD/xpub/src/xpub.sh /usr/bin/xpub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export DISPLAY=:0 | |
| export XAUTHORITY=/home/abraverm/.Xauthority | |
| if xrandr | grep -q "HDMI-1 connected" ; then | |
| notify-send "Home screen layout" | |
| xrandr --output HDMI-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal | |
| bspc query -M --names | grep -q eDP-1 && bspc monitor eDP-1 -r | |
| bspc monitor HDMI-1 -d web term III IV V mail chat music wiki | |
| xrandr --output eDP-1 --off | |
| elif xrandr | grep "^DP.* connected"; then | |
| notify-send "Work screen layout" | |
| screen="$(xrandr | grep "^DP.* connected" | awk '{print $1}')" | |
| xrandr --output "$screen" --mode 1920x1080 --pos 0x0 --rotate normal --output eDP-1 --primary --mode 1920x1080 --pos 0x1080 --rotate normal | |
| bspc monitor "$screen" -d web term III IV V | |
| bspc monitor eDP-1 -d mail chat music wiki | |
| else | |
| notify-send "Laptop only screen layout" | |
| xrandr --output VGA-1 --off --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --off --output DP-1 --off --output DP-2 --off | |
| bspc monitor eDP-1 -d web term III IV V mail chat music wiki | |
| bspc monitor DP-2-2 -r | |
| bspc monitor DP-2-3 -r | |
| bspc monitor HDMI-1 -r | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment