aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/scripts/bar.sh75
-rwxr-xr-xscripts/scripts/bluetooth.sh14
-rwxr-xr-xscripts/scripts/blur.sh25
-rwxr-xr-xscripts/scripts/cmusnp.sh45
-rwxr-xr-xscripts/scripts/date.sh4
-rwxr-xr-xscripts/scripts/draw.sh11
-rwxr-xr-xscripts/scripts/git-new-repo6
-rwxr-xr-xscripts/scripts/git-set-desc11
-rwxr-xr-xscripts/scripts/hidebars.sh23
-rwxr-xr-xscripts/scripts/img.sh32
-rwxr-xr-xscripts/scripts/netwrk.sh10
-rwxr-xr-xscripts/scripts/playpause.sh17
-rwxr-xr-xscripts/scripts/popups/cover.sh14
-rwxr-xr-xscripts/scripts/restartbars.sh6
-rwxr-xr-xscripts/scripts/time.sh6
-rwxr-xr-xscripts/scripts/url.sh4
-rwxr-xr-xscripts/scripts/wscycle.sh30
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
4fg="$(get_xres color15)"
5fg_light="$(get_xres color10)"
6bg="$(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
35ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' )
36
37# colors
38current="$( ~/scripts/get_xres color5 )"
39occupied="$( ~/scripts/get_xres color8 )"
40unoccupied="$( ~/scripts/get_xres color8 )"
41
42# print workspaces to stdout
43draw() {
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
3connections=$( hcitool con )
4devices=$( hcitool dev | wc -l )
5
6if [ $devices = 1 ]
7then
8 echo -n ""
9elif [[ $devices > 1 && $connections = "Connections:" ]]
10then
11 echo -n ""
12else
13 echo -n ""
14fi
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
3state="unblurred"
4while :; 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
25done
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
6active="$( ~/scripts/get_xres color7 )"
7inactive="$( ~/scripts/get_xres color7 )"
8
9np_string=""
10
11trunc() {
12 max_length=$1
13 text=$2
14 length=${#text}
15 (( length > max_length )) &&
16 text=${text::$(( max_length ))}...
17 echo "$text"
18}
19
20if pgrep -x "cmus" > /dev/null
21then
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
43else
44 echo
45fi
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
3month="$(date +%B)"
4printf "%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
5read -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
9g=${W}x${H}+${X}+${Y}
10
11urxvtc -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
3repo=${1:-$(basename $(pwd)).git};
4ssh git@ferrn git init --bare "$repo";
5git remote add origin git@ferrn:"$repo";
6git 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
3set_desc() {
4 # $1 - desc
5 # $2 - repo name
6 [[ -d "$2" ]] && echo "$1" > "$2/description" || echo "$2: remote not found"
7}
8
9repo=${1:-$(basename $(pwd))};
10desc=$(cat "./.git/description")
11ssh 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
3pkill n30f
4while getopts hs options
5do
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
23done
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
6test -z "$1" && exit
7
8W3MIMGDISPLAY="/usr/lib/w3m/w3mimgdisplay"
9FILENAME=$1
10FONTH=14 # Size of one terminal row
11FONTW=8 # Size of one terminal column
12COLUMNS=`tput cols`
13LINES=`tput lines`
14
15read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY`
16
17max_width=$(($FONTW * $COLUMNS))
18max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt
19
20if test $width -gt $max_width; then
21height=$(($height * $max_width / $width))
22width=$max_width
23fi
24if test $height -gt $max_height; then
25width=$(($width * $max_height / $height))
26height=$max_height
27fi
28
29w3m_command="0;1;0;0;$width;$height;;;;;$FILENAME\n4;\n3;"
30
31tput cup $(($height/$FONTH)) 0
32echo -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
3status=$( nmcli | sed -n 1p | awk '{print $2}' )
4
5if [ $status = "connected" ]
6then
7 echo -n ''
8else
9 echo -n ''
10fi
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
5if pgrep -x "cmus" > /dev/null
6then
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
15else
16 echo -ne "  "
17fi
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
3folder=$( cmus-remote -Q | grep -w file | sed 's/file //' )
4cover=${folder%/*}/cover.png
5
6convert "$cover" -resize 200x200 ~/tmp/cover.png
7
8if pgrep n30f > /dev/null
9then
10 pkill n30f
11 n30f -x 20 -y 700 ~/tmp/cover.png -c "hidebars.sh -h" -d
12else
13 n30f -x 20 -y 700 ~/tmp/cover.png -c "hidebars.sh -h" -d
14fi
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
3pkill polybar
4polybar time &
5polybar date &
6polybar 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
3fg="$(get_xres color15)"
4fg_light="$(get_xres color8)"
5# %{F$fg} $(date +%d/%m) %{F$fg_light} $(date +%Y)
6echo -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
3echo "$1" | xclip -i
4echo "$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
5ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' )
6total=5
7
8while getopts fr options
9do
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
30done