Re: [dwm] Irc channel moved

2009-05-20 Thread Szabolcs Nagy
On 5/20/09, Uriel urie...@gmail.com wrote:
 For simplicity and consistency #dwm and #wmii have moved to #hackers.
 Still in the oftc network.

#suckless



Re: [dwm] dwm's future

2009-04-29 Thread Szabolcs Nagy
 I like free software.
 But not GPL?
 It's just another lock in which is getting too big.
 Sure, if you want to make proprietary software...
 If you want to be free from wacko organisations.

this fruitful discussion shall end here



Re: [dwm] dwm's future

2009-04-28 Thread Szabolcs Nagy
On 4/28/09, Martin Oppegaard mar...@deathaven.com wrote:
 Are there any BSD-style licensed equivalents?


scipy.org



Re: [dwm] [idea] mwm - minimal/minimun/monocle window manager

2009-04-27 Thread Szabolcs Nagy
On 4/27/09, Preben Randhol rand...@pvv.org wrote:
 On Sun, 26 Apr 2009 18:44:18 -0300
 Leandro Chescotta leandro.chesco...@gmail.com wrote:
 *Wra!thhttp://bbs.archlinux.org/profile.php?id=24472in archlinux
 forums

 But I can recommend The C Programming Language
 http://www.amazon.co.uk/C-Programming-Language-2nd/dp/0131103628/ref=pd_sim_b_1

is this a new trend that people reference improper sources and discuss
topics in unrelated forums?

if the information has a clear and obvious source then why look for it
somewhere else..

why would one post ideas, questions,.. to some random web forum when
there is a dedicated mailing list (and irc channel) for the given
topic?

why would one post an url to a web shop when the book itself has more
informative resource locators: an official website, publisher, author
names, isbn number, common abbrev, wikipedia entry, google.. ?

maybe i shouldn't get annoyd by this..



Re: [dwm] dwm's future

2009-04-25 Thread Szabolcs Nagy
On 4/25/09, Christian Garbs mi...@cgarbs.de wrote:
 work, even without pango or cairo.  I have German umlauts as well as
 Japanese characters (eg. web page titles from Firefox).

try greek or cyrillic
i had trouble with those when fonts were loaded with XCreateFontSet



Re: [dwm] dwm's future

2009-04-25 Thread Szabolcs Nagy
On 4/25/09, Anselm R Garbe garb...@gmail.com wrote:
 1. One idea is getting rid of the dwm bar altogether and to print the
 dwm state to stdout when it changes, however after thinking carefully
 about it I conclude that having the bar build-in is definately a
 stayer. It's so much simpler than the hassle with an external bar, not
 worth it. So very unlikely.

if external bar is a hassle then inter-process communication is broken
in our systems

if built-in bar is a hassle then x is broken (unable to display text)

 2. Another idea is to switch to another dependency for the rendering
 bit which could possibly be cairo. After all I'm nearly giving up the
 hope that X font handling will ever be fixed and work properly,

$ du -h /usr/lib/libcairo.a
608K/usr/lib/libcairo.a

pango seems to be slightly smaller, but i don't know what these libs
do exactly..

imo it's not suckless, but it can be a temporary solution until x is fixed

 3. A third idea for legacy support is, that I tend to add a
 compile-time option or a specific Rule extension that let's you set to
 reparent all clients or certain clients which are broken

rule extension won't work as these applications tend not to set
class,instance,name properly



Re: [dwm] dwm's future

2009-04-25 Thread Szabolcs Nagy
On 4/26/09, Christian Garbs mi...@cgarbs.de wrote:
 On Sat, Apr 25, 2009 at 11:06:08PM +0100, Szabolcs Nagy wrote:
 On 4/25/09, Christian Garbs mi...@cgarbs.de wrote:
  work, even without pango or cairo.  I have German umlauts as well as
  Japanese characters (eg. web page titles from Firefox).

 try greek or cyrillic
 i had trouble with those when fonts were loaded with XCreateFontSet

 Looks ok to me:
 https://www.cgarbs.de/tmp/dwm-ru.png

no, that is ugly bold font, same problem with greek

 Wrong font here?
 https://www.cgarbs.de/tmp/dwm-ar.png

most likely your font does not cover arabic fonts (iso8859-6) in the given size

 Korean does look broken, though:
 https://www.cgarbs.de/tmp/dwm-ko.png

yes, i get the same result using fixed-14



Re: [dwm] uzbl. A browser that adheres to the unix philosophy.

2009-04-23 Thread Szabolcs Nagy
On 4/23/09, pmarin pacog...@gmail.com wrote:
 Try the last version of Dillo2. It is starting to support CSS and in
 the next version (Dillo 2.1) will support keybinding.

dillo used to be nice.. until it started using c++
i'd rather use the tcl/tk html viewer, hv3

 On Thu, Apr 23, 2009 at 11:45 AM, hiro 23h...@googlemail.com wrote:
  Now we only need a working flash replacement:(

no, flash is conceptually broken, it should not exist on the web

  On Thu, Apr 23, 2009 at 5:21 PM, Dusan ef_...@yahoo.com wrote:
   Web kit minimal browser, you will find it very interesting.

umm webkit was a 300 KLOC monster last time i checked



Re: [dwm] Font recomendation to get unicode in statusbar?

2009-04-18 Thread Szabolcs Nagy
On 4/17/09, Preben Randhol rand...@pvv.org wrote:
 Problem is that fixed font in xterm looks nice, but in the status bar
 it looks ugly for Greek language. the letters are both bold and italic.
 How do you define font[] ?

you are right greek looks ugly here as well
maybe the XCreateFontSet() + XmbDrawString() approach is not optimal
and XLoadQueryFont() + XDrawString16() should be used..
someone should figure out how fonts, encodings and locales work in X



Re: [dwm] dwm-5.5 / dmenu-4.0

2009-04-18 Thread Szabolcs Nagy
On 4/18/09, Anselm R Garbe garb...@gmail.com wrote:
 The new dwm release contains various bugfixes and code cleanups

there is a very long line in grabbuttons()
the usual 80chars limit is probably too low, but 120 chars is not nice style

the reported font problem is bothering me a bit, these font sets does
not work as they should, but i haven't looked into it too much



Re: [dwm] Font recomendation to get unicode in statusbar?

2009-04-17 Thread Szabolcs Nagy
On 4/17/09, Preben Randhol rand...@pvv.org wrote:
 Is there another font you would recommend that works with
 unicode?

fixed font

more details: http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html



Re: [dwm] [dmenu] OPTFLAGS in config.mk + patch

2009-04-08 Thread Szabolcs Nagy
On 4/8/09, Daniel Bainton d...@driftaway.org wrote:
 2009/4/8 Jan Blazek appoli...@gmail.com:
 +OPTFLAGS = -Os

 This wont make any difference, you can't pass it from the command line
 like this anyway.
 You're overwriting OPTFLAGS here all the time to -Os. You'll have to
 use the following for it to work:
 OPTFLAGS ?= -Os


that's not posix, but a bsd (and gnu) make extension though



Re: [dwm] [PATCH] dwm: remove unused variable ntiled in showhide()

2009-03-19 Thread Szabolcs Nagy
On 3/18/09, Marc Andre Tanner m...@brain-dump.org wrote:
 There seems to be an unused variable in the showhide function.


heh
it was introduced for adjustborder, but then it wasn't removed..
http://code.suckless.org/hg/dwm/rev/8b7836a471f8
nice catch



Re: [dwm] autoconf

2009-03-19 Thread Szabolcs Nagy
On 3/19/09, Anselm R Garbe garb...@gmail.com wrote:
 2009/3/19 bill lam cbill@gmail.com:
 - die(dwm-VERSION, © 2006-2009 dwm engineers, see LICENSE
 for details\n);

 Not related to autoconfm but I notice the copyright sign is in utf-8.
 If dwm is compiled in other locale, will it display properly when
 run on that locale?

 No, but we expect all users are using UTF-8 nowadays -- and if not,
 they won't care either about that detail I suppose (like those OpenBSD
 users ;)).

hm probably (c) would be better there (and in the license)
this is the only non-ascii character in the code (luckily none of the
contributors has funny name..)

while expecting utf8 is reasonable it is not required by posix or the c standard
(local specific behaviour is always risky and who knows how many non
utf8 safe tools are out there..)



Re: [dwm] autoconf

2009-03-19 Thread Szabolcs Nagy
On 3/19/09, Nico Golde n...@ngolde.de wrote:
 Please read the FAQ: http://suckless.org/common/faq

hm the 9fans link is dead, and neither 9fans[0] nor google[1] has the
entire thread archived

anyway, the main complaints:
- difficult to use by the user: --parameters
- difficult to use by the developper: m4, inconsistency, strange errors..
- huge, complex, slow, ugly..
- undebuggable huge generated files
- badly maintained, hacked together (see history[2])
- depends on perl and obscure gnu m4 features

[0] http://9fans.net/archive/2003/11
[1] http://groups.google.com/groups/search?q=configure+misery+9fans
[2] http://www.gnu.org/software/hello/manual/autoconf/History.html



Re: [dwm] Suckess Code Management

2009-03-12 Thread Szabolcs Nagy
s/DWM/dwm/



Re: [dwm] Wiki date format

2009-03-11 Thread Szabolcs Nagy
On 3/11/09, markus schnalke mei...@marmaro.de wrote:
 /mm/dd is not worst but still worse than -mm-dd.

 The latter one is a standard, and it is usable in filenames.

imho that's the point of '/' dates in werc, eg. see:
http://ninetimes.cat-v.org/news/2009/03/06/



Re: [dwm] C unit testing

2009-03-10 Thread Szabolcs Nagy
On 3/10/09, Anselm R Garbe garb...@gmail.com wrote:
 2009/3/10 Richard Pöttler richard.poett...@gmail.com:
 I just wanted to ask you guys if you could recommend me a tool to
 unit test my C code. So far I only found CUnit, Check and CuTest but
 haven't dug into any of them. Do you have any suggestions?

 #include assert.h


i see two immediate problems with assert:
1) one may want a message per failed test (to have a list) instead of abort
2) eg. equality checks are very common, but with assert
assert(x == y  important eq check)
the values of x,y are not shown in case of failure (which are
important for understanding what went wrong)

one can easily define helper macros like
print_assert(condition)
eq_assert(x, y, message)
...

i'm not sure whether it is convenient to use or not.
unfortunately there are many special cases, like the eq_assert, when
it is possible to print useful additional messages without repetitive
printfs and
most test frameworks exploit these situations to provide a more
complete tool, but they are difficult to use in my experience.



Re: [dwm] [dwm+ow...@suckless.org: Messages from dwm@suckless.org to you have been bouncing]

2009-03-05 Thread Szabolcs Nagy
On 3/5/09, Joerg van den Hoff j.van_den_h...@fzd.de wrote:
 I now want to check _which_ messages exactly have bounced (if
 at all). question: how can I identify the mail in the
 mail archive from the message number given in the bounce message?
 there seems to be no way (except counting myself...) to
 deduce the incremental message index. so which message is no. 7600?

at http://lists.suckless.org/dwm/ i see

7587 messages: Starting Wed Jul 19 2006 - 06:39:23 UTC, Ending Thu Mar
05 2009 - 08:03:46 UTC

so i wonder which is the no. 7600 if there is only 7538..



Re: [dwm] [dwm+ow...@suckless.org: Messages from dwm@suckless.org to you have been bouncing]

2009-03-05 Thread Szabolcs Nagy
On 3/5/09, Szabolcs Nagy nszabo...@gmail.com wrote:
 7587 messages: Starting Wed Jul 19 2006 - 06:39:23 UTC, Ending Thu Mar
 05 2009 - 08:03:46 UTC

 so i wonder which is the no. 7600 if there is only 7538..

7587

(sorry)



Re: [dwm] CLI color/font override patch

2009-02-24 Thread Szabolcs Nagy
On 2/24/09, Ian Daniher it.dani...@gmail.com wrote:
 ~25seconds), I sought to patch dwm to support -fn and other appearance
 changes.

why font+colors? what about borderpx, snap, showbar, topbar, usegrab,
mfact and resizehints while you are at it?

anyway if i changed something in the config it would probably be the
rules or keys not the apperance

 The code I put together is based heavily off dmenu's arg processing and adds
 a little less than thirty SLOCs.
 The patch for config.def.h adds no SLOCs.

fyi you used spaces instead of tabs there and included other not
related config.def.h modifications



Re: [dwm] [OT] Personal Website and CSS

2009-02-23 Thread Szabolcs Nagy
On 2/23/09, David Tweed david.tw...@gmail.com wrote:
 problems if things must be stateful. (Does anyone actually know how
 something like 9P works on a really, really unreliable network
 connection?)

i'm not a network expert, but the underlying protocol seems simple and
well designed

In contrast to other protocols, IL avoids blind retransmission. This
helps performance in congested networks, where blind retransmission
could cause further congestion. Like TCP, IL has adaptive timeouts, so
the protocol performs well both on the Internet and on local
Ethernets. A round-trip timer is used to calculate acknowledge and
retransmission times that match the network speed.

After 300 times the round trip time [..], the sender gives up and
assumes the connection is dead.

http://doc.cat-v.org/plan_9/4th_edition/papers/il/



Re: [dwm] Google Summer of Code 2009

2009-02-21 Thread Szabolcs Nagy
On 2/20/09, mi...@milesgroman.com mi...@milesgroman.com wrote:
 Are you allowed to participate outside of google soc ?

what do you mean by that? participating in the suckless project?
contributions are wellcome



Re: [dwm] [OT] Personal Website and CSS

2009-02-18 Thread Szabolcs Nagy
On 2/18/09, Matthias-Christian Ott o...@mirix.org wrote:
 minimalism. What annoyed me then and now was CSS and its implementations
 in modern browsers.

css cannot be implemented (..in a suckless way)

 there seems to be no agreed standard for a default CSS stylesheet merely a
 recommendation from the CSS standard [1] (which is incomplete) and a lot
 of people seem to be concerned about resetting the browser CSS defaults -
 even the W3C does so in their stylesheets [2]. Most people seems to have
 installed nearly all popular browsers, test with those and incorporate
 workarounds if necessary.

don't try to fix the browser, you can't
it leads to a chaos where each website has different versions for each
browser, display media, resolution,..

there is no way to do nice in all browsers page (or pixel correct
presentation)
(flash is obviously not an option since it's not (and cannot be)
supported by most browsers)

interactivity has the same issues (no way to do it properly)

 At the moment I'm just aware of The Anti-web Manifesto [3] that someone
 linked to on this mailing list. Although I mainly subscribe to it,

http://port70.net/webless suggests a least common denominator
imho this is the most sane approach currently (although limited in many ways)

 browsers like Mozilla Firefox have terrible default typographic style

the user is responsible for changing the default style (or using a sane browser)



Re: [dwm] floating rule when only WM_NAME defined?

2009-02-16 Thread Szabolcs Nagy
On 2/16/09, Adam adam.listm...@gmail.com wrote:
 WM_NAME(STRING) = GREG

 I have tried using GREG in every permutation possible in the rules
 of config.h, but that doesnt work. Is there any other way to get such
 a window to always float?

WM_NAME property should be the title
is that window have any title? (check the status bar)



Re: [dwm] nmaster strikes back

2009-02-11 Thread Szabolcs Nagy
On 2/11/09, Peter Hartlich sg...@hartlich.com wrote:
 It would however be useless without the setnmaster() function clocking in
 at 13 LOC, same as setmfact(). But the two have most of their code in
 common:

   1. Verify layout != floating
   2. Verify arg is within bounds
   3. Set global variable (relatively or absolutely)
   4. Call arrange()

nice, but tweak() has too much magic (if there were many runtime
tunable int parameters in dwm then it would be ok).

   enum { Abs, Rel };

   void
   tweak(int *var, const int *val, int min, int max) {
   int i;

   i = val[1] + (val[0] == Abs ? 0 : *var);
   if(!lt[sellt]-arrange || i  min || i  max)
   return;
   *var = i;
   arrange();
   }

 Previously setmfact():
   void
   tweakmwp(const Arg *arg) {
   tweak(mwp, arg-v, 5, 95);
   }

 Previously setnmaster():
   void
   tweakmn(const Arg *arg) {
   tweak(mn, arg-v, 1, wh / (1 + 2 * borderpx));
   }

 Configuration example:
   static int mwp = 55;  /* master area width percentage [5..95] */
   static int mn  = 1;   /* number of clients in master area */
   [...]
   { MODKEY,XK_h,  tweakmwp,  {.v = (int[]){Rel, -10}} },
   { MODKEY|ShiftMask,  XK_n,  tweakmn,   {.v = (int[]){Abs,   2}} },


this way master width cannot be set to a fixed value

i'd probably use a macro in the config:
.. {.v = REL(-10)},
.. {.v = ABS{2}},

is nmaster that useful?

 keyboards thread. It also corrects a discrepancy between documentation and
 code: mfact was described as [0.05..0.95], but was actually [0.1..0.9].

nice catch, config.def.h or setmfact() should be fixed



Re: [dwm] stdin to statusbar output removed?

2009-02-10 Thread Szabolcs Nagy
On 2/10/09, Neale Pickett ne...@woozle.org wrote:
 http://thread.gmane.org/gmane.comp.window-managers.dwm/6874

 And here Anselm announces it's going in:

http://thread.gmane.org/gmane.comp.window-managers.dwm/6924

fyi we have perfectly nice list archives:
http://lists.suckless.org/dwm/

and the relevant thread:
http://lists.suckless.org/dwm/0812/7098.html



Re: [dwm] No Border Behaviour

2009-01-08 Thread Szabolcs Nagy
On 1/9/09, voltaic volt...@gmail.com wrote:
 I agree with Matthias. The purpose of a border is to separate one
 client from another. If there is only one client visible at a given
 time (i.e. monocle) then borders in my opinion are a waste of space.

what's the problem? that's how tip works

read carefully:

 On Thu, Jan 8, 2009 at 10:15 AM, Anselm R Garbe garb...@gmail.com wrote:
 2009/1/8 Matthias-Christian Ott o...@mirix.org:
 borders if only one particular window is visible, because they aren't
 serving any purpose. In others words: borders are superfluous in that
 case.

 I think that is exactly how the current dwm implementation is supposed
 to be -- I never said anything different to that (at least not that I
 intended it).

the only debatable question is the monocle+multiple window case, but
the current solution seems perfectly reasonable

you can write your own layout in config.h if different behaviour is needed



Re: [dwm] last.fm + youtube downloader scripts

2009-01-06 Thread Szabolcs Nagy
On 1/6/09, Alexander Polakov polac...@gmail.com wrote:
 http://www.arrakis.es/~rggi3/youtube-dl/


that's overcomplicated and does not support every kind of youtube links

here is another version that supports playlists, embedded /v/ and
/watch? urls as well:
http://port70.net/~nsz/y/yget.sh



Re: [dwm] [dclip] dmenu-based clipboard manager

2009-01-05 Thread Szabolcs Nagy
On 1/5/09, Delta delta.tecb...@gmail.com wrote:
 On 2009-01-04, 18:52
 Szabolcs Nagy (nszabo...@gmail.com) wrote:
 also i got error message when copy-pasted text with '$' in it (imho it
 should be escaped)


 What error message do you get? Do you get it with other characters?


sorry, the problem was not with '$' but with '/': selecting '/foo' results
$ ./dclip.sh copy
sed: -e expression #1, char 4: unknown command: `f'



Re: [dwm] 25c3

2008-12-28 Thread Szabolcs Nagy
On 12/14/08, Anselm R Garbe garb...@gmail.com wrote:
 I plan a lightning talk on the 28/12 in the morning about st and the
 secret project...

sooo.. what is the secret project? ;)
or is the talk scheduled later?
what's happened?



Re: [dwm] dwm-5.3

2008-12-14 Thread Szabolcs Nagy
On 12/13/08, James Turner ja...@bsdgroup.org wrote:
 man signal on OpenBSD also states to #include signal.h, it's just
 signal.h includes sys/signal.h and for the function used by dwm
 sys/signal.h is all that is required on OpenBSD. I don't run any other
 systems so if signal.h is more portable then go with it.

for the record:

signal.h is in c89, c99 and various unix/posix standards
sys/signal.h is not

http://www.unix.org/version3/apis/headers.html



Re: [dwm] dwm-5.3

2008-12-09 Thread Szabolcs Nagy
On 12/8/08, Neale Pickett [EMAIL PROTECTED] wrote:
 I sort of like the idea of using X properties.  You could use xprop to

one of the most ununixy interfaces

man XGetWindowProperty



Re: [dwm] Using dwm as a nested manager?

2008-12-06 Thread Szabolcs Nagy
On 12/6/08, Anselm R Garbe [EMAIL PROTECTED] wrote:
 ... However
 what do you miss in dwm that you don't like to manage all windows?

i can think of a few issues:
- java awt bug
- apps with many popup windows
- apps which does not handle resizals correctly (eg matlab uses split
areas in its main window, if you resize the main win the splits change
so you dont want to accidentally resize the matlab main win which
happens when you use tiling wm)
- managing floating wins might be easier in other wms (drag, resize,
close, minimize with only mouse, using gimp in dwm is a pain)
- apps with fullscreen modes (eg if i togglefloating on xpdf,feh.. and
then try to change them to fullscreen then they open a new win which
will be tiled so no fullscreen which is annoying and also means
information loss: the position of the original floating win)
- floating wins are opened at the same position (eg some like their
terminals to be 80x25 so tiling is not good but floating is not usable
either)
- i got a request to open every child of a win with the same tag,
which turns out to be undoable in X



Re: [dwm] What happened to the -i argument?

2008-11-19 Thread Szabolcs Nagy
On 11/19/08, Eyolf Østrem [EMAIL PROTECTED] wrote:
 2. Is there a chance of getting the former mode back again?


you can manually add the strcaseido() matcher from 3.4

http://code.suckless.org/hg/dmenu/file/3.4/dmenu.c#l625



Re: [dwm] How to detect TAG activity?

2008-11-04 Thread Szabolcs Nagy
On 11/4/08, yy [EMAIL PROTECTED] wrote:
 I could do it. I can submit it today or tomorrow, but then I think wmu
 should be included in the hg repository (the script could go inside

i thought xprop can do this (setting the urgency flag of the WM_HINTS
property), but it seems xprop is a fail

+1 for adding it to suckless/programs



Re: [dwm] OT: dwm log from today (Oct 30)

2008-10-31 Thread Szabolcs Nagy
On 10/31/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 can someone please mail me the dwm.log for today. I have a gap there, even
 if I might expect a gap in the log
 I want to know :) Thanks.

what dwm.log?
you mean the mailing list archive? or irc archive?



Re: [dwm] OT: dwm log from today (Oct 30)

2008-10-31 Thread Szabolcs Nagy
On 10/31/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 irc from Oct. 30

http://port70.net/~nsz/dwm-1030.log

i don't see any noteworthy in it though..



Re: [dwm] unsubscribe

2008-10-17 Thread Szabolcs Nagy
try

[EMAIL PROTECTED]

(if you haven't already..)


On 10/17/08, Henrik Holst [EMAIL PROTECTED] wrote:

 --
 Henrik Holst, Sweden  | TYPING IS NO SUBSTITUTE FOR THINKING
 holst CHR(64) matmech.com | - A Manual for BASIC,
   |   Darthmouth College, 1 October 1964





Re: [dwm] Inclusion of DWM Wiki Pages in DWM tarball

2008-09-07 Thread Szabolcs Nagy
On 9/7/08, Amit Uttamchandani [EMAIL PROTECTED] wrote:
 Why not include the DWM wiki pages in a doc/ directory in the source
 tarball? It wouldn't bump up the size significantly and it would greatly
 help a lot of users. I guess one could ask why not just go to the online
 browse the wiki? In my case, I find that I am not online most of the time
 and having the documentation at hand in the tarball is a great reference for
 when I want to configure DWM.

the wiki is a mercurial repository, ie. you can clone the whole wiki
with revision history and browse it offline

the wiki may change more frequently than the dwm releases

the wiki is huge compared to dwm ( 1MB when compressed without history)

the wiki is a completely separate thing, we could include all the
suckless tools in dwm tarball by that logic



Re: [dwm] malloc'ed client in manage()

2008-09-07 Thread Szabolcs Nagy
On 9/6/08, Filippo Erik Negroni [EMAIL PROTECTED] wrote:
 A preferable, safer and more portable way of achieving such initialisation
 is to use the compiler's static initialisation.

is it because of null pointer might not be represented as zeros?

the point is good, but i doubt X would run on such platform ;)



Re: [dwm] malloc'ed client in manage()

2008-09-07 Thread Szabolcs Nagy
On 9/7/08, Nicolas Martyanoff [EMAIL PROTECTED] wrote:
 I think it's quite explicit: the NULL macro expands to 0.

NULL macro does not necessaryly expands to 0, but this is basic
knowledge look it up in the standard.

what am i concerned about is the internal null pointer representation
(which has nothing to do wether NULL is defined 0 or not)

it is explicitely stated in c99 that there might be architectures
where memset(p, 0, sizeof(p)) is not equivalent to p=0;



Re: [dwm] malloc'ed client in manage()

2008-09-07 Thread Szabolcs Nagy
On 9/7/08, Matthias-Christian Ott [EMAIL PROTECTED] wrote:
 Nicolas Martyanoff wrote:

 Does anyone know whether there are architectures where NULL is not equal
 to 0?

this question occasionally appears on comp.lang.c and there exists
such beast, but i cannot find the reference now

probably it's some old or otherwise esoteric architecture

 See ISO/IEC 9899:TC2 Section 7.17.3:

   The macros are NULL which expands to an implementation-defined null
pointer constant and; ...

 See ISO/IEC 9899:TC2 Section 6.3.2.3.3:
   An integer constant expression with the value 0, or such an
expression cast to type void *, is called a null pointer constant.

 Seems like a contradiction in the C99 standard (I have to admit that my
 version is a Committee Draft).

there is no contradiction

'0' can simply mean 2 completely different things: null pointer in
pointer context, or integer 0 otherwise

so a _constant_ integer expression with value 0 automagically becomes
a null pointer which may or may not be represented internally by all
bits zero

(but eg an integer 0 must be represented by all bits zero)

 See ISO/IEC 14882:1998 and ISO/IEC 14882:2003 Section 4.10:
   A null pointer constant is an integer constant expression (5.19)
rvalue of integer type that evaluates to zero.

 See ISO/IEC 14882:1998 and ISO/IEC 14882:2003 Section 18 Footnote 180:
   Possible definitions include 0 and 0L, but not (void *)0.

 And this sounds like a conflict between C and C++.

yes, c++ was developped with this design decision from the start

 But anyhow it seems that you can't do this reliably, because s isn't
 used by memset as a pointer.

 memset(s, 0, sizeof(s));

 where s is a struct.

yes, that's the point: according to standard calloc is not ok, but
default struct initialization is

(but we can overlook this since X won't run such weird architecture)

 According to ISO/IEC 9899:TC2 Section 6.7.8.1 and Section 6.7.8.10 this
 would be correct:

 s = {0}; or s = 0;

 Anyhow it's not working with gcc.

in c99 you initialize a struct to zero with:

struct_t s = {};



Re: [dwm] malloc'ed client in manage()

2008-09-07 Thread Szabolcs Nagy
On 9/7/08, Nicolas Martyanoff [EMAIL PROTECTED] wrote:
 If NULL expands to 0, then basic logic tells me that the null pointer
 constant is 0; if I'm making a logic error, what is it ?

you expect that the symbol '0' means the same for integers and
pointers, but it's not

(as i wrote earlier: integer 0 is 'all-bits-zero', thus memset works,
but pointer 0 is not required to be 'all-bits-zero', it just *happens
to be* 'all-bits-zero' on every sane platform)

 The standard contains ambiguities, everybody knows that; if KR 2 tells

no the standard is very precise about this.

 struct foo bar;
 memset(bar, 0, sizeof(struct foo));

 Will get bar.i == 0, and foo.ptr == NULL.

not guaranteed by the standard



Re: [dwm] malloc'ed client in manage()

2008-09-07 Thread Szabolcs Nagy
On 9/7/08, Matthias-Christian Ott [EMAIL PROTECTED] wrote:
 Does anyone know whether there are architectures where NULL is not equal
 to 0?

see question 1.14:
http://www.lysator.liu.se/c/c-faq/c-1.html#1-14
(last modified in 1994)



Re: [dwm] dwm: request to discuss

2008-08-30 Thread Szabolcs Nagy
On 8/30/08, Chris Monson [EMAIL PROTECTED] wrote:
 On Sat, Aug 30, 2008 at 2:11 AM, Maxim Vuets [EMAIL PROTECTED] wrote:
 2008/8/29, Matthias-Christian Ott [EMAIL PROTECTED]:
  You are using Apache? Shame on you ;). Seriously Apache is definitively
  not suckless.

 (: propose something less sucker, please. I'll take a look.

 lighttpd  - definitely sucks less

try

thttpd
nhttpd
hiawatha



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Martin Hurton [EMAIL PROTECTED] wrote:
   if((rettrans = XGetTransientForHint(dpy, w, trans) == Success))
 - for(t = clients; t  t-win != trans; t = t-next);
 + t = getclient(trans);
nice

what about
-   if((rettrans = XGetTransientForHint(dpy, w, trans) == Success))
+   if((rettrans = XGetTransientForHint(dpy, w, trans)) == Success)



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Martin Hurton [EMAIL PROTECTED] wrote:
 Can you apply the following patch too? According to spec the
 XGetTransientForHint() function returns non zero value on success
 while the Success value is defined as zero (see /usr/include/X11/X.h).

I'm not quite sure about this change.

eg. X reference manual never states explicitly that GrabSuccess is 0
(even though if one reads the X protocol specification he can *guess*
that it should be 0) so the programmer shouldn't rely on this.

but if it's changed then change consistently:
$ grep Success dwm.c |wc -l
6



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Martin Hurton [EMAIL PROTECTED] wrote:
 Those other checks seems ok to me.

what's the difference?

either you assert Success==0, so the identifier 'Success' is not
needed anywhere, or using Success is mandatory

i don't see why would one mix the two.



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Szabolcs Nagy [EMAIL PROTECTED] wrote:
 what's the difference?
ah, never mind
i see what you meant

/me failed



Re: [dwm] [patch] minor cleanups

2008-08-10 Thread Szabolcs Nagy
On 8/4/08, Johannes Hofmann [EMAIL PROTECTED] wrote:
 attached are two minor cleanups. The first simplifies grabkeys()
 similar to grabbuttons().

i've just realized that there is a problem with the patch: numlockmask
is modified but modifiers isn't

void
grabkeys(void) {
unsigned int i, j;
unsigned int modifiers[] = { 0, LockMask, numlockmask, 
numlockmask|LockMask };
KeyCode code;
XModifierKeymap *modmap;

/* init modifier map */
modmap = XGetModifierMapping(dpy);
for(i = 0; i  8; i++)
for(j = 0; j  modmap-max_keypermod; j++) {
if(modmap-modifiermap[i * modmap-max_keypermod + j] ==
XKeysymToKeycode(dpy, XK_Num_Lock))
numlockmask = (1  i);
}
XFreeModifiermap(modmap);

XUngrabKey(dpy, AnyKey, AnyModifier, root);
for(i = 0; i  LENGTH(keys); i++) {
code = XKeysymToKeycode(dpy, keys[i].keysym);
for(j = 0; j  LENGTH(modifiers); j++)
XGrabKey(dpy, code, keys[i].mod | modifiers[j], root, 
True,
 GrabModeAsync, GrabModeAsync);
}
}



Re: [dwm] Help with the tags mask syntax

2008-08-10 Thread Szabolcs Nagy
On 8/11/08, Giorgio Lando [EMAIL PROTECTED] wrote:
 I still do not understand how this relates to tag masks like 1  8 - 1,
 or ~0, which I have seen in some config.h, but I will look to your examples

http://en.wikipedia.org/wiki/Bitwise_operation#Arithmetic_shift
http://en.wikipedia.org/wiki/Bitwise_operation#NOT



Re: [dwm] rationale for resizehints=False?

2008-08-07 Thread Szabolcs Nagy
On 8/7/08, Donald Chai [EMAIL PROTECTED] wrote:
 I have tile set the height of A *precisely* to wh (A-h = wh).
 Resize hints are used for the width (A-w = A-basew + n*A-incw for
 some n such that |A-w - mfact*ww|  A-incw). For B and C, the width
 is set precisely (B-w = ww - A-w), and resize hints are used for
 the height.

 So I believe there is something between all or nothing (i.e.
 something :)), which is to follow resize hints for one dimension
 only. I was just wondering why others would prefer one setting over
 another.


actually resizehint shouldn't matter at all.
if you need it then that's a bug in your application.
adding anything more than a global flag for this is superfluous.



Re: [dwm] Purpose of Monocle Layout

2008-08-04 Thread Szabolcs Nagy
On 8/4/08, Antony Jepson [EMAIL PROTECTED] wrote:
 It is definitely useful on large screens.  At a 1680x1050 resolution, a
 full screen Web browser is a God-send.

wide screen browser? i don't see the point.. may be with scaled up
fonts, otherwise reading lot of text in one line would be hard on the
eyes
..or did you mean 1050x1680?



Re: [dwm] dwm + gkrellm. gkrellm in all tags + apps not over it

2008-08-04 Thread Szabolcs Nagy
On 8/4/08, Anselm R Garbe [EMAIL PROTECTED] wrote:
 Also you might patch dwm.c to leave some space on the right for the
 window, e.g. in updategeom:

 wh-=200;

decreasing window area height would leave space at the _bottom_
ww-=200;
is probably what you meant ;)



Re: [dwm] [patch] minor cleanups

2008-08-04 Thread Szabolcs Nagy
On 8/4/08, Johannes Hofmann [EMAIL PROTECTED] wrote:
 attached are two minor cleanups. The first simplifies grabkeys()
 similar to grabbuttons().
 The second removes isurgent() and isoccupied(). This also means that
 we need to loop over all clients only once in drawbar() now.

looks nice
thanks



Re: [dwm] unsigned int or size_t

2008-07-31 Thread Szabolcs Nagy
On 7/31/08, Filippo Erik Negroni [EMAIL PROTECTED] wrote:
 Hi All,

 I noticed the code in dwm uses unsigned int for positive counters of
 memory arrays instead of size_t.
 Is there a particular reason you don't use size_t in order to convey
 that you are using that quantity as a counter of memory space?

size_t is an unsigned intergal type so using unsigned int, while not
the best chioce there, is not extremely bad either.
(it only matters if we manage memory larger than SIZE_MAX or UINT_MAX,
actually c78 (KR book) didn't have size_t, the standardization
comittee added it for portability reasons)

i guess it's mainly for clarity: one _cannot_ use size_t consistently
[in c89] (eg what is the type of (size_t)a-(size_t)b, or what is a
size_t integer literal 123UL ?), also then one should start indexing
char* arrays with size_t (since it might be larger than int) and use
ptrdiff_t where applicable and where we require 16 bit (tagmask) there
we should use uint_fast16_t (c99), not to mention bools. [in c89 one
cannot even print a size_t value with printf! (except casting it to
unsigned long, but that's not guaranteed to work either) c99 added %z
to the already bloated format string rules..]

morale of the story:
the c integer type system is not strong enough to add hints about
which int is used in which context and how, or to write absolutely
architecture independent code.

the good news is:
usually we don't want to do that (adding hints just makes the code
less readable and applications has a very restricted audience eg. dwm
doesn't want to be more portable than X)



Re: [dwm] Coding styles

2008-07-31 Thread Szabolcs Nagy
i too tired to comment on every rule

On 7/31/08, Anselm R Garbe [EMAIL PROTECTED] wrote:
 #define UINT unsigned int

 and that looks better to me. The problem with doing

 typedef unsigned int uint;

 is, that uint might be typedef'd already on some system, but maybe not on

yes, but one should not do the same with pointers or bad things will happen
http://c-faq.com/decl/typedefvsdefine.html


 System specific calls

 Well not every platform supports POSIX, I'd really like to see a decent and
 simple portable OS abstraction library, which supports nearly all platforms,
 from Unix, Windows, WinCE to Symbian ;) That would make my current business
 life a lot easier.

+1
(main reason i started using highlevel language like python)


 Dont include more than once
 Use #ifndef _INCLUDE_FOO_H_ ; #define _INCLUDE_FOO_H_ to avoid including
 the same file twice.

 I hate this rule.  Good software should not need these hacks (or
 #pragma once as alternative).
 It is a sign that something is seriously broken, if you include a header
 file
 multiple times, and you should refactor it. This is no issue for dwm, but
 you
 will notice that all wmii-related projects aren't affected by this issue.

imho these include protectors are unavoidable if one writes lib code.



Re: [dwm] Coding styles

2008-07-31 Thread Szabolcs Nagy
On 7/31/08, pancake [EMAIL PROTECTED] wrote:
 Yeah, eclipse is a very standard tool. Using ANT is far more better than
 using make. IMHO make is also a weird tool that should be replaced

from ant manual:
'Makefiles are inherently evil as well. Anybody who has worked on them
for any time has run into the dreaded tab problem. Is my command not
executing because I have a space in front of my tab?!! said the
original author of Ant way too many times.'

i wouldn't trust my code to someone who cannot tell the difference
between spaces and tabs ;)

probably the only advantage ant has over make, is that all its
implementations are consistent (mainly because it has only one
implementation and gnu vs bsd vs.. makes are too different and posix
does not help there either)

as soon as the build tool knows about the os and file types, it turns
into a horrid monster that wants to know everything better than you.

the pleasure of editing xml build files is just an extra service
apache ant can provide.



Re: [dwm] DWMII layout for DWM 5.1, a better integration !!!

2008-07-30 Thread Szabolcs Nagy
On 7/30/08, QUINTIN Guillaume [EMAIL PROTECTED] wrote:
 The only modification is within the Client struct and holds in 11
 chars : int dwmii;\n. This modification prevents from having a more

yes the dwm config.h api is that powerful :)

i'd put all the layout code in a separate file though, and only
include that .c in config.h so the layout could be enabled/disabled
easily, and the patch would be really one extra int in the client
struct (+ possibly a layout entry in config.def.h).



Re: [dwm] save cpu cycles - bar status and wrapper scripts

2008-07-30 Thread Szabolcs Nagy
On 7/30/08, Kurt H Maier [EMAIL PROTECTED] wrote:
 static const char *barcmd[]  = { /path/to/script  /path/to/pipe, NULL };

SHCMD(/path/to/script  /path/to/pipe) macro should be used there

(so the '' is interpreted by the shell)



Re: [dwm] Being not so elitist

2008-07-29 Thread Szabolcs Nagy
On 7/29/08, Anselm R Garbe [EMAIL PROTECTED] wrote:
 Hi,

 2008/7/29 markus schnalke [EMAIL PROTECTED]:
This keeps its userbase small and elitist. No novices asking
 stupid
questions.

 Well, I removed this statement, now. It was on purpose 2 years ago,
 though. It wasn't intended as offense, however.

 I might restore this statement, if a new user shows up proposing or
 asking for a configuration file format.

I see how it can be offensive, however there is a message there which
is important to the suckless philosophy/mission.

1.) dwm favours those who can appreciate (or even admire) the nice
code of it and not those who cry when some multi-foobar-application
does not integrate well in the statusbar automagically.

2.) .h config because it is elitist and _fun_ for a c programmer
(apart from other technical reasons..)

3.) projects where the code cleanness and simplicity is the main
concern are extremely rare, most ppl don't even understand why is it
important. we find this fact sad and this should be emphasized.

4.) dwm can be used by the masses, it is quite usable actually, but
those who expect the usual trendy approach will be disappointed. they
should be warned!

well most of it is already in /common/, but i liked the way it was stated there.



Re: [dwm] Being not so elitist

2008-07-29 Thread Szabolcs Nagy
On 7/29/08, Antony Jepson [EMAIL PROTECTED] wrote:
 I say keep the sentence on the dwm homepage.  It makes a statement and a
 clear one at that.

reading back the thread, the wording could be softer to offend less ppl

s/No novices asking stupid questions/No novices asking silly questions/

according to my politically-correctness-meter this should be
acceptable for most (ignorant|whiny|..) ppl



Re: [dwm] horitzontal split layout

2008-07-20 Thread Szabolcs Nagy
On 7/20/08, pancake [EMAIL PROTECTED] wrote:
 if (n)
 for(i = 0, c = nexttiled(clients); c; c = nexttiled(c-next),i++)
 resize(c, 0, (showbar?bh:0) + ((wh/n)*i), ww-(c-bw1),
 (wh/n)-(c-bw1),0);

instead of showbar?: use wy

bw1 is an overkill optimization after you caluculating the same
division (wh/n) n times and any compiler would know how to optimize
2*bw, of course this doesn't matter much just aestetics

on a vertical monitor i usually like one horizontal split + vertical
spliting in the bottom stack area (as in bottom stack patch), but this
makes sense too, so it can be added to /dwm/patches



Re: [dwm] Border on fullscreen WINE apps and tag masks

2008-07-18 Thread Szabolcs Nagy
On 7/18/08, Antoni Grzymala [EMAIL PROTECTED] wrote:
 xprop reads as follows:

 WM_CLASS(STRING) = stalonetray, stalonetray

 [...]

 Hi, I came across a similar bug today, when xconsole and a tiny tcl/tk
 would not be subject to tagging rules in current hg tip based upon the
 WM_CLASS, even though this worked perfectly since the inception of dwm
 basically (arg, I think there's a bug lurking around).

according to xlib documentation the first string is the 'instance' and
the second is 'class' there
(dwm uses different method from xprop to query this property though,
xlsclients -l uses the same but it shouldn't matter)



Re: [dwm] Border on fullscreen WINE apps and tag masks

2008-07-17 Thread Szabolcs Nagy
On 7/18/08, Alex Matviychuk [EMAIL PROTECTED] wrote:
 1.) In the config.def.h file for DWM 5.0.1 there is a Tag Mask field
 and I'm not quite sure how to use. When I start up DWM I have
 stalonetray launch from .xinitrc and I'd like it to go to my 4th tag.
 What is the best way to do this?

tag mask is interpreted in binary
if the nth bit==1 then the nth tag is selected otherwise not.
(rightmost bit is the 0th)

in C ' n' is left shift by n, which adds zeros from right, so 14
is 1 in binary
(the 4th bit set thus 5th tag is selected (counting tags from 1))
(selecting more tags can be done like (14)|(16) or ~0 means all tags)

use the xprop command and select the stalonetray window to see
the window class or name (you should use a substring of it in the rule).

to answer your question, you'll need something like
 /* class  instancetitle   tags mask isfloating */
 { Stalone,  NULL,   NULL,   1  3,   False },
(rule strings are case sensitive!)

 2.) I enjoy the occasional old game through WINE, but when I start up
 a game and it goes fullscreen, there is a border around the window and
 a little bit of the game window is hidden. Not a big deal, but is
 there a way to fix this?

does it occure with floating layout as well?
if not then try to set the wine window floating in the rules.



Re: [dwm] little bug

2008-07-02 Thread Szabolcs Nagy
On 7/2/08, QUINTIN Guillaume [EMAIL PROTECTED] wrote:
 A little bug I found, so I fixed it !

this is the dwm ml, there is a wmii ml as well



Re: [dwm] little bug

2008-07-02 Thread Szabolcs Nagy
On 7/2/08, Szabolcs Nagy [EMAIL PROTECTED] wrote:
 On 7/2/08, QUINTIN Guillaume [EMAIL PROTECTED] wrote:
 A little bug I found, so I fixed it !

 this is the dwm ml, there is a wmii ml as well

oh sorry i misread (..wmii.diff confused me)

..so this is a dwm patch



Re: [dwm] [OT] Which dragon book: red or green?

2008-06-29 Thread Szabolcs Nagy
On 6/29/08, Hugo Tavares Reis [EMAIL PROTECTED] wrote:
 the red one.

 -htr


 On 6/28/08, markus schnalke [EMAIL PROTECTED] wrote:

  (I dont want the newest one from 2006.)


what's wrong with the purple one?



Re: [dwm] dwm exits with segm fault after last compile

2008-06-22 Thread Szabolcs Nagy
On 6/21/08, Leandro Chescotta [EMAIL PROTECTED] wrote:
 1) get mplayer working right in dwm, i get a tiled mplayer window when
 i understand that it must be in the floating layer, and if i press f
 for fullscreen i get it fullscreen but below the other apps not in top
 off all

for me fullscreen works for tiled mplayer as well (but then becomes floating)

 static Rule rules[] = {
 /* class  instancetitle   tags mask isfloating */
 { mplayer,  NULL,   NULL,   0,True },

use
s/mplayer/MPlayer/

(you can use xprop to get the proper spelling)



Re: [dwm] dwm-5.0.1

2008-06-22 Thread Szabolcs Nagy
On 6/22/08, Arun G Nair [EMAIL PROTECTED] wrote:
 So to summarize, when you alt+space when in tile mode it goes to the
 last floating mode (monocle or float) used. Is it the intended
 behavior  ?

mod + space is setlayout(0) in config.def.h which seems to toggle the
last bit of the selected layout index:

 setlayout(const Arg *arg) {
 if(!arg || !arg-v || arg-v != lt[sellt])
 sellt ^= 1;

i don't quite understand the intention behind this though..



Re: [dwm] Need a small image resize program

2008-06-13 Thread Szabolcs Nagy
On 6/13/08, markus schnalke [EMAIL PROTECTED] wrote:
 I feel the need for a image resize program that matches the
 Unix and suckless philosophy.

image resize is a non-trivial task
(there are many possible filters with different characteristics)

also saving an image in a lossy format (.jpg) will require compression
level settings (or adaptive estimation of the required settings)

 Does anyone know a small program that can resize JPEG and PNG images?

netpbm package has pnmscale but the resulting jpg/png won't be as nice
as with 'convert resize'

otherwise yes, imagemagick is not suckless



Re: [dwm] [patch] spawn without shell

2008-06-09 Thread Szabolcs Nagy
On 6/9/08, Peter Hartlich [EMAIL PROTECTED] wrote:
 Though if it is really sh that is used (and not bash etc.), there

no
currently getenv(SHELL) is used



[dwm] textnw fix

2008-06-08 Thread Szabolcs Nagy
XTextWidth returns int and now in most places textnw is used as int
thus i propose
-uint textnw
+int textnw

(it adds 2 LOCs without much gain though..)
diff -r c4152a0199c8 dwm.c
--- a/dwm.c Fri Jun 06 11:49:31 2008 +0200
+++ b/dwm.c Sun Jun 08 09:28:25 2008 +0200
@@ -166,7 +166,7 @@
 void setup(void);
 void spawn(const void *arg);
 void tag(const void *arg);
-uint textnw(const char *text, uint len);
+int textnw(const char *text, uint len);
 void tile(void);
 void togglebar(const void *arg);
 void togglefloating(const void *arg);
@@ -296,7 +296,8 @@
 
 void
 buttonpress(XEvent *e) {
-   uint i, x, mask;
+   uint i, mask;
+   int x;
Client *c;
XButtonPressedEvent *ev = e-xbutton;
 
@@ -1308,7 +1309,8 @@
 
 void
 setup(void) {
-   uint i, w;
+   uint i;
+   int w;
XSetWindowAttributes wa;
 
/* init screen */
@@ -1413,7 +1415,7 @@
}
 }
 
-uint
+int
 textnw(const char *text, uint len) {
XRectangle r;
 


Re: [dwm] patch from pkgsrc

2008-06-04 Thread Szabolcs Nagy
On 6/4/08, pancake [EMAIL PROTECTED] wrote:
 so? adding so many flags (-std -pedantic, ... makes it less portable
 (for other compilers), so i will encourage to use ?= instead of = for
 this kind of options.

seems standard posix make doesn't have ?= (gnu and bsd make has it though..)



Re: [dwm] tile bug if window has size of screen

2008-05-31 Thread Szabolcs Nagy
On 5/31/08, Johannes Hofmann [EMAIL PROTECTED] wrote:
 in tip I see a weirdness whenever a new client has exactly the size
 of the screen. On my laptop e.g.
 xpdf -geometry 1400x1050
 makes the tiled layout go crazy. bisect shows that 941bd7c15a32
 introduced this behaviour.

i can confirm it



Re: [dwm] Bottom Stack for 4.9

2008-05-29 Thread Szabolcs Nagy
On 5/29/08, Jonny Gerold [EMAIL PROTECTED] wrote:
 Which one? The 4.7 or the 5.0 patch, because I think I tried both, and
 neither worked for me? How did you patch it?

you don't need to patch dwm to get bottomstack for quite some time now.

you need to write a layout function.

the layout api changed between each version so solution for 4.7 won't
work with 4.8



Re: [dwm] way towards 5.0

2008-05-22 Thread Szabolcs Nagy
On 5/22/08, Johannes Hofmann [EMAIL PROTECTED] wrote:
 while true
 do
 echo temp $((`sysctl -n hw.acpi.thermal.tz0.temperature`/10-273))°C
  batt `sysctl -n hw.acpi.battery.life`%
 sleep 1
 done | while true; do
   dwm
 done

this way the information in the statusbar is outdated (by 1 second)
so
sleep 1
echo ..
gives more up to date status info ;)



Re: [dwm] way towards 5.0

2008-05-22 Thread Szabolcs Nagy
On 5/22/08, Szabolcs Nagy [EMAIL PROTECTED] wrote:
 this way the information in the statusbar is outdated (by 1 second)
ah sorry
this is bullshit
never mind



Re: [dwm] using bitaray for tags (PATCH)

2008-05-22 Thread Szabolcs Nagy
On 5/22/08, David Tweed [EMAIL PROTECTED] wrote:
 #define TAGMASK ((int)((1LL  LENGTH(tags) + 1) - 1))

 Incidentally, I think in the alphabet soup misdesign of C numeric
 constants, I suspect the code probably wants 1ULL and given long long
 is 64-bits and int is 32-bit on most 64-bit Linux platforms I don't
 understand the cast here.

imho the LL (and the + 1 ?) is not needed

i guess the purpose of the LL here was to make sure it works for the
all ones case
(so it was enough that long long has at least one more bits than int,
the signedness does not matter)

..but (if eg int is 32 bit and we have 32 tags then) 132 is 0, and
-1 is all ones in binary (guaranteed by the c standard)



Re: [dwm] using bitaray for tags (PATCH)

2008-05-21 Thread Szabolcs Nagy
On 5/21/08, Enno Gottox Boland [EMAIL PROTECTED] wrote:
  the (1  tagnum) in rules is a bit nasty
  it is probably nicer to do the shifting in setup();
 you mean in applyrules? - No I don't think so. It adds much more
 flexibility. You can define bitmasks as 0b10001 to tag a client to the
 first and the fifth tag or you can use ~0 to make it sticky.

i see

(it would be so nice if c had 0bXXX binary int literals..)

  instead of
   i  LENGTH(tags)  i  sizeof(int) * 8;
  what about checking once
   if(LENGTH(tags)  sizeof(int) * CHAR_BIT)
  eprint(Maximum number of tags: %d\n, sizeof(int) * CHAR_BIT);
  in setup();
 The problem about this is it denies users from using one config.h with
 many tags on different architectures. Furthermore I wouldn't check

i thought LENGTH(tags)  INT_BIT does not make sense, but in that case it's ok

probably limiting LENGTH(tags) to 16 is better (simpler, without too
much compromise (i doubt anyone uses more than 16 tags or X on an
architecture with less int bits))

 this at runtime but at compiletime. (maybe we can use #warning as
 compromise)

sizeof(type) is not expanded in the preprocessor so
 #if LENGTH(tags)  INT_BIT
 #error too many tags..
 #endif
doesn't work (so compiletime check with compiler warning/error is not
possible (imho))

 Anyway, the CHAR_BIT constant is a good idea.

it's a bit paranoid, but more conform ;)



Re: [dwm] using bitaray for tags (PATCH)

2008-05-21 Thread Szabolcs Nagy
On 5/21/08, markus schnalke [EMAIL PROTECTED] wrote:
 I read, that bit-arrays are not very portable between different
 architectures. (It was in The practice of programming, I think)

it's not exactly a bit array (arbitrary number of bits implemented eg.
as char array), it's only one int (with bit flags)

this is portable (a possible caveat is that some bit operations on
negative values are implementation defined by c89 (eg. -1  1) so
unsigned int is recommended in those cases)



Re: [dwm] Freedom (was: Re: sic ipv6 patch)

2008-05-20 Thread Szabolcs Nagy
On 5/20/08, hiro [EMAIL PROTECTED] wrote:
 What do you think about the freedom to remove the freedom from the code?
 cut any other's freedom. On the other hand everyone could use your
 code, and noone would even notice. It does *no* harm to others.

sure it does
if i start selling dwm for money then it can make harm (economically
and game theoretically)

 I could understand if you were fighting for real freedom, but this is
 an imaginary fight about intellectual nonsense.

i don't get your point here

there are many possible attitudes and strategies with respect to
software licensing and it's absolutely not trivial which one to chose
to achieve a goal (or which goal to prefer).

eg. GPL is one possibility which were discussed.

it is perfectly justified to talk and reason about the consequences of
certain licensing schemes.

 Code has no freedom. people in society want to be free, but the code
 doesn't mind. It is just letters and stuff. neither free nor unfree.

imho noone talked abut the freedom of code but the freedom of people
using that code.



Re: [dwm] Freedom (was: Re: sic ipv6 patch)

2008-05-20 Thread Szabolcs Nagy
On 5/20/08, Kurt H Maier [EMAIL PROTECTED] wrote:
 (eg. allowing to kill is more free by your definition (less
 restrictions), but if we care about consequences then it's less free
 (it may pose much more restrictions on the possibilities of an
 individual))

 This is a specious analogy.  When you kill someone you permanently
 remove them from the population.  Compiling a binary and releasing it
 without providing source does not remove the source code from the
 public grasp.

you missed my point
the analogy is to show that removing a restriction may cause more
restriction globally in some way (which also shows the flaw in your
interpretation of freedom)

i thougth this was trivial, but here is a less abstract analogy:
- remove restriction 'copyright notice should be included'
- one can sell dwm, with different copyright notice
- he may restrict * (include some evil, anti-freedom restrictrions here)
- ppl won't know about original source because it's not named, so they
will face evil restrictions
- restrictions == less freedom
- so removing restriction might mean less freedom

 There is in fact near-universal agreement on the exact meaning of the
 term.  You, and certain members and employees of the FSF, have
 deviated from that meaning.  This doesn't make the original meaning
 less valid; nor does it make your revised edition more valid.  You're

i talked about freedom more generally (not just software freedom)

when defining the term freedom provided by a ruleset the level of
inclusion of consequences is an inherent problem.
it has nothing to do with FSF.

 it to describe a copyright license that imposes restrictions on
 people, it's a clear case of obfuscating reality for political
 purposes, and it's disingenuous.  It's also not a very good way to get
 people on your side.

i think it's a matter of terminology
but even regarding it as philosophical question it should have nothing
to do with politics or one's side

 Personally, I'd like to see copyright law abolished entirely.  The
 entire concept of licensing is distasteful to me, but that's the world
 we live in.

i agree.
it would be nice if every code were in public domain so noone should
care about licensing.



Re: [dwm] more consistent codestyle patch

2008-05-14 Thread Szabolcs Nagy
On 5/14/08, Diego Biurrun [EMAIL PROTECTED] wrote:
 used spaces to achieve this which is wrong

 You have an interesting concept of wrong.  It was certainly intentional.

 no (it was consistently tab only indenting in most places)

 It was consistently aligned with the help of tabs and spaces.  You have
 undone that in your patch.

no and yes

ok it was a misunderstanding

i asked arg if it's right to make style cleanup and also asked him if
i should **use spaces everywhere in case of indented wraps because
imho that's the right way to do it (in most places the code uses tabs
for this)**

he said that he prefered tabs everywhere so i cleaned up the code with
this in mind (== spaces are wrong there)

now i see he misunderstood my intentions, but at least now everyone
agrees on the style ;)



[dwm] more consistent codestyle patch

2008-05-13 Thread Szabolcs Nagy
simple modifications (whitespce, line wrapping)
diff -r f939086fa41d dwm.c
--- a/dwm.c	Tue May 13 11:27:20 2008 +0100
+++ b/dwm.c	Tue May 13 14:03:20 2008 +0200
@@ -595,7 +595,7 @@ drawtext(const char *text, unsigned long
 	x = dc.x + (h / 2);
 	/* shorten text if necessary */
 	for(; len  (w = textnw(buf, len))  dc.w - h; len--);
-	if (!len)
+	if(!len)
 		return;
 	if(len  olen) {
 		if(len  1)
@@ -782,21 +782,21 @@ grabbuttons(Client *c, Bool focused) {
 	int i, j;
 	unsigned int buttons[]   = { Button1, Button2, Button3 };
 	unsigned int modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask,
-	 MODKEY|numlockmask|LockMask} ;
+MODKEY|numlockmask|LockMask} ;
 
 	XUngrabButton(dpy, AnyButton, AnyModifier, c-win);
 	if(focused)
 		for(i = 0; i  LENGTH(buttons); i++)
 			for(j = 0; j  LENGTH(modifiers); j++)
 XGrabButton(dpy, buttons[i], modifiers[j], c-win, False,
-BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
+	BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
 	else
 		XGrabButton(dpy, AnyButton, AnyModifier, c-win, False,
-		BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
+			BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
 }
 
 void
-grabkeys(void)  {
+grabkeys(void) {
 	unsigned int i, j;
 	KeyCode code;
 	XModifierKeymap *modmap;
@@ -1041,7 +1041,7 @@ monocle(void) {
 	Client *c;
 
 	for(c = clients; c; c = c-next)
-		if((lt-isfloating || !c-isfloating)   isvisible(c, NULL))
+		if((lt-isfloating || !c-isfloating)  isvisible(c, NULL))
 			resize(c, wx, wy, ww - 2 * c-bw, wh - 2 * c-bw, RESIZEHINTS);
 }
 
@@ -1055,7 +1055,7 @@ movemouse(Client *c) {
 	ocx = nx = c-x;
 	ocy = ny = c-y;
 	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
-			None, cursor[CurMove], CurrentTime) != GrabSuccess)
+	None, cursor[CurMove], CurrentTime) != GrabSuccess)
 		return;
 	XQueryPointer(dpy, root, dummy, dummy, x1, y1, di, di, dui);
 	for(;;) {
@@ -1221,7 +1221,7 @@ resizemouse(Client *c) {
 	ocx = c-x;
 	ocy = c-y;
 	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
-			None, cursor[CurResize], CurrentTime) != GrabSuccess)
+	None, cursor[CurResize], CurrentTime) != GrabSuccess)
 		return;
 	XWarpPointer(dpy, None, c-win, 0, 0, 0, 0, c-w + c-bw - 1, c-h + c-bw - 1);
 	for(;;) {
@@ -1351,7 +1351,7 @@ scan(void) {
 	if(XQueryTree(dpy, root, d1, d2, wins, num)) {
 		for(i = 0; i  num; i++) {
 			if(!XGetWindowAttributes(dpy, wins[i], wa)
-	|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], d1))
+			|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], d1))
 continue;
 			if(wa.map_state == IsViewable || getstate(wins[i]) == IconicState)
 manage(wins[i], wa);
@@ -1360,7 +1360,7 @@ scan(void) {
 			if(!XGetWindowAttributes(dpy, wins[i], wa))
 continue;
 			if(XGetTransientForHint(dpy, wins[i], d1)
-	 (wa.map_state == IsViewable || getstate(wins[i]) == IconicState))
+			 (wa.map_state == IsViewable || getstate(wins[i]) == IconicState))
 manage(wins[i], wa);
 		}
 	}
@@ -1479,8 +1479,8 @@ setup(void) {
 	wa.event_mask = ButtonPressMask|ExposureMask;
 
 	barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen),
-CopyFromParent, DefaultVisual(dpy, screen),
-CWOverrideRedirect|CWBackPixmap|CWEventMask, wa);
+			CopyFromParent, DefaultVisual(dpy, screen),
+			CWOverrideRedirect|CWBackPixmap|CWEventMask, wa);
 	XDefineCursor(dpy, barwin, cursor[CurNormal]);
 	XMapRaised(dpy, barwin);
 	strcpy(stext, dwm-VERSION);
@@ -1704,7 +1704,6 @@ unmapnotify(XEvent *e) {
 
 void
 updatebar(void) {
-
 	if(dc.drawable != 0)
 		XFreePixmap(dpy, dc.drawable);
 	dc.drawable = XCreatePixmap(dpy, root, bw, bh, DefaultDepth(dpy, screen));
@@ -1839,7 +1838,7 @@ xerror(Display *dpy, XErrorEvent *ee) {
 	|| (ee-request_code == X_CopyArea  ee-error_code == BadDrawable))
 		return 0;
 	fprintf(stderr, dwm: fatal error: request code=%d, error code=%d\n,
-		ee-request_code, ee-error_code);
+			ee-request_code, ee-error_code);
 	return xerrorxlib(dpy, ee); /* may call exit */
 }
 


Re: [dwm] more consistent codestyle patch

2008-05-13 Thread Szabolcs Nagy
On 5/13/08, Diego Biurrun [EMAIL PROTECTED] wrote:
 On Tue, May 13, 2008 at 02:05:27PM +0200, Szabolcs Nagy wrote:
  simple modifications (whitespce, line wrapping)

 U...
 All of this looks like code uglification to me...

well imho consistent code style is better than inconsistent
especially if the inconsistency does not serve any purpose

i don't want you to worry about it too much so here is an explanation
of the patch:

1) removed accidental double spaces eg.:
-grabkeys(void)  {
+grabkeys(void) {

2) consistent whitespace in selection/iteration statements eg:
-   if (!len)
+   if(!len)

3) use tabs for identation (even for line wraps because arg prefers this way):
XGrabButton(dpy, AnyButton, AnyModifier, c-win, False,
-   BUTTONMASK, GrabModeAsync, GrabModeSync, None, 
None);
+   BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);

4) no extra indentation if the conditional expression of a statement wraps:
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, 
GrabModeAsync,
-   None, cursor[CurResize], CurrentTime) != GrabSuccess)
+   None, cursor[CurResize], CurrentTime) != GrabSuccess)


most of the code already followed these rules and i did not see any
reason not to follow them in the specific cases.

of course i am open to any comment about these style rules



Re: [dwm] more consistent codestyle patch

2008-05-13 Thread Szabolcs Nagy
one more little patch
please review
diff -r 33ba827ee84e dwm.c
--- a/dwm.c	Tue May 13 14:33:02 2008 +0100
+++ b/dwm.c	Tue May 13 19:01:59 2008 +0200
@@ -504,7 +504,7 @@
 detachstack(Client *c) {
 	Client **tc;
 
-	for(tc=stack; *tc  *tc != c; tc=(*tc)-snext);
+	for(tc = stack; *tc  *tc != c; tc = (*tc)-snext);
 	*tc = c-snext;
 }
 
@@ -1162,8 +1162,7 @@
 
 		/* adjust for aspect limits */
 		if(c-minax != c-maxax  c-minay != c-maxay 
-		 c-minax  0  c-maxax  0  c-minay  0  c-maxay  0)
-		{
+		 c-minax  0  c-maxax  0  c-minay  0  c-maxay  0) {
 			if(w * c-maxay  h * c-maxax)
 w = h * c-maxax / c-maxay;
 			else if(w * c-minay  h * c-minax)
@@ -1532,7 +1531,7 @@
 	if(!sel)
 		return;
 	for(i = 0; i  LENGTH(tags); i++)
-		sel-tags[i] = (NULL == arg);
+		sel-tags[i] = (arg == NULL);
 	sel-tags[idxoftag(arg)] = True;
 	arrange();
 }


[dwm] dijkstra quote

2008-05-07 Thread Szabolcs Nagy
a dijkstra quote [1] i've just stumbled upon and would like to share:

The practice is pervaded by the reassuring illusion that programs are
just devices like any others, the only difference admitted being that
their manufacture might require a new type of craftsmen, viz.
programmers. From there it is only a small step to measuring
programmer productivity in terms of number of lines of code
produced per month. This is a very costly measuring unit because it
encourages the writing of insipid code, but today I am less interested
in how foolish a unit it is from even a pure business point of view.
My point today is that, if we wish to count lines of code, we should
not regard them as lines produced but as lines spent: the current
conventional wisdom is so foolish as to book that count on the wrong
side of the ledger.


[1]: http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1036.html



Re: [dwm] snapping bugs with multiple screens

2008-05-05 Thread Szabolcs Nagy
On 5/5/08, Matthias-Christian Ott [EMAIL PROTECTED] wrote:
 Let's do a poll!

you meant technical discussion

this is not fashion or politics



[dwm] hg tip minor modification proposals

2008-05-05 Thread Szabolcs Nagy
1 unnecessary space after Layout definition
2 some may need lt in their config (eg i use lt-isfloating in my
pushup/down algo)

--- a/dwm.c Mon May 05 20:06:43 2008 +0200
+++ b/dwm.c Mon May 05 20:26:51 2008 +0200
@@ -112,7 +112,7 @@
const char *symbol;
void (*arrange)(void);
Bool isfloating;
-} Layout;
+} Layout;

 typedef struct {
const char *class;
@@ -244,10 +244,12 @@
 Window root, barwin;

 /* configuration, allows nested code to access above variables */
+Layout layouts[];
+Geom geoms[];
+Layout *lt = layouts;
+Geom *geom = geoms;
 #include config.h
 #define TAGSZ (LENGTH(tags) * sizeof(Bool))
-Layout *lt = layouts;
-Geom *geom = geoms;



Re: [dwm] snapping bugs with multiple screens

2008-05-05 Thread Szabolcs Nagy
On 5/5/08, Matthias-Christian Ott [EMAIL PROTECTED] wrote:
 I want commented votes (as previously illustrated by example).

-1

i personally don't use multihead
keep the code clean



Re: [dwm] [OT] minimalistic bbs/forum

2008-04-11 Thread Szabolcs Nagy
On 4/11/08, Antoni Grzymala [EMAIL PROTECTED] wrote:
 Don't touch PHP even with a stick. It gives you intestine cancer and

agreed

 There's a minimalist Ruby on Rails forum called beast[1].

don't touch ruby on rails with a stick if you need minimalistic code


...and become a webless friend if you can
http://port70.net/webless/



Re: [dwm] dmenu, slock patches; slock DPMS crash

2008-04-10 Thread Szabolcs Nagy
On 4/9/08, Anselm R. Garbe [EMAIL PROTECTED] wrote:
  What is the problem with `sort | uniq'.
  Okay, it may be a bit slower, but beside that ...?

 There is no problem apart this. So if sort -u works with wmii as
 well, I see no reason to use | uniq.

actually 'sort | uniq' is not (much) slower
(at least i couldn't measure any difference on my linux setup)



Re: [dwm] Monocle question

2008-04-04 Thread Szabolcs Nagy
On 4/4/08, Dashing [EMAIL PROTECTED] wrote:
 Hi

 I use monocle mode a lot, but I don't like how dialog boxes get
 maximized.

 I noticed two versions for going through the clients exist:
 * for(c = clients; c; c = c-next)
 * for(c = nexttiled(clients); c; c = nexttiled(c-next))

 Why does monocle use the first and not the second?

the idea was to use monocle as togglemax() which should work on
floating clients as well

imho monocle is a perfectly valid layout, not just as a temporary
maximize in which case the second is more apropriate (i use it that
way too)



Re: [dwm] Monocle question

2008-04-04 Thread Szabolcs Nagy
On 4/4/08, Antoni Grzymala [EMAIL PROTECTED] wrote:
 Anselm R. Garbe dixit (2008-04-04, 11:35):

  Well what about having monocle work like this:
 
  just only raise and display the focused client in the monocle
  area, and restore the previous dimensions everytime a new client
  is focused? But still working on all clients of course.

 I think we all thought this is what monocle should be like in the first
 place :).

no
(at least i use it differently since 3.x)

i use monocle in fullscreen and permanently
so only one tiled client is visible (no need to restore any
dimensions) the floating windows are floating (i don't want ocassional
popup windows to obscure the whole screen not to mention gimp and
friends)

i use 1-3 tiled clients per tag in which case view one at a time
monocle layout works just fine



Re: [dwm] A rather radical thought

2008-04-02 Thread Szabolcs Nagy
On 4/2/08, Anselm R. Garbe [EMAIL PROTECTED] wrote:
 What about getting rid of supporting the selection of multiple

\o/

 tags at a time and celebrating the revival of the column layout
 of wmii again in dwm 5.0? What about getting rid of all the tiled
 layout flavors in favor for the column layout?

that's radical indeed
but sounds cleaner than the current solution so
+1



Re: [dwm] horizontal/vertical tiling behaviour

2008-03-21 Thread Szabolcs Nagy
On 3/21/08, Anthony Brown [EMAIL PROTECTED] wrote:
 pressing mod-h the tiling toggles between horizontal and vertical. The
 same can be done with mod-v. From the function names in config.h I
 assume this is not the intended behaviour?

intended: allows to toggle between current and last layout

i find it non-intuitive though



Re: [dwm] a lone client could be borderless

2008-03-21 Thread Szabolcs Nagy
On 3/21/08, markus schnalke [EMAIL PROTECTED] wrote:
 But anyway, special corner case handling leads to bad code. It
 conflicts with generality, which is one of the design principles.

if you look into the code then you will realise that the 'one tiled
client' case is handled specially anyway
(there is a 'if (--n==0)' branch)

in my setup if (n == 1) then layout falls back to monocle (which is borderless)



Re: [dwm] found a nice way to do the setgeom stuff

2008-03-19 Thread Szabolcs Nagy
On 3/19/08, Anselm R. Garbe [EMAIL PROTECTED] wrote:
 The problem is:

 void
 configurenotify(XEvent *e) {
 XConfigureEvent *ev = e-xconfigure;

 if(ev-window == root  (ev-width != sw || ev-height != sh)) {
 sw = ev-width;
 sh = ev-height;
 setgeom(NULL);
 }
 }

 This event handler is invoked whenever X changes the screen
 resolution dynamically. So for the case of
 shrinkmaster/growmaster being the current geometry this means,
 that the master area will shrink/grow whenever the
 screen resolution is changed dynamically.

what's wrong with

void growm(const char *arg) {
mw += 20;
}

?



  1   2   >