Added menu to switch display

This commit is contained in:
dbroqua 2020-06-07 22:56:23 +02:00
parent cbd6b38517
commit 474a633309
3 changed files with 41 additions and 3 deletions

View file

@ -10,9 +10,9 @@ nextconfig='laptop'
case $activeconfig in case $activeconfig in
home) home)
nextconfig='home-office' nextconfig='homeoffice'
;; ;;
home-office) homeoffice)
nextconfig='laptop' nextconfig='laptop'
;; ;;
laptop) laptop)
@ -20,6 +20,15 @@ case $activeconfig in
;; ;;
esac esac
if [ $1 ]; then
if [ "$1" = "menu" ]; then
chosen="$(echo -e "$options" | $rofi_command -dmenu -selected-row 1)"
exit 0
else
nextconfig=$1
fi
fi
echo ${nextconfig} > ~/.screenlayout.info echo ${nextconfig} > ~/.screenlayout.info
case $nextconfig in case $nextconfig in
@ -34,7 +43,7 @@ case $nextconfig in
--output DP-2 --off \ --output DP-2 --off \
--output DP-1 --off --output DP-1 --off
;; ;;
home-office) homeoffice)
# Home Office # Home Office
xrandr --output DP-2-1 --primary --mode 2560x1080 --pos 0x520 --rotate normal \ xrandr --output DP-2-1 --primary --mode 2560x1080 --pos 0x520 --rotate normal \
--output DP-2-2 --mode 1920x1080 --pos 2560x0 --rotate left \ --output DP-2-2 --mode 1920x1080 --pos 2560x0 --rotate left \

26
Bin/screenlayoutrofi.sh Executable file
View file

@ -0,0 +1,26 @@
#! /bin/bash
rofi_command="rofi"
mode="laptop"
### Options ###
laptop=" Laptop only"
home=" Wide screen"
homeoffice="  Dual screen"
# Variable passed to rofi
options="$laptop\n$home\n$homeoffice"
chosen="$(echo -e "$options" | $rofi_command -dmenu -selected-row 1)"
case $chosen in
$latpop)
mode="laptop"
;;
$home)
mode="home"
;;
$homeoffice)
mode="homeoffice"
;;
esac
screenlayout.sh $mode

View file

@ -214,6 +214,9 @@ bindsym $mod+x exec "rofi -modi 'find:~/.local/share/rofi/finder.sh' -show find"
# Show top # Show top
bindsym $mod+t exec "rofi -show top -modi top" bindsym $mod+t exec "rofi -show top -modi top"
# Screen layout
bindsym $mod+p exec "~/Bin/screenlayoutrofi.sh"
# Multimedia keys # Multimedia keys
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` +5% bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` -5% bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` -5%