Browse Source

make screen script easier to use

master
Cian Butler 1 year ago
parent
commit
1edf6b054d
Signed by: butlerx GPG Key ID: B37CA765BAA89170
1 changed files with 59 additions and 36 deletions
  1. +59
    -36
      screens

+ 59
- 36
screens View File

@@ -28,53 +28,76 @@ set_wallpaper() {
}

start_bar() {
MONITOR=$1
export MONITOR=$1
BAR=$2
polybar --reload "$BAR" </dev/null >"/var/tmp/polybar-$MONITOR.log" 2>&1 &
}

work() {
xrandr \
--output eDP-1 --mode 1920x1080 --pos 5280x824 --rotate normal \
--output DP-1 --off \
--output HDMI-1 --off \
--output DP-2 --mode 3840x2160 --pos 1440x284 --rotate normal \
--output DP-1-1 --off \
--output DP-1-2 --mode 2560x1440 --pos 0x0 --rotate right \
--output DP-1-3 --off \
--output DP-2-1 --off \
--output DP-2-2 --off \
--output DP-2-3 --off
set_wallpaper 2 scaled IMG_20190901_161515-PANO.jpg
set_wallpaper 1 auto IMG_20190903_163002-EFFECTS.jpg
set_wallpaper 0 zoom-fill IMG_20190730_155936-PANO.jpg
move_ws 2 left
TRAY_POSITION=right start_bar DP-2 4k
start_bar eDP-1 1080p
display() {
case ${1-} in
work)
xrandr \
--output eDP-1 --mode 1920x1080 --pos 5280x824 --rotate normal \
--output HDMI-1 --off \
--output DP-1 --mode 2560x1440 --pos 0x0 --rotate left \
--output DP-2 --mode 3840x2160 --pos 1440x284 --rotate normal
move_ws 2 left
;;
*) xrandr --auto ;;
esac
}

laptop() {
xrandr --auto
set_wallparer 0 auto EFFECTS.jpg
TRAY_POSITION=right start_bar eDP-1 1080p
status_bar() {
kill_polybar
(
flock 200
case ${1-} in
work)
start_bar eDP-1 1080p
start_bar DP-2 4k
;;
*) start_bar eDP-1 1080p ;;
esac
) 200>/var/tmp/polybar-launch.lock
}

wallpaper() {
case ${1-} in
work)
set_wallpaper 0 scaled IMG_20190901_161515-PANO.jpg
set_wallpaper 1 auto IMG_20190903_163002-EFFECTS.jpg
set_wallpaper 2 zoom-fill IMG_20190730_155936-PANO.jpg
;;
*) set_wallpaper 0 auto EFFECTS.jpg ;;
esac
}

show_usage() {
echo "Usage: screens [-W] [-w ENV] [-s ENV]"
}

cmd_args() {
if [[ $# -ne 1 ]]; then
laptop
exit 0
if [[ $# -eq 0 ]]; then
display
wallpaper
status_bar
exit
fi
for i in "$@"; do
case $i in
-w | --work) work ;;
*) laptop ;;
while test $# -gt 0; do
case $1 in
-W | --work)
display work
wallpaper work
status_bar work
exit
;;
-w | --wallpaper) wallpaper "${2-}" ;;
-s | --status-bar) status_bar "${2-}" ;;
--help | -h) show_usage ;;
esac
shift
done
}

(
flock 200
[ -f ~/.dotfiles/Xresources ] && xrdb -merge -I"$HOME" ~/.dotfiles/Xresources
kill_polybar
cmd_args "$@"
) 200>/var/tmp/polybar-launch.lock
[ -f ~/.dotfiles/Xresources ] && xrdb -merge -I"$HOME" ~/.dotfiles/Xresources
cmd_args "$@"

Loading…
Cancel
Save