UtkarshVerma / dwmblocks-async

An efficient, lean, and asynchronous status feed generator for dwm.
GNU General Public License v2.0
224 stars 87 forks source link

place blocks impovement #50

Closed og900aero closed 10 months ago

og900aero commented 10 months ago

Would it be possible to request an improvement so that you can not only place blocks on the right side of the screen, but also put the selected blocks to the center? For example, as in the case of the polybar, where in the case of the status bar, blocks can be placed to the right, left, and center of the screen. Personally, I prefer the date and time block in the middle of the display.

UtkarshVerma commented 10 months ago

This is impossible as dwm renders the status as nothing but a single string obtained from the root window's title. To implement this, non-trivial effort would be required to patch dwm.

From this project's side, all it does is form the status string and set it as the root window's title. If you think about it, dwmblocks-async is nothing but a glorified xsetroot which obtains the status string by executing blocks asynchronously.

DusanLesan commented 10 months ago

Weird idea I have never tried: add a lot of spaces after your date text. Enough so it pushes the date text all the way to the middle (I think you would need to increase MAX_BLOCK_OUTPUT_LENGTH)

UtkarshVerma commented 10 months ago

That would be quite hacky. I guess you could add a few blocks which just output a bunch of whitespace characters.

DusanLesan commented 10 months ago

It does sound like a hack. The several blocks would not look ok if you use delimiters

og900aero commented 10 months ago

Weird idea I have never tried: add a lot of spaces after your date text. Enough so it pushes the date text all the way to the middle (I think you would need to increase MAX_BLOCK_OUTPUT_LENGTH)

I've been using it this way for a while, but the X system crashes from time to time because of the blocks placed on the left edge. This does not happen with the block placed in the middle. I use lot of spaces. Ugly looks...

#define BLOCKS(X)         \
    X("/home/Data/Linux/Compile/dwmblocks-async/netspeed.sh", 3, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/freemem.sh", 5, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/cpu.sh", 3, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/date.sh", 86400, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/time.sh", 60, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/brightness.sh", 0, 1)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/volume.sh", 0, 10)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/network.sh", 5, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/ip.sh", 5, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/battery.sh", 60, 0)
DusanLesan commented 10 months ago

Ok, that was just a idea. I have no clue about fixing the crash though

Few questions regarding this

I've been using it this way for a while, but the X system crashes from time to time because of the blocks placed on the left edge. This does not happen with the block placed in the middle. I use lot of spaces. Ugly looks...

    X("/home/Data/Linux/Compile/dwmblocks-async/date.sh", 86400, 0)  \
    X("/home/Data/Linux/Compile/dwmblocks-async/empty.sh", 630, 0)  \

If the block is empty, why do you need interval?

For the date block, does such a huge interval cause the date remaining the same after midnight? I mean if you start you computer at 6PM, and considering the block updates once a day, would it update at midnight?

og900aero commented 10 months ago

Ok, that was just a idea. I have no clue about fixing the crash though

Few questions regarding this

If the block is empty, why do you need interval?

Is there a value that doesn't update at all?

For the date block, does such a huge interval cause the date remaining the same after midnight? I mean if you start you computer at 6PM, and considering the block updates once a day, would it update at midnight?

Well, I didn't think about that. So do I make this smaller? What do you think is the smallest value for the date that is still logical, but updates unnecessarily? Perhaps it is possible to somehow TRAP the change of the date of the machine, and then just run it?

DusanLesan commented 10 months ago

Is there a value that doesn't update at all?

Yes, 0 means it is not updated

Well, I didn't think about that. So do I make this smaller? What do you think is the smallest value for the date that is still logical, but updates unnecessarily? Perhaps it is possible to somehow TRAP the change of the date of the machine, and then just run it?

I honestly would not separate date and time if you are keeping them next to each-other. Even with 5 minutes interval, you could have inaccuracy up to 5 minutes (like for clock, if it updates at 55th second, it will not show correct time until next cycle) Regarding the date detection by OS, I am sure it is possible, but I do not now how apart from crons