diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/.bin/bat | 34 | ||||
| -rwxr-xr-x | bin/.bin/bat_check | 14 | ||||
| -rwxr-xr-x | bin/.bin/disp | 7 | ||||
| -rwxr-xr-x | bin/.bin/record | 30 |
4 files changed, 55 insertions, 30 deletions
diff --git a/bin/.bin/bat b/bin/.bin/bat index 473c7e2..38f4272 100755 --- a/bin/.bin/bat +++ b/bin/.bin/bat | |||
| @@ -1,12 +1,34 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/sh |
| 2 | while true | 2 | |
| 3 | do | 3 | pane() { |
| 4 | battery_level=$(cat /sys/class/power_supply/BAT0/capacity) | 4 | battery_level=$(cat /sys/class/power_supply/BAT*/capacity) |
| 5 | state=$(cat /sys/class/power_supply/BAT0/status) | 5 | state=$(cat /sys/class/power_supply/BAT0/status) |
| 6 | if [ $state == "Charging" ]; then | 6 | if [ $state == "Charging" ]; then |
| 7 | echo -e +$battery_level% | 7 | echo -e +$battery_level% |
| 8 | else | 8 | else |
| 9 | echo -e $battery_level% | 9 | echo -e $battery_level% |
| 10 | fi | 10 | fi |
| 11 | sleep 3 | 11 | } |
| 12 | done | 12 | |
| 13 | notifs() { | ||
| 14 | while true | ||
| 15 | do | ||
| 16 | battery_level=$(cat /sys/class/power_supply/BAT*/capacity) | ||
| 17 | state=$(cat /sys/class/power_supply/BAT*/status) | ||
| 18 | if [ $battery_level -ge 90 ] && [ $state == "Charging" ]; then | ||
| 19 | notify-send 'Pull the plug!' $battery_level% | ||
| 20 | elif [ $battery_level -le 30 -a $battery_level -ge 20 ] && [ $state == "Discharging" ]; then | ||
| 21 | notify-send 'Plug me!' $battery_level% | ||
| 22 | elif [ $battery_level -le 20 ] && [ $state == "Discharging" ]; then | ||
| 23 | notify-send -u critical 'Plug me NOW!' $battery_level% | ||
| 24 | fi | ||
| 25 | sleep 300 | ||
| 26 | done | ||
| 27 | } | ||
| 28 | |||
| 29 | case "$1" in | ||
| 30 | n) | ||
| 31 | notifs;; | ||
| 32 | *) | ||
| 33 | pane;; | ||
| 34 | esac | ||
diff --git a/bin/.bin/bat_check b/bin/.bin/bat_check deleted file mode 100755 index 547b976..0000000 --- a/bin/.bin/bat_check +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | while true | ||
| 3 | do | ||
| 4 | battery_level=$(cat /sys/class/power_supply/BAT0/capacity) | ||
| 5 | state=$(cat /sys/class/power_supply/BAT0/status) | ||
| 6 | if [ $battery_level -ge 90 ] && [ $state == "Charging" ]; then | ||
| 7 | notify-send 'Pull the plug!' $battery_level% | ||
| 8 | elif [ $battery_level -le 30 -a $battery_level -ge 20 ] && [ $state == "Discharging" ]; then | ||
| 9 | notify-send 'Plug me!' $battery_level% | ||
| 10 | elif [ $battery_level -le 20 ] && [ $state == "Discharging" ]; then | ||
| 11 | notify-send -u critical 'Plug me NOW!' $battery_level% | ||
| 12 | fi | ||
| 13 | sleep 300 # 300 seconds or 5 minutes | ||
| 14 | done | ||
diff --git a/bin/.bin/disp b/bin/.bin/disp index 89045b2..43d6987 100755 --- a/bin/.bin/disp +++ b/bin/.bin/disp | |||
| @@ -1,7 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | |||
| 2 | status=$(cat /sys/class/drm/card0/*HDMI*/status) | 3 | status=$(cat /sys/class/drm/card0/*HDMI*/status) |
| 3 | if [ $status == "connected" ]; then | 4 | if [ $status == "connected" ]; then |
| 4 | xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x1080 --rotate normal --output HDMI-1 --mode 1366x768 --pos 0x0 --scale 1.4x1.4 --rotate normal --output DisplayPort-0 --off | 5 | xrandr --output eDP-1 --mode 1920x1080 --pos 0x1076 --rotate normal --output HDMI-1 --primary --mode 1366x768 --scale 1.4x1.4 --pos 0x0 --rotate normal --output DP-1 --off |
| 6 | bspc wm -r | ||
| 5 | else | 7 | else |
| 6 | xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --off | 8 | xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --off --output DisplayPort-0 --off |
| 9 | bspc wm -r | ||
| 7 | fi | 10 | fi |
diff --git a/bin/.bin/record b/bin/.bin/record index 09ba7d1..86d9b1a 100755 --- a/bin/.bin/record +++ b/bin/.bin/record | |||
| @@ -1,10 +1,24 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | ffmpeg -f x11grab \ | 3 | usage() { |
| 4 | -s 1920x1080 \ | 4 | echo " |
| 5 | -an -i :0.0 \ | 5 | screen recording using ffmpeg |
| 6 | -c:v libvpx \ | 6 | usage: ${0##*/} [ -w/a ] |
| 7 | -b:v 5M \ | 7 | |
| 8 | -crf 10 \ | 8 | option: |
| 9 | -quality realtime \ | 9 | -w without audio |
| 10 | -y ~/record.mkv | 10 | -a with audio |
| 11 | " | ||
| 12 | exit 1 | ||
| 13 | } | ||
| 14 | |||
| 15 | case $1 in | ||
| 16 | -w) | ||
| 17 | ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 ~/screens/vids/record_$(date +%d-%b-%y-%I:%M%p).mkv | ||
| 18 | ;; | ||
| 19 | -a) | ||
| 20 | ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i default ~/screens/vids/record_$(date +%d-%b-%y-%I:%M%p).mkv | ||
| 21 | ;; | ||
| 22 | *) usage | ||
| 23 | esac | ||
| 24 | |||
