diff --git a/.config/i3/config b/.config/i3/config index 4f0dc13..93606b6 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -157,18 +157,15 @@ exec --no-startup-id $HOME/bin/startconky.sh # Redshift exec --no-startup-id redshift-gtk -# Switch display output -exec --no-startup-id $HOME/bin/switch_monitors.sh - # KeePassXC exec --no-startup-id $HOME/bin/start_keepassxc.sh -# Mate-power-manager -exec --no-startup-id mate-power-manager - -# Launch Nemo +# 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 bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) @@ -203,3 +200,6 @@ mode "resize" { bindsym $mod+r mode "resize" +#bar { +# status_command i3blocks +#} diff --git a/.config/polybar/config b/.config/polybar/config index 0aadb52..d674b3d 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -28,6 +28,8 @@ height = 27 radius = 3.0 fixed-center = true +monitor = ${env:MONITOR:} + background = ${colors.background} foreground = ${colors.foreground} @@ -37,10 +39,10 @@ line-color = #f00 border-size = 0 border-color = #00000000 -padding-left = 0 +padding-left = 2 padding-right = 2 -module-margin-left = 1 +module-margin-left = 2 module-margin-right = 2 font-0 = Icons:size=10;1 @@ -49,10 +51,10 @@ font-2 = Weather Icons:size=10;1 modules-left = i3 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-position = left +tray-position = right scroll-up = i3wm-wsnext scroll-down = i3wm-wsprev diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh index b1e25b5..45e79a9 100755 --- a/.config/polybar/launch.sh +++ b/.config/polybar/launch.sh @@ -7,4 +7,14 @@ killall -q polybar while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done # 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 & diff --git a/bin/monitor_setup.sh b/bin/monitor_setup.sh new file mode 100755 index 0000000..dd46c79 --- /dev/null +++ b/bin/monitor_setup.sh @@ -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 diff --git a/bin/switch_monitors.sh b/bin/switch_monitors.sh index 5308395..a3683f7 100755 --- a/bin/switch_monitors.sh +++ b/bin/switch_monitors.sh @@ -2,8 +2,8 @@ intern=eDP-1 extern=HDMI-1 -if xrandr | grep "$extern disconnected"; then - xrandr --output "$extern" --off --output "$intern" --auto +if xrandr --listactivemonitors | grep "$intern"; then + xrandr --output "$intern" --off else - xrandr --output "$intern" --off --output "$extern" --auto + xrandr --output "$intern" --auto fi