dwmblocks scripts.
This commit is contained in:
parent
d25a6431fb
commit
24dd7f46c9
6 changed files with 97 additions and 0 deletions
40
_suckless/_scripts/rofi_display
Executable file
40
_suckless/_scripts/rofi_display
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
both() { # If both is selected and there are two screens.
|
||||
primary=$(echo "$screens" | rofi -dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | rofi -dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
xrandr --output "$primary" --mode 1920x1080 --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --mode 2560x1440 --scale 1.0x1.0
|
||||
}
|
||||
|
||||
onescreen() {
|
||||
case "$1" in
|
||||
eDP) xrandr --output "$1" --mode 1920x1080 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -) ;;
|
||||
DisplayPort*) xrandr --output "$1" --mode 2560x1440 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -) ;;
|
||||
*) xrandr --output "$1" --auto $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -) ;;
|
||||
esac
|
||||
}
|
||||
|
||||
postrun() {
|
||||
feh --no-fehbg --bg-scale ~/.local/share/wallpaper
|
||||
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||
}
|
||||
|
||||
# Get all possible displays
|
||||
allposs=$(xrandr -q | grep "connected")
|
||||
|
||||
# Get all connected screens.
|
||||
screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
||||
|
||||
# If there's only one screen
|
||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
||||
{ onescreen "$screens"; postrun; exit ;}
|
||||
|
||||
# Get user choice including both and manual selection:
|
||||
chosen=$(printf "%s\\nboth" "$screens" | rofi -dmenu -i -p "Select display arangement:") &&
|
||||
case "$chosen" in
|
||||
"both") both ;;
|
||||
*) onescreen "$chosen" ;;
|
||||
esac
|
||||
|
||||
postrun
|
Loading…
Add table
Add a link
Reference in a new issue