Update monitor setup and switching

This commit is contained in:
LordMathis 2019-02-05 20:31:53 +01:00
parent d097818be3
commit 4fc2bcab0a
5 changed files with 51 additions and 15 deletions

View File

@ -157,18 +157,15 @@ exec --no-startup-id $HOME/bin/startconky.sh
# Redshift # Redshift
exec --no-startup-id redshift-gtk exec --no-startup-id redshift-gtk
# Switch display output
exec --no-startup-id $HOME/bin/switch_monitors.sh
# KeePassXC # KeePassXC
exec --no-startup-id $HOME/bin/start_keepassxc.sh exec --no-startup-id $HOME/bin/start_keepassxc.sh
# Mate-power-manager # Nemo
exec --no-startup-id mate-power-manager
# Launch Nemo
bindsym $mod+n exec nemo bindsym $mod+n exec nemo
# Turn on/off internal laptop monitor
bindsym $mod+Shift+s exec $HOME/bin/switch_monitors.sh
# reload the configuration file # reload the configuration file
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
@ -203,3 +200,6 @@ mode "resize" {
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
#bar {
# status_command i3blocks
#}

View File

@ -28,6 +28,8 @@ height = 27
radius = 3.0 radius = 3.0
fixed-center = true fixed-center = true
monitor = ${env:MONITOR:}
background = ${colors.background} background = ${colors.background}
foreground = ${colors.foreground} foreground = ${colors.foreground}
@ -37,10 +39,10 @@ line-color = #f00
border-size = 0 border-size = 0
border-color = #00000000 border-color = #00000000
padding-left = 0 padding-left = 2
padding-right = 2 padding-right = 2
module-margin-left = 1 module-margin-left = 2
module-margin-right = 2 module-margin-right = 2
font-0 = Icons:size=10;1 font-0 = Icons:size=10;1
@ -49,10 +51,10 @@ font-2 = Weather Icons:size=10;1
modules-left = i3 modules-left = i3
modules-center = datetime openweathermap modules-center = datetime openweathermap
modules-right = system-usb-udev updates pulseaudio-tail wlan eth xkeyboard battery powermenu modules-right = system-usb-udev updates pulseaudio-tail wlan eth xkeyboard battery
tray-detached = false tray-detached = false
tray-position = left tray-position = right
scroll-up = i3wm-wsnext scroll-up = i3wm-wsnext
scroll-down = i3wm-wsprev scroll-down = i3wm-wsprev

View File

@ -7,4 +7,14 @@ killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch polybar # Launch polybar
polybar default &
intern=eDP-1
extern=HDMI-1
if xrandr | grep "$extern disconnected"; then
m=$intern
else
m=$extern
fi
MONITOR=$m polybar default &

24
bin/monitor_setup.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
intern=eDP-1
extern=HDMI-1
case $1 in
"single")
if xrandr | grep "$extern disconnected"; then
xrandr --output "$extern" --off --output "$intern" --auto
else
xrandr --output "$intern" --off --output "$extern" --auto
fi
;;
"dual")
if xrandr | grep "$extern disconnected"; then
xrandr --output "$extern" --off --output "$intern" --auto
else
xrandr --output $extern --primary
xrandr --output $extern --left-of $intern
fi
;;
esac
i3-msg restart

View File

@ -2,8 +2,8 @@
intern=eDP-1 intern=eDP-1
extern=HDMI-1 extern=HDMI-1
if xrandr | grep "$extern disconnected"; then if xrandr --listactivemonitors | grep "$intern"; then
xrandr --output "$extern" --off --output "$intern" --auto xrandr --output "$intern" --off
else else
xrandr --output "$intern" --off --output "$extern" --auto xrandr --output "$intern" --auto
fi fi