You are not logged in.

#1501 2017-02-25 15:07:17

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 114

Re: DWM Hackers Unite! Share (or request) dwm patches.

It's 9menu so right-click behaves like Openbox root menu. The C code works I just don't know how to include this in dwm.

#include <stdio.h>
#include <stdlib.h>

#define MENUSCRIPT "\
#!/bin/sh \n\
9menu -teleport -warp -popup -bg \"#101010\" -fg \"#c0c0c0\" -font \"-*-dejavu sans mono-medium-r-*-*-17-*-*-*-*-*-*-*\" \
\"Run\":\"dmenu_run -b -fn 'DejaVu Sans Mono-15' -nb '#101010' -nf '#c0c0c0' -sb '#c0c0c0' -sf '#101010' &\" \
\"Ranger\":\"xterm -e ranger &\" \
\"Firefox\":\"firefox &\" \
\"Geany\":\"geany &\" \
\"Terminal\":\"xterm &\" \
----------: \
\"Exit\":exit \n\
"

int main()
{
    system(MENUSCRIPT);
    return 0;
}

Offline

#1502 2017-02-25 18:55:04

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

Re: DWM Hackers Unite! Share (or request) dwm patches.

Calling System() to execute a shell to just in turn run a different binary is ridiculous.  Just run 9menu with it's parameters through dwm's built in exec.

static const char *menucmd[]  = { "9menu", "-teleport", "-warp", ... , NULL };

Fill in the dots with all your other parameters for 9menu.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#1503 2017-03-04 15:09:00

PackRat
Member
Registered: 2013-03-27
Posts: 18

Re: DWM Hackers Unite! Share (or request) dwm patches.

Pretty sure I've seen this done, but is there a patch that will remove the window title from the statusbar, or will that require some editing of dwm.c?

Offline

#1504 2017-03-04 18:50:42

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

PackRat wrote:

Pretty sure I've seen this done, but is there a patch that will remove the window title from the statusbar, or will that require some editing of dwm.c?

Although it's old and may no longer apply cleanly, this might be what you want. It will at least point you to the relevant lines of code.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1505 2017-03-04 20:13:53

PackRat
Member
Registered: 2013-03-27
Posts: 18

Re: DWM Hackers Unite! Share (or request) dwm patches.

Thanks; that's prpbably where I origianlly saw the patch.

Edit - and you're right, it no longer applies cleanly.

Last edited by PackRat (2017-03-06 01:57:10)

Offline

#1506 2017-03-12 18:41:36

matej.focko
Member
From: Slovakia
Registered: 2015-11-28
Posts: 4

Re: DWM Hackers Unite! Share (or request) dwm patches.

Hi, I've tried a few of WMs (i3wm, dwm, awesomeWM), I think I'm mostly satisfied with dwm.. I use pertag, tilegap and movestack patches from official site... But there's a thing that bothers me most... It's that I'm unable to change the height of the windows, I currently don't have a much time to look into it, but I've searched before and haven't managed to find patch like that... Has anyone tried that or seen patch for this? Thanks for anyone's reply smile

Offline

#1507 2017-03-12 19:00:17

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

Re: DWM Hackers Unite! Share (or request) dwm patches.

matej, can you clarify what you want?  How do you want to change the height of the windows: manually, or change a default height?  Tilers generally have windows fill the available space within their tiled region, so I'm not really clear what changing the height would mean unless you want to leave a gap at the top or bottom of the screen.  Alternatively, do you mean manually change window height either with mouse resizing or a keybinding?

EDIT: oops, in hindsight there is a meaning that seems more likely, but if you could confirm this is what you want it'd still be helpful: do you mean within the stack (e.g. windows on the right half of the screen in rstack mode) change the portion of the vertical height given to each window?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#1508 2017-03-12 19:39:15

matej.focko
Member
From: Slovakia
Registered: 2015-11-28
Posts: 4

Re: DWM Hackers Unite! Share (or request) dwm patches.

that edit smile i don't want gaps, i just want to be able change height of a window in the stack

EDIT:
maybe this? http://dwm.suckless.org/patches/cfacts i need to look into it, still last versin 6.1 so it's possible i'll need to modify it a bit

EDIT #2:
there's also mistake in the patch,,, the height of stack(?) tiles must be multiplied instead of divided as it's in the original source (it has been changed for master tiles, but not for stack)

Last edited by matej.focko (2017-03-14 22:05:45)

Offline

#1509 2017-03-22 23:09:59

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,212

Re: DWM Hackers Unite! Share (or request) dwm patches.

Perhaps I'm not using the right search terms but would anyone point me to the right direction, if it exists, to finding a patch.  I currently use the warp patch, which focus window where mouse cursor is hovering.  This goes against what I need for one type of work flow.

I download pdf in web browser (master) and open the pdf.  It opens zathura in the client side.  I press cntrl+p to open the floating print menu.  I press enter to let it print.  The float window is over the master side so when the floating print pop up goes away, focus is now on master, which is the web browser.  Is there any patch that can focus on last active window when float windows are closed? 

I'd hate to give up the warp patch as in other work flows, this is very handy.  Anyone else come up against this situation?  Any guidance always appreciated.

Edit:  Another workaround would be if anyone can suggest a way to have floating windows show up on top right of screen (first client ) that would work too.

Last edited by frank604 (2017-03-22 23:36:51)

Offline

#1510 2017-04-06 11:53:23

zanculmarktum
Member
Registered: 2016-09-25
Posts: 10

Re: DWM Hackers Unite! Share (or request) dwm patches.

Can anyone help, I have the following code:

static const char *dmenucmd[] = { "j4-dmenu-desktop", "--dmenu", "dmenu -i -fn '-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*' -nb '#222222' -sb '#005577'", "--no-generic", "--term=urxvt", NULL };

the problem is I want -fn, -nb, -sb to have value from font, normbgcolor, selbgcolor, but if I change it to the following:

static const char *dmenucmd[] = { "j4-dmenu-desktop", "--dmenu", "dmenu -i -fn", font, "-nb", normbgcolor, "-sb", selbgcolor, "--no-generic", "--term=urxvt", NULL };

it won't work because  "dmenu -i -fn '-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*' -nb '#222222' -sb '#005577'" must be in one string.
I don't even know C, so I hope you understand what I'm saying.
Thanks in advance.

Offline

#1511 2017-04-06 12:22:37

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

Re: DWM Hackers Unite! Share (or request) dwm patches.

Your best best would be to use preprocessor macros:

#define FONT   "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*"
#define NB     "#222222"
#define SB     "#005577"

...

static const char *font = FONT

...

static const char *dmenucmd[] = { "j4-dmenu-desktop", "--dmenu", "dmenu -i -fn '" FONT "' -nb '" NB "' -sb ...

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#1512 2017-04-06 12:51:56

zanculmarktum
Member
Registered: 2016-09-25
Posts: 10

Re: DWM Hackers Unite! Share (or request) dwm patches.

Thanks a lot.
Another question, is there a way to make an application that can't remember its own windows placement (such as terminal, gvim, etc) to be placed on the center of the screen when it's started? By default it's started on the corner near tags, it doesn't affect application like Firefox, though but it's quite irritating, requires me to move it to the center of the screen.
I'm in floating mode, BTW.

Offline

#1513 2017-04-06 13:25:59

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

Re: DWM Hackers Unite! Share (or request) dwm patches.

I suspect the following diff to dwm.c (based on dwm-git) should do that:

1048,1051c1048,1049
< 	c->x = MAX(c->x, c->mon->mx);
< 	/* only fix client y-offset, if the client center might cover the bar */
< 	c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
< 	           && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
---
> 	c->x = c->mon->mx + (c->mon->mw - c->w) / 2;
> 	c->y = c->mon->my + (c->mon->mh - c->h) / 2;

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#1514 2017-06-14 12:44:14

zanculmarktum
Member
Registered: 2016-09-25
Posts: 10

Re: DWM Hackers Unite! Share (or request) dwm patches.

@Trilby: it appears that everything is forced to be placed in the center (e.g. GIMP).
Without those patch, GIMP can remember the placement, but after patched, GIMP lost its placement.

Before:
https://ptpb.pw/RJ9O.png

After:
https://ptpb.pw/bvpO.png

Last edited by zanculmarktum (2017-06-14 12:54:23)

Offline

#1515 2017-06-14 13:53:18

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

Re: DWM Hackers Unite! Share (or request) dwm patches.

True, you can adapt my approach.  Just check if c->x and c->y are zero before centering.  Then any client that specifies a (non-zero) position would be placed as requested, but any client that doesn't specify coordinates would be centered.  Of course this would fail on clients that actually wanted 0,0 coordinates, but there's really no good way around that.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#1516 2017-06-14 14:25:00

zanculmarktum
Member
Registered: 2016-09-25
Posts: 10

Re: DWM Hackers Unite! Share (or request) dwm patches.

Something like this?

if c->x == 0 and c->y {
	c->x = c->mon->mx + (c->mon->mw - c->w) / 2;
	c->y = c->mon->my + (c->mon->mh - c->h) / 2;
}

Please fix, I don't know C, lol.

Offline

#1517 2017-06-14 14:35:58

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

Re: DWM Hackers Unite! Share (or request) dwm patches.

You'd either have to check c->x and c->y prior to the 2 lines above, or compare them to c->mon->mx:

if (c->x == c->mon->mx && c->y == c->mon->my) {
	c->x = c->mon->mx + (c->mon->mw - c->w) / 2;
	c->y = c->mon->my + (c->mon->mh - c->h) / 2;
}

This checks if the window *would* be mapped at the upper right corner of the monitor, and it so it moves it to the center of the monitor.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#1518 2017-09-19 19:23:12

oldgaro
Member
From: Brazil
Registered: 2017-09-19
Posts: 9
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

How can I set this command in config.h so later assign it to print key?

maim  ~/Pictures/Screenshot-$(date -Iseconds | cut -d'+' -f1).png

Thanks!

Ps: Maim is yet another Scrot like screenshot tool!

Last edited by oldgaro (2017-09-19 19:25:48)


GNU - Dwm - St - Screen - Zsh - SpacEmacs - Neovim
Github

Offline

#1519 2017-09-20 08:44:43

sekret
Member
Registered: 2013-07-22
Posts: 283

Re: DWM Hackers Unite! Share (or request) dwm patches.

You could save this command line as a script in e.g. /usr/local/bin, name it e.g. "screenshot" , then assign the print key to the executable like this:

[...]
static const char *screenshot[] = { "/usr/local/bin/screenshot", NULL };
[...]
{ 0, XK_Print, spawn, {.v = screenshot } },
[...]

Offline

#1520 2017-09-20 10:13:52

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

Re: DWM Hackers Unite! Share (or request) dwm patches.

What?  Why create a script.  Just use that command passed to a shell - or just use the macro defined specifically for this purpose:

{ 0, XK_Print, swan, SHCMD("maim  ~/Pictures/Screenshot-$(date -Iseconds | cut -d'+' -f1).png") },

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#1521 2017-09-20 23:51:00

oldgaro
Member
From: Brazil
Registered: 2017-09-19
Posts: 9
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

Thanks!

#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
{ 0,                            XK_Print,      spawn,           SHCMD("maim  ~/Pictures/Screenshot-$(date -Iseconds | cut -d'+' -f1).png") },

Last edited by oldgaro (2017-09-21 00:59:50)


GNU - Dwm - St - Screen - Zsh - SpacEmacs - Neovim
Github

Offline

#1522 2017-09-21 08:05:49

sekret
Member
Registered: 2013-07-22
Posts: 283

Re: DWM Hackers Unite! Share (or request) dwm patches.

This is of course the better solution wink I just prefer scripts, because I can change them anytime without the need to recompile anything.

Last edited by sekret (2017-09-21 08:05:57)

Offline

#1523 2017-09-21 21:06:07

oldgaro
Member
From: Brazil
Registered: 2017-09-19
Posts: 9
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

sekret wrote:

This is of course the better solution wink I just prefer scripts, because I can change them anytime without the need to recompile anything.

Interesting! I somewhat change my scripts sometimes...I will keep  your solution commented in config.h for later use!..haha


GNU - Dwm - St - Screen - Zsh - SpacEmacs - Neovim
Github

Offline

#1524 2017-09-23 22:24:39

oldgaro
Member
From: Brazil
Registered: 2017-09-19
Posts: 9
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

Does anyone know why St do not fill the entire screen?

Same happens with Spacemacs, urxvt but not with firefox, zathura,steam...

https://imgur.com/OqWlAfm
https://github.com/oldgaro/dotfiles/blo … nfig.def.h

thanks!

PS: resizehint to 0 did not make any effect!

Last edited by oldgaro (2017-09-23 23:02:33)


GNU - Dwm - St - Screen - Zsh - SpacEmacs - Neovim
Github

Offline

#1525 2017-09-23 22:29:06

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

Please read the wiki before posting here: https://wiki.archlinux.org/index.php/Dw … al_windows

Also, this is a hacking, not a general support, thread.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB