Browse Source

Add display management script 'srandr.sh'

Added 'srandr.sh' which can utilize a local '~/.display.sh' to read
values as shown in the following:

DisplayConfigs="LVDS1 HDMI1 VGA1"
LVDS1() {
    xrandr --output LVDS1 --auto
}
HDMI1() {
    xrandr --output HDMI1 --auto --above LVDS1
}
VGA1() {
    xrandr --output VGA1  --auto --above LVDS1
}
master
jcmdln 3 years ago
parent
commit
c1ea526d23
3 changed files with 51 additions and 14 deletions
  1. 16
    13
      etc/i3/config
  2. 33
    0
      etc/srandr.sh
  3. 2
    1
      gein.sh

+ 16
- 13
etc/i3/config View File

@@ -10,7 +10,10 @@ set $mod Mod4

## Applications
bindsym $mod+d exec --no-startup-id dmenu_run
bindsym $mod+Return exec st
bindsym $mod+Return exec --no-startup-id st -f 'Noto Mono:10pt'

## Display
exec --no-startup-id "bash /etc/srandr.sh"


### Appearance ###################################
@@ -181,16 +184,16 @@ bindsym Shift+Print --release exec --no-startup-id \
# bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle

## Audio (PulseAudio)
# bindsym XF86AudioRaiseVolume exec --no-startup-id \
# pactl set-sink-volume @DEFAULT_SINK@ +5%
# bindsym XF86AudioLowerVolume exec --no-startup-id \
# pactl set-sink-volume @DEFAULT_SINK@ -5%
# bindsym XF86AudioMute exec --no-startup-id \
# pactl set-sink-mute @DEFAULT_SINK@ toggle
# bindsym XF86AudioPlay exec --no-startup-id pactl play-pause
# bindsym XF86AudioPause exec --no-startup-id pactl pause
# bindsym XF86AudioNext exec --no-startup-id pactl next
# bindsym XF86AudioPrev exec --no-startup-id pactl previous
bindsym XF86AudioRaiseVolume exec --no-startup-id \
pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec --no-startup-id \
pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec --no-startup-id \
pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioPlay exec --no-startup-id pactl play-pause
bindsym XF86AudioPause exec --no-startup-id pactl pause
bindsym XF86AudioNext exec --no-startup-id pactl next
bindsym XF86AudioPrev exec --no-startup-id pactl previous

## Audio (Sndio)
# bindsym XF86AudioRaiseVolume exec --no-startup-id mixerctl
@@ -203,5 +206,5 @@ bindsym Shift+Print --release exec --no-startup-id \
# bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-

## Brightness (xbacklight)
# bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15
# bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 15
bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 5
bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 5

+ 33
- 0
etc/srandr.sh View File

@@ -0,0 +1,33 @@
#!/usr/bin/env sh

Displays=""

while :; do
if [[ $DISPLAY ]]; then
CDisplays=$(xrandr | grep ' connected' | awk '{print $1}')
DDisplays=$(xrandr | grep 'disconnected' | awk '{print $1}')

if [ "$Displays" != "$CDisplays" ]; then
for display in $CDisplays; do
if [ -e "$HOME/.display.sh" ]; then
. "$HOME/.display.sh"
for config in $DisplayConfigs; do
if [ "$display" == "$config" ]; then
$config
fi
done
else
xrandr --output "$display" --auto
fi
done

for display in $DDisplays; do
xrandr --output "$display" --off
done

Displays="$Connected"
fi
else
sleep 5
fi
done

+ 2
- 1
gein.sh View File

@@ -77,6 +77,7 @@ CONFIG() {
/etc/i3/config

/etc/Xresources
/etc/srandr.sh
/etc/tmux.conf
/etc/vimrc
/etc/xinitrc
@@ -149,7 +150,7 @@ case "$(uname -m)" in

*)
echo "gein: CPU arch has not been defined yet"
echo "gein: Submit an issue with the output of 'uname -m'"
echo "gein: Submit an issue with the output of 'uname -m'"
exit
esac


Loading…
Cancel
Save