❦
baskerville / sutils Goto Github PK
View Code? Open in Web Editor NEWSmall command-line utilities
License: The Unlicense
Small command-line utilities
License: The Unlicense
❦
~ $ battery
Full 106
~ $ acpi -i
Battery 0: Full, 100%
Battery 0: design capacity 7570 mAh, last full capacity 7140 mAh = 94%
Reported battery is 106%, while I expect it to be 100% or less.
Hi @baskerville ,
I am an happy bspwm
user, but I am having this issue with the clock
applet with lemonbar
. What happens is that everything works fine, until at some point the clock is stuck and does not get updated any more.
Everything else (like the battery
, xtitle
, workspaces etc) works, which means that it should be more of a clock
issue rather than a lemonbar
issue (this is why I am reporting it here).
Strangely enough, if I type clock
from a terminal it prints out the correct time.
FYI below is my panel script (I could have cut off the not important things but I preferred to keep it as-is). I call it in my init.sh
as panel.sh &
#! /bin/sh
# From example .profile changes
export PANEL_FIFO="/tmp/panel-fifo"
export PANEL_HEIGHT="28"
export PANEL_FONT="SourceCodePro-10"
export PANEL_WM_NAME="lemonpanel"
# From panel_colors file
COLOR_DEFAULT_FG="#c0c5ce"
COLOR_DEFAULT_BG="#2b303b"
COLOR_MONITOR_FG="#a3be8c"
COLOR_MONITOR_BG="#2b303b"
COLOR_FOCUSED_MONITOR_FG="#a3be8c"
COLOR_FOCUSED_MONITOR_BG="#4f5b66"
COLOR_FREE_FG="#4f5b66"
COLOR_FREE_BG="#2b303b"
COLOR_FOCUSED_FREE_FG="#000000"
COLOR_FOCUSED_FREE_BG="#504e4e"
COLOR_OCCUPIED_FG="#a7a5a5"
COLOR_OCCUPIED_BG="#2b303b"
COLOR_FOCUSED_OCCUPIED_FG="#d6d3d2"
COLOR_FOCUSED_OCCUPIED_BG="#4f5b66"
COLOR_URGENT_FG="#f15d66"
COLOR_URGENT_BG="#2b303b"
COLOR_FOCUSED_URGENT_FG="#501d1f"
COLOR_FOCUSED_URGENT_BG="#d5443e"
COLOR_STATE_FG="#b483ad"
COLOR_STATE_BG="#2b303b"
COLOR_TITLE_FG="#8fa1b3"
COLOR_TITLE_BG="#2b303b"
COLOR_SYS_FG="#ebcb8b"
COLOR_SYS_BG="#2b303b"
COLOR_GREEN="#a3be8c"
COLOR_RED="#bf616a"
# Kill any panel processes older than us, instead of bailing like the example
# does. That caused one too many panel-less boots for me.
while [ $(pgrep -cx panel.sh) -gt 1 ] ; do
pkill -ox -9 panel.sh
done
# Kill any remaining trays / xtitle instances so we don't have multiples.
killall -9 xtitle
killall -9 stalonetray
killall -9 nm-applet
killall -9 indicator-sound-switcher
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"
bspc config top_padding $PANEL_HEIGHT
bspc subscribe report > "$PANEL_FIFO" &
# Here are the subprograms that add information to the status FIFO which are
# interpreted by panel_bar, below. Each output is detected by its first
# character, which is how the bspwm internal information is presented.
# T - xtitle output
# S - date output (same as example)
# B - battery output
xtitle -sf 'T%s' > "$PANEL_FIFO" &
clock -sf 'S%a, %b %d %H:%M' > "$PANEL_FIFO" &
bat_percent() {
BAT="/sys/class/power_supply/BAT1"
while true; do
CHARGE_NOW=`cat $BAT/charge_now`
CHARGE_FULL=`cat $BAT/charge_full`
PERCENT=`echo "($CHARGE_NOW * 100)/$CHARGE_FULL" | bc`
BATSTATUS=`cat $BAT/status`
if [ "$BATSTATUS" = "Charging" ]; then
BATSTATUS="+"
elif [ "$BATSTATUS" = "Discharging" ]; then
BATSTATUS="-"
else
BATSTATUS=""
fi
echo "B$BATSTATUS$PERCENT"
sleep 1
done
}
bat_percent > "$PANEL_FIFO" &
vol_info() {
while true; do
volStatus=$(amixer -D pulse sget Master | tail -n 1 | cut -d '[' -f 3 | sed 's/]//g')
volLevel=$(amixer -D pulse sget Master | awk '/Front Left:/ {print $5}' | tr -dc "0-9" | sed 's/%//g' )
if [ $volStatus = "on" ]; then
echo "N$volLevel"
else
echo "F$volLevel"
fi
sleep 1
done
}
vol_info > "$PANEL_FIFO" &
brightness_info() {
while true; do
br_float=$(xbacklight)
br_int=${br_float%.*}
echo "R$br_int"
sleep 1
done
}
brightness_info > "$PANEL_FIFO" &
num_mon=$(bspc query -M | wc -l)
panel_bar() {
while read line < $PANEL_FIFO; do
case $line in
R*)
# brightness
br="%{F$COLOR_SYS_FG} ${line#?}%{F-}"
;;
N*)
# volume output - on status
vol="%{F$COLOR_GREEN} ${line#?}%{F-}"
;;
F*)
# volume output - off status
vol="%{F$COLOR_RED} ${line#?}%{F-}"
;;
B*)
# battery output
bat="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?}%"
;;
S*)
# clock output
sys="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
;;
T*)
# xtitle output
title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
;;
W*)
# bspwm's state
wm=""
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
name=${item#?}
case $item in
[mM]*)
[ $num_mon -lt 2 ] && shift && continue
case $item in
m*)
# monitor
FG=$COLOR_MONITOR_FG
BG=$COLOR_MONITOR_BG
;;
M*)
# focused monitor
FG=$COLOR_FOCUSED_MONITOR_FG
BG=$COLOR_FOCUSED_MONITOR_BG
;;
esac
wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}"
;;
[fFoOuU]*)
case $item in
f*)
# free desktop
FG=$COLOR_FREE_FG
BG=$COLOR_FREE_BG
;;
F*)
# focused free desktop
FG=$COLOR_FOCUSED_FREE_FG
BG=$COLOR_FOCUSED_FREE_BG
;;
o*)
# occupied desktop
FG=$COLOR_OCCUPIED_FG
BG=$COLOR_OCCUPIED_BG
;;
O*)
# focused occupied desktop
FG=$COLOR_FOCUSED_OCCUPIED_FG
BG=$COLOR_FOCUSED_OCCUPIED_BG
;;
u*)
# urgent desktop
FG=$COLOR_URGENT_FG
BG=$COLOR_URGENT_BG
;;
U*)
# focused urgent desktop
FG=$COLOR_FOCUSED_URGENT_FG
BG=$COLOR_FOCUSED_URGENT_BG
;;
esac
wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}"
;;
[LTG]*)
# layout, state and flags
wm="${wm}%{F$COLOR_STATE_FG}%{B$COLOR_STATE_BG} ${name} %{B-}%{F-}"
;;
esac
shift
done
;;
esac
if [ "$num_mon" -gt "1" ]; then
printf "%s\n" "%{l}${wm}%{c}${title}%{r}${bat}${vol}${br}${sys}%{S+}%{l}${wm}%{c}${title}%{r}${bat}${vol}${br}${sys}"
else
printf "%s\n" "%{l}${wm}%{c}${title}%{r}${bat}${vol}${br}${sys}"
fi
done
}
panel_bar | lemonbar -a 32 -n "$PANEL_WM_NAME" -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" | sh &
if [ "$num_mon" -gt "1" ]; then
TRAY_GEOM="1x1-2810"
else
TRAY_GEOM="1x1-250"
fi
stalonetray --geometry $TRAY_GEOM -i $PANEL_HEIGHT -bg "$COLOR_DEFAULT_BG" --grow-gravity NE --kludges force_icons_size &
wid=$(xdo id -a stalonetray)
tries_left=20
while [ -z "$wid" -a "$tries_left" -gt 0 ] ; do
sleep 0.05
wid=$(xdo id -a stalonetray)
tries_left=$((tries_left -1))
done
[ -n "$wid" ] && xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
wid=$(xdo id -a "$PANEL_WM_NAME")
tries_left=20
while [ -z "$wid" -a "$tries_left" -gt 0 ] ; do
sleep 0.05
wid=$(xdo id -a "$PANEL_WM_NAME")
tries_left=$((tries_left - 1))
done
[ -n "$wid" ] && xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
nm-applet &
indicator-sound-switcher &
wait
It seems clock does not listen in on locale and uses English by default. Which creates a problem for us non-english speakers.
heres the actual error
[#] Making package: sutils-git 1f35ea442016.04.11-1 (Sun 15 May 2022 11:58:15 AM IST)
[#] Checking for missing dependencies...
[#] Retrieving sources...
[->] Updating sutils git repo...
Fetching origin
[#] Validating source files with md5sums...
sutils ... Skipped
[#] Extracting sources...
[->] Creating working copy of sutils git repo...
[#] Starting pkgver()...
[#] Removing existing $pkgdir/ directory...
[#] Starting build()...
cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -std=c99 -pedantic -Wall -Wextra -I/usr/include -D_POSIX_C_SOURCE=200112L -Os -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/lib -s -o essid essid.c
essid.c: In function ‘main’:
essid.c:65:5: error: format not a string literal and no format arguments [-Werror=format-security]
65 | sprintf(request.ifr_name, interface);
| ^~~~~~~
cc1: some warnings being treated as errors
make: *** [Makefile:27: essid] Error 1
[!] A failure occurred in build().
Aborting...
, i am trying to package sutils for MPR aka makedeb.org. the installation is failing due to the build process having some errors. any possible fix to overcome this issue is appreciated.
It can update the version of the tarball?
For as there were interesting changes on the master, it could also be updated in the tarball.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.