diff options
author | Shubham Saini <pryr@pryr.xyz> | 2020-12-01 20:21:04 +0000 |
---|---|---|
committer | Shubham Saini <pryr@pryr.xyz> | 2020-12-01 20:21:04 +0000 |
commit | 1ff834e2b06761b083df9959d6c3d6bd2a94d2de (patch) | |
tree | abb8ff13bab1c6b5a0c0b17f2d29c058358d2135 /bin | |
parent | 90e96958f919df1f914381e93a97d77506fdcf03 (diff) |
mah thinkpad
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/.bin/bat_check (renamed from bin/.local/bin/bat_check.sh) | 0 | ||||
-rwxr-xr-x | bin/.bin/dotstow (renamed from bin/.local/bin/dotstow) | 0 | ||||
-rwxr-xr-x | bin/.bin/fixmap | 2 | ||||
-rwxr-xr-x | bin/.bin/gitit (renamed from bin/.local/bin/gitit) | 0 | ||||
-rwxr-xr-x | bin/.bin/lay | 3 | ||||
-rwxr-xr-x | bin/.bin/lay_both | 2 | ||||
-rwxr-xr-x | bin/.bin/lay_edp | 2 | ||||
-rwxr-xr-x | bin/.bin/lay_hdmi | 2 | ||||
-rwxr-xr-x | bin/.bin/lemonconf | 74 | ||||
-rwxr-xr-x | bin/.bin/light (renamed from bin/.local/bin/light) | 2 | ||||
-rwxr-xr-x | bin/.bin/pcolor | 3 | ||||
-rwxr-xr-x | bin/.bin/pkg | 22 | ||||
-rwxr-xr-x | bin/.bin/record (renamed from bin/.local/bin/record) | 2 | ||||
-rwxr-xr-x | bin/.bin/shut (renamed from bin/.local/bin/shut) | 0 | ||||
-rwxr-xr-x | bin/.bin/statusbar (renamed from bin/.local/bin/statusbar) | 0 | ||||
-rwxr-xr-x | bin/.bin/sysinfo | 20 | ||||
-rwxr-xr-x | bin/.bin/temp (renamed from bin/.local/bin/temp) | 0 | ||||
-rwxr-xr-x | bin/.bin/unblock (renamed from bin/.local/bin/unblock) | 0 | ||||
-rwxr-xr-x | bin/.bin/update-resolv-conf.sh | 71 | ||||
-rwxr-xr-x | bin/.bin/wpa | 16 | ||||
-rwxr-xr-x | bin/.local/bin/lock | 6 | ||||
-rwxr-xr-x | bin/.local/bin/screenshot | 16 |
22 files changed, 219 insertions, 24 deletions
diff --git a/bin/.local/bin/bat_check.sh b/bin/.bin/bat_check index 547b976..547b976 100755 --- a/bin/.local/bin/bat_check.sh +++ b/bin/.bin/bat_check | |||
diff --git a/bin/.local/bin/dotstow b/bin/.bin/dotstow index bcadc5e..bcadc5e 100755 --- a/bin/.local/bin/dotstow +++ b/bin/.bin/dotstow | |||
diff --git a/bin/.bin/fixmap b/bin/.bin/fixmap new file mode 100755 index 0000000..e937e7c --- /dev/null +++ b/bin/.bin/fixmap | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/bash | ||
2 | setxkbmap -layout us -option caps:ctrl_modifier | ||
diff --git a/bin/.local/bin/gitit b/bin/.bin/gitit index 5d576c2..5d576c2 100755 --- a/bin/.local/bin/gitit +++ b/bin/.bin/gitit | |||
diff --git a/bin/.bin/lay b/bin/.bin/lay new file mode 100755 index 0000000..b891ab1 --- /dev/null +++ b/bin/.bin/lay | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | ~/bin/lay_hdmi | ||
3 | xrandr --output HDMI-1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output eDP-1 --mode 1366x768 --pos 1366x0 --rotate normal | ||
diff --git a/bin/.bin/lay_both b/bin/.bin/lay_both new file mode 100755 index 0000000..245ff20 --- /dev/null +++ b/bin/.bin/lay_both | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | xrandr --output eDP-1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output HDMI-1 --mode 1366x768 --pos 0x0 --rotate normal | ||
diff --git a/bin/.bin/lay_edp b/bin/.bin/lay_edp new file mode 100755 index 0000000..e83d882 --- /dev/null +++ b/bin/.bin/lay_edp | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | xrandr --output eDP-1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output HDMI-1 --off | ||
diff --git a/bin/.bin/lay_hdmi b/bin/.bin/lay_hdmi new file mode 100755 index 0000000..9f84242 --- /dev/null +++ b/bin/.bin/lay_hdmi | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | xrandr --output eDP-1 --off --output HDMI-1 --mode 1366x768 --pos 0x0 --rotate normal | ||
diff --git a/bin/.bin/lemonconf b/bin/.bin/lemonconf new file mode 100755 index 0000000..cb5e505 --- /dev/null +++ b/bin/.bin/lemonconf | |||
@@ -0,0 +1,74 @@ | |||
1 | #!/bin/bash | ||
2 | # Outputs a configuration for lemonbar | ||
3 | |||
4 | vol(){ | ||
5 | vol=$(pulsemixer --get-volume | awk '{print $1}') | ||
6 | mute=$(pulsemixer --get-mute) | ||
7 | if [ "$mute" == 1 ]; then | ||
8 | echo -e "%{F#787878}vol%{F-} muted " | ||
9 | elif [ "$mute" == 0 ]; then | ||
10 | echo -e "%{F#787878}vol%{F-} $vol% " | ||
11 | fi | ||
12 | } | ||
13 | |||
14 | bat() { | ||
15 | power=$(cat /sys/class/power_supply/BAT0/capacity) | ||
16 | status=$(cat /sys/class/power_supply/BAT0/status) | ||
17 | if [ "$status" == "Charging" ]; then | ||
18 | echo -e "%{F#787878}bat%{F-} +$power% " | ||
19 | elif [ "$status" == "Discharging" ]; then | ||
20 | echo -e "%{F#787878}bat%{F-} $power% " | ||
21 | fi | ||
22 | } | ||
23 | |||
24 | dte() { | ||
25 | dte=$(date +"%a, %b %d") | ||
26 | echo -e "%{F#787878}date%{F-} $dte " | ||
27 | } | ||
28 | |||
29 | tie() { | ||
30 | tme=$(date +"%I:%M %P") | ||
31 | echo -e "%{F#787878}time%{F-} $tme " | ||
32 | } | ||
33 | |||
34 | groups() { | ||
35 | cur=`xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}'` | ||
36 | tot=`xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}'` | ||
37 | |||
38 | for w in `seq 0 $((cur - 1))`; do line="${line} "; done | ||
39 | line="${line} " | ||
40 | for w in `seq $((cur + 2)) $tot`; do line="${line} "; done | ||
41 | echo $line | ||
42 | } | ||
43 | |||
44 | workspaces() { | ||
45 | all=$(bspc query -D) | ||
46 | occupied=$(bspc query -D -d .occupied) | ||
47 | current=$(bspc query -D -d .focused) | ||
48 | result="" | ||
49 | padding=" " | ||
50 | while IFS= read -r line; do | ||
51 | # Get the name of the current desktop | ||
52 | name="" | ||
53 | if [[ "$occupied" == *"$line"* ]]; | ||
54 | then | ||
55 | name="" | ||
56 | fi | ||
57 | |||
58 | if [[ "$current" == *"$line"* ]]; | ||
59 | then | ||
60 | name="" | ||
61 | fi | ||
62 | |||
63 | result="$result$padding" | ||
64 | result="$result$name" | ||
65 | result="$result$padding" | ||
66 | done <<< "$all" | ||
67 | echo -e "$result" | ||
68 | } | ||
69 | |||
70 | while true; do | ||
71 | echo " $(vol) $(bat) $(tie) $(dte) %{F#787878}%{r}$(workspaces)%{F-} " | ||
72 | xdo above -t $(xdo id -n root) $(xdo id -n lemonbar) | ||
73 | sleep 3 | ||
74 | done | ||
diff --git a/bin/.local/bin/light b/bin/.bin/light index b34150f..bba7e82 100755 --- a/bin/.local/bin/light +++ b/bin/.bin/light | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/bash |
2 | # brightness wrapper | 2 | # brightness wrapper |
3 | 3 | ||
4 | case "$1" in | 4 | case "$1" in |
diff --git a/bin/.bin/pcolor b/bin/.bin/pcolor new file mode 100755 index 0000000..4cc28a0 --- /dev/null +++ b/bin/.bin/pcolor | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/bash | ||
2 | pcs() { for i in {0..7}; do echo -en "\e[${1}$((30+$i))m \u2588\u2588 \e[0m"; done; } | ||
3 | printf "\n%s\n%s\n\n" "$(pcs)" "$(pcs '1;')" | ||
diff --git a/bin/.bin/pkg b/bin/.bin/pkg new file mode 100755 index 0000000..5eea459 --- /dev/null +++ b/bin/.bin/pkg | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | case "$1" in | ||
4 | i*) | ||
5 | sudo xbps-install "$@" | ||
6 | ;; | ||
7 | d*) | ||
8 | sudo xbps-remove -R "$@" | ||
9 | ;; | ||
10 | q*) | ||
11 | sudo xbps-query "$@" | ||
12 | ;; | ||
13 | u*) | ||
14 | sudo xbps-install -Syu | ||
15 | ;; | ||
16 | o*) | ||
17 | sudo xbps-remove -Oo | ||
18 | ;; | ||
19 | *) | ||
20 | printf "i - install\nd - delete\nq - query\nu - update\no - remove obs" | ||
21 | ;; | ||
22 | esac | ||
diff --git a/bin/.local/bin/record b/bin/.bin/record index f254e20..5c6b499 100755 --- a/bin/.local/bin/record +++ b/bin/.bin/record | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | ffmpeg -f x11grab \ | 3 | ffmpeg -f x11grab \ |
4 | -s 1366x768 \ | 4 | -s 1980x1080 \ |
5 | -an -i :0.0 \ | 5 | -an -i :0.0 \ |
6 | -c:v libvpx \ | 6 | -c:v libvpx \ |
7 | -b:v 5M \ | 7 | -b:v 5M \ |
diff --git a/bin/.local/bin/shut b/bin/.bin/shut index 1fb1295..1fb1295 100755 --- a/bin/.local/bin/shut +++ b/bin/.bin/shut | |||
diff --git a/bin/.local/bin/statusbar b/bin/.bin/statusbar index c506244..c506244 100755 --- a/bin/.local/bin/statusbar +++ b/bin/.bin/statusbar | |||
diff --git a/bin/.bin/sysinfo b/bin/.bin/sysinfo new file mode 100755 index 0000000..4f9f456 --- /dev/null +++ b/bin/.bin/sysinfo | |||
@@ -0,0 +1,20 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # System info | ||
4 | |||
5 | wm="$(echo $XDG_CURRENT_DESKTOP)" | ||
6 | distro="$(cat /etc/*-release | grep PRETTY_NAME | cut -d '=' -f2 | tr -d '"')" | ||
7 | packages="$(xbps-query -l | wc -l)" | ||
8 | font="jetbrains mono" | ||
9 | colors="pencil" | ||
10 | |||
11 | printf " \e[0m\n" | ||
12 | printf " \e[1;34m distro \e[0m$distro\n" | ||
13 | printf " \e[1;34m pkgs \e[0m$packages\n" | ||
14 | printf " \e[1;34m wm \e[0m$wm\n" | ||
15 | printf " \e[1;34m font \e[0m$font $fontsize\n" | ||
16 | printf " \e[1;34m colors \e[0m$colors\n" | ||
17 | printf " \e[0m\n" | ||
18 | |||
19 | pcs() { for i in {0..7}; do echo -en "\e[${1}$((30+$i))m \u2588\u2588 \e[0m"; done; } | ||
20 | printf "\n%s\n%s\n\n" "$(pcs)" "$(pcs '1;')" | ||
diff --git a/bin/.local/bin/temp b/bin/.bin/temp index fec8439..fec8439 100755 --- a/bin/.local/bin/temp +++ b/bin/.bin/temp | |||
diff --git a/bin/.local/bin/unblock b/bin/.bin/unblock index 257c4fb..257c4fb 100755 --- a/bin/.local/bin/unblock +++ b/bin/.bin/unblock | |||
diff --git a/bin/.bin/update-resolv-conf.sh b/bin/.bin/update-resolv-conf.sh new file mode 100755 index 0000000..16622a1 --- /dev/null +++ b/bin/.bin/update-resolv-conf.sh | |||
@@ -0,0 +1,71 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # | ||
3 | # Parses DHCP options from openvpn to update resolv.conf | ||
4 | # To use set as 'up' and 'down' script in your openvpn *.conf: | ||
5 | # up /etc/openvpn/update-resolv-conf | ||
6 | # down /etc/openvpn/update-resolv-conf | ||
7 | # | ||
8 | # Used snippets of resolvconf script by Thomas Hood <jdthood@yahoo.co.uk> | ||
9 | # and Chris Hanson | ||
10 | # Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. | ||
11 | # 07/2013 colin@daedrum.net Fixed intet name | ||
12 | # 05/2006 chlauber@bnc.ch | ||
13 | # | ||
14 | # Example envs set from openvpn: | ||
15 | # foreign_option_1='dhcp-option DNS 193.43.27.132' | ||
16 | # foreign_option_2='dhcp-option DNS 193.43.27.133' | ||
17 | # foreign_option_3='dhcp-option DOMAIN be.bnc.ch' | ||
18 | # foreign_option_4='dhcp-option DOMAIN-SEARCH bnc.local' | ||
19 | |||
20 | ## The 'type' builtins will look for file in $PATH variable, so we set the | ||
21 | ## PATH below. You might need to directly set the path to 'resolvconf' | ||
22 | ## manually if it still doesn't work, i.e. | ||
23 | ## RESOLVCONF=/usr/sbin/resolvconf | ||
24 | export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin | ||
25 | RESOLVCONF=$(type -p resolvconf) | ||
26 | |||
27 | case $script_type in | ||
28 | |||
29 | up) | ||
30 | for optionname in ${!foreign_option_*} ; do | ||
31 | option="${!optionname}" | ||
32 | echo $option | ||
33 | part1=$(echo "$option" | cut -d " " -f 1) | ||
34 | if [ "$part1" == "dhcp-option" ] ; then | ||
35 | part2=$(echo "$option" | cut -d " " -f 2) | ||
36 | part3=$(echo "$option" | cut -d " " -f 3) | ||
37 | if [ "$part2" == "DNS" ] ; then | ||
38 | IF_DNS_NAMESERVERS="$IF_DNS_NAMESERVERS $part3" | ||
39 | fi | ||
40 | if [[ "$part2" == "DOMAIN" || "$part2" == "DOMAIN-SEARCH" ]] ; then | ||
41 | IF_DNS_SEARCH="$IF_DNS_SEARCH $part3" | ||
42 | fi | ||
43 | fi | ||
44 | done | ||
45 | R="" | ||
46 | if [ "$IF_DNS_SEARCH" ]; then | ||
47 | R="search " | ||
48 | for DS in $IF_DNS_SEARCH ; do | ||
49 | R="${R} $DS" | ||
50 | done | ||
51 | R="${R} | ||
52 | " | ||
53 | fi | ||
54 | |||
55 | for NS in $IF_DNS_NAMESERVERS ; do | ||
56 | R="${R}nameserver $NS | ||
57 | " | ||
58 | done | ||
59 | #echo -n "$R" | $RESOLVCONF -x -p -a "${dev}" | ||
60 | echo -n "$R" | $RESOLVCONF -x -a "${dev}.inet" | ||
61 | ;; | ||
62 | down) | ||
63 | $RESOLVCONF -d "${dev}.inet" | ||
64 | ;; | ||
65 | esac | ||
66 | |||
67 | # Workaround / jm@epiclabs.io | ||
68 | # force exit with no errors. Due to an apparent conflict with the Network Manager | ||
69 | # $RESOLVCONF sometimes exits with error code 6 even though it has performed the | ||
70 | # action correctly and OpenVPN shuts down. | ||
71 | exit 0 | ||
diff --git a/bin/.bin/wpa b/bin/.bin/wpa new file mode 100755 index 0000000..89f0141 --- /dev/null +++ b/bin/.bin/wpa | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | #https://github.com/icyphox/bin/blob/master/wpa | ||
3 | case "$1" in | ||
4 | r*) | ||
5 | sudo pkill wpa_supplicant | ||
6 | sudo wpa_supplicant -i wlp3s0 -B -c /etc/wpa_supplicant/wpa_supplicant.conf | ||
7 | ;; | ||
8 | n*) | ||
9 | sudo wpa_cli -i wlp3s0 select_network "$2" | ||
10 | ;; | ||
11 | l*) | ||
12 | sudo wpa_cli -i wlp3s0 list_networks | ||
13 | ;; | ||
14 | *) | ||
15 | sudo wpa_cli -i wlp3s0 "$*" | ||
16 | esac | ||
diff --git a/bin/.local/bin/lock b/bin/.local/bin/lock deleted file mode 100755 index d7dc632..0000000 --- a/bin/.local/bin/lock +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | scrot /tmp/screen.png | ||
3 | convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png | ||
4 | [[ -f $1 ]] && convert /tmp/screen.png $1 -gravity center -composite -matte /tmp/screen.png | ||
5 | i3lock -u -i /tmp/screen.png | ||
6 | rm /tmp/screen.png | ||
diff --git a/bin/.local/bin/screenshot b/bin/.local/bin/screenshot deleted file mode 100755 index 56310fc..0000000 --- a/bin/.local/bin/screenshot +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | screenshot() { | ||
3 | case $1 in | ||
4 | f*) | ||
5 | scrot -m -e 'mv $f ~/scrots' | ||
6 | ;; | ||
7 | w*) | ||
8 | sleep 1 | ||
9 | scrot -s -e 'mv $f ~/scrots' | ||
10 | ;; | ||
11 | *) | ||
12 | ;; | ||
13 | esac; | ||
14 | } | ||
15 | |||
16 | screenshot $1 | ||