summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShubham Saini <pryr@pryr.xyz>2021-05-22 19:18:51 +0000
committerShubham Saini <pryr@pryr.xyz>2021-05-22 19:18:51 +0000
commit72ccd83ccc66d942b855fe8379bc3f0d24384b76 (patch)
tree515997e25fb736ee1e3481dc941c1b540c03624b
parentbde9d8e1c9a6e2213fc7d40298d43a14f2e99359 (diff)
improved scripts
-rwxr-xr-xbin/.bin/bat34
-rwxr-xr-xbin/.bin/bat_check14
-rwxr-xr-xbin/.bin/disp7
-rwxr-xr-xbin/.bin/record30
-rwxr-xr-xbspwm/.config/bspwm/bspwmrc10
-rwxr-xr-xpolybar/.config/polybar/launch (renamed from polybar/.config/polybar/launch.sh)0
-rwxr-xr-xx/.xinitrc4
7 files changed, 62 insertions, 37 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
2while true 2
3do 3pane() {
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}
12done 12
13notifs() {
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
29case "$1" in
30 n)
31 notifs;;
32 *)
33 pane;;
34esac
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
2while true
3do
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
14done
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
2status=$(cat /sys/class/drm/card0/*HDMI*/status) 3status=$(cat /sys/class/drm/card0/*HDMI*/status)
3if [ $status == "connected" ]; then 4if [ $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
5else 7else
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
7fi 10fi
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
3ffmpeg -f x11grab \ 3usage() {
4-s 1920x1080 \ 4 echo "
5-an -i :0.0 \ 5screen recording using ffmpeg
6-c:v libvpx \ 6usage: ${0##*/} [ -w/a ]
7-b:v 5M \ 7
8-crf 10 \ 8option:
9-quality realtime \ 9 -w without audio
10-y ~/record.mkv 10 -a with audio
11"
12 exit 1
13}
14
15case $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
23esac
24
diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc
index cfc46bd..7c0df1b 100755
--- a/bspwm/.config/bspwm/bspwmrc
+++ b/bspwm/.config/bspwm/bspwmrc
@@ -20,16 +20,12 @@ bspc rule -a Steam desktop='^6'
20bspc rule -a "VirtualBox Manager" desktop='^6' 20bspc rule -a "VirtualBox Manager" desktop='^6'
21 21
22# autostart 22# autostart
23xrdb -merge ~/.Xresources &
24xsetroot -cursor_name left_ptr &
25sxhkd & 23sxhkd &
26xss-lock -- slock & 24xss-lock -- slock &
27xset b off &
28xset s 300 &
29~/.fehbg &
30urxvtd & 25urxvtd &
31~/.bin/bat_check &
32picom --experimental-backends & 26picom --experimental-backends &
33dunst & 27dunst &
34~/.config/polybar/launch.sh &
35/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & 28/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
29~/.fehbg &
30~/.config/polybar/launch &
31~/.bin/bat n &
diff --git a/polybar/.config/polybar/launch.sh b/polybar/.config/polybar/launch
index c39a374..c39a374 100755
--- a/polybar/.config/polybar/launch.sh
+++ b/polybar/.config/polybar/launch
diff --git a/x/.xinitrc b/x/.xinitrc
index 6455e33..f79fafb 100755
--- a/x/.xinitrc
+++ b/x/.xinitrc
@@ -2,4 +2,8 @@
2setxkbmap -layout us -option caps:ctrl_modifier & 2setxkbmap -layout us -option caps:ctrl_modifier &
3xcape -e 'Caps_Lock=Escape' & 3xcape -e 'Caps_Lock=Escape' &
4xinput --disable "ETPS/2 Elantech Touchpad" 4xinput --disable "ETPS/2 Elantech Touchpad"
5xrdb -merge ~/.Xresources &
6xsetroot -cursor_name left_ptr &
7xset b off &
8xset s 300 &
5exec dbus-run-session bspwm 9exec dbus-run-session bspwm