#!/bin/sh
-sensors | awk '/^k10temp/ {getline; getline; print $2}'
+case $BLOCK_BUTTON in
+ 2)
+ nohup "${TERMINAL}" -e "${EDITOR}" "$0" >/dev/null &
+ ;;
+esac
+
+temp="$(sensors | awk '/^k10temp/ {getline; getline; print $2}')"
+icon=""
+
+printf "%s %s\n" "${icon}" "${temp}"
--- /dev/null
+#!/bin/bash
+
+case ${BLOCK_BUTTON} in
+ 2)
+ nohup "${TERMINAL}" -e "${EDITOR}" "$0" >/dev/null &
+ ;;
+esac
+
+logfile="${HOME}/.cache/cpulog"
+prevdata="$(cat ${logfile})"
+curdata="$(grep 'cpu ' /proc/stat | awk '{print $2" "$4" "$5}')"
+
+puser="$(echo ${prevdata} | cut -d' ' -f1)"
+psystem="$(echo ${prevdata} | cut -d' ' -f2)"
+pidle="$(echo ${prevdata} | cut -d' ' -f3)"
+
+cuser="$(echo ${curdata} | cut -d' ' -f1)"
+csystem="$(echo ${curdata} | cut -d' ' -f2)"
+cidle="$(echo ${curdata} | cut -d' ' -f3)"
+
+work="$(((cuser+csystem)-(puser+psystem)))"
+idle="$((cidle-pidle))"
+
+cpu="$((100*work/(work+idle)))"
+
+echo "${curdata}" > "${logfile}"
+
+icon=""
+
+printf "%s %.f%%\n" "${icon}" "${cpu}"
--- /dev/null
+#!/bin/bash
+
+case ${BLOCK_BUTTON} in
+ 1)
+ nohup "${TERMINAL}" -e sh -c 'cal -3; read' >/dev/null &
+ ;;
+ 2)
+ nohup "${TERMINAL}" -e "${EDITOR}" "$0" >/dev/null &
+ ;;
+esac
+
+icon=""
+val="$(date '+%a %b %d %H:%M %Y')"
+
+printf "%s %s\n" "${icon}" "${val}"
--- /dev/null
+#!/bin/bash
+
+location=${1:-/}
+
+[[ -d ${location} ]] || exit
+
+case ${BLOCK_BUTTON} in
+ 1)
+ notify-send "Disk space" "$(df -h --output=target,used,size)"
+ ;;
+ 2)
+ nohup "${TERMINAL}" -e "${EDITOR}" "$0" >/dev/null &
+ ;;
+esac
+
+case ${location} in
+ "/home"* )
+ icon=""
+ ;;
+ "/mnt"* )
+ icon=""
+ ;;
+ *)
+ icon=""
+ ;;
+esac
+
+printf "%s %s\n" "${icon}" "$(df -h ${location} | awk ' /[0-9]/ {print $3 "/" $2}')"
+
--- /dev/null
+#!/bin/bash
+
+panel_backgroud=$(xrdb -query | grep '*.panel_background' | awk '{print $NF}')
+focused_background=$(xrdb -query | grep '*.ws_focused' | awk '{print $NF}')
+text=$(xrdb -query | grep '*.text_color' | awk '{print $NF}')
+
+i=0
+while IFS= read -r input; do
+ if (( $i == 0 )); then
+ value="${input}"
+ fi
+ if (( $i == 1 )); then
+ foreground="${input}"
+ fi
+ if (( $i == 2 )); then
+ background="${input}"
+ fi
+
+ i=$(( $i + 1 ))
+done
+
+while getopts "sr" opt; do
+ case ${opt} in
+ s)
+ separator="yes"
+ ;;
+ r)
+ reversed="yes"
+ ;;
+ \?)
+ echo "Invalid option"
+ exit 1
+ ;;
+ esac
+done
+
+if [[ -z ${separator} ]]; then
+ if [[ -z ${reversed} ]]; then
+ foreground=${foreground:-${text}}
+ background=${background:-${panel_backgroud}}
+ else
+ foreground=${foreground:-${text}}
+ background=${background:-${focused_background}}
+ fi
+else
+ if [[ -z ${reversed} ]]; then
+ foreground=${foreground:-${focused_background}}
+ background=${background:-${panel_backgroud}}
+ else
+ foreground=${foreground:-${panel_backgroud}}
+ background=${background:-${focused_background}}
+ fi
+fi
+
+echo "${value}"
+echo ""
+echo "${foreground}"
+echo "${background}"
+
#!/bin/bash
#Pass the password to the block instance
-if [[ -n $BLOCK_INSTANCE ]]; then
+[[ -n $BLOCK_INSTANCE ]] && \
password=("-h" "${BLOCK_INSTANCE}@localhost")
-fi
filter() {
tr '\n' ' ' | grep -Po '.*(?= \[playing\])|paused' | tr -d '\n'
}
+icon=""
+
case $BLOCK_BUTTON in
- 1) mpc $password status | filter && $TERMINAL -e ncmpcpp & disown ;; # right click pause/unpause
- 3) mpc $password toggle | filter ;; # right click, pause/unpause
- 4) mpc $password prev | filter ;; # scroll up, previous
- 5) mpc $password next | filter ;; # scroll down, next
- *) mpc $password status | filter ;;
+ 1)
+ out=$(mpc $password status | filter)
+ [[ -n ${out} ]] && nohup $TERMINAL -e ncmpcpp >/dev/null &
+ ;; # left click run ncmpcpp
+ 3)
+ out=$(mpc $password toggle | filter)
+ ;; # right click, pause/unpause
+ 4)
+ out=$(mpc $password prev | filter)
+ ;; # scroll up, previous
+ 5)
+ out=$(mpc $password next | filter)
+ ;; # scroll down, next
+ *)
+ out=$(mpc $password status | filter)
+ ;;
esac
+
+[[ -n ${out} ]] && \
+ printf "%s %s\n" "${icon}" "${out}"
esac
ipaddr=$(ip addr show enp3s0 | awk '/inet/ { print $2 ; exit }' | sed 's/\/.*//g')
-#echo $ipaddr
-printf '<span foreground="#66ff33">%s</span>' "${icon} ${ipaddr}"
+
+echo "${icon} ${ipaddr}"
+echo "#66ff33"
+++ /dev/null
-#!/bin/bash
-
-setxkbmap -layout us,ru -option grp:ctrls_toggle
#!/bin/bash
-xkb-switch
-xkb-switch -W
+i3bkeymapfile="${HOME}/.cache/i3b_pid_keymap"
+icon=""
+i3bpid="$(cat ${i3bkeymapfile})"
+i3bpidcur="$(pidof i3blocks)"
+
+if [[ ${i3bpid} == ${i3bpidcur} ]]; then
+ xkb-switch -n
+else
+ echo "${i3bpidcur}" > "${i3bkeymapfile}"
+fi
+
+out="$(xkb-switch)"
+printf "%s %s\n" "${icon}" "${out}"
echo "${fmt_msg}"
}
+export consumption_list="$(mem_info)"
+
case $BLOCK_BUTTON in
- 1) notify-send "Top 10 memory consumption" "$(mem_info)" -t 30000;;
+ 1)
+ notify-send "Top 10 memory consumption" "$(mem_info)" -t 30000
+ ;;
+ 2)
+ nohup "${TERMINAL}" -e "${EDITOR}" "$0" >/dev/null &
+ ;;
esac
-free -h | awk '/^Mem:/ {print $3 "/" $2}' | sed 's/i//g'
+icon=
+val=$(free -h | awk '/^Mem:/ {print $3 "/" $2}' | sed 's/i//g'i)
+
+echo "${icon} ${val}"
--- /dev/null
+#!/bin/bash
+
+logfile="${HOME}/.cache/netlog"
+prevdata="$(cat ${logfile})"
+
+rxcur="$(($(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+')))"
+txcur="$(($(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+')))"
+rx="$(((rxcur-${prevdata%% *})/1024))"
+tx="$(((txcur-${prevdata##* })/1024))"
+
+echo "${rxcur} ${txcur}" > "${logfile}"
+
+printf "%sKiB%sKiB\n" "${rx}" "${tx}"
sink=$( pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | tail -n 1 )
-case $BLOCK_BUTTON in
- 2) pactl set-sink-mute $sink toggle ;;
- 4) pactl set-sink-volume $sink +5% ;;
- 5) pactl set-sink-volume $sink -5% ;;
+case ${BLOCK_BUTTON} in
+ 2)
+ nohup "${TERMINAL}" -e "${EDITOR}" "$0" >/dev/null &
+ ;;
+ 3)
+ pactl set-sink-mute $sink toggle
+ ;;
+ 4)
+ pactl set-sink-volume $sink +5%
+ ;;
+ 5)
+ pactl set-sink-volume $sink -5%
+ ;;
esac
muted=$( awk '/muted/ {print $2}' <(pacmd list-sinks | grep '^[[:space:]]muted:' | head -n $(( $sink + 1 )) | tail -n 1 ) )
if [ "$muted" = "yes" ]; then
- icon="🔇"
- printf "%s\\n" "$icon"
+ icon=""
+ printf "%s\n" "$icon"
else
vol=$( pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $sink + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' )
if [ "$vol" -gt 60 ]; then
- icon="🔊"
+ icon=""
elif [[ "$vol" -le 60 && "$vol" -gt 30 ]]; then
- icon="🔉"
+ icon=""
else
- icon="🔈"
+ icon=""
fi
- printf "%s %s%%\\n" "$icon" "$vol"
+ printf "%s %s%%\n" "$icon" "$vol"
fi
complete -cf man
export EDITOR=vim
+
+. /usr/share/bash-completion/bash_completion
--- /dev/null
+# __ __
+# / /____ __/ /_ ___
+# / //_/ / / / __ \/ _ \
+# / ,< / /_/ / /_/ / __/
+#/_/|_|\__,_/_.___/\___/
+source <(kubectl completion bash)
--- /dev/null
+export PATH="/opt/vault:${PATH}"
+
+complete -C /opt/vault/vault vault