aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-12-02 14:23:33 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-12-02 14:23:33 +0100
commit58a9e65b5554b2c9552540dfea96b562375cf321 (patch)
tree118dbc0f74d7d09c328e5fbdecd118c7f3f23ee4
parent1ab2d661fb0ffa625d828792deabfb92a5c3611a (diff)
downloadscripts-58a9e65b5554b2c9552540dfea96b562375cf321.tar.gz
scripts-58a9e65b5554b2c9552540dfea96b562375cf321.zip
Mon 02 Dec 2019 02:23:33 PM CET
-rwxr-xr-xcmusPlay.sh3
-rwxr-xr-xi3blocks/i3internet.sh31
-rwxr-xr-xi3blocks/i3music.sh7
-rwxr-xr-xpdfs/asPDF.sh (renamed from asPDF.sh)4
-rwxr-xr-xpdfs/pdfSxiv.sh (renamed from pdfSxiv.sh)0
-rwxr-xr-xpdfs/toPDF.sh25
-rwxr-xr-xtmuxSetups/cards4
7 files changed, 56 insertions, 18 deletions
diff --git a/cmusPlay.sh b/cmusPlay.sh
index 64f5b2c..5a8f8fa 100755
--- a/cmusPlay.sh
+++ b/cmusPlay.sh
@@ -1,7 +1,8 @@
#!/bin/sh
+[ -f "/usr/bin/tmux" ] && tmux="tmux new-session -s cmus"
if ! pgrep -x cmus ; then
- urxvt -title floating -sh 20 -geometry "185x15+30-28" -cd ~/music -e cmus
+ urxvt -title floating -sh 20 -geometry "185x15+30-28" -cd ~/music -e $tmux cmus
else
cmus-remote -u
fi
diff --git a/i3blocks/i3internet.sh b/i3blocks/i3internet.sh
index 2f55fd2..4065a31 100755
--- a/i3blocks/i3internet.sh
+++ b/i3blocks/i3internet.sh
@@ -8,30 +8,37 @@ case $BLOCK_BUTTON in
esac
wifiDev="wlp2s0"
-ethDev="enp3s0"
-wstatus=$(cat /sys/class/net/$wifiDev/operstate)
-estatus=$(cat /sys/class/net/$ethDev/operstate)
+ethDev=""
+wstatus="$(cat /sys/class/net/$wifiDev/operstate)"
+estatus="$(cat /sys/class/net/$ethDev/operstate)"
+tick=✅
+wifiSymbol="📶"
+ethSymbol="🌐"
if [ "$wstatus" = "down" ]; then
wifi="❌"
-elif [ "$(nmcli | grep "$wifiDev: connecting ")" ]; then
- step="$(nmcli | grep "$wifiDev: connecting " | sed 's/^.*(/(/;s/).*$/)/')"
- wifi="⚙️ <span color='#fabd2f'>$(nmcli | grep "$wifiDev: " | cut -d' ' -f5-) $step</span>"
+elif [ "$(nmcli | fgrep "$wifiDev: connecting ")" ]; then
+ step="$(nmcli | fgrep "$wifiDev: connecting " | sed 's/^.*(/(/;s/).*$/)/')"
+ wifi="$tick <span color='#fabd2f'>$(nmcli | fgrep "$wifiDev: " | cut -d' ' -f5-) $step</span>"
else
# with IP
- #wifi="✔️$(nmcli | grep "$wifiDev: connected to " | cut -d' ' -f4-) ($(ip addr show $wifiDev | grep "inet " | cut -d' ' -f6)) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))"
+ #wifi="$tick$(nmcli | fgrep "$wifiDev: connected to " | cut -d' ' -f4-) ($(ip addr show $wifiDev | fgrep "inet " | cut -d' ' -f6)) ($(egrep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))"
# with name
- wifi="✔️ <span color='#79ff79'>$(nmcli | grep "$wifiDev: connected to " | cut -d' ' -f4-) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))</span>"
+ wifi="$tick <span color='#79ff79'>$(nmcli | fgrep "$wifiDev: connected to " | cut -d' ' -f4-) ($(egrep '^\s*w' /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))</span>"
fi
-if [ -z "$(nmcli | grep $ethDev)" ]; then
+
+[ -z "$ethDev" ] && echo "$wifiSymbol$wifi" && exit 0
+
+if [ -z "$(nmcli | fgrep "$ethDev")" ]; then
en="❌❗ No $ethDev"
elif [ "$estatus" = "down" ]; then
en="❌"
else
# with IP
- #en=$(ip addr show $ethDev | grep "inet " | cut -d' ' -f6)
+ #en=$(ip addr show $ethDev | fgrep "inet " | cut -d' ' -f6)
# no IP
- en=✔️
+ en=$tick
fi
-echo "📶$wifi 🌐$en"
+echo "$wifiSymbol$wifi $ethSymbol$en"
+exit 0
diff --git a/i3blocks/i3music.sh b/i3blocks/i3music.sh
index cad0b66..d446b50 100755
--- a/i3blocks/i3music.sh
+++ b/i3blocks/i3music.sh
@@ -7,18 +7,19 @@ case $BLOCK_BUTTON in
esac
symbol=🎵
-ampersand="I"
+ampersand='and' # & in echo messes up script
pgrep -x cmus >/dev/null || exit 0
stat="$(cmus-remote -Q | grep "^status " | awk '{print $2}' | sed "s/&/$ampersand/")"
artist="$(cmus-remote -Q | grep "^tag artist " | cut -d' ' -f3- | sed "s/&/$ampersand/")"
title="$(cmus-remote -Q | grep "^tag title " | cut -d' ' -f3- | sed "s/&/$ampersand/")"
[ -z "$artist" ] && artist="(unknown)"
-[ -z "$title" ] && title="$(basename "$(cmus-remote -Q | grep "^file" | cut -d' ' -f2- | sed "s/&/$ampersand/")")" # sed to fix & in title messing up script
+[ -z "$title" ] && title="$(basename "$(cmus-remote -Q | grep "^file" | cut -d' ' -f2- | sed "s/&/$ampersand/")")"
if [ "$stat" = "playing" ]; then
- #echo "$symbol $artist ─ $title"
echo "$symbol $artist ─ $title"
+ echo "$symbol ...$title"
elif [ "$stat" = "paused" ]; then
echo "$symbol ( $artist ─ $title )"
+ echo "$symbol ( ...$title )"
else
echo "$symbol $stat"
fi
diff --git a/asPDF.sh b/pdfs/asPDF.sh
index 3391d43..a03f0aa 100755
--- a/asPDF.sh
+++ b/pdfs/asPDF.sh
@@ -1,9 +1,9 @@
#!/bin/sh
outdir="/tmp/pdf"
-opener="zathura"
name="${1%.*}"
ext="${1##*.}"
+[ -d "$outdir" ] || mkdir -p "$outdir"
case "$ext" in
"md")
@@ -11,4 +11,4 @@ case "$ext" in
*)
lowriter --convert-to pdf --outdir "$outdir" "$1" 1>/dev/null 2>&1 ;;
esac
-"$opener" "$outdir/$name.pdf"
+"$READER" "$outdir/$name.pdf"
diff --git a/pdfSxiv.sh b/pdfs/pdfSxiv.sh
index 0a63586..0a63586 100755
--- a/pdfSxiv.sh
+++ b/pdfs/pdfSxiv.sh
diff --git a/pdfs/toPDF.sh b/pdfs/toPDF.sh
new file mode 100755
index 0000000..e4e6ece
--- /dev/null
+++ b/pdfs/toPDF.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# toPDF.sh
+#
+# Usage: toPDF.sh [-o] INPUTFILE
+#
+# Compiles a file to a temporal PDF using pandoc, updating the temporal file if
+# it already exists.
+# Opens the file with $READER if -o option is given.
+
+if [ "$1" = "-o" ]; then
+ open="1"
+ shift
+fi
+
+[ -z "$1" ] && exit 1
+
+targetDir="/tmp/toPDF"
+sourceFile="$1"
+targetFile="${targetDir}/${sourceFile##*/}"
+targetFile="${targetFile%.*}.pdf"
+
+[ -d "$targetDir" ] || mkdir -p "$targetDir"
+pandoc "$sourceFile" -o "$targetFile"
+[ -n "$open" ] && "$READER" "$targetFile" &
diff --git a/tmuxSetups/cards b/tmuxSetups/cards
new file mode 100755
index 0000000..4658c56
--- /dev/null
+++ b/tmuxSetups/cards
@@ -0,0 +1,4 @@
+#!/bin/sh
+tmux new-window "cd $HOME/proyects/cards/web; nvim"
+tmux previous-window
+ranger "$HOME/proyects/cards/"