clean up
This commit is contained in:
parent
cd52843da6
commit
bd568d74f2
19 changed files with 7 additions and 1176 deletions
|
|
@ -1,119 +0,0 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC2059,SC2064,SC2086,SC2001,SC2016
|
||||
|
||||
# simple lightweight lemonbar script for use with dk
|
||||
|
||||
set -eE -o pipefail
|
||||
|
||||
bg="#000000" # background colour
|
||||
fg="#ffffff" # foreground colour
|
||||
hi="#00aaaa" # highlight colour
|
||||
ul=2 # underline thickness
|
||||
sep="┃" # separator text
|
||||
fifo="/tmp/bar.fifo"
|
||||
font="Iosevka:size=11"
|
||||
|
||||
clock()
|
||||
{
|
||||
date +"T %a %H:%M "
|
||||
|
||||
# sync up the clock to the minute mark
|
||||
min=$(date +"%M")
|
||||
while [[ $(date +"%M") == "$min" ]]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while :; do
|
||||
date +"T %a %H:%M "
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
battery()
|
||||
{
|
||||
while :; do
|
||||
perc="$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
echo "B bat: ${perc}%"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
volume()
|
||||
{
|
||||
vol="$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oE '[1-9]+%' | head -n1)"
|
||||
echo "V vol: ${vol}"
|
||||
}
|
||||
|
||||
workspaces()
|
||||
{
|
||||
# these will be filled out once we eval each line
|
||||
typeset name="" title="" layout="" focused=false active=false
|
||||
|
||||
WS=""
|
||||
while read -r l; do
|
||||
printf '%s\n\n' "$1" >> "$HOME/a" 2>&1
|
||||
if [[ $l =~ ^title=* ]]; then
|
||||
# default foreground, background, and underline colours
|
||||
# changing the foreground and underline based on
|
||||
# the active and focused state
|
||||
f="$fg" b="$bg" u="$fg";
|
||||
$active && u="$hi"
|
||||
if $focused; then
|
||||
# clicking the layout symbol will cycle the layout
|
||||
lyt="%{A:dkcmd set layout cycle:}${layouts[$layout]}%{A}"
|
||||
WIN="${title:0:50}"
|
||||
f="$hi"
|
||||
fi
|
||||
# clicking on a workspace name will view it
|
||||
WS="$WS%{F$f}%{B$b}%{+u}%{U$u}%{A:dkcmd ws $name:} $name %{A}%{-u}%{B-}%{F-}"
|
||||
fi
|
||||
# turn the dk JSON output into lines that can be `eval`ed one by one,
|
||||
# filling out the following fields: name, focused, active, layout, title
|
||||
done < <(dkcmd -p <<< "$1" | sed '/.*\[\|]/d; /[{}],\?/d; s/^\s*\|,$//g; /"monitor":\|"number":\|"id":/d; s/"\(.*\)": /\1=/; s/\$(/\\\$(/g; s/`/\\`/g')
|
||||
WS="$WS $lyt"
|
||||
}
|
||||
|
||||
parsefifo()
|
||||
{
|
||||
# globals to simplify the workspaces call
|
||||
declare -g WS
|
||||
|
||||
local time vol bat net
|
||||
|
||||
while read -r line; do
|
||||
case $line in
|
||||
T*) time="${line#?}" ;;
|
||||
V*) vol="${line#?}" ;;
|
||||
B*) bat="${line#?}" ;;
|
||||
N*) net="${line#?}" ;;
|
||||
'{'*) workspaces "$line" ;;
|
||||
esac
|
||||
echo "%{l} ${WS}%{c}${time}%{r}${bat}${vol} "
|
||||
done
|
||||
}
|
||||
|
||||
# kill the process and cleanup if we exit or get killed
|
||||
trap "trap - TERM; rm -f '$fifo'; kill 0" INT TERM QUIT EXIT PIPE
|
||||
|
||||
# make the fifo
|
||||
[ -e "$fifo" ] && rm "$fifo"
|
||||
mkfifo "$fifo"
|
||||
|
||||
# here we dump info into the FIFO, order does not matter things are parsed
|
||||
# out using the first character of the line. Click commands for left button
|
||||
# can be added by passing an argument containing the command (like below)
|
||||
#
|
||||
# comment a line to remove the "module"
|
||||
clock > "$fifo" &
|
||||
battery > "$fifo" &
|
||||
volume > "$fifo" &
|
||||
dkcmd status type=bar > "$fifo" &
|
||||
|
||||
# run the pipeline
|
||||
if [[ $1 == '-b' ]]; then
|
||||
parsefifo < "$fifo" | lemonbar -b -a 32 -u $ul -B "$bg" -F "$fg" -f "$font" | sh;
|
||||
else
|
||||
parsefifo < "$fifo" | lemonbar -a 32 -u $ul -B "$bg" -F "$fg" -f "$font" | sh
|
||||
fi
|
||||
|
||||
# vim:ft=sh:fdm=marker:fmr={,}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
get_mem() {
|
||||
while IFS=':k ' read -r key val _; do
|
||||
case $key in
|
||||
MemTotal) mem_used="$((mem_used + val))" ;;
|
||||
Shmem) mem_used="$((mem_used + val))" ;;
|
||||
MemFree|Buffers|Cached|SReclaimable) mem_used="$((mem_used - val))" ;;
|
||||
esac
|
||||
done < /proc/meminfo
|
||||
|
||||
echo "$((mem_used / 1024))"
|
||||
}
|
||||
|
||||
echo "$USER@$(hostname)"
|
||||
echo 'os: Void Linux x86_64-musl'
|
||||
echo "uptime:$(uptime -p | tr -d 'up')" # 4 hors 20 mintes
|
||||
echo "ip: $(ip a | grep -oEm1 '192\.168\.[0-9][0-9][0-9]\.[0-9]+' | head -n1)"
|
||||
echo "pkgs: $(xbps-query -lm | wc -l)"
|
||||
echo "mem: $(get_mem)M"
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
JOURNAL="$HOME/nfs/idk"
|
||||
|
||||
tmp="$(mktemp /tmp/journal.XXXXXX)"
|
||||
|
||||
d="$(date -I)"
|
||||
grep "$d" "$JOURNAL" || printf "%s\n" "$d" > "$tmp"
|
||||
|
||||
"${EDITOR:-vi}" "$tmp"
|
||||
tail "$JOURNAL"
|
||||
(printf "\n"; cat "$tmp" | tee -a "$JOURNAL") && rm "$tmp"
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
LIBGL_ALWAYS_SOFTWARE=1 exec /usr/bin/luakit $@
|
||||
2
files/.local/bin/xclip
Executable file
2
files/.local/bin/xclip
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
xclip -selection clipboard $@
|
||||
Loading…
Add table
Add a link
Reference in a new issue