dotfiles/Utils/octopus.sh
Frank Villaro-Dixon 4b72214091 octopus changes
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
2022-08-26 20:56:13 +02:00

146 lines
2.9 KiB
Bash
Executable file

#!/bin/bash
set -x
#OCTOPUS=~/Programmation/Utils/octopus.sh
#This octopus handles all the actions like volume up, refresh status bar, etc..
if [ $# -lt 1 ]
then
echo "Usage : $0 [vol up|vol down|refresh|monitor extern|monitor laptop|monitor dual...]"
exit
fi
case $1 in
"vol"|"volume")
case $2 in
"up")
pactl set-sink-volume @DEFAULT_SINK@ +5%
;;
"down")
pactl set-sink-volume @DEFAULT_SINK@ -5%
;;
"mute")
pactl set-sink-mute @DEFAULT_SINK@ toggle
;;
esac
$0 refresh
;;
"brightness"|"bright")
case $2 in
"up")
sudo brightnessctl set "+5%"
;;
"down")
sudo brightnessctl set "5%-"
;;
esac
;;
"monitor")
#SNU=`xrandr | grep VGA | cut -d' ' -f1 | cut -c4`
VGA=DP-1
PROJ=DP-1-3
LVDS=eDP-1
case $2 in
"proj")
xrandr --output $LVDS --off \
--output $VGA --off \
--output $PROJ --auto --rotate normal
;;
"extern")
xrandr --output $LVDS --off \
--output $VGA --auto --rotate normal
;;
"music")
xrandr --output $LVDS --auto --rotate left \
--output $VGA --off
;;
"laptop")
xrandr --output $LVDS --auto --rotate normal \
--output $VGA --off
;;
"dual")
xrandr --output $LVDS --auto --rotate normal \
--output $VGA --auto --rotate normal \
--left-of $LVDS
;;
"CV")
xrandr --output $LVDS --auto --rotate normal \
--output $VGA --auto --rotate normal \
--right-of $LVDS
;;
"dualCV")
xrandr --output $LVDS --auto --rotate normal \
--output $VGA --auto --rotate left --right-of $LVDS
;;
"programming")
xrandr --output $VGA --auto --rotate left \
--output $LVDS --off
;;
"pdfpc")
xrandr --output $LVDS --auto --rotate normal \
--output $VGA --auto --rotate normal \
--left-of $LVDS
;;
"clone")
xrandr --output $LVDS --auto \
--output $VGA --auto --same-as $LVDS
;;
"off")
sleep 0.1
xset dpms force off
;;
esac
#$0 wallpaper
;;
"refresh")
DATE=`date +"%a %e %Hh%M"`
BATT_PCT=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep 'percentage' | cut -d':' -f2 | xargs)
VOLUME=`pactl get-sink-volume @DEFAULT_SINK@ | cut -d'/' -f4 | head -n1 | xargs`
xsetroot -name "Vol $VOLUME :: Bat $BATT_PCT $BATT_TIME :: $DATE" || true
;;
"checkbatt")
;;
#BATT_PCT=$(acpi -b | cut -d, -f2 | cut -d" " -f2 | cut -d'%' -f1)
#if [ $BATT_PCT -le 15 ]; then
# # systemctl suspend -i
# true
# for i in `seq 10`; do
# $0 leds thinklight on
# sleep .1
# $0 leds thinklight off
# sleep .1
# done
#fi;
#;;
"reset-screen")
$0 init-all
;;
"init-all")
$0 monitor dual
;;
"suspend")
slock &
systemctl suspend -i
;;
"lock")
slock &
#/home/frank/Programmation/dotfiles/lock/i3lock-color/lock.sh
#$0 monitor off
;;
esac
# vim: ts=4