You are not logged in.

#1 2013-06-27 22:20:17

thecarrotstick
Member
Registered: 2013-06-27
Posts: 4

[SOLVED]Creating a gap at the top of the screen in DWM / Dzen2

I've messed around with this for a couple days to no avail. I'd like to create a small gap at the top of the screen in dwm 6.0 (replacing dwm's topbar) so I can insert a dzen status bar. I'm pretty new to editing dwm.c, but from my google-fu have found that the answer lies somewhere in the setup() and updategeom() functions. Any other relevant information is only applicable to earlier versions of dwm.

So, can anyone help me out, or atleast point me in the right direction? I understand this might be possible through xmonad, but would like to avoid that if there's a chance.

Last edited by thecarrotstick (2013-06-27 22:57:33)

Offline

#2 2013-06-27 22:31:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,550
Website

Re: [SOLVED]Creating a gap at the top of the screen in DWM / Dzen2

There are a couple ways to do this - I'd recommend adjust right where sh (screen height) is set.  This is on lines 579 and 1595 of an unpatched "vanilla" dwm.c.

example:

    sw = DisplayWidth(dpy, screen);
-   sh = DisplayHeight(dpy, screen);
+   sh = DisplayHeight(dpy, screen) - dzen_height;
    bh = dc.h = dc.font.height + 2;

then make dzen_height a constant in your config.h

Last edited by Trilby (2013-06-27 22:37:18)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2013-06-27 22:55:28

thecarrotstick
Member
Registered: 2013-06-27
Posts: 4

Re: [SOLVED]Creating a gap at the top of the screen in DWM / Dzen2

Trilby wrote:

There are a couple ways to do this - I'd recommend adjust right where sh (screen height) is set.  This is on lines 579 and 1595 of an unpatched "vanilla" dwm.c.

example:

    sw = DisplayWidth(dpy, screen);
-   sh = DisplayHeight(dpy, screen);
+   sh = DisplayHeight(dpy, screen) - dzen_height;
    bh = dc.h = dc.font.height + 2;

then make dzen_height a constant in your config.h

Thank you, my [failed] solution was just shy of yours. It seems to have done it though.

Offline

#4 2013-06-27 23:00:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,550
Website

Re: [SOLVED]Creating a gap at the top of the screen in DWM / Dzen2

Uh ... I just reread this - and originally I thought you wanted the gap at the *bottom* of the screen.  This should not work for a cap at the top unless you've also done other patching.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2013-06-27 23:06:42

thecarrotstick
Member
Registered: 2013-06-27
Posts: 4

Re: [SOLVED]Creating a gap at the top of the screen in DWM / Dzen2

Trilby wrote:

Uh ... I just reread this - and originally I thought you wanted the gap at the *bottom* of the screen.  This should not work for a cap at the top unless you've also done other patching.

You're right, I couldn't get it to work as intended. Do you have any idea what kind of patching I'd need to do?

Offline

#6 2013-06-27 23:08:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,550
Website

Re: [SOLVED]Creating a gap at the top of the screen in DWM / Dzen2

If you really want to replace dwm's bar, then you don't need to do anything - just have dzen over dwm's bar.  If you wanted to make it as efficient as possible, you could delete the function that draws the bar (or probably more easily just delete it's contents so it is an empty function).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2013-06-27 23:18:13

thecarrotstick
Member
Registered: 2013-06-27
Posts: 4

Re: [SOLVED]Creating a gap at the top of the screen in DWM / Dzen2

Trilby wrote:

If you really want to replace dwm's bar, then you don't need to do anything - just have dzen over dwm's bar.  If you wanted to make it as efficient as possible, you could delete the function that draws the bar (or probably more easily just delete it's contents so it is an empty function).

That actually worked to some effect, I was so OCD about it being clean I didn't want to paint over the original bar, but just deleting the function that draws it doesn't seem to have removed the gap where it used to be. This solution also allows me the ability to hide it as well.

So thanks, I'm pretty happy with these results.

Offline

Board footer

Powered by FluxBB