commit 3cbd9827fe2f993de261a20b078a66e461bff3b5
parent 7fd404a4a2f2e9369205e28e61e16ddc3f575012
Author: klewer-martin <martin.cachari@gmail.com>
Date: Mon, 10 May 2021 02:46:53 -0300
Updated some status bar blocks and also openbook, a script to open books with dmenu
Diffstat:
10 files changed, 69 insertions(+), 47 deletions(-)
diff --git a/keyboardmap b/keyboardmap
@@ -6,4 +6,6 @@ setxkbmap -option caps:swapescape
setxkbmap -option altwin:swap_lalt_lwin
+setxkbmap -option altwin:swap_alt_win
+
# setxkbmap -option caps:super ; xcape -e 'Super_L=Escape'
diff --git a/openbook b/openbook
@@ -1,8 +1,19 @@
-#!/bin/bash
+#!/bin/sh
-# Prints a list of books in dmenu from the folder $HOME/dox/books
-# if you choose one then its opened with zathura;
+# Prints a list of books in dmenu and opens the chosen one with pdfviewer
+# The arguments receive are redirected to dmenu
-BOOKNAME=$(ls $HOME/dox/books | dmenu -l 10)
+# by github.com/klewer-martin
-[ "$BOOKNAME" != "" ] && zathura $HOME/dox/books/"$BOOKNAME"
+dir=$HOME/dox/books
+pdfviewer=zathura
+dmenucmds="-i -l 10 -h 14 -z 750 -bw 2 -c $@"
+
+bookname=$(ls $dir | dmenu $dmenucmds)
+
+[ "$bookname" = "" ] && exit
+
+[ $(file "$dir/$bookname" | cut -d ":" -f 2) = "directory" ] &&
+ dir=$dir/$bookname && bookname=$(ls "$dir" | dmenu $dmenucmds)
+
+[ "$bookname" != "" ] && $pdfviewer "$dir/$bookname"
diff --git a/statusbar/sb-battery b/statusbar/sb-battery
@@ -22,10 +22,10 @@ for battery in /sys/class/power_supply/BAT?*; do
[ -n "${capacity+x}" ] && printf " "
# Sets up the status and capacity
case "$(cat "$battery/status")" in
- "Full") status="⚡:" ;;
- "Discharging") status="🔋:" ;;
- "Charging") status="🔌:" ;;
- "Not charging") status="🛑: " ;;
+ "Full") status="⚡" ;;
+ "Discharging") status="🔋" ;;
+ "Charging") status="🔌" ;;
+ "Not charging") status="🛑" ;;
"Unknown") status="♻️: " ;;
esac
capacity=$(cat "$battery/capacity")
diff --git a/statusbar/sb-price b/statusbar/sb-binance
diff --git a/statusbar/sb-clock b/statusbar/sb-clock
@@ -27,4 +27,4 @@ esac
#esac
#date "+ %a %b %d %Y $icon: %I:%M%p"
-date "+📅: %a %d/%m/%Y | $icon: %R "
+date "+📅 %a %d/%m/%Y | $icon %R "
diff --git a/statusbar/sb-disk b/statusbar/sb-disk
@@ -17,7 +17,7 @@ esac
case "$location" in
"/home"* ) icon="🏠" ;;
"/mnt"* ) icon="💾" ;;
- *) icon="🖥";;
+ *) icon="💾";;
esac
-printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
+printf "%s %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
diff --git a/statusbar/sb-kbselect b/statusbar/sb-kbselect
@@ -3,14 +3,15 @@
# requirements: dmenu, xorg-setxkbmap
kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1
-case $BLOCK_BUTTON in
- 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
- kb="$(echo "$kb_choice" | awk '{print $3}')"
- setxkbmap "$kb"
- pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
- 3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')")
-- Left click to change keyboard.";;
- 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
-esac
+# case $BLOCK_BUTTON in
+# 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
+# kb="$(echo "$kb_choice" | awk '{print $3}')"
+# setxkbmap "$kb"
+# pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
+# 3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')")
+# - Left click to change keyboard.";;
+# 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+# esac
-echo "$kb"
+printf "%s: %s" "⌨️" "$kb"
+# echo "⌨️: $kb"
diff --git a/statusbar/sb-memory b/statusbar/sb-memory
@@ -9,4 +9,4 @@
# 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
#esac
-free --mebi | sed -n '2{p;q}' | awk '{printf (" 🧠: %2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
+free --mebi | sed -n '2{p;q}' | awk '{printf (" 🧠 %2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
diff --git a/statusbar/sb-price b/statusbar/sb-price
@@ -11,28 +11,35 @@ dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices"
pricefile="$dir/$1"
chartfile="$dir/$1-chart"
+# curl -s "rate.sx/1$1" > "$pricefile"
+
+#updateprice() { ping -q -c 1 example.org >/dev/null 2>&1 &&
+# curl -s "rate.sx/1$1" > "$pricefile" &&
+# curl -s "rate.sx/$1$interval" > "$chartfile" ;}
+
updateprice() { ping -q -c 1 example.org >/dev/null 2>&1 &&
- curl -s "rate.sx/1$1" > "$pricefile" &&
- curl -s "rate.sx/$1$interval" > "$chartfile" ;}
+ binance-cli --keyfile /home/mk/go/bin/keys.json list-price --symbol $1 | grep price | awk {'print $2'} | sed 's/"//g' > "$pricefile" ;}
[ -d "$dir" ] || mkdir -p "$dir"
-[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
- updateprice "$1"
-
-case $BLOCK_BUTTON in
- 1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;;
- 2) notify-send -u low "$3 Updating..." "Updating $2 price..."
- updateprice "$1" && notify-send "$3 Update complete." "$2 price is now
-\$$(cat "$pricefile")" ;;
- 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
- notify-send "$3 $2 module" "\- <b>Exact price: \$$(cat "$pricefile")</b>
-- Left click for chart of changes.
-- Middle click to update.
-- Shows 🔃 if updating prices.
-- <b>Last updated:
- $uptime</b>" ;;
- 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
-esac
-
-printf "$3$%0.2f" "$(cat "$pricefile")"
+#[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
+# updateprice "$1"
+
+updateprice "$1"
+
+# case $BLOCK_BUTTON in
+# 1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;;
+# 2) notify-send -u low "$3 Updating..." "Updating $2 price..."
+# updateprice "$1" && notify-send "$3 Update complete." "$2 price is now
+# \$$(cat "$pricefile")" ;;
+# 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
+# notify-send "$3 $2 module" "\- <b>Exact price: \$$(cat "$pricefile")</b>
+# - Left click for chart of changes.
+# - Middle click to update.
+# - Shows 🔃 if updating prices.
+# - <b>Last updated:
+# $uptime</b>" ;;
+# 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+# esac
+
+printf "$3$%0.3f" "$(cat "$pricefile")"
diff --git a/statusbar/sb-volume b/statusbar/sb-volume
@@ -13,7 +13,7 @@
# 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
# esac
-[ $(pamixer --get-mute) = true ] && echo "🔇: 0%" && exit
+[ $(pamixer --get-mute) = true ] && echo "🔇 0%" && exit
vol="$(pamixer --get-volume)"
@@ -27,5 +27,6 @@ else
icon="🔉"
fi
-echo "$icon: $vol%"
-#echo "VOL: $vol%"
+printf "%s%3d%s" "$icon" "$vol" "%"
+# echo "$icon: $vol%"
+# echo "VOL: $vol%"