lukesmithxyz / dwmblocks Goto Github PK
View Code? Open in Web Editor NEWMy status bar: my build of the modular dwmblocks
License: GNU General Public License v2.0
My status bar: my build of the modular dwmblocks
License: GNU General Public License v2.0
Hi,
I was wondering about this "crashing" / "freezing" issue of the blocks. If I run crontab -l
it outputs no crontab for usrname
. And there is no items left in those /etc/cron.hourly
, /etc/cron.daily
, /etc/cron.weekly
, /etc/cron.monthly
directories.
This, I suppose, means that there is no unexpected signals sent to the blocks? However it freezes every once in a while and the dwm needs to be renewed.
Thanks for any advice in advance!
So i was looking at the systray patch and i saw it inverter with dwmblocks patch in dwm.c so my question is if i have dwmblocks i can't have a systray?
When I use an external monitor my volume
module always shows 100%
.
The sed
command sed "s,.* \([0-9]\+\)%.*,\1,;1q"
show match the line including volume
number and replace it with the number it gets if I'm not wrong.
But the information after grep
I get looks like this:
Should I change some settings about the external monitor or should I change the script?
I'm a brainlet when it comes to some of this stuff, so I'll ask publicly because I'm sure someone knows better.
As it is, dwmblocks updates modules when you send a particularly numbered kill signal to it. E.g. the sb-mailbox
script is 12, so if you run pkill -RTMIN+12 dwmblocks
, the mail module will be updated.
That applies for all the numbers assigned in the config, but suppose someone disables the mail module and now 12 is unused. In that case, if we have another script that theoretically would send a signal 12 for an update, that actually is interpreted by dwmblocks as a general kill signal so dwmblocks dutifully closes. This is mentioned in the current README.
Would it be possible or advisable, however, to have dwmblocks generally ignore most all kill signals to avoid this? Would this interfere with other functionality or be too irregular?
I would sort of want to do this to avoid conflicts. In the case of the mail module, it'd be nice to have mutt-wizard sync script automatically signal dwmblocks to update the module if there, but I'd hate for the script to kill the program for people who are not using that signal number.
hi sir i need help, i have a script before using dwmblocks and it ran just fine in dwm status bar and now i tried to use it in dwmblocks but its not showing up, here is the script i use for torrent, it shows percentage downloaded and download status.
torrents() {
data=$(transmission-remote -l 2>/dev/null | grep -E "%|n/a")
[ "$data" ] || return
while read -r line; do
per="$(printf %s "$line" | awk '{ printf $2 }')"
printf %s "$line" | sed "
s/.*Stopped.*/ ๐ /g;
s/.*Seeding.*/ ๐ฑ /g;
s/.*Idle.*/ โ /g;
s/.*Uploading.*/ ๐ผ /g;
s/.*Downloading.*/ ๐ฝ /g;
s/.*[A-Z][a-z].*/ โ
/ g;
"
printf %s "$per"
done <<EOF
$data
EOF
transmission-remote -l | grep -qE "%|n/a" && printf " %s" "$SEP"
}
im not good at scripting any help is appreciated. thank you
Edit: got it working with this
data=$(transmission-remote -l 2>/dev/null | grep -E "%|n/a")
while read -r line; do
per="$(printf %s "$line" | awk '{ printf $2 }')"
printf %s "$line" | sed "
s/.*Stopped.*/ ๐ /g;
s/.*Seeding.*/ ๐ฑ /g;
s/.*Idle.*/ โ /g;
s/.*Uploading.*/ ๐ผ /g;
s/.*Downloading.*/ ๐ฝ /g;
s/.*[A-Z][a-z].*/ โ
/ g;
"
printf %s "$per"
done <<EOF
$data
EOF
transmission-remote -l | grep -qE "%|n/a" && printf " %s"
Right now empty pacpackages
input displays as ||
which doesn't seem correct.
This is because dwmblocks will insert delimiter if input is not empty.
Lines 78 to 82 in cc1b97c
And pacpackages
returns newline if there are no packages.
packpackages | cat -A
$
So the length is 1 and delimiter gets inserted.
You could fix it by fixing scripts, but newlines are so common that I think it's better to remove them in dwmblocks, because dwm ignores them anyway.
I'll provide a patch.
void getcmd(const Block *block, char *output)
{
...
fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
...
pclose(cmdf);
}
here at line 78 of dwmblocks.c , when inputting too quickly .( for example a quick scroll).
there will be a flush of function getcmd executed at once.
and somehow this causes the fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
not printing anything to (output +i) ; so the block content got disappeared.
I have verified to let buttonhandler to handle another script but same signal. and commented out the buttonhandler's signal or status updating functions, the problem remains.
Lets fix this problem , any ideas ?
Hello, i use a Desktop PC without wifi card. So the internet module crashes when loaded into dwmblocks (complaining about /sys/class/net/w*/operstate not existing), when i started using it i commented out this lines:
grep -q "down" /sys/class/net/w*/operstate && wifiicon="๐ก" ||
wifiicon="$(grep "^\s*w" /proc/net/wireless | awk '{ print "๐ถ", int($3 * 100 / 70) "%" }')"
Today out of boredom i decided to take on it and try to fix it, but i feel that my patch is sloppy and there should be a better way to do it, so i will leave it here and learn from someone a better solution.
I added this line so it would check if the file exists, but since i don't have wifi on my pc i can't check if it works as solution.
[ $(grep "^\s*w" /proc/net/wireless) ] &&
grep -q "down" /sys/class/net/w*/operstate && wifiicon="๐ก" ||
wifiicon="$(grep "^\s*w" /proc/net/wireless | awk '{ print "๐ถ", int($3 * 100 / 70) "%" }')"
Thanks for the patience.
Tags not in use are hidden. Where/how is this configured?
I'm asking as I pretty much want to disable it or have some tag numbers always shown even when not in use.
I have tried putting dwmblocks & command in .xprofile and dwm autostart, but didn't work. It has a pid assigned to it though. It works after I type dwmblocks & in terminal. What should I do?
Ive extended the config.h (dwmblocks) in order to show the current keyboard layout.
It works as expected refreshing all 1s, but I would like to change it to use the signal to update / refresh dwmblocks
Is there a way to get the signal for a particular command ?
I'v bumped in to this post on reddit : My custom build of dwmblocks. ,.. which is a rewritten LukeSmith dwmblocks as supposedly he didn't like your coding style and rewrote it from scratch, and says you had a bug in it which i never noticed till i found this post as oddly enough none of us actually use the mouse in LARBS do we? :P
when you scroll down on the bar it starts to flickr, and the volume module starts to disapear on its own
even worse, when you scroll up after a while all the modules simply go missing
after they go missing you start scrolling down, and they come back out of no where ... this is crazy strange ๐ก๏ธ
best to show it like this .. video of the bug at work
btw... already found a bug in his rewritten "improved" version ๐ฏ
my dwmblocks is not showing colored emoji's, i have installed libxft-bgra
for the AUR, they were showing fine until yesterday, today i logged in and colored emoji's are not showing some are showing as squares and some are black and white. i have ttf-joypixels
and noto-fonts-emoji
installed as well. i have removed these lines also in drw.c
FcBool iscol;
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
XftFontClose(drw->dpy, xfont);
return NULL;
}
The status bar is great but I think the icons could be made more attractive if siji icons were used. Please consider it https://github.com/stark/siji I have been using Larbs for more than a year and I'm really thankful to you.
Hi there,
I am sorry if this is a too silly of a question. I modified your script for keyboard layout to include a layout for Turkish language. I would like to replicate what you did for volume control and other scripts that only update the dwmblocks in situation change but not regularly, every n seconds. However, I am having a hard time to get it to work. Below is a section from dwm/config.h file:
static const char *xkbscmd[] = { "xkbswitch", "&&", "kill", "-44", "$(pgrep dwmblocks)", NULL };
...
{ MODKEY|ShiftMask, XK_k, spawn, {.v = xkbscmd } },
And here is the section in dwmblocks/blocks.h file:
{"", "kbselect", 0, 10}
xkbswitch effectively switches the keyboard layout with the right key combination. kbselect script initially displays the correct layout on status bar but fails to respond to the switch and doesn't update the keyboard layout on status bar.
Disclosures:
I did not use the SHCMD style in dwm/config.h file but I doubt that this is the underlying problem, since dwm compiles fine without errors and responds to the correct key combination and does what it is supposed to do.
I had to modify the kbselect script slightly to make it work in OpenBSD, which is the OS I am currently working on.
I don't have a clue how to figure out which signal would be the right one to send to the process and I suspect that it may be different in OpenBSD as compared to linux. I would greatly appreciate the pointers if any.
Thanks for your time.
I always keep my laptop suspended while it's not in use. But when I start the laptop from suspending it freezes and only shows status before suspending.
I can't figure out what's the solution for this.
I appreciate the help in this issue.
Sorry if I asked a stupid question but I'm really confused.
I applied the latest patch to my dwm build, but the buttonhandler event is not executed for whatever reason.
Then, I figuered out that the following code in the latest dwm patch is grabbing the statussig:
https://dwm.suckless.org/patches/statuscmd/dwm-statuscmd-20210405-67d76bd.diff
void
sigstatusbar(const Arg *arg)
{
union sigval sv;
if (!statussig)
return;
sv.sival_int = arg->i;
if ((statuspid = getstatusbarpid()) <= 0)
return;
sigqueue(statuspid, SIGRTMIN+statussig, sv);
}
If I change this SIGRTMIN+statussig
to 10, it works fine. It seems that this is not compatible with the way the dwmblocks works, because dwmblocks is always listening to the same signal no matter which "module" is actually clicked:
sa.sa_sigaction = buttonhandler;
sa.sa_flags = SA_SIGINFO;
sigaction(SIGUSR1, &sa, NULL);
struct sigaction sigchld_action = {
.sa_handler = SIG_DFL,
.sa_flags = SA_NOCLDWAIT
};
sigaction(SIGCHLD, &sigchld_action, NULL);
Does enyone have this issue as well and can help me out?
Hello, I'm pretty noob in this so yeah. I'm sorry!
i3blocks had this misc section at the beginning of the bar which was populated by misc icons such as messengers, other programs (like Steam) and so forth.
I noticed that dwmblocks doesn't have such block and I couldn't find any patch or guide to enable it.
Any idea on what to do? I'm afraid I don't know C that much to write it on my own. So keep it noob friendly, please.
Pardon me for my poor English.
[1] 6990 segmentation fault (core dumped) dwmblocks
The characters underlined in red are not supposed to be there. The block scripts output comes after the bookmark icon, so the problem is not in them.
My config.h file:
static const Block blocks[] = {
{"๏ฎ", "dwm-volume", 0, 10},
{"๏ฎ", "dwm-battery", 5, 3},
{"๏ฎ", "dwm-clock", 60, 1},
};
static char *delim = "|";
When two or more blocks use the same signal, clicking on either has the same effect as clicking on the first one mentioned in config.h
This is a known issue, @LukeSmithxyz talks about it in the video. I think it should be mentioned in the readme to prevent people (like myself) from wasting time trying to troubleshoot it
when I have dwmblocks running in a terminal I get "zsh: unknown signal dwmblocks"
I'm guessing the issue is similar to #16
I've tried commenting out all the modules except for the clock and internet but I still have this issue.
Is there a way to figure out which is the offending signal and where this error lies?
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
static const Block blocks[] = {
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
{"", "cat /tmp/recordingicon 2>/dev/null", 0, 9},
{"", "music", 0, 11},
/* {"", "pacpackages", 0, 8}, */
/* {"", "news", 0, 6}, */
/* {"", "crypto", 0, 13}, */
/* {"", "price bat \"Basic Attention Token\" ๐ฆ", 0, 20}, */
/* {"", "price btc Bitcoin ๐ฐ", 0, 21}, */
/* {"", "price lbc \"LBRY Token\" ๐", 0, 22}, */
/* {"", "torrent", 20, 7}, */
/* {"", "memory", 10, 14}, */
/* {"", "cpu", 10, 18}, */
/* {"", "moonphase", 18000, 17}, */
{"", "weather", 18000, 5},
{"", "mailbox", 180, 12},
{"", "nettraf", 1, 16},
{"", "volume", 0, 10},
{"", "clock", 60, 1},
{"", "internet", 5, 4},
/* {"", "help-icon", 0, 15}, */
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
static char *delim = " ";
// Have dwmblocks automatically recompile and run when you edit this file in
// vim with the following line in your vimrc/init.vim:
// autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid dwmblocks & }
After last commit scripts like newsup, mailsync makes emoji stay in the bar even there's 0 RSS, 0 new mail and or 0 new packeges
Hello, i downloaded larbs, and this came with it. It is really cool, but my clock is showing wrong time, it shows gmt+4, but i live in gmt+2. cant find the file to edit this.
It would be cool if there was a disk_io function from /sys/class/block/*/stat. In the form of disk read/write speed. Read is the third and write is the seventh columns.
I installed dwmblocks and believe I have all the scripts in the right places and made sure my scrips are loading in zprofile.
However, there are small squares to the left of each icon on the bar.
The icons still print.
It not the delimiter as I was able to change that and it worked without issue.
Is there a package I am missing?
Thanks,
Hi there,
am I the only one where the mechanism with the BLOCK_BUTTON does not work? (the actions specified in the case $BLOCK_BUTTON are not executed)
In addition, when I do a mousewheel click a terminal is opened (st) which definitely should not happen.
Are these Bugs or is there something wrong with my clone?
(and I think maybe one should add an explanation for the BLOCK_BUTTON mechanism which as I think makes it possible to react to clicks depending on which block it it clicked)
I have newly installed Luke's build of dwm and dwmblocks (no other patches yet).
when I started desktop without dwmblocks, switching around was just super fast.
once dwmblocks start , the hole desktop just lags a bit , and switching become slower.
but killing dwmblocks and running "xsetroot -name 'blablabla' " just recovers it.
using none emoji and none scheme color changing also has the same problem. htop shows minimum cpu usage.
does any one feels the lag as well? This problem probably also exists in other build.
I haven't done any real bugtesting on this, but I've noticed that dwmblocks occasionally crashes without an obvious cause.
I'd like to figure out the origin of this, or perhaps have dwm babysit the process and continue to restart it if it isn't manually killed by the user.
Suggestions or ideas welcome.
What fonts do i need for the icons to work?
I'm using this build and up to now very good. A little problem though. When login, there are 2 scripts hold the whole dwmblocks back. One is pacpackage and the other is openweathermap( I use this one instead of wttr.in because it's realtime temperature).
Is it possible to update these 2 modules later?
I saw a multithreading pull request in original github, but wasn't accepted yet.
torrinfail/dwmblocks#34
Thanks.
When I want to change separator to ' | ' I recive errors on compile step.
How did you manage do add little more space between each block?
I found systemtray helpful most of the time. There's a patch for it but does not patch immediately (need some work). Wonder if there's a plan to add it in.
How can I change size of dwmblock?
weather just shows spawn telnet rainmaker.wunderground.com 3000
im guessing the part showing unknown 95 next to it is my bat percentage.
volume just doesnt show up at all
the only things being displayed are the time and date and the network %.
Heres the config.h
:
static const Block blocks[] = {
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
{"๐ก", "/home/user/.local/bin/statusbar/network", 6, 12},
{"๐ฝ", "/home/user/.local/bin/statusbar/storage", 45, 13},
{"๐ก", "/home/user/.local/bin/statusbar/backlight", 5, 14},
{"๐", "/home/user/.local/bin/statusbar/volume", 5, 10},
{"", "/home/user/.local/bin/statusbar/keyboard", 5, 16},
{"RAM:", "/home/user/.local/bin/statusbar/memory", 8, 17},
{"๐", "/home/user/.local/bin/statusbar/battery", 10, 18},
{"", "/home/user/.local/bin/statusbar/date", 30, 19}
};
static char *delim = " ";
And also here are the following commands that are being executed when updating brightness and the volume:
pamixer -i 2; kill -44 $(pidof dwmblocks)
, /home/user/.local/bin/scripts/backlight inc; kill -48 $(pidof dwmblocks)
/home/user/.local/bin/scripts/backlight
:
#!/bin/dash
if [ $(xbacklight | sed 's/\..*//') -le 1 ]; then
if [ "$1" = "inc" ]; then
xbacklight -inc 0.1 &
elif [ "$1" = "dec" ]; then
xbacklight -dec 0.1 &
fi
elif [ $(xbacklight | sed 's/\..*//') -le 6 ]; then
if [ "$1" = "inc" ]; then
xbacklight -inc 0.5 &
elif [ "$1" = "dec" ]; then
xbacklight -dec 0.5 &
fi
else
if [ "$1" = "inc" ]; then
xbacklight -inc 5 &
elif [ "$1" = "dec" ]; then
xbacklight -dec 5 &
fi
fi
time backlight inc
usualy wanders around 0.03 secs, while time (pamixer -i 2; kill -44 $(pidof dwmblocks))
around 0.015, not much of a difference.
When changing the brightness this way via dwm keybindings, everything works fine. The issue is, when changing the volume this way dwmblocks tends to 'flicker'. Some modules tend to dissapear for a moment, especially the network module, ram, backlight and the keyboard module. Like they never existed (for a moment only of course). The date module (and also the storage one) does not flicker almost at all, however when i lower its update interval to something like 1, it also undergoes the same process. Seems like the lower their interval is the more likely they are to flicker when dwmblocks is being signaled.
Same issue happens on torrinfails dwmblocks.
Hi,
I noticed that if I try to update the weather module by middle clicking... it disappears from the bar. (can get it back by sending the relevant signal (39).)
I might be barking up the wrong tree here:
but I believe this is caused by the fact that when the buttonhandler
function is called it forks the block command call (I'm guessing if slow internet, cpu, prevent a block crash affecting rest of bar etc)
The parent continues though and runs the getsigcmds
function - as the fork is already getting the weather update - I think getsigcmds
->getcmds
tries to get the update as well - and either bombs out or returns updating the statusstr
variable as blank for the weather block.
I thought about adding a wait
for the fork - but then this negates the point of the fork.
Sorry, having trouble fixing this one. Any ideas?
Sorry to ask a noob question but is it possible to scroll up/down to change the volume like in i3?
whenever i try to open the cpu memory, internet and weather scripts in vim or nano its crashes/closes the terminal window, only way i can edit them if i use a graphical text editor, also they don't show on status bar. i tried to run the script in terminal ./(script-name)
, terminal crashes and closes. clicking on the modules does nothing it shows a notification saying Mouse 1, Mouse 3
also the emoji's show as black and white rather than colored emoji's,
and im not able to adjust volume and brightness when in dwm, as im on a laptop and i don't know how to bind the volume and brightness and airplane mode and all those keys to appropriate keys which are on Fn keys.
btw im using vanilla dwmblocks, just grabbed your scripts for modules.
statuscmd patch that you just applied to dwmblocks & dwm doesn't seem to be compatible with the barpadding patch, when you have bar padding enabled and you click the ? icon it spawns and closes the window, also when you click between the newsboat icon and # it spawns my pulsemixer for some reason :D
I'm trying Artix with openrc.
setup using larbs
But when I left click the cpu or memory part of dwmblocks it doesn't show the notification popup with the 10 processes.
Also this error shows up in my ~/.xsession-errors
(notify-send:2977): GLib-WARNING **: 14:04:35.909: In call to g_spawn_sync(), exit status of a child process was requested but ECHILD was received by waitpid(). See the documentation of g_child_watch_source_new() for possible causes.
You don't seem to use the feature so why have it?
I created a diff file for the latest commit (fefab15) of the original dwmblocks repo
I know this should probably be a pull request but I'm lazy. Github also doesn't allow uploading .diff files so I pasted it here.
dwmblocks-noicons-20200412-fefab15.diff:
From ecf776db4312d3742a1332a5e0740df94df88b25 Mon Sep 17 00:00:00 2001
From: Urban Prah <[email protected]>
Date: Sun, 12 Apr 2020 17:16:14 +0200
Subject: [PATCH] This patch removes the functionality of adding icon prefixes.
Remove the icons column in config.h
---
dwmblocks.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/dwmblocks.c b/dwmblocks.c
index 88bdfb0..6cf442a 100644
--- a/dwmblocks.c
+++ b/dwmblocks.c
@@ -8,7 +8,6 @@
#define CMDLENGTH 50
typedef struct {
- char* icon;
char* command;
unsigned int interval;
unsigned int signal;
@@ -48,15 +47,12 @@ void replace(char *str, char old, char new)
//opens process *cmd and stores output in *output
void getcmd(const Block *block, char *output)
{
- strcpy(output, block->icon);
char *cmd = block->command;
- FILE *cmdf = popen(cmd,"r");
+ FILE *cmdf = popen(cmd, "r");
if (!cmdf)
return;
- char c;
- int i = strlen(block->icon);
- fgets(output+i, CMDLENGTH-i, cmdf);
- i = strlen(output);
+ fgets(output, CMDLENGTH, cmdf);
+ int i = strlen(output);
if (delim != '\0' && --i)
output[i++] = delim;
output[i++] = '\0';
--
2.26.0
This maybe the same issue, Crashes when receiving unassigned signal number #10 But you never said what unused module was causing the issue. I couldn't find the fix in any commit you did either. What was your fix? so I might be able to see if I have the same problem?
I have looked at all the modules that update and silenced any that have a RTMIN, still get the crash.
Took a hacky solution to try and solve it by having a crontab run refdwmblocks script ever 5 minutes to see if that worked (because running refdwmblocks works in the terminal so why shouldn't it work with a cronie?) but that will actually case it to crash also when the cron job runs.
What did you do to stop dwmblocks from randomly crashing, and crashing upon using the update modules in ~/.local/bin/cron/*
This maybe the same issue as: Crashes when receiving unassigned signal number #10 but I cannot figure out what module if any is causing dwmblocks to crash on my end.
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.