diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/scripts/bar.sh | 75 | ||||
-rwxr-xr-x | scripts/scripts/bluetooth.sh | 14 | ||||
-rwxr-xr-x | scripts/scripts/blur.sh | 25 | ||||
-rwxr-xr-x | scripts/scripts/cmusnp.sh | 45 | ||||
-rwxr-xr-x | scripts/scripts/date.sh | 4 | ||||
-rwxr-xr-x | scripts/scripts/draw.sh | 11 | ||||
-rwxr-xr-x | scripts/scripts/git-new-repo | 6 | ||||
-rwxr-xr-x | scripts/scripts/git-set-desc | 11 | ||||
-rwxr-xr-x | scripts/scripts/hidebars.sh | 23 | ||||
-rwxr-xr-x | scripts/scripts/img.sh | 32 | ||||
-rwxr-xr-x | scripts/scripts/netwrk.sh | 10 | ||||
-rwxr-xr-x | scripts/scripts/playpause.sh | 17 | ||||
-rwxr-xr-x | scripts/scripts/popups/cover.sh | 14 | ||||
-rwxr-xr-x | scripts/scripts/restartbars.sh | 6 | ||||
-rwxr-xr-x | scripts/scripts/time.sh | 6 | ||||
-rwxr-xr-x | scripts/scripts/url.sh | 4 | ||||
-rwxr-xr-x | scripts/scripts/wscycle.sh | 30 |
17 files changed, 17 insertions, 316 deletions
diff --git a/scripts/scripts/bar.sh b/scripts/scripts/bar.sh deleted file mode 100755 index 1903462..0000000 --- a/scripts/scripts/bar.sh +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | #! /usr/bin/env bash | ||
2 | |||
3 | |||
4 | fg="$(get_xres color15)" | ||
5 | fg_light="$(get_xres color10)" | ||
6 | bg="$(get_xres color0)" | ||
7 | # %{F$fg} $(date +%d/%m) %{F$fg_light} $(date +%Y) | ||
8 | |||
9 | (while true; do echo -e "\n$(date +%H)\n$(date +%M)\n"; sleep 10; done) | dzen2 \ | ||
10 | -e "onstart=uncollapse;" \ | ||
11 | -fg "$fg" \ | ||
12 | -bg "$fg_light" \ | ||
13 | -tw 0 \ | ||
14 | -l 3 \ | ||
15 | -x 20 \ | ||
16 | -y 600 \ | ||
17 | -w 70 \ | ||
18 | -h 30 \ | ||
19 | -sa c \ | ||
20 | -p & | ||
21 | |||
22 | (echo -e "\n"; while true; do echo -e "$(bat -i)"; sleep 1; done )| dzen2 \ | ||
23 | -e "onstart=uncollapse;" \ | ||
24 | -fg "$fg" \ | ||
25 | -bg "$fg_light" \ | ||
26 | -tw 70 \ | ||
27 | -l 4 \ | ||
28 | -x 20 \ | ||
29 | -y 500 \ | ||
30 | -w 70 \ | ||
31 | -h 15 \ | ||
32 | -sa c \ | ||
33 | -p & | ||
34 | |||
35 | ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' ) | ||
36 | |||
37 | # colors | ||
38 | current="$( ~/scripts/get_xres color5 )" | ||
39 | occupied="$( ~/scripts/get_xres color8 )" | ||
40 | unoccupied="$( ~/scripts/get_xres color8 )" | ||
41 | |||
42 | # print workspaces to stdout | ||
43 | draw() { | ||
44 | for i in {0..5}; do | ||
45 | # get the number of windows in each workspace | ||
46 | windows=$( wmctrl -l | cut -d ' ' -f3 | grep $i | wc -l ) | ||
47 | |||
48 | |||
49 | if [[ $i -eq $ws ]] | ||
50 | then | ||
51 | # current workspace | ||
52 | echo -ne "^($current)O" | ||
53 | else | ||
54 | if [[ $windows -eq 0 ]] | ||
55 | then | ||
56 | echo -ne "^($unoccupied)o" | ||
57 | else | ||
58 | echo -ne "^($occupied)x" | ||
59 | fi | ||
60 | fi | ||
61 | done | ||
62 | } | ||
63 | |||
64 | # echo -e "\n\n$(draw)\n" | dzen2 \ | ||
65 | # -e "onstart=uncollapse;" \ | ||
66 | # -fg "$fg" \ | ||
67 | # -bg "$fg_light" \ | ||
68 | # -tw 70 \ | ||
69 | # -l 4 \ | ||
70 | # -x 20 \ | ||
71 | # -y 500 \ | ||
72 | # -w 70 \ | ||
73 | # -h 15 \ | ||
74 | # -sa c \ | ||
75 | # -p & | ||
diff --git a/scripts/scripts/bluetooth.sh b/scripts/scripts/bluetooth.sh deleted file mode 100755 index 85b7f08..0000000 --- a/scripts/scripts/bluetooth.sh +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | connections=$( hcitool con ) | ||
4 | devices=$( hcitool dev | wc -l ) | ||
5 | |||
6 | if [ $devices = 1 ] | ||
7 | then | ||
8 | echo -n "" | ||
9 | elif [[ $devices > 1 && $connections = "Connections:" ]] | ||
10 | then | ||
11 | echo -n "" | ||
12 | else | ||
13 | echo -n "" | ||
14 | fi | ||
diff --git a/scripts/scripts/blur.sh b/scripts/scripts/blur.sh deleted file mode 100755 index 9349b03..0000000 --- a/scripts/scripts/blur.sh +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #! /usr/bin/env bash | ||
2 | |||
3 | state="unblurred" | ||
4 | while :; do | ||
5 | current_workspace="$(xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}')" | ||
6 | if [[ -n "$current_workspace" ]]; then | ||
7 | num_windows="$(echo "$(wmctrl -l)" | awk -F" " '{print $2}' | grep ^$current_workspace)" | ||
8 | if [ -n "$num_windows" ]; then | ||
9 | if [ "$state" != "blurred" ]; then | ||
10 | for i in {0..6}; do | ||
11 | feh --bg-fill ~/pics/blurs/busy"$i".jpg | ||
12 | done | ||
13 | fi | ||
14 | state="blurred" | ||
15 | else | ||
16 | if [ "$state" != "unblurred" ]; then | ||
17 | for i in $(seq 5 -1 0); do | ||
18 | feh --bg-fill ~/pics/blurs/busy"$i".jpg | ||
19 | done | ||
20 | feh --bg-fill ~/pics/blurs/busy.jpg | ||
21 | fi | ||
22 | state="unblurred" | ||
23 | fi | ||
24 | fi | ||
25 | done | ||
diff --git a/scripts/scripts/cmusnp.sh b/scripts/scripts/cmusnp.sh deleted file mode 100755 index b43c7e8..0000000 --- a/scripts/scripts/cmusnp.sh +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Display currently playing song from cmus | ||
3 | # Requires cmus | ||
4 | |||
5 | # colors | ||
6 | active="$( ~/scripts/get_xres color7 )" | ||
7 | inactive="$( ~/scripts/get_xres color7 )" | ||
8 | |||
9 | np_string="" | ||
10 | |||
11 | trunc() { | ||
12 | max_length=$1 | ||
13 | text=$2 | ||
14 | length=${#text} | ||
15 | (( length > max_length )) && | ||
16 | text=${text::$(( max_length ))}... | ||
17 | echo "$text" | ||
18 | } | ||
19 | |||
20 | if pgrep -x "cmus" > /dev/null | ||
21 | then | ||
22 | status=$( cmus-remote -Q | grep status\ | sed 's/status //' ) | ||
23 | artist=$( cmus-remote -Q | grep tag\ artist\ | sed 's/tag artist //' ) | ||
24 | title=$( cmus-remote -Q | grep tag\ title\ | sed 's/tag title //' ) | ||
25 | |||
26 | np_string="$title - $artist" | ||
27 | np_string=$( trunc 35 "$np_string" ) | ||
28 | |||
29 | spc=$(( $(( 32 - ${#np_string} ))/2 )) | ||
30 | spc="$( printf "%${spc}s" )" | ||
31 | |||
32 | if [[ "$status" = *playing* ]] | ||
33 | then | ||
34 | echo -ne "%{F#FF0000}%{F#FFFFFF}PAUSE" | ||
35 | elif [[ "$status" = *paused* ]] | ||
36 | then | ||
37 | echo -ne "PLAY" | ||
38 | elif [[ "$status" = *stopped* ]] | ||
39 | then | ||
40 | echo -ne "START" | ||
41 | fi | ||
42 | |||
43 | else | ||
44 | echo | ||
45 | fi | ||
diff --git a/scripts/scripts/date.sh b/scripts/scripts/date.sh deleted file mode 100755 index f97bdc9..0000000 --- a/scripts/scripts/date.sh +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #! /usr/bin/env bash | ||
2 | |||
3 | month="$(date +%B)" | ||
4 | printf "%s $(date +%e) $(date +%Y)" "${month^^}" | ||
diff --git a/scripts/scripts/draw.sh b/scripts/scripts/draw.sh deleted file mode 100755 index 8e34904..0000000 --- a/scripts/scripts/draw.sh +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Spawn terminals interactively | ||
3 | # Requires slop, urxvt | ||
4 | |||
5 | read -r X Y W H < <(slop -f "%x %y %w %h" -b 4 -c 0.8,0.8,0.8,0.8 -t 0 ) | ||
6 | (( W /= 14 )) | ||
7 | (( H /= 25 )) | ||
8 | |||
9 | g=${W}x${H}+${X}+${Y} | ||
10 | |||
11 | urxvtc -geometry $g | ||
diff --git a/scripts/scripts/git-new-repo b/scripts/scripts/git-new-repo new file mode 100755 index 0000000..9d87310 --- /dev/null +++ b/scripts/scripts/git-new-repo | |||
@@ -0,0 +1,6 @@ | |||
1 | #! /usr/bin/env bash | ||
2 | |||
3 | repo=${1:-$(basename $(pwd)).git}; | ||
4 | ssh git@ferrn git init --bare "$repo"; | ||
5 | git remote add origin git@ferrn:"$repo"; | ||
6 | git push -u origin HEAD; | ||
diff --git a/scripts/scripts/git-set-desc b/scripts/scripts/git-set-desc new file mode 100755 index 0000000..08568fe --- /dev/null +++ b/scripts/scripts/git-set-desc | |||
@@ -0,0 +1,11 @@ | |||
1 | #! /usr/bin/env bash | ||
2 | |||
3 | set_desc() { | ||
4 | # $1 - desc | ||
5 | # $2 - repo name | ||
6 | [[ -d "$2" ]] && echo "$1" > "$2/description" || echo "$2: remote not found" | ||
7 | } | ||
8 | |||
9 | repo=${1:-$(basename $(pwd))}; | ||
10 | desc=$(cat "./.git/description") | ||
11 | ssh git@ferrn "$(typeset -f set_desc); set_desc \"$desc\" \"$repo\"" | ||
diff --git a/scripts/scripts/hidebars.sh b/scripts/scripts/hidebars.sh deleted file mode 100755 index 6f449d6..0000000 --- a/scripts/scripts/hidebars.sh +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | pkill n30f | ||
4 | while getopts hs options | ||
5 | do | ||
6 | case $options in | ||
7 | h) # hide | ||
8 | pkill -f polybar\ artist | ||
9 | pkill -f polybar\ track | ||
10 | pkill -f polybar\ album | ||
11 | ;; | ||
12 | s) # show | ||
13 | if pgrep -f polybar\ artist > /dev/null; then | ||
14 | ~/scripts/popups/cover.sh | ||
15 | else | ||
16 | polybar artist & | ||
17 | polybar track & | ||
18 | polybar album & | ||
19 | ~/scripts/popups/cover.sh | ||
20 | fi | ||
21 | ;; | ||
22 | esac | ||
23 | done | ||
diff --git a/scripts/scripts/img.sh b/scripts/scripts/img.sh deleted file mode 100755 index baea386..0000000 --- a/scripts/scripts/img.sh +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # z3bra -- 2014-01-21 | ||
4 | # http://blog.z3bra.org/2014/01/images-in-terminal.html | ||
5 | |||
6 | test -z "$1" && exit | ||
7 | |||
8 | W3MIMGDISPLAY="/usr/lib/w3m/w3mimgdisplay" | ||
9 | FILENAME=$1 | ||
10 | FONTH=14 # Size of one terminal row | ||
11 | FONTW=8 # Size of one terminal column | ||
12 | COLUMNS=`tput cols` | ||
13 | LINES=`tput lines` | ||
14 | |||
15 | read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY` | ||
16 | |||
17 | max_width=$(($FONTW * $COLUMNS)) | ||
18 | max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt | ||
19 | |||
20 | if test $width -gt $max_width; then | ||
21 | height=$(($height * $max_width / $width)) | ||
22 | width=$max_width | ||
23 | fi | ||
24 | if test $height -gt $max_height; then | ||
25 | width=$(($width * $max_height / $height)) | ||
26 | height=$max_height | ||
27 | fi | ||
28 | |||
29 | w3m_command="0;1;0;0;$width;$height;;;;;$FILENAME\n4;\n3;" | ||
30 | |||
31 | tput cup $(($height/$FONTH)) 0 | ||
32 | echo -e $w3m_command|$W3MIMGDISPLAY | ||
diff --git a/scripts/scripts/netwrk.sh b/scripts/scripts/netwrk.sh deleted file mode 100755 index 4fec3a5..0000000 --- a/scripts/scripts/netwrk.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | status=$( nmcli | sed -n 1p | awk '{print $2}' ) | ||
4 | |||
5 | if [ $status = "connected" ] | ||
6 | then | ||
7 | echo -n '' | ||
8 | else | ||
9 | echo -n '' | ||
10 | fi | ||
diff --git a/scripts/scripts/playpause.sh b/scripts/scripts/playpause.sh deleted file mode 100755 index 72ba0fb..0000000 --- a/scripts/scripts/playpause.sh +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Interactive polybar icon for music controls | ||
3 | # Requires cmus | ||
4 | |||
5 | if pgrep -x "cmus" > /dev/null | ||
6 | then | ||
7 | status=$( cmus-remote -Q | grep status\ | sed 's/status //' ) | ||
8 | if [[ "$status" == *playing* ]]; then | ||
9 | echo -ne " %{F$(get_xres color2)} " | ||
10 | elif [[ "$status" == *paused* ]]; then | ||
11 | echo -ne " %{F$(get_xres color2)} " | ||
12 | elif [[ "$status" == *stopped* ]]; then | ||
13 | echo -ne " %{F$(get_xres color2)} " | ||
14 | fi | ||
15 | else | ||
16 | echo -ne " " | ||
17 | fi | ||
diff --git a/scripts/scripts/popups/cover.sh b/scripts/scripts/popups/cover.sh deleted file mode 100755 index 356e5ba..0000000 --- a/scripts/scripts/popups/cover.sh +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | folder=$( cmus-remote -Q | grep -w file | sed 's/file //' ) | ||
4 | cover=${folder%/*}/cover.png | ||
5 | |||
6 | convert "$cover" -resize 200x200 ~/tmp/cover.png | ||
7 | |||
8 | if pgrep n30f > /dev/null | ||
9 | then | ||
10 | pkill n30f | ||
11 | n30f -x 20 -y 700 ~/tmp/cover.png -c "hidebars.sh -h" -d | ||
12 | else | ||
13 | n30f -x 20 -y 700 ~/tmp/cover.png -c "hidebars.sh -h" -d | ||
14 | fi | ||
diff --git a/scripts/scripts/restartbars.sh b/scripts/scripts/restartbars.sh deleted file mode 100755 index 44d339f..0000000 --- a/scripts/scripts/restartbars.sh +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | pkill polybar | ||
4 | polybar time & | ||
5 | polybar date & | ||
6 | polybar music & | ||
diff --git a/scripts/scripts/time.sh b/scripts/scripts/time.sh deleted file mode 100755 index 66b0fbe..0000000 --- a/scripts/scripts/time.sh +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | fg="$(get_xres color15)" | ||
4 | fg_light="$(get_xres color8)" | ||
5 | # %{F$fg} $(date +%d/%m) %{F$fg_light} $(date +%Y) | ||
6 | echo -ne "$(date +%p) $(date +%I:%M)" | ||
diff --git a/scripts/scripts/url.sh b/scripts/scripts/url.sh deleted file mode 100755 index 6b3264d..0000000 --- a/scripts/scripts/url.sh +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #! /usr/bin/env bash | ||
2 | |||
3 | echo "$1" | xclip -i | ||
4 | echo "$1" | xclip -sel c | ||
diff --git a/scripts/scripts/wscycle.sh b/scripts/scripts/wscycle.sh deleted file mode 100755 index 7ea608d..0000000 --- a/scripts/scripts/wscycle.sh +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # cycle through workspaces | ||
3 | |||
4 | # get the current ws | ||
5 | ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' ) | ||
6 | total=5 | ||
7 | |||
8 | while getopts fr options | ||
9 | do | ||
10 | case $options in | ||
11 | f) | ||
12 | if [[ $ws -eq $total ]] | ||
13 | then | ||
14 | wmctrl -s 0 | ||
15 | else | ||
16 | ws=$(( $ws + 1 )) | ||
17 | wmctrl -s $ws | ||
18 | fi | ||
19 | ;; | ||
20 | r) | ||
21 | if [[ $ws -eq 0 ]] | ||
22 | then | ||
23 | wmctrl -s $total | ||
24 | else | ||
25 | ws=$(( $ws - 1 )) | ||
26 | wmctrl -s $ws | ||
27 | fi | ||
28 | ;; | ||
29 | esac | ||
30 | done | ||