Replies: 36 comments 35 replies
-
Whoa! Have album art working with a really hacky script! Requires albumart.sh#!/bin/bash
rm -f /tmp/*.jpg
type mpc > /dev/null 2>&1 || exit
type jpegtopnm > /dev/null 2>&1 || exit
MUSIC_DIR="$HOME/Music"
MPD_PID=$(pidof mpd)
[ -z "$MPD_PID" ] && exit
mpc | grep -q 'playing' || exit
R=$(echo $RANDOM)
TMPFILE=/tmp/${R}.jpg
function scale_pic() {
(jpegtopnm "$1" | pamscale -width 48 -height 48 | pnmtojpeg > $TMPFILE)>/dev/null 2>&1
}
function get_albumart() {
NOW_PLAYING_FILE="$(mpc current --format %file%)"
ART_DIR="${NOW_PLAYING_FILE%\/*}"
if [ -f "$MUSIC_DIR/$ART_DIR/albumart.jpg" ];then
scale_pic "$MUSIC_DIR/$ART_DIR/albumart.jpg"
echo $R
return 0
elif [ -f "$MUSIC_DIR/$ART_DIR/cover.jpg" ];then
scale_pic "$ART_DIR/cover.jpg"
echo $R
return 0
else
echo 0
return 1
fi
}
get_albumart && exit $? mpd.widget
videorecording.mp4@LBCrion is this (with a script) the best/easiest way to use album art? Mind you I have never used |
Beta Was this translation helpful? Give feedback.
-
I think there should be a way to simplify this, but I'll need to
experiment a bit. Alas, my train doesn't have a working WiFi today.
Hopefully, I'll have a better luck tomorrow.
…On Thu, 5 Sept 2024, 12:21 micko, ***@***.***> wrote:
Whoa! Have album art working with a *really* hack script!
Requires mpd, mpc, netpbm (for scaling image or you could hack in magick)
albumart.sh
#!/bin/bash
rm -f /tmp/*.jpgtype mpc > /dev/null 2>&1 || exittype jpegtopnm > /dev/null 2>&1 || exit
MUSIC_DIR="$HOME/Music"
MPD_PID=$(pidof mpd)
[ -z "$MPD_PID" ] && exit
mpc | grep -q 'playing' || exit
R=$(echo $RANDOM)
TMPFILE=/tmp/${R}.jpg
function scale_pic() {
(jpegtopnm "$1" | pamscale -width 48 -height 48 | pnmtojpeg > $TMPFILE)>/dev/null 2>&1
}
function get_albumart() {
NOW_PLAYING_FILE="$(mpc current --format %file%)"
ART_DIR="${NOW_PLAYING_FILE%\/*}"
if [ -f "$MUSIC_DIR/$ART_DIR/albumart.jpg" ];then
scale_pic "$MUSIC_DIR/$ART_DIR/albumart.jpg"
echo $R
return 0
elif [ -f "$MUSIC_DIR/$ART_DIR/cover.jpg" ];then
scale_pic "$ART_DIR/cover.jpg"
echo $R
return 0
else
echo 0
return 1
fi
}
get_albumart && exit $?
mpd.widget
include("mpd.source")
scanner {
Exec("albumart.sh") {
Res = Grab(First)
}
}
define Icn = "/tmp/" + Str(Res,0) + ".jpg"
define NoIcn = "gtk-no"
define Ico = If(Res > 0,Icn,NoIcn)
layout {
style = If(MpdState.count=0,"hidden","frame")
label {
css = "* { padding-bottom: 10px; font-weight: 600; }"
style = "mpd"
interval = 100
value = $MpdTitle
tooltip = "Currently playing: " +$MpdTitle
loc(1,1,4,1)
}
label {
css = "* { padding-bottom: 10px; }"
style = "mpd"
interval = 100
value = $MpdArtist+" - "+ $MpdAlbum
tooltip = $MpdArtist+" - "+ $MpdAlbum
loc(1,2,4,1)
}
image {
style="mpd"
value = "icons/misc/rewind.svg"
loc(1,3,1,1)
action = MpdCmd "previous"
}
image {
style="mpd"
value = "icons/misc/play.svg"
loc(2,3,1,1)
action = MpdCmd "play"
}
image {
style="mpd"
value = "icons/misc/stop.svg"
loc(3,3,1,1)
action = MpdCmd "stop"
}
image {
style="mpd"
value = "icons/misc/fforward.svg"
loc(4,3,1,1)
action = MpdCmd "next"
}
image {
style="art"
css = "* { min-height: 48px; min-width: 48px; margin-top: 9px; }"
value = Ico
trigger = "mpd"
loc(2,4,2,1)
}
}
#CSS
image#mpd {
-ScaleImage-color: @theme_fg_color;
}
label#mpd {
-GtkWidget-max-width: 150;
}
image#art {
background: @theme_selected_bg_color;
padding-top: 4px;
padding-bottom: 4px;
border: 0.6px solid @borders;
}
video
https://github.com/user-attachments/assets/4264ac32-07c8-41f0-9c32-360a2ca0d12a
@LBCrion <https://github.com/LBCrion> is this (with a script) the
best/easiest way to use album art? Mind you I have *never* used mpd until
yesterday! I've fallen in love! 🤣 The code in the script is crude but
amounts to not very much compared with the hoops you'd have to jump through
in C.
—
Reply to this email directly, view it on GitHub
<#228 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHPFFBQTRKLRMIHCU2G42TZVA5DNAVCNFSM6AAAAABNUGNDDOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANJVGY2TENQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
How about a .widget file like this?
|
Beta Was this translation helpful? Give feedback.
-
Btw, You don't need to scale the image, so long as you specify min-height / min-width for it, sfwbar will scale it automatically. |
Beta Was this translation helpful? Give feedback.
-
I've updated the first post with all the latest configs/widgets. |
Beta Was this translation helpful? Give feedback.
-
That's very cool, Thanks a lot |
Beta Was this translation helpful? Give feedback.
-
With the new found album art stuff I took the liberty to add it to the mpd-intmod
|
Beta Was this translation helpful? Give feedback.
-
Updated first post with bugfixes to calendar and kernel widgets. @LBCrion do you think the regex is ok for the For some strange reason my highlighting of the date in the calendar widget works perfectly now - must have been a bug in the support libs for GTK as I did nothing - a |
Beta Was this translation helpful? Give feedback.
-
Nice! The regex for kernel looks reasonable, it should extract the first occurrence of 3 numbers separate by dots. You may want to set |
Beta Was this translation helpful? Give feedback.
-
Mpd artwork is a bit a tricky. The music directory isn't always ~/Music. I.e. my local directory is ~/.music. You can in theory get it by sending a |
Beta Was this translation helpful? Give feedback.
-
A rather ugly hack to get the music directory from the mpd server (it looks like currently you can only declare
|
Beta Was this translation helpful? Give feedback.
-
Multiple MpdClient declarations should be gracefully handled now. Var lists will be merged. Address and trigger from the first declaration will be used throughout (if specified). |
Beta Was this translation helpful? Give feedback.
-
For kernel version, instead of |
Beta Was this translation helpful? Give feedback.
-
Oh, forgot to add |
Beta Was this translation helpful? Give feedback.
-
In the |
Beta Was this translation helpful? Give feedback.
-
Probably the last addition here is a mod to my I'm using #!/bin/bash
#set -x
[[ -e /tmp/albumart.lock ]] && exit 1
type mpc > /dev/null 2>&1 || exit 1
type jpegtopnm > /dev/null 2>&1 || exit 1
read IGNORE MUSIC_DIR <<<$(grep -m1 'music_directory' ~/.config/mpd/mpd.conf)
MUSIC_DIR=${MUSIC_DIR//\"/}
MUSIC_DIR=${MUSIC_DIR/\~/} # tilde not expanded in the test in get_albumart()
MUSIC_DIR=$HOME$MUSIC_DIR
mpc | grep -q 'playing' || exit 1
function scale_pic() {
R=/tmp/albumart.png
(jpegtopnm "$1"| pamscale -width 72 -height 72 | pnmtopng > ${R}) >/dev/null 2>&1
sleep 1
[[ -e "/tmp/albumart.lock" ]] || notify-send -i "${R}" -a "mpd" -u "low" -t 7000 "Playing: $(mpc current --format %title%)" &
}
function get_albumart() {
NOW_PLAYING_FILE="$(mpc current --format %file%)"
ART_DIR="${NOW_PLAYING_FILE%\/*}"
if [ -f "$MUSIC_DIR/$ART_DIR/albumart.jpg" ];then
scale_pic "$MUSIC_DIR/$ART_DIR/albumart.jpg"
elif [ -f "$MUSIC_DIR/$ART_DIR/folder.jpg" ];then
scale_pic "$MUSIC_DIR/$ART_DIR/folder.jpg"
elif [ -f "$MUSIC_DIR/$ART_DIR//cover.jpg" ];then
scale_pic "$MUSIC_DIR/$ART_DIR//cover.jpg"
fi
}
get_albumart
touch /tmp/albumart.lock
(sleep 8 && rm -f /tmp/albumart.lock) & And here is the adjusted
|
Beta Was this translation helpful? Give feedback.
-
Have you had a chance to play with the sfwbar notification center module
yet? The default widget represents it as a popup window but it should be
possible to configure it as a notification popping up on screen as it
arrives.
…On Sat, 21 Sept 2024, 07:21 micko, ***@***.***> wrote:
Actually fnott works great! I like it better than mako :) - after jumping
through all the stupid sydtemd hoops! I think I'm getting closer to going
back to Slackware but I do have a job to finish on debian, likely done when
trixie goes stable.
—
Reply to this email directly, view it on GitHub
<#228 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHPFFEWOFQWDWNW57INNRTZXUF6LAVCNFSM6AAAAABNUGNDDOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZRGEZDAMI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@01micko, @LBCrion splendid work @01micko; Can you add in the OP, how to run |
Beta Was this translation helpful? Give feedback.
-
Just saw this. Wouldn't have thought that this is possible with sfwbar. Awesome work! |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
If you use a horizontal bar (top or bottom) it is necessary to trim the bar size to 90% , or whatever suits, in the rhs config, Bear in mind I'm testing on 1920x1080 res, so if smaller you may have to trim out a bunch of widgets no matter where your bar is, and of course on a larger res you can go to town to add more widgets! |
Beta Was this translation helpful? Give feedback.
-
Everything in the OP is updated now including usage instructions. |
Beta Was this translation helpful? Give feedback.
-
Just tested on |
Beta Was this translation helpful? Give feedback.
-
This is really cool! As an aside, the predecessor of sfwbar was a simple alternative to conky. It was a scanner to read data from files, an expression engine to do simple calcs and an libX11 based widget set to display the results. Since I was using fvwm, the taskbar came from FvwmIconMan. |
Beta Was this translation helpful? Give feedback.
-
A clock widget - not any old clock. clock.mp4clock.widget
|
Beta Was this translation helpful? Give feedback.
-
This is seriously cool. I was always thinking that I'll need to implement trig functions at some point to make an analog clock. Turns out svg renderer can do the rotation math on it's own. |
Beta Was this translation helpful? Give feedback.
-
How about, Set Hour = Str((Val(Time("%H"))%12)*30+Val(Time("%M"))/2)
…On Fri, 1 Nov 2024, 19:07 micko, ***@***.***> wrote:
Yes it does : eg:
Set Sec = Str(Val($sc) * 6)
Set Min = Str(Val($mn) * 6)
For hour I'm using a complex Map()
Set Shr = If($Meridiem = "PM", Str(Val($hr) - 12), $hr)
# string
Set Hour = Map($Shr,
"1", If(Val($mn) <= 12, "30", If(Val($mn) <= 24, "36", If(Val($mn) <= 36, "42", If(Val($mn) <= 48, "48", "54")))),
"2", If(Val($mn) <= 12, "60", If(Val($mn) <= 24, "66", If(Val($mn) <= 36, "72", If(Val($mn) <= 48, "78", "84")))),
"3", If(Val($mn) <= 12, "90", If(Val($mn) <= 24, "96", If(Val($mn) <= 36, "102", If(Val($mn) <= 48, "108", "114")))),
"4", If(Val($mn) <= 12, "120", If(Val($mn) <= 24, "126", If(Val($mn) <= 36, "132", If(Val($mn) <= 48, "138", "144")))),
"5", If(Val($mn) <= 12, "150", If(Val($mn) <= 24, "156", If(Val($mn) <= 36, "162", If(Val($mn) <= 48, "168", "174")))),
"6", If(Val($mn) <= 12, "180", If(Val($mn) <= 24, "186", If(Val($mn) <= 36, "192", If(Val($mn) <= 48, "198", "204")))),
"7", If(Val($mn) <= 12, "210", If(Val($mn) <= 24, "216", If(Val($mn) <= 36, "222", If(Val($mn) <= 48, "228", "234")))),
"8", If(Val($mn) <= 12, "240", If(Val($mn) <= 24, "246", If(Val($mn) <= 36, "252", If(Val($mn) <= 48, "258", "264")))),
"9", If(Val($mn) <= 12, "270", If(Val($mn) <= 24, "276", If(Val($mn) <= 36, "282", If(Val($mn) <= 48, "288", "294")))),
"01", If(Val($mn) <= 12, "30", If(Val($mn) <= 24, "36", If(Val($mn) <= 36, "42", If(Val($mn) <= 48, "48", "54")))),
"02", If(Val($mn) <= 12, "60", If(Val($mn) <= 24, "66", If(Val($mn) <= 36, "72", If(Val($mn) <= 48, "78", "84")))),
"03", If(Val($mn) <= 12, "90", If(Val($mn) <= 24, "96", If(Val($mn) <= 36, "102", If(Val($mn) <= 48, "108", "114")))),
"04", If(Val($mn) <= 12, "120", If(Val($mn) <= 24, "126", If(Val($mn) <= 36, "132", If(Val($mn) <= 48, "138", "144")))),
"05", If(Val($mn) <= 12, "150", If(Val($mn) <= 24, "156", If(Val($mn) <= 36, "162", If(Val($mn) <= 48, "168", "174")))),
"06", If(Val($mn) <= 12, "180", If(Val($mn) <= 24, "186", If(Val($mn) <= 36, "192", If(Val($mn) <= 48, "198", "204")))),
"07", If(Val($mn) <= 12, "210", If(Val($mn) <= 24, "216", If(Val($mn) <= 36, "222", If(Val($mn) <= 48, "228", "234")))),
"08", If(Val($mn) <= 12, "240", If(Val($mn) <= 24, "246", If(Val($mn) <= 36, "252", If(Val($mn) <= 48, "258", "264")))),
"09", If(Val($mn) <= 12, "270", If(Val($mn) <= 24, "276", If(Val($mn) <= 36, "282", If(Val($mn) <= 48, "288", "294")))),
"10", If(Val($mn) <= 12, "300", If(Val($mn) <= 24, "306", If(Val($mn) <= 36, "312", If(Val($mn) <= 48, "318", "324")))),
"11", If(Val($mn) <= 12, "330", If(Val($mn) <= 24, "336", If(Val($mn) <= 36, "342", If(Val($mn) <= 48, "348", "354")))),
"12", If(Val($mn) <= 12, "0", If(Val($mn) <= 24, "6", If(Val($mn) <= 36, "12", If(Val($mn) <= 48,"18", "24")))),
"00", If(Val($mn) <= 12, "0", If(Val($mn) <= 24, "6", If(Val($mn) <= 36, "12", If(Val($mn) <= 48,"18", "24")))),
"x")
—
Reply to this email directly, view it on GitHub
<#228 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHPFFH4F7LSINV4KKTBKPTZ6PGPDAVCNFSM6AAAAABNUGNDDOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMJSGUZDINA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
My configs repo is updated with all these configs. |
Beta Was this translation helpful? Give feedback.
-
So I thought (knew there wasn't) there was a bug with parsing time zones. But they need to be spot on and now I know how to find them and so far so good..
So far tested on Sydney, Zurich, Tokyo. This is very timely (pun intended) as New York switched to And used like this it works
yeah, read the docs and kinda know how it works 🤣 |
Beta Was this translation helpful? Give feedback.
-
Sorry (not sorry!) saiko.mp4 |
Beta Was this translation helpful? Give feedback.
-
sfwbar
has you covered!You can have all monitoring with sfwbar on your desktop if desired or hide it and access when needed/wanted.
Caveats
All the configs posted below are not designed to placed in your normal bar. If you do, strange things will happen!
That said, there's no reason you can't adapt them for
popup
widgets or otherwise.I developed this on
labwc
. To use onsway
in thesidebar-rhs.config
near the top changelayer = "background"
tolayer = "bottom"
. Not tested onwayfire
,river
,hyprland
or other compositor. Feedback on that is welcome.main:
sidebar-rhs.config
main config
weather:
weather-side.widget
weather - adjust your lat/long
kernel:
kernel.widget
kernel
CPU temp:
cpu-temp.widget
cpu-temp
RAM:
memory.widget
memory
CPU:
cpu-chart.widget
Credit for this one to @Consolatis
cpu chart
DISK usage:
disk-prog.widget
disk usage
Calendar:
calendar-side.widget
Credit to @LBCrion and @salahoued
calendar
MPD:
mpd-side.widget
Thanks to @LBCrion for help on this one.
music player daemon
Album art:
albumart.widget
Thanks to @LBCrion for help with this one.
album art widget
I've updated this Sun 27 Oct 2024 11:07:29 AEST
How do I use this?
~/.config/sfwbar/
Term
variable insidebar-rhs.config
How do I start this then?
sfwbar -f sidebar-rhs.config
after your main config is upWhat if I want to hide the bar and start on demand?
I have written a little convenience script to toggle the sidebar
toggle-side
toggle-side convenience script
Make that executable and put it in your executable
PATH
That's nice but I don't want to open a terminal just to toggle the bar!
There's also a convenience widget that you can put into your
sfwbar.config
launch-sidebar.widget
toggle sidebar widget
Change the
image
tobutton
if you like, change thevalue =
to any icon you like and the [max,min]-width to suit your bar size.NOTES:
size = "90%"
and trimming down a few widgets if you are on 1920x1080 res. If on a larger screen height add some more widgets (use your imagination). See this post down furtherDirect download - sfw-side-cfgs.tar.gz - 5.3kB
sha256 -
db563b4fda6acae9c992f740a2cf9515937ba1790dc90e61991aab36a0431240 sfw-side-cfgs.tar.gz
I hope you have fun with this and if there are any issues don't hesitate to post in this discussion.
Beta Was this translation helpful? Give feedback.
All reactions