You are not logged in.

#526 2012-04-08 12:19:00

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: monsterwm! ~ yet another tiny wm

mhertz wrote:

I couldn't previously understand why the tag/state part of some_sorta_bar wasen't instantaneously updating and had a 2 sec delay, whereas dzen was instantaneously updating, and I had configured some_sorta_bar to update whenever the fifo changed, and not with a reguar timeout...

Now I then found out that it was obviously because that with dzen, I had two dzen instances, one for left and one for right, and in the right statusbar I had e.g. acpi running to display battery state, and which took about 2 secs, but it didn't interfere with the left bar which showed tag/state info, but on my some_sorta_bar setup, I had the acpi part in the main loop(in the $datetime var) which also showed tag/state info...

I just used the example for some_sorta_bar from c00kie's gist-page, and then just added extra commands to the $datetime var, like e.g. the acpi command...

So, I was thinking if someone could kindly help me out about how I could make some_sorta_bar show tag/state info instantaneous, and still having e.g. the acpi command etc. on the right?

Sorry for nobish question in advance, but im not very advanced in scripting, and i've allready tried a lot of ways which didn't work right...

Thanks!

You would need some timeout interrupting code, so block until x seconds timeout or interrupt if fifo has data. You can do this with select and C.
But IMO, I would seperate the tag and status bar to two seperate panels, (with dzen for example), makes much simpler code.
(Even though  I have in my status bar code interrupts for alsa volume changing too so it's instant)

Also, updated -xcb fork, din't had much time to test it. But hopefully everything is okay.

Last edited by Cloudef (2012-04-08 12:19:32)

Offline

#527 2012-04-08 12:51:35

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

while read -t 30 -r wmout || true; do

30 there is the amount of seconds to wait before updating the bar. change it to 1 and it should be good enough.
the loop runs if there is new data on the pipe or when the timeout expires.

(I don't know what will happen of you give 0 as a timeout tongue)


.:[ git me! ] :.

Offline

#528 2012-04-08 12:57:45

Earnestly
Member
Registered: 2011-08-18
Posts: 804

Re: monsterwm! ~ yet another tiny wm

Strange request: Would it be possible to add more mouse buttons? A lot of these niche window managers seem to only support 5 (X header related?) whereas most mice these days seem to cover at least 9 (1, 2, 3, horizontal (2) and vertical (2) scroll and back/forward.

In my case, xev reports up to 17 buttons. I'm not entirely sure how difficult it would be to implement; WMs such as Subtle and Openbox seem to manage this somehow.

Thanks for your time and effort towards this rather nice Window Manager. smile

Offline

#529 2012-04-08 14:22:30

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

@Cloudef

Thanks alot for your help! To be honest I don't think I will be able to do that(skillwise), but I will think about a way and if I fail i'll just change to using two dzen bars...

@c00kie

Thank you! Yeah, I understand what you're saying, but my problem isn't related to that and sorry for not being able to describe the issue better!

Monsterwm outputs e.g. tag switching info to the fifo instantaneously and so the timeout isn't actually needed for this scenario, but when then having an acpi command also in that while loop, then there will be a delay because of that...

To describe it better, then if you take the example for some_sorta_bar that you have on your gist-page, then it works perfectly, since the datetime just has a quick date command in it, but if you then e.g. change the date command into an acpi command, then suddently the bar will have a 2 sec waiting period whenever changing tags and such, because acpi is a command that takes more time/processing than the date command and as the datetime var is run through the while loop each time we're changing tags....

Anyway, you don't have to bother with it, and I will try to find a way myself, but I just wanted to explain what I where reffering to smile

Offline

#530 2012-04-08 19:38:56

el mariachi
Member
Registered: 2007-11-30
Posts: 588

Re: monsterwm! ~ yet another tiny wm

thank you cloudef! everything is perfect!

edit: humm if a window gets the urgent hint, the "tag" will be correctly colored to the URGENT color, but after I go to that tag and select the urgent window the color won't change back to DEFAULT

Last edited by el mariachi (2012-04-08 20:20:17)

Offline

#531 2012-04-08 21:53:01

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

.. Just if anyone else should have the same issue as I described in my previous post, then i've found a solution, but it's not very pretty as it uses a tempfile in /tmp, but atleast it works! Also, if anyone know a better cleaner way then I would much appreciate it...

OK, instead of having all the commands in the $datetime var, then add them in a while loop placed before the main statusbar while-loop, and make it echo the output once every second to /tmp/statusbar:

while sleep 1; do
echo "$(date +%R) | $(acpi | cut -d ' ' -f5 | cut -d ':' -f1-2) | $(amixer get Master | tail -1 | cut -d ' ' -f6 | tr -d '[]') $(amixer get Master | tail -1 | cut -d ' ' -f8 | tr -d '[]')" > /tmp/statusbar
done &

And then in the xsetroot command, remove the $(datetime) and instead add $(cat /tmp/statusbar), and finally change the timeout in the main statusbar while loop from 30 to 1:

while read -t 1 -r wmout || true; do

.
This then means that the long-taking acpi command isn't run anymore upon each tag-change so that it's not delayed anymore, and instead just a quick 'cat /tmp/statusbar' is done, and the actual acpi while loop has been seperated out of the main loop, so that it dosen't delay tag-changing anymore...

Edit: Hmm, the above solution isn't just ugly, but as it needs to write to disc every second(about every 3'rd sec, since acpi takes about 2 secs + 1 secs sleep), then it's not worth it, and i'd rather then use some more mem and use two dzen's...

I've tried different things, but e.g. as a backgrounded while loop makes a new subshell, then I cannot just output to a var, since that var won't be available outside of that subshell and so the main statusbar while loop cannot read it and hence, the lame tmp file idea...

Edit2: Tried to make the above use a fifo, but that just made the delay come back! Hmm, i'm not good enough yet at these sorta things I must confess...

edit3: @c00kie
I just now noticed that in your example for some_sorta_bar on gist, then also the "::" signs are highlighted in the choosen color, and when selecting last desktop, then also the tiling-mode symbol is highlighted. I mean that the code takes a little extra to the right, when highlighting choosen desktop...

If you could look into that highlighting when you have the time/motivation, then it would be much appreciated!

Last edited by mhertz (2012-04-08 23:39:00)

Offline

#532 2012-04-09 05:01:27

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,020

Re: monsterwm! ~ yet another tiny wm

@mhertz
    I came up with this which seems to have the desktop changes show snapily and updates the text each second

numlockx &
xsetroot -cursor_name left_ptr &
fbsetbg -l &
#turn of the caps lock key !!
xmodmap -e 'keycode 66 ='

ds=("web" "dev" "foo" "bar")
ms=("T" "M" "B" "G" "F")
PID=""

function writer {
    while true; do
        xsetroot -name "&L$1 &5[&3$i&5] &R$(date +'%I:%M:%S')"
        sleep 1
    done
}

~/progs/c.files/some_sorta_bar/some_sorta_bar &

monsterwm | while read -r wmout; do
    kill -n 15 $PID 2> /dev/null
    if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
        #printf "\nWOOT \t $wmout\n"
        read -ra desktops <<< "$wmout" && unset r
        for desktop in "${desktops[@]}"; do
            IFS=':' read -r d w m c u <<< "$desktop"
            ((c)) && fg="&4" i="${ms[$m]}" || fg="&3"
            ((u)) && w+='&5!'
            if [[ $w > 0 ]]; then
                r+="$fg${ds[$d]} ${w/#0/&8¡} "
            else
                r+="$fg${ds[$d]} "
            fi
        done
    fi
    writer "$r" &
    PID=$!
done

Last edited by moetunes (2012-04-09 07:25:30)


You're just jealous because the voices only talk to me.

Offline

#533 2012-04-09 08:48:54

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: monsterwm! ~ yet another tiny wm

el mariachi wrote:

thank you cloudef! everything is perfect!
edit: humm if a window gets the urgent hint, the "tag" will be correctly colored to the URGENT color, but after I go to that tag and select the urgent window the color won't change back to DEFAULT

That's weird, it should reset the urgent hint whenever new desktop info comes with the urgent bit as 0.

Offline

#534 2012-04-09 09:11:48

kuraku
Member
From: planet Earth
Registered: 2012-01-03
Posts: 199

Re: monsterwm! ~ yet another tiny wm

c00kiemon5ter wrote:

alright, pushed, back to using pixel size values. should be equal now wink

Yes, it is working like a charm now. Thank you.

Offline

#535 2012-04-09 12:48:30

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

@moetunes

Thanks alot for your help, mate! Unfortunetly, it still dosen't work right...

With your code, then everything is dandy, but try adding an extra command to xsetroot: $(acpi), and now changing tags isn't instantanieous anymore, since upon each tag change, then 'acpi' is run, which takes ~ 2 secs on my i3-2.4ghz, and hence, tag changing is delayed 2 secs, just like all things i've tried till now, except using a tmp file in /tmp, like in my previous post! (since cat'ing a file through xsetroot is much quicker than running acpi, and the acpi while loop i seperated out from the main while loop)

Thank you anyways for the effort!

Last edited by mhertz (2012-04-09 13:16:16)

Offline

#536 2012-04-09 14:33:39

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

mhertz, fixed the highlight issue, define the color you want the separator to have where you define the desktops. I used the dzen2 script as a base, but dzen2 has ^fg() which signifies the reset of the foreground color.

I wrote a very simple parser for mosnterwm's output in c here looking at cloudef's source. One can specify commands to run, whose output will be picked up and appended to the formatted output. That output can be given to other things like some_sorta_bar or dzen2 to draw the panel.
The way it is, output is supposed to go to some_sorta_bar. Also commands are run only when there is output from monsterwm. So it needs work, but it small and simple. Don't expect much at this point.
If anyone wants, grab it and build on it.


.:[ git me! ] :.

Offline

#537 2012-04-09 14:37:33

el mariachi
Member
Registered: 2007-11-30
Posts: 588

Re: monsterwm! ~ yet another tiny wm

@cloudef: it's working today :s I must've done something wrong. anyway.. thank you wink

Offline

#538 2012-04-09 14:54:10

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

Thanks alot c00kie, that's freakin' awesome!

.. Going to play with it now!

Thanks alot  again!

Edit:

@c00kie

I've just tried the revised some_sorta_bar script(bash), and you've fixed the issue about the seperators, except for when selecting the last tag, which will make the rest of the statusbar change color also...

Last edited by mhertz (2012-04-09 15:55:28)

Offline

#539 2012-04-09 16:16:33

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

Kaustic wrote:

Strange request: Would it be possible to add more mouse buttons? A lot of these niche window managers seem to only support 5 (X header related?) whereas most mice these days seem to cover at least 9 (1, 2, 3, horizontal (2) and vertical (2) scroll and back/forward.

In my case, xev reports up to 17 buttons. I'm not entirely sure how difficult it would be to implement; WMs such as Subtle and Openbox seem to manage this somehow.

Thanks for your time and effort towards this rather nice Window Manager. smile

hmm, I can't seem to find the header that defines those. Xlib defines up to Button5. You can define more yourself, in config.h, and hope they don't clutter with others.

 ...
#define Button6 6
#define Button7 7
#define Button8 8
#define Button9 9
static Button buttons[] = {
    {  MOD1,    Button1,     mousemotion,   {.i = MOVE}},
    {  MOD1,    Button3,     mousemotion,   {.i = RESIZE}},
    {  MOD4,    Button6,     spawn,         {.com = menucmd}},
    // etc
};

.:[ git me! ] :.

Offline

#540 2012-04-09 16:32:39

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

mhertz wrote:

I've just tried the revised some_sorta_bar script(bash), and you've fixed the issue about the seperators, except for when selecting the last tag, which will make the rest of the statusbar change color also...

I changed it again, to what I use. hope it's not much complicated wink


.:[ git me! ] :.

Offline

#541 2012-04-09 16:58:57

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

Thanks alot, mate!

Btw, i've tested your mparser, and I get my desktops shown multiple times over and over, and no external commands is seen, probably because it's out of the screen-range or something...

I've just changed my desktop names, and removed the statusbar external command...

.. Just reporting, as I know you said that you won't be working more on this and it's up to our selves...

Btw, in your gist for mparser, then underneath in the comment section where you write how to enable it through .xinitrc, then you've made a typo:

mparser monsterwm.fifo ...

Instead of:

mparser /tmp/monsterwm.fifo

Again, thanks for your help!

Offline

#542 2012-04-09 18:52:41

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

@cookie

The some_sorta_bar bash script on your gist, when I run it unmodified, fails with a syntax error; the last done is unexpected?

Anyway, I don't want to be a pain about this, so i'll just use moetunes script he posted here previously...

Thanks for your help again! smile

CU, Martin.

Offline

#543 2012-04-09 18:57:55

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

dah, a missing 'fi', fixed. don't know how that was left out on copy/paste :S

Last edited by c00kiemon5ter (2012-04-09 18:58:05)


.:[ git me! ] :.

Offline

#544 2012-04-09 20:38:01

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

Thanks cookie, now the some_sorta_bar bash script work perfectly with monsterwm! Also, I like the dash for empty desktops and the exclamation point for urgent desks; nice smile

(Of course there's still the issue of the delay when adding time-consuming commands like acpi, but nonetheless...)

Thanks for your patience and efforts; it's much appreciated!

CU, Martin.

Last edited by mhertz (2012-04-09 20:43:18)

Offline

#545 2012-04-10 00:53:15

Earnestly
Member
Registered: 2011-08-18
Posts: 804

Re: monsterwm! ~ yet another tiny wm

c00kiemon5ter wrote:

hmm, I can't seem to find the header that defines those. Xlib defines up to Button5. You can define more yourself, in config.h, and hope they don't clutter with others.

Thanks, I'll definitely give it a try when there's more time.

Offline

#546 2012-04-11 12:56:30

TheLemonMan
Member
From: Italy
Registered: 2011-09-04
Posts: 214
Website

Re: monsterwm! ~ yet another tiny wm

le-hrm, im having some issues with ida pro running on wine. Monsterwm segfaults every now and then, i suspect because of the floating dialog windows. I'm ready to help troubleshooting this, you can find me in #archlinux as TheLemonMan so just ping me smile

Offline

#547 2012-04-11 14:03:40

whooper
Member
From: Portugal
Registered: 2008-12-24
Posts: 36

Re: monsterwm! ~ yet another tiny wm

Hi,

I'm using your startwm2some_sorta_bar script and I'm wondering if it's possible to display something when there's a window in a desktop instead of the number of windows? Maybe a asterisk?

Also, I like the centredfloating patch on dwm(centers on the screen the determined floating windows). Could you provide a similar function to monsterwm?

Thanks!

Offline

#548 2012-04-11 16:42:07

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

TheLemonMan wrote:

le-hrm, im having some issues with ida pro running on wine. Monsterwm segfaults every now and then, i suspect because of the floating dialog windows. I'm ready to help troubleshooting this, you can find me in #archlinux as TheLemonMan so just ping me smile

I'll look into it, I have an idea where things might be going wrong wink

whooper wrote:

I'm using your startwm2some_sorta_bar script and I'm wondering if it's possible to display something when there's a window in a desktop instead of the number of windows? Maybe a asterisk?

yep, "$w" is the number of windows so replace that with w/e you want

replace

r+="$fg${ds[$d]} ${w/#0/&8-} &3:: "

with

if ((w)); then w="*"; else w=""; fi
r+="$fg${ds[$d]} $w &3:: "

so you'll get a * when there are windows, or nothing ("") when there is none (w==0)

whooper wrote:

Also, I like the centredfloating patch on dwm(centers on the screen the determined floating windows). Could you provide a similar function to monsterwm?

I can try that when I'll get some free time


.:[ git me! ] :.

Offline

#549 2012-04-11 16:52:02

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: monsterwm! ~ yet another tiny wm

If not too hard, or if you have time sometime, and of course if you thinks it ok, then how about the ability of moving floating windows around, or resizing them, through the keyboard, like that moveresize patch for dwm, or whatever it was called...

I use floats very rarelly, so not really important to me, but just thinking out loud alittle here about what could make this awesome wm even nicer than it allready is... (not having to use the mouse for _anything_ would be pretty cool imho)...

Last edited by mhertz (2012-04-11 16:57:21)

Offline

#550 2012-04-11 20:08:57

whooper
Member
From: Portugal
Registered: 2008-12-24
Posts: 36

Re: monsterwm! ~ yet another tiny wm

Thank you very much c00kie. You're awesome!

Offline

Board footer

Powered by FluxBB