On Sun, Oct 22, 2023 at 07:50:54AM -0400, The Wanderer wrote:
> On 2023-10-22 at 07:24, tomas@tuxteam.de wrote:
>
> > I better not tell. My clock is a... shell script in a tiny Xterm
> > which also shows my battery status.
>
> Ooo, that sounds interesting. I don't currently have a laptop, so the
> battery-status part wouldn't currently apply, but this sounds like
> something I might like to try when that changes; any chance of sharing
> the specific details?
Glad to oblige.
The date part is the smallest, down there in the lower right
corner :-)
========================================================================
tomas@trotzki:~$ cat ~/bin/bat
#!/bin/bash
# Notes:
# for colors:
# tput setaf 1 ; tput bold ; echo -n 123 ; tput setaf 7 ; tput sgr0 ; echo 456
# cf tput(1) terminfo(5)
# do continuous mode with watch -c, possibly t
BAT='/sys/class/power_supply/BAT0'
AC='/sys/class/power_supply/AC'
FULL=$(cat $BAT/energy_full)
NOW=$(cat $BAT/energy_now)
case $(cat $AC/online) in
0) online="BAT" ;;
1) online="AC " ;;
*) online="???" ;;
esac
echo -ne "$online " ; dc -e "5k $NOW $FULL / p" ; date +"%F%a%n %T"
========================================================================
The fun part is convincing fvwm to do its thing:
========================================================================
# Style for bat, clock:
Style bat !Borders,!Handles,!Title
# NOTES if text too big, nothing to be seen;
# watch -t: no title;
# the -geometry is there to place the window off screen while it's
# not yet swallowed.
# Can we change colors? Yeah: watch lets 'em through with option -c
*FvwmButtons: (2x1, Frame 2, \
Swallow bat "Exec exec xterm -class bat -bg black -fg white \
-geometry +5000+5000 \
-fn 'xft:DejaVu Sans Mono Book:pixelsize=7' \
-e watch -tn 10 bat" )
========================================================================
Enjoy :)
I've been mulling around whether to switch to Tcl/Tk: I like the
unobtrusiveness of the thing, but some more noise when the battery
is on its last legs would be desirable :-)
> > But I'm weird.
>
> I literally used to go by "Weird" as a nickname, though (sadly?) it
> never became as commonly used as with Al. Weird doesn't bother me at
> all.
A good feeling not to be alone around here ;-)
Cheers
--
t
Attachment:
signature.asc
Description: PGP signature