You are not logged in.

#101 2010-06-09 06:08:11

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: The dwm thread

Thank you so much! It worked like a charm (couldn't resist to try before go to bed). Now my dwm is a dream, it does everything I expect.

I did it manually (I mean, edited dwm.c, and then patched without creating a new patch and editing the PKGBUILD). I'll try to do a patch tomorrow with more time.

Thanks again smile


/Edit: There's only a minor glitch: the nmaster patch doesn't work that well with pertag. The amount of master windows is shared among all tags. Isn't a big deal, just pointing it out.

Last edited by rb (2010-06-09 06:12:22)


Sorry for my English. Feel free to point out my errors.

Offline

#102 2010-06-09 16:39:30

cabrey
Member
Registered: 2009-08-15
Posts: 29

Re: The dwm thread

I have a general question for this thread now (I feel like I'm spamming).

I want my status bar text to only be rendered on my larger monitor, the HDMI one. I narrowed it down to the drawbar() function and within that, the if(m == selmon) statement, but I'm not quite sure how to modify it to suite my goals. Anyone have any ideas?

Offline

#103 2010-06-17 23:42:12

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: The dwm thread

I'm trying to bind the Print Screen key to scrot like in this image, but I can't get the whole thing to work.

This is the relevant part of my config.h

/* commands */
    ...
static const char *prtscrcmd[]  = { "scrot", "%Y.%m.%d-$wx$h.png", "--quality", "100", "-e", "'mv $f /home/rafael/media/images/screenshots/'",  NULL };
    ...

static Key keys[] = {
    ...
    /* printscreen */
    { 0,                            XK_Print,    spawn,          {.v = prtscrcmd } },
    ...
};

The screen is taken properly and the name format is applied correctly (Y.M.D-WxH). The problem is that scrot complains about the folder being inexistent... and needles to say that the folder does exist. I checked the path like 10 times and it's correct.

The funny thing is that when I execute the command manually (scrot name.png --quality 100 -e 'mv $f /home/rafael/media/images/screenshots/'), it works flawlessly.

I fail to see what I'm doing wrong. Anyone can give me some hint? Thanks


Sorry for my English. Feel free to point out my errors.

Offline

#104 2010-06-18 00:16:20

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: The dwm thread

The error says 'file or directory'. My guess is it can't find the file that scrot creates because of the environment that /bin/sh starts with (either that or a quoting issue). Works fine here if I move the scrot command to a bash script and call the bash script from config.h. I personally prefer this method as it doesn't require a recompile of DWM to change an option with scrot.

Offline

#105 2010-06-18 00:27:37

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: The dwm thread

falconindy, thanks. That seems to be a simple yet elegant solution. I think I'll go that way.

However I would like to know what's wrong with the method I'm currently using. This is the error output (listed on tty1):

sh: mv 2010.06.17-1680x1050.png /home/rafael/images/screenshots/ : Not such file or directory

According with the scrot manual, $f means image path/filename. If I get this right, $f would be the same that the full image path plus the image name, so it should work with mv, shouldn't it?

/EDIT: I just realized that the image file is created at my home. Maybe I should try something like "-e" "'mv /home/rafael/$f /home/rafael/images/screenshots/screenshots/'" just to try. I'll make an script either way.

/EDIT2: Also, I wasn't able to bind scrot -s to any key. I remove that entry from my config.h, so I can't reproduce the error right now. Not a big deal tho

Last edited by rb (2010-06-18 00:33:09)


Sorry for my English. Feel free to point out my errors.

Offline

#106 2010-06-18 08:07:10

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 456
Website

Re: The dwm thread

This works for me:

    {      0,                       XK_Print, spawn,          SHCMD("exec scrot -q 100 -t 25 '%Y-%m-%d-%H-%M-%S.jpg' -e 'mv $f $m ~/Pictures/Screenshots/'") },

If you move the stuff inside "SHCMD" to the variable you create, it should work just fine too.


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

#107 2010-06-18 09:53:41

edma2
Member
Registered: 2009-08-20
Posts: 66

Re: The dwm thread

I added a keybinding in dwm:
mod+g executes a script which runs dmenu, and points surf at its output, piped to google search

I got tired of first launching "surf google.com" in dmenu before using google.

I'm sort of a noob so tips on improving the script would be helpful, thanks!

config.h

-snip-
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *google_cmd[] = { "/home/edma2/.scripts/googled.sh", NULL }; /* google search engine */
static const char *wiki_cmd[] = { "/home/edma2/.scripts/wikid.sh", NULL }; /* wikipedia search engine */
static const char *termcmd[]  = { "urxvtc", NULL };

static Key keys[] = {
        /* modifier                     key        function        argument */
        { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
        { MODKEY,                       XK_g,      spawn,          {.v = google_cmd } },
        { MODKEY|ShiftMask,             XK_g,      spawn,          {.v = wiki_cmd } },
        { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
        { MODKEY,                       XK_b,      togglebar,      {0} },
-snip-

googled.sh

#!/bin/bash
entry=`dmenu_path | dmenu -fn "-*-bitstream vera sans mono-medium-r-normal-*-10-*-*-*-*-*-*-*" -nb "#222222" -nf "#dcdccc"`
if test "X$entry" != "X"; then
        surf http://www.google.com/search?q="$entry"
fi

Last edited by edma2 (2010-06-18 10:15:32)

Offline

#108 2010-06-18 18:03:30

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: The dwm thread

@lswest, what $m is for? I couldn't find an entry for that in the scrot manual.


Sorry for my English. Feel free to point out my errors.

Offline

#109 2010-06-18 20:11:11

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 456
Website

Re: The dwm thread

$m moves the generated thumbnail along with the actual file (i.e. I'm specifying that both files need to be moved to my Pictures/Screenshots folder).  I'm not sure anymore where I picked up that tidbit of information (nor could I remember what it did when you asked tongue but I checked the command with and without it, and realized the significance of it).  Only really useful if you have scrot generate thumbnails along with the screenshot.  I usually use this for when I'm uploading my pictures to dropbox/some imagehost that doesn't generate thumbnails automatically, so it's up to you if you want to keep it.  If you don't want to generate a thumbnail at all, you can always just remove the "-t 25" bit.

Hope that clears it up for you!
Lswest


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

#110 2010-06-18 21:51:57

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: The dwm thread

Thank you. At the moment I'm using an external script like falconindy suggested, but still I'm curious about what I wasn't working on the first place. I hope someday figure that out tongue


Sorry for my English. Feel free to point out my errors.

Offline

#111 2010-06-19 04:20:02

antlechrist
Member
Registered: 2010-04-21
Posts: 26

Re: The dwm thread

edma2 wrote:

I added a keybinding in dwm:
mod+g executes a script which runs dmenu, and points surf at its output, piped to google search

I got tired of first launching "surf google.com" in dmenu before using google.

Hi edma2

You might want to try pjh's bmarks_history script, or pancake and nibble's bmarks (simpler) version.

Offline

#112 2010-06-27 12:21:53

jck
Member
From: USA
Registered: 2009-05-08
Posts: 98

Re: The dwm thread

rb wrote:

I'm trying to bind the Print Screen key to scrot like in this image, but I can't get the whole thing to work.

This is the relevant part of my config.h

/* commands */
    ...
static const char *prtscrcmd[]  = { "scrot", "%Y.%m.%d-$wx$h.png", "--quality", "100", "-e", "'mv $f /home/rafael/media/images/screenshots/'",  NULL };
    ...

static Key keys[] = {
    ...
    /* printscreen */
    { 0,                            XK_Print,    spawn,          {.v = prtscrcmd } },
    ...
};

The screen is taken properly and the name format is applied correctly (Y.M.D-WxH). The problem is that scrot complains about the folder being inexistent... and needles to say that the folder does exist. I checked the path like 10 times and it's correct.

The funny thing is that when I execute the command manually (scrot name.png --quality 100 -e 'mv $f /home/rafael/media/images/screenshots/'), it works flawlessly.

I fail to see what I'm doing wrong. Anyone can give me some hint? Thanks

I suggest you use actkbd to handle such keybindings which are independent of your WM, such as screen shots, volume control and mpd control.
Just install it from the aur, then run actkbd -ns to get the keycodes of the keys you would like to bind and edit /etc/actkbd.conf

Offline

#113 2010-06-27 18:48:59

jck
Member
From: USA
Registered: 2009-05-08
Posts: 98

Re: The dwm thread

Have any of you got this working on dwm 5.8.2? : http://dwm.suckless.org/patches/moveresize

Offline

#114 2010-06-28 14:18:36

clutch
Member
Registered: 2010-05-01
Posts: 48

Re: The dwm thread

Does anyone know of a way to get attachaside to be the default behavior?  It works fine, its just that DWM switches back to the default behavior of attaching new windows as master (which I almost never actuallly want) every time you switch tags.  I'm breaking my fingers over here hitting shift+alt+s every two minutes.

I finally moved up to a 1600X900 monitor after spending all my life at 1024x768, so now that I have more room I'm putting more stuff on a single tag.  Probably about time to redo my whole DWM setup.  smile

ps sorry for cross-post, this is the thread that I originally meant to post it in, but I found a different DWM thread before I found this one and thought it was the one I was looking for.

Offline

#115 2010-06-29 04:51:48

hellomynameisphil
Member
From: /home/phil/Vancouver
Registered: 2009-10-02
Posts: 257
Website

Re: The dwm thread

clutch wrote:

Does anyone know of a way to get attachaside to be the default behavior?

There is a patch for that I believe. I don't know which patch it is off the top of my head. I actually use (and *love*) dwm-sprinkles, which is a heavily patched version of dwm. One of the features it has is to allow the user to choose the default attach mode per tag. It's possible that this functionality comes from a readily available and easily applicable patch.

Have you already checked the available patches at the dwm site? If so, and haven't found what you seek, you might have a look at dwm-sprinkles (google it if need be) and see how they do it.

Offline

#116 2010-06-29 05:09:29

clutch
Member
Registered: 2010-05-01
Posts: 48

Re: The dwm thread

hellomynameisphil wrote:
clutch wrote:

Does anyone know of a way to get attachaside to be the default behavior?

There is a patch for that I believe. I don't know which patch it is off the top of my head. I actually use (and *love*) dwm-sprinkles, which is a heavily patched version of dwm. One of the features it has is to allow the user to choose the default attach mode per tag. It's possible that this functionality comes from a readily available and easily applicable patch.

Have you already checked the available patches at the dwm site? If so, and haven't found what you seek, you might have a look at dwm-sprinkles (google it if need be) and see how they do it.

Hahaha I actually am using the latest version of Sprinkles already because patching was a pain in the ass.  I only use about half of what's patched into it by default, but with something as tiny as DWM it doesn't really matter if you have a few hundred lines you don't need.  I have a feeling there's a way to do what I want in Sprinkles by goofing around with my config.h a little bit, but I don't know enough C for it to be immediately apparent yet.

...actually I'm looking at config.h on my other monitor as I write this and the line just jumped out at me.

static const int tagattachmode[] = { AttNormal, AttAsLast, AttNormal, AttNormal... ... ... ... };

Haha, don't know how I didn't see that last night.  Changed all those AttNormals to AttAside and it worked.  Looks like you can do it on a per-tag basis as well, but I haven't tried that.  I think that it may be specific to sprinkles and/or people who have different attach modes patched in (I would check, but I don't have a vanilla dwm config.h atm).  Can't recall if DWM has any other attach modes by default.

For anyone out there as blind as me, the offending behavior can be found in the vicinity of line 46, depending on how much extra crap you have included in your config.

Personally, having all tags default to attachaside is much easier.  On the rare occasion I do want something to pop up in the master section, a quick alt+enter does the trick.

Offline

#117 2010-07-31 21:31:43

necr0mancer
Member
Registered: 2010-05-01
Posts: 28

Re: The dwm thread

I'm having a problem applying the uselessgap patch (http://dwm.suckless.org/patches/uselessgap) on 5.8.2. Even trying to change the code manually, I can't seem to figure it out.
The code in the patch is across 2 different functions (I think) and I'm not sure what to do. Can anyone help with this?

Last edited by necr0mancer (2010-07-31 21:32:08)


arch64 :: zsh :: dwm :: urxvt \\ Still using the same computer I built when I was 15 smile
I also use twitter entirely too much.

Offline

#118 2010-07-31 21:55:39

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

Re: The dwm thread

It failed for me as well, so I hand patched it and had to make some changes to the code. You can find my version of the patch in my bitbucket repo.

See if that works...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#119 2010-08-01 01:13:58

valium97582
Member
Registered: 2010-06-19
Posts: 126

Re: The dwm thread

Yes, the dwm patches have been problematic nowadays (at least in my experience).

Just for that moved to XMonad. Will move back to dwm when I get my patches to do patching correctly. I do not like Haskell (great concept, but horrible language IMHO; maybe I am just not ready for it, as I actually can do FP outside Haskell, or, maybe, I do not want to be away from my parenthesis).


I'm also known as zmv on IRC.

Offline

#120 2010-08-02 17:09:19

necr0mancer
Member
Registered: 2010-05-01
Posts: 28

Re: The dwm thread

jasonwryan wrote:

It failed for me as well, so I hand patched it and had to make some changes to the code. You can find my version of the patch in my bitbucket repo.

See if that works...

Aaaaaaaaah! Thank you!


arch64 :: zsh :: dwm :: urxvt \\ Still using the same computer I built when I was 15 smile
I also use twitter entirely too much.

Offline

#121 2010-08-03 01:36:28

hikyle
Member
Registered: 2009-12-21
Posts: 3

Re: The dwm thread

i'm still rather new to dwm, could somebody point out what i'm doing wrong here?

$ wget https://bitbucket.org/jasonwryan/workstation/raw/e3141295e6be/dwm-5.8.2/patches/useless-gaps-5.8.2.diff
$ mv useless-gaps-5.8.2.diff ~/dwm
$ cd ~/dwm/src/dwm-5.8.2
$ patch < ~/dwm/useless-gaps-5.8.2.diff

i get an error about c->oldx and c->oldy when i run the patch line

Offline

#122 2010-08-03 02:20:06

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

Re: The dwm thread

Without more detail it is hard to be sure, but you could try:

mv uselessgaps.diff ~/dwm/src/dwm-5.8.2/
cd ~/dwm/src/dwm-5.8.2/
patch -p1 < uselessgaps.diff

# edit 1: I applied it to a vanilla 5.8.2-2 and got the same failure: it looks like it is an error in my patch: I'll update it later in the week...

# edit 2: fixed: it now works with vanilla 5.8.2-2

Last edited by jasonwryan (2010-08-03 21:32:53)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#123 2010-08-03 05:45:37

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: The dwm thread

This diff works for me for the uselessgap patch: (just make sure to add in the gappx to your config.h or config.def.h if you have it customized)

diff -r 72e52c5333ef config.def.h
--- a/config.def.h      Wed Nov 25 13:56:17 2009 +0000
+++ b/config.def.h      Thu Mar 11 16:32:24 2010 +0100
@@ -9,6 +9,7 @@
 static const char selbgcolor[]      = "#0066ff";
 static const char selfgcolor[]      = "#ffffff";
 static const unsigned int borderpx  = 1;        /* border pixel of windows */
+static const unsigned int gappx     = 6;        /* gap pixel between windows */
 static const unsigned int snap      = 32;       /* snap pixel */
 static const Bool showbar           = True;     /* False means no bar */
 static const Bool topbar            = True;     /* False means bottom bar */
diff -r 72e52c5333ef dwm.c
--- a/dwm.c     Wed Nov 25 13:56:17 2009 +0000
+++ b/dwm.c     Thu Mar 11 16:32:24 2010 +0100
@@ -269,6 +269,7 @@
 static DC dc;
 static Monitor *mons = NULL, *selmon = NULL;
 static Window root;
+static int globalborder ;
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
@@ -1357,6 +1357,11 @@ quit(const Arg *arg) {
 
 void
 resize(Client *c, int x, int y, int w, int h, Bool interact) {
+       if(c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) { globalborder = 0 ; }
+       else {
+               if (selmon->lt[selmon->sellt]->arrange == monocle) { globalborder = 0 - borderpx ; }
+               else { globalborder =  gappx ; }
+       }
        if(applysizehints(c, &x, &y, &w, &h, interact))
                resizeclient(c, x, y, w, h);
 }
@@ -1365,10 +1370,10 @@ void
 resizeclient(Client *c, int x, int y, int w, int h) {
        XWindowChanges wc;
 
-       c->oldx = c->x; c->x = wc.x = x;
-       c->oldy = c->y; c->y = wc.y = y;
-       c->oldw = c->w; c->w = wc.width = w;
-       c->oldh = c->h; c->h = wc.height = h;
+       c->oldx = c->x; c->x = wc.x = x + globalborder;
+       c->oldy = c->y; c->y = wc.y = y + globalborder;
+       c->oldw = c->w; c->w = wc.width = w - 2 * globalborder;
+       c->oldh = c->h; c->h = wc.height = h - 2 * globalborder;
        wc.border_width = c->bw;
        XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
        configure(c);

Scott

Offline

#124 2010-08-04 16:28:00

beepressure
Member
Registered: 2009-10-29
Posts: 80

Re: The dwm thread

Is it worth it to upgrade from 5.7 to 5.8?

Offline

#125 2010-08-04 16:42:30

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: The dwm thread

Do you use any patches which haven't been ported?

Offline

Board footer

Powered by FluxBB