Re: [dwm] Stats script
On Sat, May 02, 2009 at 11:30:23PM -0400, Jake Todd wrote: I was wondering what some other dwm users were using for stats like memory, temperature, et cetera. Right now I'm using this for termperature, memory, wifi, date: Your script is nice, though I use an UTF-8-based script[0] I wrote some month ago (and posted a preview here[1]) which you can found useful. From my ~/.xinitrc it run as follow: while true ; do xsetroot -name $(~/.mk8monbar.sh -dacw wlan0 -tl) ; sleep 30 ; done It may need to be adapted from case to case (e.g., your thermal zone directory in proc is THRM while in mine are TZ00 and TZ01). The only problem with this is when memory goes over 100MB, it doesn't show up (need to fix that). To be honest i don't get any value for the memory field at all. You should found a better general way. Alsa i suggest you, in order to save few (?) cycle of CPU, you can avoid to call cat(1) passing the file name directly to sed(1), tail(1), and so forth for others Unix tools. Hope this helps. Regards, Claudio M. Alessi [0] http://cma.teroristi.org/chems/usr/files/sources/scripts/mk8monbar.sh [1] http://lists.suckless.org/dwm/0810/6849.html -- JID: smoppy AT gmail.com WWW: http://cma.teroristi.org
Re: [dwm] Stats script
On Sun, May 03, 2009 at 11:03:03AM -0400, Jake Todd wrote: I took your advice and I've reduced the amount of cpu cycles used for displaying stats by a significant amount. This is what my xinitrc looks like now: It appear much clear now. Also i'm now able to get all fields properly, though I'm only able to see the last two digit of the memory abount when it goes over 99Mb. As far as I can tell, you could use cut(1) to get the desired offset of bytes from free(1), as in this example: free -m |grep ^- |cut -b27-30 There is more than one way to do it. You may also want to increase the sleep time (30 seconds are enough?) in order to not stress the CPU furthemore. HTH. Regards, Claudio M. Alessi -- JID: smoppy AT gmail.com WWW: http://cma.teroristi.org
Re: [dwm] what is mwm hint?
On Mon, Mar 16, 2009 at 12:41:38PM +0800, bill lam wrote: What is mwm hint? Is that important? Not to be hostile, but Google taken less than a second[0] to find your answer[1]. [0] Results 1 - 10 of about 11,200 for mwm hint. (0.07 seconds) [1] http://mail.gnome.org/archives/wm-spec-list/2001-December/msg00046.html Regards, Claudio M. Alessi -- JID: smo...@gmail.com WWW: http://cma.teroristi.org
[dwm] Text marquee script
Hi to all dwm and dvtm users! I wrote a little script to make a marquee text with the given input line. It works well on dwm and it's easy to use with dvtm (just change the value of the PRINT variable and use echo(1) to generate the text which will be sent to the dvtm FIFO, later). It's just few lines of code i wrote for funny, in the hope of be useful for someone. I attached the 1,2K script. Regards, Claudio M. Alessi -- JID: smo...@gmail.com WWW: http://cma.teroristi.org slide.sh Description: Bourne shell script
Re: [dwm] minimal communication
On Fri, Mar 06, 2009 at 04:23:23PM -0800, Scytrin dai Kinthra wrote: My question however, is anyone familiar with a jabber client similar to sic? No, but you can use XMMP with any IRC client through bitlbee. The best news (for me) is that the development version of WeeChat already have a beta jabber plugin. Next release will be almost the perfect IM (not IRC) client ever. Hope this helps, Claudio M. Alessi. -- JID: smo...@gmail.com WWW: http://cma.teroristi.org
Re: [dwm] [dvtm]: fix for status bar
I tested your patch a bit and it seems to work properly. Does it will going in upstream? Thanks for your help and time. Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.teroristi.org
Re: [dwm] [dvtm]: fix for status bar
On Thu, Nov 20, 2008 at 10:48:30PM +0100, Marc Andre Tanner wrote: Problem is that strlen is used to calculate character width, which doesn't work for utf8 therefore the statusbar content is not properly aligned. I don't think i have the skills to fully solve the problem. I guess it would be useful a code like the following into the drawbar() function (replacing the strlen(3) call): l = mbstowcs(trash, stext, sizeof trash); This works properly with the right alignment but not with the left one. I'll RTFM and try to solve the problem, however if anyone is able to do the work it would be faster (better?) than me. Regards, Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.teroristi.org
Re: [dwm] make setlayout toggle
On Wed, Nov 05, 2008 at 09:39:58AM +, Anselm R Garbe wrote: Ok, are there any concerns making this upstream again? (Yes I know, we had this already in earlier versions, by that time it was called togglelayout())... There were reasons for not toggling, basically it was confusing to toggle the layout after a long period of time, because one forgets about what the previous layout was. You shouldn't care about the previous layout, it's not a memory game. Users change layouts once they need it, then use another layout in order to fit their new needs and so forth. Changing the layout is not an hard task, i think. I already have some feature i never use but i wouldn't make a dwm-lite release. Please add only real useful code :-) Regards, Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.teroristi.org
Re: [dwm] make setlayout toggle
Definitively i do _not_ want to add such code in upstream. Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.teroristi.org
[dwm] [dvtm]: fix for status bar
Hi to all dvtm users! The attached patch restore wah to the height value as the latest stable release. This prevent to decrement wah of the bh value anytime the togglebar() function is called (which makes the dvtm size smaller). HTH Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.teroristi.org --- statusbar.c.orig 2008-11-15 17:10:56.069144430 +0100 +++ statusbar.c 2008-11-15 17:14:55.956136435 +0100 @@ -8,6 +8,7 @@ by = 0; wax = 0; way = 0; + wah = height; if (statusfd == -1) return; if (barpos == BarTop) {
[dwm] [dvtm] Top stack layout patch
Hi again, i just fixed the top stack layout. It had some problem with the status bar, now everything should work properly once for all. I cannot link the tstack.c file ATM since i'm working on my web server. The attached patch is against the implementation included in git. Regards, Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.teroristi.org --- tstack.c.orig 2008-11-15 18:18:31.300888250 +0100 +++ tstack.c 2008-11-15 18:27:42.940891169 +0100 @@ -17,31 +17,36 @@ nx = wax, nw = waw; for(i = 0, c = clients; c; c = c-next, i++){ if(i == 0){ /* master */ - ny = wah - mh; + ny = way + wah - mh; nh = mh; - } else { /* tile window */ + } + else { /* tile window */ if(i == 1){ nx = wax; ny = way + m; -nh = wah - mh - ny; +nh = wah - mh - ny + way; } if(i == n - m - 1){ /* last not minimized client */ nw = (wax + waw) - nx; - } else if(i == n - m){ /* first minimized client */ + } + else if(i == n - m) { /* first minimized client */ nx = wax; -ny--; +--ny; nh = 1; nw = waw; - } else if(c-minimized) { /* minimized window */ -ny--; + } + else if(c-minimized) { /* minimized window */ +--ny; nh = 1; nw = waw; - } else /* normal non minimized tile window */ + } + else /* normal non minimized tile window */ nw = tw; + if(i 1 !c-minimized){ mvvline(ny, nx, ACS_VLINE, nh); mvaddch(ny, nx, ACS_TTEE); -nx++, nw--; +++nx, --nw; } }
Re: [dwm] [dvtm] Status bar script
On Fri, Oct 24, 2008 at 8:59 PM, Marc Andre Tanner [EMAIL PROTECTED]wrote: Thanks for the script it is a nice idea to use unicode characters for the battery level indicator, unfortunately dvtm currently can't handle it and therefore displays it at the wrong place. Do you care enough to send a patch which corrects it? Cheers, Marc To be honest i actually don't have the time to work on it. I had some problem in RL and cannot use a PC for more than ~10 minutes (no, i'm not arrested, just i leaved my childhood home). I hope to find a bit of time to write a patch, though any contribution from the dvtm community is really appreciated. Sorry for the inconvenience and THX for your time! Regards, Claudio M. Alessi
[dwm] [dvtm] Status bar script
Hi to all dvtm users! Some time ago i wrote a small shell script[0] which helps to generate a little status bar to be used mainly with dvtm. It use largely UTF-8 and probably you will need to fix some path (about /proc/acpi informations) but i hope someone will found it useful. Here is a sample output: [EMAIL PROTECTED]:$ ~/.mk8monbar.sh -dacw wlan0 -tl 10/10/2008 - 18:59 ᛁ 0.07 ᛁ +45C ᛁ 99% ᛁ -:-- [√] ᛁ ▁▂▃▄▅▆▇█ Hope this helps. Saluti, Claudio M. Alessi [0] http://cma.teroristi.org/sources/scripts/misc/mk8monbar.sh -- JID: [EMAIL PROTECTED] WWW: http://dinotte.altervista.org -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
Re: [dwm] [dvtm] testing current git HEAD aka dvtm-0.5-rc1
On Tue, Oct 07, 2008 at 08:37:38PM +0200, Marc Andre Tanner wrote: Thanks for testing! I have fixed the issues, guess i should introduce a randconfig script like the kernel does ;) Unfortunately repo.or.cz seems to be down so I couldn't push the changes. I'm impatient to test the new dvtm RC! I have no strong feeling about it, lets wait and see whether someone steps up who would like it enabled by default. Right, let the others to talk about it. Indeed, i could change idea after playing around a bit with such support. We'll wait for the fixed RC to be committed. Thanks, the patch was from Donald Chai. Yeah, many thanks to Donald :-) Could you please post a link to the source, i am too lazy to search ;) You can get the top stack implementation from here: http://cma.teroristi.org/sources/contrib/dvtm/tstack.c Thanks for the great work! Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.altervista.org -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
Re: [dwm] patch on movemouse/resizemouse
On Tue, Oct 07, 2008 at 02:18:35PM +0400, Peter Kosyh wrote: Hopes, it will help for someone... :) No changes here: i still have an high CPU usage while resizing (not moving) clients. Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.altervista.org -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
Re: [dwm] [dvtm] testing current git HEAD aka dvtm-0.5-rc1
I reply to myself.. On Tue, Oct 07, 2008 at 02:12:52AM +0200, Claudio M. Alessi wrote: Now i get lots of errors about moving/resize. I'm playing around a bit from about 5 minutes so i didn't figure out what's the problem, yet. The problem occur by simply comment out the CONFIG_STATUSBAR line in config.mk. It just need to be cleaned up, i guess. Regards, Claudio M. Alessi -- JID: [EMAIL PROTECTED] WWW: http://dinotte.altervista.org -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
[dwm] [patch] Per-client label.
Hi to all dwm users. I was reading a pancake's post[0] about client's tag in order to make the focus faster. He proposed to tag each client in order to recall it any time later with (i guess) a one-character label. Other suggestions has been proposed later and Anselm said he was thinking about such feature for dwm-5.0. Though i still didn't see any changes. So i wrote my own code in order to implement a very minimal one-char clients labels support. The reason i called it labels instead of tags, as you cat expect, is just to differentiate it from the more famous dwm tags, from here the names labelset() and labelfocus(). It's not a definitive patch but an input for the community to think about it and maybe going to implement a better solution toughether. I really like it when i have lots of floating clients and here, indeed, even with few clients it results more comfortable in some case. Suggestions and comments are very welcomed! Hope someone else (other than me) will found it useful. Saluti, Claudio M. Alessi [0] http://lists.suckless.org/dwm/0804/5502.html
[dwm] Re: [patch] Per-client label.
Here is the patch against dwm-5.2. Sorry for the inconvenience. --- dwm.c.orig 2008-09-28 11:04:51.051974392 +0200 +++ dwm.c 2008-09-29 09:00:37.980516502 +0200 @@ -83,6 +83,7 @@ typedef struct Client Client; struct Client { char name[256]; + char label; float mina, maxa; int x, y, w, h; int basew, baseh, incw, inch, maxw, maxh, minw, minh; @@ -168,6 +169,9 @@ static void maprequest(XEvent *e); static void monocle(void); static void movemouse(const Arg *arg); +static void labelset(const Arg *arg); +static void labelfocus(const Arg *arg); +static int xgetc(void); static Client *nexttiled(Client *c); static void propertynotify(XEvent *e); static void quit(const Arg *arg); @@ -985,6 +989,51 @@ XUngrabPointer(dpy, CurrentTime); } +void +labelset(const Arg *arg) +{ + if( sel ) + sel-label = xgetc(); +} + +void +labelfocus(const Arg *arg) +{ + Client *c; + char l; + + if( ! sel ) + return; + + l = xgetc(); + + for(c = clients; c; c = c-next) + if( c-label == l ) + break; + + if(c) { + focus(c); + restack(); + } +} + +int +xgetc(void) +{ + XEvent ev; + KeySym keysym; + XComposeStatus status; + char ch[2] = { 0 }; + + XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime); + XMaskEvent(dpy, KeyPressMask, ev); + XLookupString((XKeyEvent *)ev, ch, 1, keysym, status); + XUngrabKeyboard(dpy, CurrentTime); + + return *ch; +} + + Client * nexttiled(Client *c) { for(; c (c-isfloating || !ISVISIBLE(c)); c = c-next);
Re: [dwm] Floating children
On Mon, Sep 29, 2008 at 12:03 AM, Carlos Pita [EMAIL PROTECTED]wrote: Hi, Hi. I'm a bit reluctant to patch dwm pertag just for this. I think it's more sensible to make floating client's children recursively floating. Why? It does exactly what you need if you use a tag only for that program. What do you think? Can you help me implement this, if it's possible at all? (I'm not even sure whether X has a notion of parent-child relationship between clients or not) I'm not an X11 coder but AFAIK you can go through the siblings of a parent window and eventually apply a set of rules to each client by using the XQueryTree(3) routine in a way similar to that of the scan() function. It's a bit excessive in thise case, i think. I had such problem with aMSN which have a different WM_CLASS name for each sibling. For lucky the number of possible siblings is finite and not much huge so the result, in my case, are the following lines in config.h: // aMSN { Amsn, NULL, NULL, 11, True }, { Chatwindow, NULL, NULL, 11, True }, { Toplevel, NULL, NULL, 11, True }, { Searchdialog, NULL, NULL, 11, True }, { Assistant, NULL, NULL, 11, True }, Likely it's doable in a better manner even if i'm quite happy this way. Saluti, Claudio M. Alessi
Re: [dwm] Floating children
This is a bit off topic, but writing 2 instead of 11 might save you some typing next time :). Yes, you are right. Though i like to read some shift operator while scrolling my config.h ;-) THX
Re: [dwm] Coding styles
Hi Pancake and all the dwm users! I read your ``suggestions'' about good coding style and i agree mostly with what you wrote. Keep the good work up. Though, i think this sentence should be a bit different: [..]Humans are here to make computer's life easier.[..] I wondering, doesn't computers are here to make humans' life easier? :-) Also, since i don't like the cats much, i'm pleased to announce that i'll only use uppercase characters in my C codes (out of the C preprocessor :-P). I'm j/k, of course. It would be interesting to read the NetBSD source code style guide[0] which show several good rules to follow while coding (except, maybe, the main() function prototype inclusion). Hope this helps. [0] http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=HEADcontent-type=text/x-cvsweb-markup Saluti. -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
[dwm] [dvtm, patch] Locking the screen.
Hi to all dvtm users, i wrote a little'n simple routine which allow to lock the screen until a passphrase has been inserted. It's doesn't deal with encrypted key (that's because i don't need it; it's quite easy to implement, btw). I hope someone else (other than me) will found it useful too. In the attached patch i also removed the draw() function which is unused at all. Hope this help. -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK-- --- dvtm.c.orig 2008-05-31 13:37:04.884264616 +0200 +++ dvtm.c 2008-05-31 13:35:22.185846371 +0200 @@ -108,6 +108,7 @@ void setlayout(const char *args[]); void redraw(const char *args[]); void zoom(const char *args[]); +void lock(const char *key[]); #if defined(HANDLE_MOUSE) void mouse_focus(const char *args[]); @@ -466,13 +467,6 @@ } void -draw(Client *c){ - draw_content(c); - draw_border(c); - wrefresh(c-window); -} - -void clear_workspace(){ unsigned int y; for(y = 0; y wah; y++) @@ -545,6 +539,39 @@ } } +/* + * Lock the screen until the key is typed + * + * NOTE: this function doesn't handle the input from clients. All + * foreground operations are temporarly suspended since the + * function doesn't return (screen is unlocked). Also there + * is no password enc/dec handling (needed?). +*/ +void +lock(const char *key[]) +{ + size_t size = strlen(key[0]); + int i = 0; + + if( ! size ) + return; + + erase(); + curs_set(0); + mvprintw(LINES / 2, COLS / 2 - 7, Screen locked!); + + while( i != (int)size ) { + + for(i = 0; i (int)size; i++) { + if( getch() != key[0][i] ) +break; + } + } + + arrange(); + +} /* eof lock() */ + void killclient(const char *args[]){ if(!sel) --- config.h.orig 2008-05-31 13:37:04.884264616 +0200 +++ config.h 2008-05-31 13:35:22.197847122 +0200 @@ -56,6 +56,7 @@ /* you can at most specifiy MAX_ARGS (2) number of arguments */ Key keys[] = { + { MOD, 'X', { lock, { test } } }, { MOD, 'c', { create, { NULL }} }, { MOD, 'x', { killclient, { NULL }} }, { MOD, 'j', { focusnext, { NULL }} },
Re: [dwm] [dvtm-patch] Master client number: 0/1?
Sorry, i'd forgot to attach the patch. -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK-- --- dvtm.c.orig 2008-02-28 17:08:07.709479866 +0100 +++ dvtm.c 2008-02-28 17:08:17.174071365 +0100 @@ -157,7 +157,7 @@ c-next = clients; c-prev = NULL; clients = c; - for(order = 1; c; c = c-next, order++) + for(order = 0; c; c = c-next, order++) c-order = order; } --- dvtm.1.orig 2008-02-28 16:24:08.676550615 +0100 +++ dvtm.1 2008-02-28 16:26:07.443973115 +0100 @@ -36,10 +36,10 @@ Close focused window. .TP .B Mod\-l -Increases the master area width about 5% (tiled and bottom stack layout only). +Increases the master area width about 5% (all except grid and fullscreen layout). .TP -.B Mod1\-h -Decreases the master area width about 5% (tiled layout only). +.B Mod\-h +Decreases the master area width about 5% (all except grid and fullscreen layout). .TP .B Mod\-j Focus next window.
[dwm] [dvtm-patch] Top stack layout
Hi all. For a personal choose i usually put all the secondary things at the top of the screen mantaining the current working area at the bottom. For this reason i thought would be nice to do the same thing with dvtm and i hacked the ``bottom stack'' layout in order to make it works exactly as the contrary; from here the ``top stack'' layout. I found it very useful expecially when i have only three maximized clients (often). The code works but i will not surprise to find bugs. I hope someone will found it helpful. -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK-- diff -Nwur dvtm.orig/config.h dvtm.wip/config.h --- dvtm.orig/config.h 2008-02-26 19:19:53.653584435 +0100 +++ dvtm.wip/config.h 2008-02-26 20:38:21.831827186 +0100 @@ -42,12 +42,14 @@ #include tile.c #include grid.c +#include tstack.c #include bstack.c #include fullscreen.c Layout layouts[] = { { []=, tile }, { +++, grid }, + { LLL, tstack }, { TTT, bstack }, { [ ], fullscreen }, }; @@ -64,6 +66,7 @@ { MOD, 'k', { focusprev, { NULL }} }, { MOD, 't', { setlayout, { []= } } }, { MOD, 'g', { setlayout, { +++ } } }, + { MOD, 'B', { setlayout, { LLL } } }, { MOD, 'b', { setlayout, { TTT } } }, { MOD, 'm', { setlayout, { [ ] } } }, { MOD, ' ', { setlayout, { NULL }} }, diff -Nwur dvtm.orig/dvtm.c dvtm.wip/dvtm.c --- dvtm.orig/dvtm.c 2008-02-26 19:19:53.685586435 +0100 +++ dvtm.wip/dvtm.c 2008-02-26 19:25:49.271809187 +0100 @@ -403,7 +403,7 @@ setmwfact(const char *args[]) { double delta; - if(!isarrange(tile) !isarrange(bstack)) + if( ! (isarrange(tile) || isarrange(tstack) || isarrange(bstack)) ) return; /* arg handling, manipulate mwfact */ if(args[0] == NULL) Binary files dvtm.orig/.git/index and dvtm.wip/.git/index differ diff -Nwur dvtm.orig/Makefile dvtm.wip/Makefile --- dvtm.orig/Makefile 2008-02-26 19:19:53.649584185 +0100 +++ dvtm.wip/Makefile 2008-02-26 20:37:52.794012436 +0100 @@ -35,7 +35,7 @@ @echo creating dist tarball @mkdir -p dvtm-${VERSION} @cp -R LICENSE Makefile README config.h config.mk \ - ${SRC} tile.c bstack.c grid.c fullscreen.c \ + ${SRC} tile.c tstack.c bstack.c grid.c fullscreen.c \ madtty.h dvtm-status dvtm.1 dvtm-${VERSION} @tar -cf dvtm-${VERSION}.tar dvtm-${VERSION} @gzip dvtm-${VERSION}.tar diff -Nwur dvtm.orig/tstack.c dvtm.wip/tstack.c --- dvtm.orig/tstack.c 1970-01-01 01:00:00.0 +0100 +++ dvtm.wip/tstack.c 2008-02-26 19:18:12.171242185 +0100 @@ -0,0 +1,53 @@ +void +tstack(void) { + unsigned int i, m, n, nx, ny, nw, nh, mh, tw; + Client *c; + + for(n = 0, m = 0, c = clients; c; c = c-next, n++) + if(c-minimized) + m++; + + /* relative height */ + mh = (wah - m) * (n == 1 || n - 1 == m ? 1 : mwfact); + + /* true if there are at least 2 non minimized clients */ + if(n - 1 m) + tw = waw / (n - m - 1); + + nx = wax, nw = waw; + for(i = 0, c = clients; c; c = c-next, i++){ + if(i == 0){ /* master */ + ny = wah - mh; + nh = mh; + } else { /* tile window */ + if(i == 1){ +nx = wax; +ny = way + m; +nh = wah - mh - ny; + } + if(i == n - m - 1){ /* last not minimized client */ +nw = (wax + waw) - nx; + } else if(i == n - m){ /* first minimized client */ +nx = wax; +ny--; +nh = 1; +nw = waw; + } else if(c-minimized) { /* minimized window */ +ny--; +nh = 1; +nw = waw; + } else /* normal non minimized tile window */ +nw = tw; + if(i 1 !c-minimized){ +mvvline(ny, nx, ACS_VLINE, nh); +mvaddch(ny, nx, ACS_TTEE); +nx++, nw--; + } + } + + resize(c,nx,ny,nw,nh); + + if(n 1 i n - m - 1) + nx += nw; + } +}
Re: [dwm] [dvtm] mouse selection just inside a window?
There is no way to do it at the moment AFAIK but maybe some further release of dvtm will provide relevant features. I just use the rxvt rectangular selection (alt+Left mouse button, for instance). It is the best i'm able to do now ;-) HTH -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
[dwm] [dvtm-patch] Status bar optional
Hi, i'm continuing to study the dvtm code in order to be able to make some real improvement. I'm a (not so) beginner C programmer so all my experiments and your points of view about are useful to improve myself (not only dvtm). It's free software, after all. As for the mouse support, i don't use the status bar at all (at least not in box other than my laptop) so there is no reason to build such feature. Even i think that such modularization help to make the code cleaner (e.g. i had to move the terminal size variables from the updatebaros() function to the resize_screen() one, which seems to be a better place for them). This will give a bit of work to Leonardo Taccari which is working on the pkgsrc dvtm packages; a new option is needed, i guess. Hope this helps but, if not, feel free to insult me ;-) -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK-- --- ../dvtm-0.4.orig/dvtm.c 2008-02-16 12:09:13.191369197 +0100 +++ dvtm.c 2008-02-19 13:31:27.751955582 +0100 @@ -101,7 +101,6 @@ void focusprev(const char *args[]); void focusprevnm(const char *args[]); void toggleminimize(const char *args[]); -void togglebar(const char *args[]); void setmwfact(const char *args[]); void setlayout(const char *args[]); void redraw(const char *args[]); @@ -112,10 +111,14 @@ void mouse_minimize(const char *args[]); void mouse_zoom(const char *args[]); +#if defined(STATUS_BAR) +void togglebar(const char *args[]); +void drawbar(); +#endif /* STATUS_BAR */ + void clear_workspace(); void draw_all(bool border); void draw_border(Client *c); -void drawbar(); void resize(Client* c, int x, int y, int w, int h); unsigned int bh = 1, by, waw, wah, wax, way; @@ -129,9 +132,13 @@ double mwfact = MWFACT; Layout *layout = layouts; Client *client_killed = NULL; + +#if defined(STATUS_BAR) int statusfd = -1; -char stext[512]; int barpos = BARPOS; +#endif /* STATUS_BAR */ + +char stext[512]; const char *shell; bool need_screen_resize = true; int width, height; @@ -348,13 +355,9 @@ arrange(); } +#if defined(STATUS_BAR) void updatebarpos(void) { - by = 0; - wax = 0; - way = 0; - waw = width; - wah = height; if(statusfd == -1) return; if(barpos == BarTop){ @@ -378,6 +381,33 @@ } void +drawbar(){ + int s, l, maxlen = width - 2; + char t = stext[maxlen]; + if(barpos == BarOff || !*stext) + return; + curs_set(0); + attrset(BAR_ATTR); + mvaddch(by, 0, '['); + stext[maxlen] = '\0'; + l = strlen(stext); + if(BAR_ALIGN_RIGHT) + for(s = 0; s + l maxlen; s++) + addch(' '); + else + for(; l maxlen; l++) + stext[l] = ' '; + addstr(stext); + stext[maxlen] = t; + addch(']'); + attrset(ATTR_NORMAL); + if(sel) + curs_set(madtty_cursor(sel-term)); + refresh(); +} +#endif /* STATUS_BAR */ + +void setlayout(const char *args[]) { unsigned int i; @@ -503,32 +533,6 @@ } void -drawbar(){ - int s, l, maxlen = width - 2; - char t = stext[maxlen]; - if(barpos == BarOff || !*stext) - return; - curs_set(0); - attrset(BAR_ATTR); - mvaddch(by, 0, '['); - stext[maxlen] = '\0'; - l = strlen(stext); - if(BAR_ALIGN_RIGHT) - for(s = 0; s + l maxlen; s++) - addch(' '); - else - for(; l maxlen; l++) - stext[l] = ' '; - addstr(stext); - stext[maxlen] = t; - addch(']'); - attrset(ATTR_NORMAL); - if(sel) - curs_set(madtty_cursor(sel-term)); - refresh(); -} - -void escapekey(const char *args[]){ int key; if(sel (!sel-minimized || isarrange(fullscreen))) { @@ -778,8 +782,14 @@ wrefresh(curscr); refresh(); } + + by = wax = way = 0; + waw = width, wah = height; + +#if defined(STATUS_BAR) updatebarpos(); drawbar(); +#endif /* STATUS_BAR */ arrange(); need_screen_resize = false; } @@ -819,8 +829,10 @@ void cleanup(){ endwin(); +#if defined(STATUS_BAR) if(statusfd 0) close(statusfd); +#endif /* STATUS_BAR */ } void @@ -832,7 +844,13 @@ void usage(){ cleanup(); - eprint(usage: dvtm [-v] [-m mod] [-s status] [cmd...]\n); + eprint( usage: dvtm [-v] [-m mod] +#if defined(STATUS_BAR) + [-s status] +#endif /* STATUS_BAR */ + [cmd...]\n + ); + exit(EXIT_FAILURE); } @@ -864,6 +882,7 @@ for(i = 0; i countof(keys); i++) keys[i].mod = *mod; break; +#if defined(STATUS_BAR) case 's': if(++arg = argc) usage(); @@ -879,6 +898,7 @@ } updatebarpos(); break; +#endif /* STATUS_BAR */ default: usage(); } @@ -908,10 +928,12 @@ FD_ZERO(rd); FD_SET(STDIN_FILENO, rd); +#if defined(STATUS_BAR) if(statusfd != -1){ FD_SET(statusfd, rd); nfds = max(nfds, statusfd); } +#endif /* STATUS_BAR */ for(c = clients; c; c = c-next){ FD_SET(c-pty, rd); @@ -959,6 +981,7 @@ continue; } +#if defined(STATUS_BAR) if(statusfd != -1 FD_ISSET(statusfd, rd)){ char *p; switch(r = read(statusfd, stext, sizeof stext - 1
Re: [dwm] [dvtm-patch] Status bar optional
I'm not trying to insult you, but I don't see the point of having the status bar as a compile time option. The point is that if the code is not needed there is no reason to have it, even why we have a larger binary and a slowest build time (other than C statements and checks that will never be true). Thanks to not insult me, btw ;-) I cannot try it know, but I think when you don't set the status text to anything (you don't use the -s option), you won't have the status bar. Adding complexity with the code with #ifdefs for this option is not a good idea, IMO. That's the same with the mouse support which is not used at all if you don't bind the keys. Though there is no need to build it when not used. Why shouldn't be the same for the status bar? I also wondering where all this complexity come from but please, consider i'm a beginner of C programming so i'll appreciated any eventually further technical explanation. A bit of patience! Maybe you want to have a look at http://doc.cat-v.org/henry_spencer/ifdef_considered_harmful.pdf, it is worth reading. Yes, i understand your point and i also agree with some of the things discussed in that paper. Though this is not a portability issues nor, to me, a wrong use of the conditional preprocessor statements. I'm just trying to remove stuff i don't need. Remove them is not the same as not use them. I appreciated your reply (and i will any further one). Please, sorry for my (often wrong) english and have a nice day. -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
Re: [dwm] [dvtm-patch] Fix for the alt keystrokes
On Tue, Feb 19, 2008 at 03:25:04PM +0200, Daniel Bainton wrote: IMO it would make sense to s/ESC/META/ the patch though, as it isn't just the esc key that is affected. You are probably right, i just used ESC because it's what the ascii(7) man page show. Using META is even better and i'm pretty sure Marc will agree with us. Thanks! -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
Re: [dwm] [dvtm-patch] Fix for the alt keystrokes
On Tue, Feb 19, 2008 at 06:51:11PM +0100, Marc Andre Tanner wrote: Could you please try the attached patch and report whether this solves the problem? Also the delay you saw can be adjusted with the environment variable ESCDELAY, see the dvtm-status script for an example. Of course it does, though i'm not sure a while() loop is needed. I tried to change the value of the ESCDELAY environment variable but i see no changes. I'll read the source in order to learn more about. Thanks! -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
Re: [dwm] [dvtm-patch] Status bar optional
On Tue, Feb 19, 2008 at 06:57:21PM +0100, Marc Andre Tanner wrote: I don't want to clutter the code with all the #ifdefs plus some day we might introduce tags/workspaces and then a statusbar will become more important. I hope this will never happen. Have a nice day. -- Claudio M. Alessi -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
Re: [dwm] [dvtm-patch] Fix for the alt keystrokes
Okay, i reply to myself. The following is an improved version of the previous patch which use is_modifier() rather then the preprocessor #if and check for the next character after the ESC key. This allow to send immediately the ESC key when typed (without have to wait for another key to be press). The only problem is that, for some reason i'm not currently able to figure out, there is a bit of delay between these two steps. Please, consider this thread as an input for a real and good solution. I know my code is a bit dirty but since it works i thought it was a good idea to post here. Thanks! -- Claudio M. -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK-- --- ../dvtm-0.4.orig/dvtm.c 2008-02-16 12:09:13.191369197 +0100 +++ dvtm.c 2008-02-18 12:52:38.977473837 +0100 @@ -55,6 +55,7 @@ #define CTRL(k) ((k) 0x1F) #endif #define CTRL_ALT(k) ((k) + (129 - 'a')) +#define ESC 27 #define MAX_ARGS 2 @@ -949,6 +950,15 @@ if(sel (!sel-minimized || isarrange(fullscreen))){ madtty_keypress(sel-term, code); if(r == 1){ + + if(code == ESC ! is_modifier(ESC)) { + nodelay(stdscr, TRUE); + code = getch(); + nodelay(stdscr, FALSE); + if( code != ERR ) +madtty_keypress(sel-term, code); + } + draw_content(sel); wrefresh(sel-window); }
Re: [dwm] [dvtm] CO_BEL patch for madtty.c
On Sun, Feb 17, 2008 at 10:41:49AM +0100, Marc Andre Tanner wrote: I personally don't like the beeping and flashing but i will give it a try and see how this works in practise (i haven't yet seen a difference with this patch applied on my macbook). I don't like such notification stuff too, expecially the beeping but may be usefull to have some kind of customization which allow to do a certain thing (other than beeping). Indeed notification is more than just a beep IMHO. What about using a code like the following rather a static beep(3) or flash(3) which, if defined, is executed? #if defined(NOTIFY) NOTIFY /* Some notify */ #endif This way we could have a thing like this in our config.h file: #define NOTIFY flash() /* beep() */ or even a bit more complex example like this: /* Would you provide a better example? :-) */ #define NOTIFY flash(); beep(); \ mvprintw(LINES - 1, 0, Hey, do you like notify?); \ refresh(); sleep(1); Indeed it's better than the comment we actually have, i think. HTH. -- Claudio M. -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK--
[dwm] [dvtm-patch] Fix for the alt keystrokes
Hi, i was frustrated to not be able to use my usual alt+n keys combination in WeeChat, ELinks, bash, and so forth. This due to a problem related to the way dvtm handles the input which forced me to type another key before the alt+n have any effect. I decided to try to solve the problem by playing a bit with the code and finally i found a way, here. I hope it's a solution (not an hack) which, maybe with some change, may work without cause any other problems. At least it works great here! Now i'm able to use alt+n with bash, alt+r which clear the current line, using unlucky ELinks key combinations, switch the channels on WeeChat (and irssi) and so forth. Also there is a new (useles?) constant ESC which may be used in config.h or so. The patch is very little (only three lines) and it is based on the latest release rather than the git one. Any improvement of course is very appreciated. Hope this helps. -- Claudio M. -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK-- --- ../dvtm-0.4.orig/dvtm.c 2008-02-16 12:09:13.191369197 +0100 +++ dvtm.c 2008-02-17 23:26:48.799848446 +0100 @@ -55,6 +55,7 @@ #define CTRL(k) ((k) 0x1F) #endif #define CTRL_ALT(k) ((k) + (129 - 'a')) +#define ESC 27 #define MAX_ARGS 2 @@ -949,6 +950,10 @@ if(sel (!sel-minimized || isarrange(fullscreen))){ madtty_keypress(sel-term, code); if(r == 1){ +#if MOD != ESC + if(code == ESC FD_ISSET(STDIN_FILENO, rd)) +madtty_keypress(sel-term, getch()); +#endif draw_content(sel); wrefresh(sel-window); }
[dwm] [dvtm-patch]: Mouse support optional
Hi, i started to read the dvtm source code only few days ago in the hope to be able to contribute with the project soon which, to me, is one of the best tool we could have today. Yes, i'm serious. Since i don't need the mouse support at all i made such support optional with few lines of preprocessor code. This allow to toggle the support by adding/removing the relative comment into the config.mk file. Feel free to include this little patch into the main code or discard it at all if you think it's not much usefull (in which case i'll have to remove the mouse code by hand before compile any new release of dvtm). I also disabled the debug informations which may be easily toggled in a similar way to the mouse support in config.mk Hope this helps and thanks to providing us a great tool as dvtm! -- Claudio M. -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/MU d-@ s: a-- C++(+++) UB++$ P+ !L E--- W++(+++) N+@ o-- K? w+@ O-@ M- V? PS+@ PE+@ Y+ PGP t(-)@ 5? X+ R? tv-- b+ DI-- D? G e+@ h--@ r y* --END GEEK CODE BLOCK-- --- ../dvtm-0.4.orig/dvtm.c 2008-02-16 12:09:13.191369197 +0100 +++ dvtm.c 2008-02-16 12:13:44.352315696 +0100 @@ -71,10 +71,12 @@ Action action; } Key; +#if defined(HANDLE_MOUSE) typedef struct { mmask_t mask; Action action; } Button; +#endif /* HANDLE_MOUSE */ enum { BarTop, BarBot, BarOff }; @@ -106,11 +108,14 @@ void setlayout(const char *args[]); void redraw(const char *args[]); void zoom(const char *args[]); + +#if defined(HANDLE_MOUSE) /* special mouse related commands */ void mouse_focus(const char *args[]); void mouse_fullscreen(const char *args[]); void mouse_minimize(const char *args[]); void mouse_zoom(const char *args[]); +#endif /* HANDLE_MOUSE */ void clear_workspace(); void draw_all(bool border); @@ -669,6 +674,7 @@ return NULL; } +#if defined(HANDLE_MOUSE) void mouse_focus(const char *args[]){ focus(msel); @@ -727,6 +733,7 @@ buttons[i].action.cmd(buttons[i].action.args); msel = NULL; } +#endif /* HANDLE_MOUSE */ Client* get_client_by_pid(pid_t pid){ @@ -802,10 +809,14 @@ start_color(); noecho(); keypad(stdscr, TRUE); + +#if defined(HANDLE_MOUSE) for(i = 0, mask = 0; i countof(buttons); i++) mask |= buttons[i].mask; if(mask) mousemask(mask, NULL); +#endif /* HANDLE_MOUSE */ + raw(); madtty_init_colors(); madtty_init_vt100_graphics(); @@ -931,9 +942,12 @@ int code = getch(); Key *key; if(code = 0){ +#if defined(HANDLE_MOUSE) if(code == KEY_MOUSE){ handle_mouse(); -} else if(is_modifier(code)){ +} else +#endif /* HANDLE_MOUSE */ +if(is_modifier(code)){ int mod = code; code = getch(); if(code = 0){ --- ../dvtm-0.4.orig/config.h 2008-02-16 12:09:13.191369197 +0100 +++ config.h 2008-02-16 12:13:45.072360697 +0100 @@ -116,12 +116,14 @@ * REPORT_MOUSE_POSITIONreport mouse movement */ +#if defined(HANDLE_MOUSE) Button buttons[] = { { BUTTON1_CLICKED,{ mouse_focus, { NULL } } }, { BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { [ ] } } }, { BUTTON2_CLICKED,{ mouse_zoom, { NULL } } }, { BUTTON3_CLICKED,{ mouse_minimize, { NULL } } }, }; +#endif /* HANDLE_MOUSE */ /* gets executed when dvtm is started */ Action actions[] = { --- ../dvtm-0.4.orig/config.mk 2008-02-16 12:09:13.191369197 +0100 +++ config.mk 2008-02-16 12:13:52.912850695 +0100 @@ -13,6 +13,12 @@ CFLAGS = -std=c99 -Os ${INCS} -DVERSION=\${VERSION}\ -DNDEBUG LDFLAGS = -L/usr/lib -L/usr/local/lib ${LIBS} +# Debug informations +#CFLAGS += -DNDEBUG + +# Mouse handling +#CFLAGS += -DHANDLE_MOUSE + DEBUG_CFLAGS = -std=c99 -O0 -g -ggdb ${INCS} -Wall -DVERSION=\${VERSION}\ CC = cc