2013-06-11 20:39:53 +00:00
|
|
|
#!/bin/bash
|
2014-03-09 21:35:57 +00:00
|
|
|
#set -x
|
2013-06-11 21:26:08 +00:00
|
|
|
#OCTOPUS=~/Programmation/Utils/octopus.sh
|
2013-06-11 20:39:53 +00:00
|
|
|
#This octopus handles all the actions like volume up, refresh status bar, etc..
|
|
|
|
|
|
|
|
if [ $# -lt 1 ]
|
|
|
|
then
|
2013-07-01 20:56:32 +00:00
|
|
|
echo "Usage : $0 [vol up|vol down|refresh|monitor extern|monitor laptop|monitor dual...]"
|
2013-06-11 20:39:53 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
|
|
|
|
"vol"|"volume")
|
|
|
|
case $2 in
|
|
|
|
"up")
|
2022-05-31 20:46:13 +00:00
|
|
|
pactl set-sink-volume @DEFAULT_SINK@ +5%
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
|
|
|
"down")
|
2022-05-31 20:46:13 +00:00
|
|
|
pactl set-sink-volume @DEFAULT_SINK@ -5%
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
|
|
|
"mute")
|
2022-05-31 20:46:13 +00:00
|
|
|
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
2014-03-09 21:35:57 +00:00
|
|
|
;;
|
2013-06-11 20:39:53 +00:00
|
|
|
esac
|
|
|
|
$0 refresh
|
|
|
|
;;
|
|
|
|
|
2013-12-02 22:37:14 +00:00
|
|
|
|
2013-06-11 20:39:53 +00:00
|
|
|
"monitor")
|
2019-08-28 15:59:12 +00:00
|
|
|
#SNU=`xrandr | grep VGA | cut -d' ' -f1 | cut -c4`
|
2019-11-22 15:15:22 +00:00
|
|
|
VGA=DP-1
|
2020-08-31 08:54:50 +00:00
|
|
|
PROJ=DP-1-3
|
2019-11-22 15:15:22 +00:00
|
|
|
LVDS=eDP-1
|
2013-06-11 20:39:53 +00:00
|
|
|
case $2 in
|
2020-08-31 08:54:50 +00:00
|
|
|
"proj")
|
|
|
|
xrandr --output $LVDS --off \
|
|
|
|
--output $VGA --off \
|
|
|
|
--output $PROJ --auto --rotate normal
|
|
|
|
;;
|
2013-06-11 20:39:53 +00:00
|
|
|
"extern")
|
2014-09-02 09:32:36 +00:00
|
|
|
xrandr --output $LVDS --off \
|
|
|
|
--output $VGA --auto --rotate normal
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
2017-03-27 23:07:07 +00:00
|
|
|
"music")
|
|
|
|
xrandr --output $LVDS --auto --rotate left \
|
|
|
|
--output $VGA --off
|
|
|
|
;;
|
2013-06-11 20:39:53 +00:00
|
|
|
"laptop")
|
2014-09-02 09:32:36 +00:00
|
|
|
xrandr --output $LVDS --auto --rotate normal \
|
|
|
|
--output $VGA --off
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
|
|
|
"dual")
|
2014-09-02 09:32:36 +00:00
|
|
|
xrandr --output $LVDS --auto --rotate normal \
|
|
|
|
--output $VGA --auto --rotate normal \
|
2019-11-22 15:15:22 +00:00
|
|
|
--left-of $LVDS
|
2013-09-29 15:36:18 +00:00
|
|
|
;;
|
2016-02-01 09:21:14 +00:00
|
|
|
"CV")
|
2016-07-22 12:53:14 +00:00
|
|
|
xrandr --output $LVDS --auto --rotate normal \
|
|
|
|
--output $VGA --auto --rotate normal \
|
|
|
|
--right-of $LVDS
|
|
|
|
;;
|
|
|
|
"dualCV")
|
2016-02-01 09:21:14 +00:00
|
|
|
xrandr --output $LVDS --auto --rotate normal \
|
|
|
|
--output $VGA --auto --rotate left --right-of $LVDS
|
|
|
|
;;
|
2013-12-18 22:08:34 +00:00
|
|
|
"programming")
|
2014-09-02 09:32:36 +00:00
|
|
|
xrandr --output $VGA --auto --rotate left \
|
|
|
|
--output $LVDS --off
|
2013-12-18 22:08:34 +00:00
|
|
|
;;
|
2013-09-30 07:49:46 +00:00
|
|
|
"pdfpc")
|
2014-09-02 09:32:36 +00:00
|
|
|
xrandr --output $LVDS --auto --rotate normal \
|
|
|
|
--output $VGA --auto --rotate normal \
|
|
|
|
--left-of $LVDS
|
2013-09-30 07:49:46 +00:00
|
|
|
;;
|
2013-09-29 15:36:18 +00:00
|
|
|
"clone")
|
2014-09-02 09:32:36 +00:00
|
|
|
xrandr --output $LVDS --auto \
|
|
|
|
--output $VGA --auto --same-as $LVDS
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
2013-06-14 17:13:19 +00:00
|
|
|
"off")
|
2015-02-24 20:50:11 +00:00
|
|
|
sleep 0.1
|
2013-06-14 17:13:19 +00:00
|
|
|
xset dpms force off
|
|
|
|
;;
|
2013-06-11 20:39:53 +00:00
|
|
|
esac
|
2019-08-28 15:59:12 +00:00
|
|
|
#$0 wallpaper
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
"refresh")
|
2014-09-23 21:03:23 +00:00
|
|
|
DATE=`date +"%a %e %Hh%M"`
|
|
|
|
|
2022-05-31 20:46:13 +00:00
|
|
|
BATT_PCT=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep 'percentage' | cut -d':' -f2 | xargs)
|
2014-09-23 21:03:23 +00:00
|
|
|
|
2022-05-31 20:46:13 +00:00
|
|
|
VOLUME=`pactl get-sink-volume @DEFAULT_SINK@ | cut -d'/' -f4 | head -n1 | xargs`
|
2013-06-11 21:26:08 +00:00
|
|
|
|
2022-05-31 20:46:13 +00:00
|
|
|
xsetroot -name "Vol $VOLUME :: Bat $BATT_PCT $BATT_TIME :: $DATE" || true
|
2017-03-27 23:07:07 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
"checkbatt")
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
2020-08-31 08:54:50 +00:00
|
|
|
#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;
|
|
|
|
#;;
|
2013-06-11 20:39:53 +00:00
|
|
|
|
2013-09-29 15:59:30 +00:00
|
|
|
"reset-screen")
|
|
|
|
$0 init-all
|
|
|
|
;;
|
|
|
|
|
2013-06-11 21:26:08 +00:00
|
|
|
"init-all")
|
2019-08-28 15:59:12 +00:00
|
|
|
$0 monitor dual
|
2013-06-14 17:13:19 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
"suspend")
|
2014-01-20 09:55:57 +00:00
|
|
|
slock &
|
2014-08-04 21:19:01 +00:00
|
|
|
systemctl suspend -i
|
2013-08-22 14:26:45 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
"lock")
|
2014-01-20 09:55:57 +00:00
|
|
|
slock &
|
2019-08-28 15:59:12 +00:00
|
|
|
#/home/frank/Programmation/dotfiles/lock/i3lock-color/lock.sh
|
|
|
|
#$0 monitor off
|
2014-01-20 09:55:57 +00:00
|
|
|
;;
|
|
|
|
|
2013-06-11 20:39:53 +00:00
|
|
|
esac
|
2013-06-11 21:26:08 +00:00
|
|
|
|
|
|
|
# vim: ts=4
|