Re: [dwm] move to lower tab, hide status bar and map the arrow keys

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sat, 14 Jun 2008 11:44:10 +0200

On Sat, Jun 14, 2008 at 12:11:23AM -0700, Oren Golan wrote:
> I just installed dwm after trying awesome and xmonad and I love it!
> 4 questions:
>
> 1.
> I added a method for 'next tab' and it works:
> nexttag(const char *arg) {
> unsigned int i, j;
>
> memcpy(prevtags, seltags, sizeof seltags);
> for (i = 0; i < LENGTH(tags); i++) {
> if (seltags[i])
> j = (i + 1) % LENGTH(tags);
> seltags[i] = False;
> }
> seltags[j] = True;
> arrange();
> }
>
> now i am trying to add a prevtag method.
> i replaced the (i + 1) with (i - 1) but it's not working correctly-
> when i am in tab 0 it jumps to tab 4 instead of tab 9.
>
> someone in irc told me that since i is unsigned i get underflow.
> what do u think?

Well, I recommend you adapting to hg tip, besides some minor
changes it represents 5.0 already, which I'm going to release
soon.

So my answer is mainly related to hg tip, not to the above
(4.7?) version you are talking about. However your observation
of

        j = (0 - 1) % 9 = 3

is correct, because (unsigned int)-1 is the biggest unsigned
integer which can be represented in 32bits, so

        j = 4294967295 % 9 = 3

So in a prevtag solution it should be

        if(seltags[i])
                j = (i == 0) ? (LENGTH(tags) - 1) : (i - 1) % LENGTH(tags);

However, as I told, in hg tip the solution would look like the
attached patch.

> 2.
> how can I hide the status bar? (like mod+b in awesome)

Mod1-b in hg tip.

> 3.
> how do i map the arrow keys? is it something like this?
> { MODKEY, XK_left, prevtag, NULL }

See attached patch for the hg tip representation.

> 4.
> the default keys to switch between tabs are alt+#.
> these are the same keys used by firefox to switch between tabs.
> how do you solve it?

Wether using the mouse in firefox or just using a different
MODKEY, like Mod4Mask for the windows key.

Kind regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361

Received on Sat Jun 14 2008 - 11:44:10 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:49:08 UTC