Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to properly implement barpadding to the latest dwm-systray-dwmblocks patch (6.3); conditional block format at the end. #43

Open
rowsephx opened this issue Aug 5, 2022 · 7 comments

Comments

@rowsephx
Copy link

rowsephx commented Aug 5, 2022

I'm having a tough time adding bakkeby's barpadding patch to my own build because I have little to no knowledge of C, and haven't fully grasped the codebase in terms of how it works yet.

Anyways, they have two versions of the patch, an old 6.3, and a new 6.3, and since I can't make sense of the latter, I tried with the older version.

Here's what I did:

  • My only problem as far as I know is transferring drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0); inside the drawbar function. I don't know how to do so since you made changes.

  • For XMoveResizeWindow, I just made changes inside the resizebarwin function. This line in particular: XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh); to XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh);. I'm not sure if that's how it should be done, but I just did it that way.

  • The rest of the changes were plug and play.

If It can help, here's my dwm.c without the barpadding patch.

I apologize for this mess of an "issue", and I would be grateful for any help you can provide!

@ashish-yadav11
Copy link
Owner

What does barpadding do?

@ashish-yadav11
Copy link
Owner

Is it like gaps for normal clients?

@ashish-yadav11
Copy link
Owner

Look at this---it seems related: issue 27.

@rowsephx
Copy link
Author

rowsephx commented Aug 5, 2022

Is it like gaps for normal clients?

It's the patch which pushes the bar away from the corner.

Look at this---it seems related: issue 27.

I've checked this issue already, they're using 6.2, and most likely dwm-dwmblocks (without systray).

I haven't gotten to the "clickability misalignement" issue yet, since I need to get the barpadding patch together with your dwm-systray-dwmblocks working first.

@ashish-yadav11
Copy link
Owner

I am sorry, it will require some time to fix and I am afraid I don't have it for now.

@rowsephx
Copy link
Author

rowsephx commented Aug 5, 2022

It's alright, I got another question. Lemme know if I should open a separate issue for this or not.

It's about outputting the content of pathc to pathu...

I got this pathu script which shows the date-time:

#!/bin/sh

HOUR=$(date "+%I")
case "$HOUR" in
        "00") ICON="󱑖" ;;
        "01") ICON="󱑋" ;;
        "02") ICON="󱑌" ;;
        "03") ICON="󱑍" ;;
        "04") ICON="󱑎" ;;
        "05") ICON="󱑏" ;;
        "06") ICON="󱑐" ;;
        "07") ICON="󱑑" ;;
        "08") ICON="󱑒" ;;
        "09") ICON="󱑓" ;;
        "10") ICON="󱑔" ;;
        "11") ICON="󱑕" ;;
        "12") ICON="󱑖" ;;
esac

printf "\x0f󰃶 %s  $ICON %s\x0b " "$(date "+%a, %b %d")" "$(date "+%I:%M")"

What I want this pathu to look like is this: printf "\x0f$ICON %s\x0b " "$(date "+%I:%M")". So basically removing the date format while keeping the time.

What I'm trying to achieve is when I click this pathu, it'll will change to the date format overwriting the time. Looking like this: printf "\x0f󰃶 %s\x0b " "$(date "+%a, %b %d")"

Altogether toggling, or cycling from time to date format when clicked.

I tried passing printf as an argument ($1) when clicking, referring to my pathu fullpath, and making a condition to toggle between the two format inside the pathu, but that didn't work.

How would I write the pathc for this? Or the way you would go about it?

@ashish-yadav11
Copy link
Owner

ashish-yadav11 commented Aug 6, 2022

Interesting (actually, these are the reasons I wrote dsblocks, there, since everything is handled by the same C program, these situations can be easily handled), you can use a tmpfile for this (you have to save the state somewhere, and a tmpfile is the only possiblity). Something like

pathu

if [ -e /tmp/dwmblocks.calendar.alternate-format ] ; then
    printf 'one format'
else
    printf 'another format'
fi

pathc

if [ -e /tmp/dwmblocks.calendar.alternate-format ] ; then
    rm /tmp/dwmblocks.calendar.alternate-format
else
    touch /tmp/dwmblocks.calendar.alternate-format
fi

For more complicated cases, you can write something in the file with pathc and read it in pathu (using some default behaviou if the file doesn't exist).

@ashish-yadav11 ashish-yadav11 changed the title How to properly implement barpadding to the latest dwm-systray-dwmblocks patch (6.3) How to properly implement barpadding to the latest dwm-systray-dwmblocks patch (6.3); conditional block format at the end. Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants