Fix monitor problems
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
92c15e04d0
commit
be92d7f1b3
12 changed files with 149 additions and 128 deletions
24
system/.local/bin/is-connected
Executable file
24
system/.local/bin/is-connected
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# is-connected
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin@kaderli.dev>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Checks if the output is connected
|
||||
#
|
||||
# USAGE:
|
||||
# ./is-connected OUTPUT
|
||||
|
||||
if [ -z "${1}" ]; then
|
||||
echo "No output given"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$(xrandr --query | grep "${1} connected")" ]; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
16
system/.local/bin/monitor-setup
Executable file
16
system/.local/bin/monitor-setup
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# monitor-setup
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin@kaderli.dev>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Setups the resolution, wallpaper and polybar
|
||||
#
|
||||
# USAGE:
|
||||
# ./monitor-setup
|
||||
resolution
|
||||
polybar-launch
|
||||
wallpaper
|
44
system/.local/bin/polybar-launch
Executable file
44
system/.local/bin/polybar-launch
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# polybar-launch
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin@kaderli.dev>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# This script kills existing polybar processes and then launches the bars.
|
||||
#
|
||||
# USAGE:
|
||||
# ./polybar-launch
|
||||
|
||||
# Terminate already running bar instances
|
||||
killall -q polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
if [ "${IS_WORK}" = "1" ]; then
|
||||
export POLYBAR_BATTERY="BAT1"
|
||||
export POLYBAR_WLAN="wlp4s0"
|
||||
export POLYBAR_NETWORK="enp0s31f6"
|
||||
else
|
||||
export POLYBAR_BATTERY="BAT0"
|
||||
export POLYBAR_WLAN="wlp3s0"
|
||||
export POLYBAR_NETWORK="enp0s31f6"
|
||||
fi
|
||||
|
||||
MONITORS=(
|
||||
"eDP1"
|
||||
"eDP-1-1"
|
||||
"HDMI1"
|
||||
"HDMI-1-1"
|
||||
"DVI-I-1-1"
|
||||
"DVI-I-2-1"
|
||||
)
|
||||
|
||||
for monitor in "${MONITORS[@]}"; do
|
||||
export POLYBAR_MONITOR="${monitor}"
|
||||
polybar top &
|
||||
polybar bottom &
|
||||
done
|
|
@ -16,9 +16,30 @@
|
|||
xrandr --listproviders | grep -q "modesetting" && xrandr --setprovideroutputsource 1 0
|
||||
|
||||
xrandr --dpi 96
|
||||
xrandr --output HDMI1 --mode 1280x1024 --pos 0x56 --rotate normal
|
||||
xrandr --output HDMI-1-1 --mode 1280x1024 --pos 0x56 --rotate normal
|
||||
|
||||
if is-connected "HDMI1"; then
|
||||
xrandr --output HDMI1 --mode 1280x1024 --left-of eDP1
|
||||
else
|
||||
xrandr --output HDMI1 --off
|
||||
fi
|
||||
|
||||
if is-connected "HDMI-1-1"; then
|
||||
xrandr --output HDMI-1-1 --mode 1280x1024 --left-of eDP-1-1
|
||||
else
|
||||
xrandr --output HDMI-1-1 --off
|
||||
fi
|
||||
|
||||
xrandr --output eDP1 --primary --mode 1920x1080 --pos 1280x0 --rotate normal
|
||||
xrandr --output eDP-1-1 --primary --mode 1920x1080 --pos 1280x0 --rotate normal
|
||||
xrandr --output DVI-I-1-1 --mode 1920x1080 --pos -640x0 --rotate normal
|
||||
xrandr --output DVI-I-2-1 --mode 1920x1080 --pos -640x0 --rotate normal
|
||||
|
||||
if is-connected "DVI-I-1-1"; then
|
||||
xrandr --output DVI-I-1-1 --off
|
||||
else
|
||||
xrandr --output DVI-I-1-1 --mode 1920x1080 --left-of eDP1
|
||||
fi
|
||||
|
||||
if is-connected "DVI-I-2-1"; then
|
||||
xrandr --output DVI-I-2-1 --off
|
||||
else
|
||||
xrandr --output DVI-I-2-1 --mode 1920x1080 --left-of eDP-1-1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue