Re: [dev] dwm: suckless way to monitor work hours

2009-09-01 Thread v4hn
ev'ning,

Nice idea!
I'm definitly interested in that project, so please report further progress.


v4hn


pgpNadfWQRjtq.pgp
Description: PGP signature


Re: [dev] Re: Local vs global variables

2009-11-08 Thread v4hn
On Fri, Nov 06, 2009 at 09:18:50PM +0100, QUINTIN Guillaume wrote:
> > Was that someone Niklaus Wirth? ... oh, I forgot: He would not
> > recommend any C at all. ;-)
> 
> No he is my boss at my work, we were discussing, and I said that
> sometimes I use global variables and everybody laughed at me.

That just reminded me of an old xkcd comic :)
http://xkcd.com/154/


v4hn


pgpEKCGSloach.pgp
Description: PGP signature


Re: [dev] simple portscanner

2010-01-02 Thread v4hn
ev'ning everyone,

i got some obscure behaviour of gcc/icc over here,
is there anyone able to tell my why this happens/works?

> v4hn 18:52:19 ~/repos/netscan $ gcc -lpthread -lpcap *.o -o portscan
network.o: In function `default_device':
network.c:(.text+0x5d5): undefined reference to `pcap_lookupdev'
scan.o: In function `setupfilter':
scan.c:(.text+0x94d): undefined reference to `pcap_lookupnet'
scan.c:(.text+0xa04): undefined reference to `pcap_compile'
scan.c:(.text+0xa14): undefined reference to `pcap_geterr'
scan.c:(.text+0xa41): undefined reference to `pcap_setfilter'
scan.c:(.text+0xa51): undefined reference to `pcap_geterr'
scan.o: In function `generic_tcp_raw_scan':
scan.c:(.text+0xda4): undefined reference to `pcap_open_live'
scan.c:(.text+0xdd6): undefined reference to `pcap_get_selectable_fd'
scan.c:(.text+0x10be): undefined reference to `pcap_next_ex'
scan.c:(.text+0x1123): undefined reference to `pcap_geterr'
scan.c:(.text+0x1193): undefined reference to `pcap_close'
collect2: ld returned 1 exit status
> v4hn 18:52:31 ~/repos/netscan $ gcc -lpthread *.o -o portscan -lpcap
> v4hn 18:52:52 ~/repos/netscan $ ls portscan
portscan
> v4hn 18:53:03 ~/repos/netscan $ 

so I needed the following patch to compile it over here on my (lunar-)linux box.

--- makefile2010-01-02 18:56:40.0 +0100
+++ makefile.patched   2010-01-02 18:58:08.0 +0100
@@ -13 +13 @@
-  $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
+  $(CC) $(OBJS) -o $(PROG) $(LDFLAGS)



v4hn


pgpvVHtygBnc8.pgp
Description: PGP signature


Re: [dev] simple portscanner

2010-01-02 Thread v4hn
On Sat, Jan 02, 2010 at 09:38:36PM +0300, anonymous wrote:
> > --- makefile2010-01-02 18:56:40.0 +0100
> > +++ makefile.patched   2010-01-02 18:58:08.0 +0100
> > @@ -13 +13 @@
> > -  $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
> > +  $(CC) $(OBJS) -o $(PROG) $(LDFLAGS)
> 
> Will it work with this?
> $(CC) $(LDFLAGS) -o $(PROG) $(OBJS)
> Or with this:
> $(CC) -o $(PROG) $(LDFLAGS) $(OBJS)

neither nor.
wierd:

This produces undefined references
> icc -o portscan -lpcap network.o column.o common.o hosts.o parse.o ports.o 
> portscan.o scan.o -lpthread

while this works:
> icc -o portscan network.o -lpcap column.o common.o hosts.o parse.o ports.o 
> portscan.o scan.o -lpthread

It seems like -lpcap has to be behind network.o
Why the hack?


v4hn


pgpaFsjBU1JLQ.pgp
Description: PGP signature


Re: [dev] simple portscanner

2010-01-02 Thread v4hn
On Sun, Jan 03, 2010 at 12:35:44AM +0300, anonymous wrote:
> Something from gcc manpage:
> 
> "It makes a difference where in the command you write this option; the
> linker searches and processes libraries and object files in the order
> they are specified.  Thus, foo.o -lz bar.o searches library z after
> file foo.o but before bar.o.  If bar.o refers to functions in z, those
> functions may not be loaded."
> 
> "The linker handles an archive file by scanning through it for members
> which define symbols that have so far been referenced but not
> defined."

Hm, never noticed that behaviour before..

> If it works with the following I will push it into repository.
> $(CC) -o $(PROG) $(OBJS) $(LDFLAGS)

That does work.

There are also some minor changes attached
in order to remove warnings/notices from icc / gcc -Wextra.


v4hn
diff -r 459d7656e0f3 network.c
--- a/network.c Sun Jan 03 00:47:34 2010 +0300
+++ b/network.c Sun Jan 03 02:07:32 2010 +0100
@@ -153,1 +153,1 @@
-   return ~sum;
+   return (u_int16_t) ~sum;
diff -r 459d7656e0f3 parse.c
--- a/parse.c   Sun Jan 03 00:47:34 2010 +0300
+++ b/parse.c   Sun Jan 03 02:07:32 2010 +0100
@@ -64,1 +64,1 @@
-parsecidr(char *host, char *s, struct options *opts)
+parsecidr(char *hoststring, char *s, struct options *opts)
@@ -67,1 +67,1 @@
-   struct sockaddr *sa = eresolve(host, AF_INET);
+   struct sockaddr *sa = eresolve(hoststring, AF_INET);
diff -r 459d7656e0f3 ports.c
--- a/ports.c   Sun Jan 03 00:47:34 2010 +0300
+++ b/ports.c   Sun Jan 03 02:07:32 2010 +0100
@@ -86,1 +86,1 @@
-   port->portno = i;
+   port->portno = (in_port_t) i;
diff -r 459d7656e0f3 portscan.c
--- a/portscan.cSun Jan 03 00:47:34 2010 +0300
+++ b/portscan.cSun Jan 03 02:07:32 2010 +0100
@@ -140,1 +140,1 @@
-   n = printf("%u/%s", port->portno, p_name);
+   n = printf("%hu/%s", port->portno, p_name);
@@ -233,1 +233,1 @@
-   opts.netopts.ttl = strtol(optarg, NULL, 0);
+   opts.netopts.ttl = (u_int8_t) strtol(optarg, NULL, 0);
diff -r 459d7656e0f3 scan.c
--- a/scan.cSun Jan 03 00:47:34 2010 +0300
+++ b/scan.cSun Jan 03 02:07:32 2010 +0100
@@ -51,1 +51,1 @@
-   int i;
+   unsigned int i;
@@ -134,1 +134,1 @@
-   int portno = port->portno;
+   in_port_t portno = port->portno;
@@ -198,1 +198,1 @@
-   int res = getsockopt(conn->sockfd, SOL_SOCKET, 
SO_ERROR, &error, &len);
+   res = getsockopt(conn->sockfd, SOL_SOCKET, SO_ERROR, 
&error, &len);
@@ -485,1 +485,1 @@
-   struct port *port; /* !!! */
+   struct port *rcvport; /* !!! */
@@ -490,2 +490,2 @@
-   port = connsearch(&head, pktp, &pool);
-   if (port == NULL)
+   rcvport = connsearch(&head, pktp, &pool);
+   if (rcvport == NULL)
@@ -494,1 +494,1 @@
-   port->state =
+   rcvport->state =


pgpfOYViZn1O2.pgp
Description: PGP signature


Re: [dev] [DWM] suggestion for dwm

2010-01-03 Thread v4hn
How about this one?
http://stalonetray.sourceforge.net/


v4hn

On Sun, Jan 03, 2010 at 07:20:53PM +0100, Julien Pecqueur wrote:
> Hi,
> 
> First, i wish you a happy new year :)
> 
> I have a suggestion for DWM. I use DWM for about months and i miss one 
> functionality : a trayer (a zone for icons in the status bar to reduce 
> applications like xchat or to have icons for applications like gmixer, 
> batterymon, wicd-client) in the status bar!
> I've tried to use some apps to have a trayer (bmpanel and other panels with 
> tray) but it's not fine and i haven't find a trayer app which runs like conky 
> (in background of others clients).
> 
> Is it planned to implement this in DWM? If not, do you have a solution for me?
> 
> Thanks!


pgp2vxNFKPw6m.pgp
Description: PGP signature


Re: [dev] dmenu_path rewrite in C

2010-05-19 Thread v4hn
Thank you Elmo!

On Wed, May 19, 2010 at 12:09:33PM +0200, Premysl Hruby wrote:
> Well, I (and others possibly) have no concern about cache miss, my files
> in $PATH doesn't changes every five minutes :-)

mine do about three times a week.

I use a source based distro over here on my netbook(Samsung NC10),
so I'm often working while updating and nearly every compiled packet
changes some binary in PATH so it's /quite/ annoying over here
to wait about 1.5 seconds for dmenu during that time...
Now it's just 0.05 seconds!

> So, I see no reason to have it "mainline".

Well, since the shellscript got a noticeable lag that shouldn't exist
in any graphical software after all, I suppose speed is a criterion
for being suckless in this case.

So imho the c-version should be mainline, even if the source should be
cleaned before(\t -> '  ', source style?, ...)


pgpVJecYxpJtY.pgp
Description: PGP signature


Re: [dev] Tiling windowmanager workflow (Was: [dvtm] Fibonacci layout patch)

2010-06-01 Thread v4hn
On Tue, Jun 01, 2010 at 01:56:28PM +0200, Moritz Wilhelmy wrote:
> > On Tue, Jun 01, 2010 at 01:27:07PM +0200, Mate Nagy wrote:
> > > Using the vim splits may be cheating, but it sure is convenient.
> > sorry for self-reply: I thought that maybe for maximum punishment, the
> > fibonacci layout could support nmaster. (Also note that this is a
> > 2560x1600 setup, that's why so much division (and nmaster) makes sense.)
> 
> Ah, guess it's just my 1280x1024 screen then :)
> Actually tiling doesn't even make much sense on it,
> when I went with monocle on the netbook I grew used to it
> and use it everywhere now.
> Anyone else interested in sharing their way
> how they use their System? It seems like an interesting topic.


Don't know what your talking about, I got 1024x600 over here,
and I use quite a number of different Layouts,
together with an hacked pertag-patch on dwm 5.2.

monocle - show one Terminal containing a screen with chatclient & mutt.
  / one dillo/lynx/firefox(in that order) while browsing

bstack - for working on the internet
 => one ping(or download) running in a term on top
(with minimum height), while browsing/writing
with equally-sized windows below.

tile - watch a compile-process (and its errors) on the left while doing
   anything on the right
   / display a pdf on the left while hacking some TeX for it on the right

grid - for displaying a number of equally relevant pictures/graphs/sourcefiles
   (did display more then 50 pictures with feh this way some days ago)

dwindle - I sometimes use it as something like bstack with one more window
  on the left while programming
  => some reference left and kind of a 'typical' bstack-layout
 on the right - never used it with more then 5 windows though

well, fibonacci is quite the same as dwindle..

And for the tags: I got 10 of them (Super +) 0-9 and use them
heap-stack like. 0 upward is for my normal workflow process
9 downwards is for root-shells and maintaining-tasks
and sometimes i fork and use 6 upward for another process..


v4hn


pgpQJSICwPPxr.pgp
Description: PGP signature


[dev] dwm 5.8.2 patches

2010-06-15 Thread v4hn
ev'ning everyone,

I thought about updating my current dwm installation(5.2)
for some time. Well, now I had some spare time left
and updated my old monocle_count-patch to 5.8.2 - 
if anyone is interested: it prints the total number of
clients and the number of the currently activated client
besides the symbol of the monocle layout, while the current release
prints only the number of total clients within the symbol.

Also I tweaked the patches of bstack, fibonacci and gridmode
to apply clean if applied incrementally. So the following does
work without rejections now:

dwm-5.8.2 $ cat ../dwm-5.8.2-bstack.diff \
../dwm-5.8.2-fibonacci.diff \
../dwm-5.8.2-gridmode.diff \
../dwm-5.8.2-monocle_count.diff \
../dwm-5.8.2-pertag_without_bar.diff | patch -p1

Last but not least in my current setup I see no point of
one showbar flag for each tag, while I really like pertag.
So I hacked pertag, to keep one boolean showbar,
while layout and mfact are stored per tag.


All patched are attached, have fun :)


v4hn
diff -NU5 -r dwm-5.8.2/bstack.c dwm-5.8.2-bstack/bstack.c
--- dwm-5.8.2/bstack.c  1970-01-01 01:00:00.0 +0100
+++ dwm-5.8.2-bstack/bstack.c   2010-06-15 17:47:44.0 +0200
@@ -0,0 +1,29 @@
+static void
+bstack(Monitor *m) {
+   int x, y, h, w, mh;
+   unsigned int i, n;
+   Client *c;
+
+   for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+   if(n == 0)
+   return;
+   /* master */
+   c = nexttiled(m->clients);
+   mh = m->mfact * m->wh;
+   resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * 
c->bw, False);
+   if(--n == 0)
+   return;
+   /* tile stack */
+   x = m->wx;
+   y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh;
+   w = m->ww / n;
+   h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh;
+   if(w < bh)
+   w = m->ww;
+   for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
+   resize(c, x, y, /* remainder */ ((i + 1 == n)
+  ? m->wx + m->ww - x - 2 * c->bw : w - 2 * c->bw), h - 2 
* c->bw, False);
+   if(w != m->ww)
+   x = c->x + WIDTH(c);
+   }
+}
diff -NU5 -r dwm-5.8.2/bstackhoriz.c dwm-5.8.2-bstack/bstackhoriz.c
--- dwm-5.8.2/bstackhoriz.c 1970-01-01 01:00:00.0 +0100
+++ dwm-5.8.2-bstack/bstackhoriz.c  2010-06-15 17:47:44.0 +0200
@@ -0,0 +1,30 @@
+static void
+bstackhoriz(Monitor *m) {
+   int x, y, h, w, mh;
+   unsigned int i, n;
+   Client *c;
+
+   for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+   if(n == 0)
+   return;
+   /* master */
+   c = nexttiled(m->clients);
+   mh = m->mfact * m->wh;
+   resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * 
c->bw, False);
+   if(--n == 0)
+   return;
+   /* tile stack */
+   x = m->wx;
+   y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh;
+   w = m->ww;
+   h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh;
+   h /= n;
+   if(h < bh)
+   h = m->wh;
+   for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
+   resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
+  ? m->wy + m->wh - y - 2 * c->bw : h - 2 * c->bw), False);
+   if(h != m->wh)
+   y = c->y + HEIGHT(c);
+   }
+}
diff -NU5 -r dwm-5.8.2/config.def.h dwm-5.8.2-bstack/config.def.h
--- dwm-5.8.2/config.def.h  2010-06-04 12:39:15.0 +0200
+++ dwm-5.8.2-bstack/config.def.h   2010-06-15 17:47:44.0 +0200
@@ -29,1 +29,3 @@
+#include "bstack.c"
+#include "bstackhoriz.c"
 static const Layout layouts[] = {
@@ -34,5 +36,7 @@
+   { "TTT",  bstack },
+   { "===",  bstackhoriz },
 };
 
 /* key definitions */
 #define MODKEY Mod1Mask
 #define TAGKEYS(KEY,TAG) \
diff --git a/config.def.h b/config.def.h
index cca37df..91b91aa 100644
--- a/config.def.h
+++ b/config.def.h
@@ -29,1 +29,2 @@
+#include "fibonacci.c"
 static const Layout layouts[] = {
@@ -34,3 +35,5 @@
+   { "[...@]",  spiral },
+   { "[\\]",  dwindle },
 };
 
 /* key definitions */
diff --git a/fibonacci.c b/fibonacci.c
new file mode 100644
index 000..fce0a57
--- /dev/null
+++ b/fibonacci.c
@@ -0,0 +1,66 @@
+void
+fibonacci(Monitor *mon, int s) {
+   unsigned int i, n, nx, ny, nw, nh;
+   Client *c;
+
+   for(n = 0, c = nexttiled(mon-&g

Re: [dev] dwm 5.8.2 patches

2010-06-16 Thread v4hn
> On 15 June 2010 18:04, v4hn  wrote:
> > dwm-5.8.2 $ cat ../dwm-5.8.2-bstack.diff \
> >                ../dwm-5.8.2-fibonacci.diff \
> >                ../dwm-5.8.2-gridmode.diff \
> >                ../dwm-5.8.2-monocle_count.diff \
> >                ../dwm-5.8.2-pertag_without_bar.diff | patch -p1
> >
> > Last but not least in my current setup I see no point of
> > one showbar flag for each tag, while I really like pertag.
> > So I hacked pertag, to keep one boolean showbar,
> > while layout and mfact are stored per tag.

Two more things:

- The pertag-patch for 5.8.2 contains a bug concerning adding
monitors after setup() - lts for that monitor will not be initialized
properly resulting in a segfault.
patch is attached.(with and without bar per tag)

- Since there are Monitor structs the exact definition of Monitor using pertag
requires knowledge about the number of tags(for there is an array
of LENGTH(tags)+1 layouts in there).
Because tags is defined in config.h, the definition of struct Monitor had to be
moved below `#include "config.h"` - this is ugly, but I can't see
any way around this.
Problem is, it became a habit for layout-patches to add an include above the
array of layouts, like:

> +#include "bstack.c"
> static const Layout layouts[] = {

But since layout algorithms dereference a Monitor pointer, the exact
definition of Monitor has to be given before, else compilation fails.

Are there any ideas on how to resolve this cyclic dependency?
It would be nice to have a unified way of writing layout patches imho.


v4hn
diff -U3 dwm-5.8.2/dwm.c dwm-5.8.2-pertag/dwm.c
--- dwm-5.8.2/dwm.c 2010-06-04 12:39:15.0 +0200
+++ dwm-5.8.2-pertag/dwm.c  2010-06-16 10:32:20.0 +0200
@@ -122,26 +122,6 @@
void (*arrange)(Monitor *);
 } Layout;
 
-struct Monitor {
-   char ltsymbol[16];
-   float mfact;
-   int num;
-   int by;   /* bar geometry */
-   int mx, my, mw, mh;   /* screen size */
-   int wx, wy, ww, wh;   /* window area  */
-   unsigned int seltags;
-   unsigned int sellt;
-   unsigned int tagset[2];
-   Bool showbar;
-   Bool topbar;
-   Client *clients;
-   Client *sel;
-   Client *stack;
-   Monitor *next;
-   Window barwin;
-   const Layout *lt[2];
-};
-
 typedef struct {
const char *class;
const char *instance;
@@ -278,6 +258,31 @@
 /* configuration, allows nested code to access above variables */
 #include "config.h"
 
+struct Monitor {
+   char ltsymbol[16];
+   float mfact;
+   int num;
+   int by;   /* bar geometry */
+   int mx, my, mw, mh;   /* screen size */
+   int wx, wy, ww, wh;   /* window area  */
+   unsigned int seltags;
+   unsigned int sellt;
+   unsigned int tagset[2];
+   Bool showbar;
+   Bool topbar;
+   Client *clients;
+   Client *sel;
+   Client *stack;
+   Monitor *next;
+   Window barwin;
+   const Layout *lt[2];
+   int curtag;
+   int prevtag;
+   const Layout *lts[LENGTH(tags) + 1];
+   double mfacts[LENGTH(tags) + 1];
+   Bool showbars[LENGTH(tags) + 1];
+};
+
 /* compile-time check if all tags fit into an unsigned int bit array. */
 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 
@@ -611,15 +616,30 @@
 Monitor *
 createmon(void) {
Monitor *m;
+   unsigned int i;
 
if(!(m = (Monitor *)calloc(1, sizeof(Monitor
die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1;
+   /* init mfacts */
m->mfact = mfact;
+   for(i=0; i < LENGTH(tags) + 1 ; i++) {
+   m->mfacts[i] = m->mfact;
+   }
+   /* init bars */
m->showbar = showbar;
+   for(i=0; i < LENGTH(tags) + 1; i++) {
+   m->showbars[i] = m->showbar;
+   }
m->topbar = topbar;
+   /* init layouts */
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
+   for(i=0; i < LENGTH(tags) + 1; i++) {
+   m->lts[i] = &layouts[0];
+   }
+   
+   m->curtag = m->prevtag = 1;
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
return m;
 }
@@ -1494,7 +1514,7 @@
if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
selmon->sellt ^= 1;
if(arg && arg->v)
-   selmon->lt[selmon->sellt] = (Layout *)arg->v;
+   selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag] = 
(Layout *)arg->v;
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof 
selmon->ltsymbol);
if(selmon->sel)
arrange(selmon)

Re: [dev] Presentation slides software

2010-06-29 Thread v4hn
On Tue, Jun 29, 2010 at 06:30:30PM +0200, Antoni Grzymala wrote:
> Would that be hand-crafted TeX or a set of macros like LaTeX beamer [1]?
> 
> [1] http://bitbucket.org/rivanvx/beamer/wiki/Home

In academics LaTeX-Beamer is used frequently.

Seriously, what do you think of LaTeX(-Beamer)?
It definitely does it's job,
and since TeX seems to be a standard anyway?


v4hn


pgpBX48cshF4r.pgp
Description: PGP signature


Re: [dev] pertag and bstack patches to dwm incompatible

2010-07-07 Thread v4hn
good morning!

http://lists.suckless.org/dev/1006/4795.html

reading mails isn't to hard, is it?

Well, probably you subscribed a couple of days later...
But don't blame me for not getting answers.

On Wed, Jul 07, 2010 at 11:08:13AM -0400, Donald Allen wrote:
> It appears that whoever updated this patch for 5.8.2 didn't bother to test
> whether it actually worked, which is disappointing. I hand-edited the lines
> that patch refused to insert.

I updated, I bothered, I tested, I fixed manually for my setup and
wrote the mail mentioned above. Since nobody thought of a reply,
that's where we are.


v4hn



pgpp7NikTCTwy.pgp
Description: PGP signature


Re: [dev] libdraw development

2010-08-31 Thread v4hn
ok,

you're a great programmer as far a I can see,
so don't take the following personally.

I suppose I _kind of_ get why you're proposing such things,
but excuse me?? What is wrong with you?

On Mon, Aug 30, 2010 at 06:44:36PM +0200, pancake wrote:
> I would like to have functions in libdraw to work with clipboard, [...]

from the README: 
> libdraw is a simple dynamic drawing library.

What's the connection between support for X clipboard and _simple drawing_?
And what the HELL would be suckless about that?
If you like to write an X library based on X, call it X12,
but I'm quite sure, this wouldn't become suckless software.


v4hn



pgp2KrlVXUGNs.pgp
Description: PGP signature


Re: [dev] libdraw development

2010-08-31 Thread v4hn
On Tue, Aug 31, 2010 at 08:53:02PM +0200, pancake wrote:
> I know that copypasting is probably not related to drawing, but
> afaik libdraw aims to be a [yet another] graphical backend API.

Well, if that's what it should be, then adding clipboard-support
is straightforward. However libdraw does sound like a suckless
library solving the problem of drawing on the screen, not the whole
problem of user interaction. And I suppose user interaction is,
where support for the clipboard is needed.

> As far as libdraw is distributed as a static library with one
> function per file it makes it good for adding more features without
> making resulting bins bigger.

Sure, the layout allows a lot of extensions..
But that doesn't imply the community should start writing
extensions for mouse-cursor handling, 3d-carved font rendering,
on-the-fly-translations while printing...

> In swk for example I'm implementing multiline text support which is
> in fact a text editor widget. The text manipulation functions are in
> text.c and I don't think a widget kit should provide a text
> processor. But where's the place for this? Libdraw maybe? 

_If_ a wk includes multiline text support, then it has to include
some kind of text processor. But why should you propagate all editing
functions to the outside? Isn't it enough to provide one function
to initialize the text of the widget and one to read the content again?
Why does a _simple_ wk need to tell the program what happens while editing?
imho that's unneeded.
Another approach taken by e.g. lynx is to provide a way to open the
text in the multiline widget with $EDITOR if the user needs more
than the bare minimum of text handling implemented in the wk.

> Splitting each feature in different libs it makes the development
> harder (more dependencies).

Sure it does, yet specifying clearly what a library should provide
(and what it shouldn't provide) makes coding suckless easier.

In my opinion the domain of problems sselp addresses is simply to small
to make it a library on its own..
But on the other hand, if it's needed in a number of different
projects. Why not? One could still provide libdraw and 'libsselp'
as one package of suckless GUI libs.


v4hn


pgpcz8D4sZc8B.pgp
Description: PGP signature


Re: [dev] [OT] What's wrong with C++?

2010-09-10 Thread v4hn
On Fri, Sep 10, 2010 at 08:19:38PM +0300, Nikhilesh S wrote:
> I haven't really understood the problems with C++ that the people here
> that have problems with C++ have[...]

Felix von Leitner gave a pretty good presentation in 2007 on such problems :)

http://www.fefe.de/c++/c%2b%2b-talk.pdf

> Maybe C++ is 'complex' but doing things with it is 'simple',[...]

That's exactly one of the problems.
As mentioned in the slides:
- C++ makes using good libraries very nice
- C++ makes writing good libraries almost impossible


v4hn


pgp297TvpD3Lj.pgp
Description: PGP signature


Re: [dev] [OT] What's wrong with C++?

2010-09-11 Thread v4hn
On Sat, Sep 11, 2010 at 01:59:07PM +0200, Nicolai Waniek wrote:
> From looking at FeFe's presentation just some notes: His complaints are
> mostly corner cases. You can produce some stupid corner cases where the
> language sucks for every language.

Sure, but it's quite easy for C++ ;)
After all this was a c++ bashing presentation, so there was no need to add
a lot of 'real' arguments.

However Nikhilesh asked for "problems with C++ that the people here
that have problems with C++ have", and there are a number of really good
examples in the slides :)

> Additionally from someone who can't properly code (look at his open
> source stuff...) one should simply stop reading when he's complaining
> about possibly cryptic compiler output...

:D I do know his codes^^.
However he does know something about auditing code and about hacking
especially with C/C++ code.
And in security research those corner cases are the most interesting ones.


v4hn



pgppiU9ckNLqY.pgp
Description: PGP signature


Re: [dev] [dwm] tagging interface

2010-09-22 Thread v4hn
On Tue, Sep 21, 2010 at 10:19:55PM -0700, Wolf Tivy wrote:
> Ok so I'm done my little mods, works great. I have attached
> a 'patch' so that the rest of you can play with it.
> Some possible breakage is that the new view function
> doesn't toggle between the two tag sets. Still works for me
> though. I find this new interface to be much nicer than the
> seperate toggle functions. Thanks for all the help! 

hey,

sounds quite interesting, but what's wrong with a simple
diff-file instead of instructions where to insert c-code? -.-


v4hn


pgp92byv8bwFd.pgp
Description: PGP signature


Re: [dev] git dmenu mirror with feature branches instead of separate patches

2010-11-21 Thread v4hn
On Sun, Nov 21, 2010 at 04:14:26PM +0100, sta...@cs.tu-berlin.de wrote:
> Often, issues arise when applying multiple patches. The prposal doesn't
> solve this, does it? For single features -- sure, it's beneficial, but the
> work to keep stuff up to date with master remains.

Yes, there are problems with multiple patches. In my opinion
we should spend some more time on making the optional patches as compatible
as possible. - I did that with a couple of dwm-patches some time ago.

> Set of branches based on multiple patches, representing different dmenu
> flavours -- like surf-flavour (e.g. vertical and token match and xyz ),
> dwm-flavour, someones-music-player-flavour -- might make more sense... not
> sure. 

That's another option, but keeping track of applied patches on each branch
will become a pile of work imho, so this again would result in making
the patches compatible.


v4hn


pgphtUOuwvXno.pgp
Description: PGP signature


Re: [dev] which minimal os

2011-02-11 Thread v4hn
evening,

On Fri, Feb 11, 2011 at 04:35:31PM -0500, Claudiu Bucur wrote:
> it [gentoo] has been my closest experience to what
> i imagine "linux from scratch" would be like.

You should try Lunar (lunar-linux.org) or SourceMage (sourcemage.org) then.
Those systems _are_ LFS with a couple of bash scripts to handle
modules... :)


On Fri, Feb 11, 2011 at 05:26:21PM -0500, Kurt H Maier wrote:
> gentoo is a pile of shit [...]
> archlinux is just gentoo but less well maintained.
> debian is a bloated monstrosity
> ubuntu has all the drawbacks of debian with all the incompetence of arch 
> linux.
> netbsd is run by crackpots.
> freebsd is decent but not as nice as openbsd

yeah, everything's fubar,
so I wonder why you even take your time writing such an idiotic mail...
Go and fix it :P


v4hn


pgpsK8fVHqAt6.pgp
Description: PGP signature


Re: [dev] @bleidl, 26/03/11 19:41

2011-03-30 Thread v4hn
On Tue, Mar 29, 2011 at 02:36:00PM -0400, Josh Rickmar wrote:
> identi.ca (free and distributed) works reasonably well,

It's a working alternative to twitter.

> but is unfortunately overloaded with gnu freetards.

If you think that's true, change that by using it.


v4hn


pgpKGRhFSStCh.pgp
Description: PGP signature


Re: [dev] dwm

2011-05-07 Thread v4hn
On Fri, May 06, 2011 at 03:33:51PM +0200, Petr Sabata wrote:
> On Fri, May 06, 2011 at 03:26:11PM +0200, m1...@web.de wrote:
> > [huge pile of crap]
> 
> Oh that hurts...

You did _not_ try to read this, did ya?

Anselm wrote:
> I'm looking into mlmmj to let html mails bounce.

Would be great to see this working, thanks!


v4hn


pgpYWrPMT4Gr7.pgp
Description: PGP signature


Re: [dev] suckless games collection?

2011-05-27 Thread v4hn
On Thu, May 26, 2011 at 11:01:51AM +0200, pancake wrote:
> I found this chess implementation in obfuscated C. I'm sure than
> cleaning it up
> (deobfuscating it) will make it ready to be in the cathegory of
> "suckless games"
> 
>   http://nanochess.110mb.com/chess1_es.html
> 
> What do you think about creating a 'sgames' project? collecting
> minimalistic simple
> games? I wrote a word guess game few time ago named 'wg' which can be merged
> into this project.

Afair there was such a discussion about a year ago.
Why not, if someone got nice ideas for sl-games...

Deobfuscating might not be that much of a good idea,
the code is meant to confuse so wth should you try to understand it?
Attached is a small (RTFC-readable) chess implementation in 349 LOCs
which supports en passant / castling and promotion.
You might merge it into such a project if you want to,
just send me an email if you do so.

have fun


v4hn


pgpKRa1CE5J8H.pgp
Description: PGP signature


Re: [dev] suckless games collection?

2011-05-27 Thread v4hn
sorry for double post, missed the attachment.


v4hn
/* simple chess implementation by v4hn @ 2009 */

#include 
#include 
#include 

typedef enum {
  BLACK = 0x00,
  WHITE = 0x20
} chess_color;

typedef unsigned short chess_move;
typedef signed char chess_pos;
typedef char* chess_board;

#define IS_FREE(x)  (x == 0x20)
#define IS_PIECE(x) (x&(0x40))
#define IS(color, x) (!IS_FREE(x) && ((x&0x20) == color))
#define OPPONENT(color) ((chess_color) (color^0x20))

#define POS(x,y) ((chess_pos)(x-65)+((8-y)*8))
#define MOVE(f,t) ((chess_move)(((short) (f) << 8) | (t)))
#define FROM(m) ((chess_pos)(m >> 8))
#define TO(m) ((chess_pos)(m & 0xFF))

void print_board();
int valid_pawn_move(chess_move m);
int valid_rook_move(chess_move move);
int valid_bishop_move(chess_move move);
int valid_knight_move(chess_move move);
int valid_king_move(chess_move move);
int valid_castling_move(chess_color color, chess_move move);
int is_reachable(chess_color color, chess_pos pos);
int self_check_after(chess_color color, chess_move move);
int is_valid(chess_color color, chess_move move);
chess_move read_move(chess_color color);
int do_move(chess_move move);
int move(chess_color color);

/* current board */
char* board;
/* was the last move a wide pawn jump? (en passant possible)*/
chess_pos pawn_jump;
/* is castling still allowed? */
char castling_possible[2];

inline int sgn(int x){
  return (x < 0) ? -1 : 1;
}

void print_board(){
  unsigned int row= 0, col= 0;
  printf("\n"
 "  || A | B | C | D | E | F | G | H ||\n"
 "===\n");
  for(row= 0; row < 8; row++){
printf("%d ||", 8-row);
for(col= 0; col < 8; col++){
  printf(" %c |", board[row*8+col]);
}
printf("| %d\n"
   "---\n",
   8-row);
  }
  printf("===\n"
 "  || A | B | C | D | E | F | G | H ||\n\n");
}

int valid_pawn_move(chess_move m){
  return ( IS(WHITE, board[FROM(m)]) ?
  ((FROM(m)/8 - TO(m)/8 == 1) &&
   (FROM(m)%8 - TO(m)%8 == 0) &&
   IS_FREE(board[TO(m)])) ||
  ((FROM(m)/8 - TO(m)/8 == 1) &&
   (abs(FROM(m)%8 - TO(m)%8) == 1) &&
   (IS(BLACK, board[TO(m)]) || (pawn_jump == TO(m)+8))) ||
  ((FROM(m)/8 - TO(m)/8 == 2) &&
   FROM(m)%8 - TO(m)%8 == 0 &&
   IS_FREE(board[FROM(m)-8]) &&
   IS_FREE(board[TO(m)]))
   :
  ((TO(m)/8 - FROM(m)/8 == 1) &&
   (TO(m)%8 - FROM(m)%8 == 0) &&
   IS_FREE(board[TO(m)])) ||
  ((TO(m)/8 - FROM(m)/8 == 1) &&
   (abs(TO(m)%8 - FROM(m)%8) == 1) &&
   (IS(WHITE, TO(m)) || pawn_jump == TO(m)-8)) ||
  ((TO(m)/8 - FROM(m)/8 == 2) &&
   TO(m)%8 - FROM(m)%8 == 0 &&
   IS_FREE(board[FROM(m)+8]) &&
   IS_FREE(board[TO(m)]))
   );
}


int valid_rook_move(chess_move move){
  chess_pos i;

  if((FROM(move)%8 != TO(move)%8) &&
 (FROM(move)/8 != TO(move)/8))
return 0;

  i= FROM(move);

  while(i != TO(move) && IS_FREE(board[ i+= sgn(TO(move)-FROM(move)) * 
((FROM(move)%8 == TO(move)%8)?8:1) ]) );

  return (i == TO(move));
}


int valid_bishop_move(chess_move move){
  chess_pos i, last_round;

  if( (!((TO(move)-FROM(move))%9) &&
   !((TO(move)-FROM(move))%7)))
return 0;

  i= last_round= FROM(move);
  while(i != TO(move) && IS_FREE(board[ i+= sgn(TO(move)-FROM(move)) * 
((TO(move)-FROM(move))%9 ? 7 : 9) ])){
if(abs(last_round/8 - i/8) != 1)
  return 0;
last_round= i;
  }
  return (i == TO(move));
}


int valid_knight_move(chess_move move){
  return (abs(FROM(move)%8 - TO(move)%8) == 2 && abs(FROM(move)/8 - TO(move)/8) 
== 1) ||
 (abs(FROM(move)%8 - TO(move)%8) == 1 && abs(FROM(move)/8 - TO(move)/8) 
== 2);
}


int valid_king_move(chess_move move){
  return (abs(FROM(move)%8 - TO(move)%8) <= 1) && (abs(FROM(move)/8 - 
TO(move)/8) <= 1);
}


int valid_castling_move(chess_color color, chess_move move){
  chess_pos i;
  switch(TO(move)&~0x20){
  case 0:
if(castling_possible[color == WHITE]%2 == 0)
  return 0;

for(i= 5+8*(color == WHITE ? 7 : 0); i%8 != 7; i++)
  if(!IS_FREE(board[i]))
return 0;

for(i= 5+8*(color == WHITE ? 7 : 0); i%8 != 7; i++)
  if(is_reachable(OPPONENT(color), i))
return 0;
break;

  case 1:
if(castling_possible[color == WHITE] < 2)
  return 0;

for(i= 1+8*(color == WHITE ? 7 : 0); i%8 != 4; i++)
  if(!IS_FREE(board[i]))
return 0;

for(i= 2+8*(color == WHITE ? 7 : 0); i%8 != 5; i++)
  if(is_reach

Re: [dev] ideas on suckless file manager

2011-06-07 Thread v4hn
On Tue, Jun 07, 2011 at 11:17:32AM -0400, Le Tian wrote:
> Yes, icons are not efficient, but there are cases, when not only you will
> use the pc, like a girlfriend, she needs icons and stuff). I think it's a
> bad habit of a windows user, to see everything in rows of thumbs. But still
> like clicking a video file with a mouse in a file manager, when editing
> happens only in console.

If your girlfriend uses your pc and got problems with suckless/non-bloated
software then get her a parallel setup of debian/arch/.. with a nice KDE/Gnome.
(works quite fine over here ;))

v4hn


pgp7gj5uj6EK4.pgp
Description: PGP signature


Re: [dev] What is bad with Python

2014-03-03 Thread v4hn
On Mon, Mar 03, 2014 at 09:35:18PM +0100, FRIGN wrote:
> On Mon, 3 Mar 2014 23:21:02 +0100
> Szymon Olewniczak  wrote:
> > (...) and I must admit that I've found Python much less 
> > harmful that I had previously considered it to be.
> 
> I agree on this one. The language designers did a good job.

That depends on your perspective. Python, _in my opinion_ much more than C code,
should not be written by beginners, but on the other hand is one of the most 
attractive
languages for newbies. The language is way _too_ flexible and makes people 
believe
they know how to code just because they know a couple of more or less sensible 
concepts
like lambda, list comprehension, *iterator, iterator*int, ...
I observe _really strong_ hammer->nail effects quite regularly...

In the end, there a lot of people who learnt to write unmaintainable code.
I seriously prefer perl-programmers who know what they're doing.


v4hn


pgpKZS70fuuW0.pgp
Description: PGP signature


Re: [dev] Looking for simple, alpha supporting image format

2014-07-18 Thread v4hn
On Fri, Jul 18, 2014 at 01:45:08PM -0400, Lee Fallat wrote:
> On Fri, Jul 18, 2014 at 1:41 PM, Truls Becken  wrote:
> > On Fri, Jul 18, 2014 at 7:15 PM, Charlie Murphy  wrote:
> > How about putting the widthxheight in the file name and having RGBA
> > data only inside? Would that result in the best possible compression?
> >
> Put the header in a separate file...hahahah...I don't think putting
> information in the filename is a good idea. People are always renaming
> files. File names are for FILE NAMES, not metadata.

You can always put the header in a separate file (a different one
from the meta-data, because you obviously don't want dynamically-sized data in 
there)
and put everything together into a tar-file.

Seriously guys, get a repository and an issue tracker for that project
and stop using this list for development. Status reports are fine,
but the details of your discussions are of no relevance to the whole list.

Enjoy your weekend,


v4hn


pgpUZ0onaoqc4.pgp
Description: PGP signature


Re: [dev] [sbase][patch]cat stdin if arg is exactly "-" not begins with '-'

2014-11-19 Thread v4hn
On Tue, Nov 18, 2014 at 01:50:18PM -0800, Evan Gates wrote:
> This patch makes
> cat -- -foo
> cat the file ./foo and not stdin.

You meant to write "./-foo", didn't you?


v4hn


pgpnP77Se1hZh.pgp
Description: PGP signature


Re: [dev] GCC situation

2014-11-24 Thread v4hn
On Sun, Nov 23, 2014 at 10:20:44PM +, Henrique Lengler wrote:
> Hi,
> 
> What is the situation of GCC, is it bloated?

On Wed, Nov 19, 2014 at 10:35:52PM +, doa379 wrote:
> There's an incredible amount of spam and OT on this list isn't there!

Indeed.


v4hn


pgpxKlkM6DhL4.pgp
Description: PGP signature


[dev] [st] [PATCH] set selection to IDLE on clear

2015-05-14 Thread v4hn
From 3823c33f284a9c11d3db7a020957775b6d59d4e3 Mon Sep 17 00:00:00 2001
From: v4hn 
Date: Thu, 14 May 2015 15:36:57 +0200
Subject: [PATCH] set selection to IDLE on clear

Otherwise a tangling bmotion event will consider
the selection still valid and selnormalize segfaults
because of an invalid sel.ob.y index.
---
 st.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/st.c b/st.c
index 55a5c56..0cad879 100644
--- a/st.c
+++ b/st.c
@@ -1069,6 +1069,7 @@ void
 selclear(XEvent *e) {
if(sel.ob.x == -1)
return;
+   sel.mode = SEL_IDLE;
sel.ob.x = -1;
tsetdirt(sel.nb.y, sel.ne.y);
 }
-- 
2.4.0



pgprGeITFf0QE.pgp
Description: PGP signature


Re: [dev] new mailinglist [news] and hackers repurpose

2015-06-05 Thread v4hn
Hey everyone,

On Thu, Jun 04, 2015 at 06:22:00PM +0200, Christoph Lohmann wrote:
> 1.)  There  is now a news@ mailinglist for package maintainers who don’t
> want to follow the discussions on dev@. All new releases should  be  an‐
> nounced there and on dev@.

Makes sense. Thank you for that.

> 2.)  The  purpose  of  hackers@  has been redefined that new patches for
> projects have to be sent and discussed there.
> 
> These  changes  will  keep  the  development  out of the endless support
> threads on dev@ and development more enjoyable.

This is the suckless community you're talking about.
If somebody raises a support question without providing a patch,
the first five replies will usually tell him to write a patch.
Code and philosophical "development" questions go hand in hand
in this community, so I'm unsure how to draw the line between
hackers@ and dev@. Also I'm unsure whether or not I should
subscribe to hackers@ now, because someone might eventually
have a problem with one of the patches I contributed to suckless
in the last years or I might miss some UI change in one of the projects
I use which will break my local set of patches.

Ross' latest mails beautifully illustrate I'm not the only one with that 
problem.


v4hn


pgpRrZsSKKNi7.pgp
Description: PGP signature


Re: [dev] [dvtm] create in $CWD not working

2015-07-15 Thread v4hn
On Wed, Jul 15, 2015 at 11:32:38AM -0400, Ross Mohn wrote:
> $ pstree -p 2199
> dvtm(2199)─┬─sh(2239)───bash(2240)───mutt(11096)
>├─sh(2324)───bash(2325)
>├─sh(12015)───bash(12016)───vim(17544)
>└─sh(12116)───bash(12117)───pstree(21626)

Fix your setup. Spawning two shells is stupid already,
but to keep the outer shell (your "generic sh") running
is insane.

exec could help, but reviewing the spawn process to avoid sh
to spawn "your" shell would be better.


v4hn


pgpSk08HZcSAu.pgp
Description: PGP signature


Re: [dev] [farbfeld] announce

2015-11-10 Thread v4hn
On Tue, Nov 10, 2015 at 10:37:30PM +0100, FRIGN wrote:
> I'm very glad to announce farbfeld to the public, a lossless image
> format as a successor to "imagefile" with a better name and some
> format-changes reflecting experiences I made since imagefile has
> been released.

Congratulation, might be a step into the right direction
of handling image data.

> You may have already seen my talk at slcon2 about the topic[0].
> I carried on the idea of ditching the CIELAB-approach

Why? Do you consider the values to be sRGB then?
Do you consider sRGB to cover "enough" of the visible spectrum
for all intended use-cases of farbfeld?

>The largest image in existence is still 7 orders of magnitude
>smaller than the largest image possibly expressed in
>(2^32-1)x(2^32-1) pixels.

Now I'm curious. What do you consider to be ``the largest image in existence''?


v4hn


signature.asc
Description: PGP signature


Re: [dev] sent-0.1 or libxft bug

2015-11-16 Thread v4hn
Sorry in advance in case my sarcasm detector failed me...

On Mon, Nov 16, 2015 at 11:43:30PM +, Nick wrote:
> Quoth ret set:
> > > At least describe in one sentence what you mean.
> > Segmentation fault in in sent-0.1.
>
> Christoph is right, you really should have provided more description
> of what the fault is,

On Tue, Nov 17, 2015 at 01:34:30AM +0300, ret set wrote:
>> Subject: [dev] [...] bug
>> [...]
>> Segmentation fault

> how to reproduce it,

On Tue, Nov 17, 2015 at 01:34:30AM +0300, ret set wrote:
>> $ make && ./sent <(python -c 'print "A\n"*4000')
>> sent build options:
>> CFLAGS = -g -std=c99 -pedantic -Wall -I. -I/usr/include 
>> -I/usr/include/freetype2 -I/usr/X11R6/include -DVERSION="0.1" 
>> -D_XOPEN_SOURCE=600
>> LDFLAGS = -g -L/usr/lib -lc -lm -L/usr/X11R6/lib -lXft -lfontconfig -lX11 
>> -lpng
>> CC = cc
>> Segmentation fault

> and what you think was causing it.

On Tue, Nov 17, 2015 at 01:34:30AM +0300, ret set wrote:
>> Subject: [dev] sent-0.1 or libxft bug
>> [...]
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x77529980 in XftCharExists () from 
>> /usr/lib/x86_64-linux-gnu/libXft.so.2

Everything you requested was there in the first mail
and I would send pretty much the same message if
I didn't have the time to fix this myself.

> But regardless, as far as I can see this is fixed in the latest code
> in git, aa713a8a342ec0e6eca173cd4489834f8baa0a86.

Yes, there is no segmentation fault anymore.
I do think the current behavior w.r.t. long lines or long paragraphs could be 
improved though.

Over here using the latest HEAD ret set's example yields a slide with *one* 
rather small "A" at the top center.
Also I just noticed that `./sent <(python -c 'print "A"*4000')` (might vary 
with screen size/available fonts?)
gives me a number of rather big As partially overlaying each other,
whereas `./sent <(python -c 'print "A"*400')` works pretty much as expected:
the line is too long for the screen with a reasonable font size, so a long 
string of rather small As
is printed from side to side.


v4hn


signature.asc
Description: PGP signature


Re: [dev] Re: [sbase] cal doesn't highlight current day

2015-11-20 Thread v4hn
On Fri, Nov 20, 2015 at 10:48:15AM -0200, Marc Collin wrote:
> I really believe this would be a 0% complexity addition

Don't believe but demonstrate. Did you write a patch yet?
util-linux' cal manpage states:

> the day will be highlighted if the calendar is displayed on a terminal.

Go ahead.

> Left is how it is. Right is how it could be (with current day highlighted).
> Does anyone else think this would help a lot those who use cal constantly?

I use util-linux' cal approx. 5 times a day,
and yes, the highlight is rather important for my everyday usage.
As I'm not sure when I will finally get around to setup sbase/ubase
on my workstation, I don't feel obliged to implement this myself at the moment.


v4hn


signature.asc
Description: PGP signature


Re: [dev] [st] Reporting a Segmentation fault

2015-11-20 Thread v4hn
On Fri, Nov 20, 2015 at 10:52:28AM -0200, Marc Collin wrote:
> Hello, I want to report a segfault when using st.
> 
> Steps to reproduce:
> 1) open st
> 2) "vim file"
> 3) Press "Enter"
> 
> Around 30% of times this results in a crash.
> Here's the message st gives:
> 
> erresc: unknown sequence ESC 0xFD '.'
> Segmentation fault
> 
> I am using the latest st from the git repo.
> 
> If any other info is needed let me know, and I'll try to get it.

Are you a troll?

We discussed what bug reports in this community should look like
just this week in a different thread.

Where's the backtrace?
What system are you using?
Are you sure your terminfo file is up2date and TERM is correct?

"Steps to reproduce" do not produce a segfault over here as well.


v4hn


signature.asc
Description: PGP signature


Re: [dev] [ANNOUNCE] spt-0.1

2016-02-02 Thread v4hn
Heya,

On Mon, Feb 01, 2016 at 08:30:43AM +0800, Pickfire wrote:
> Here is my first C program, a program that double your productivity by
> using the Pomodoro Technique™:

With *that* introduction, I expected much worse. :)
It looks reasonably neat.

>https://github.com/pickfire/spt
>http://git.pickfire.wha.la/spt  (I will be offline everyday, so...)
> 
> A quick introduction of what it does:
> 
> 1. It uses the timer in the config.h
> 2. When timer is off, it notify you using libnotify (depends on conf.)

I tried it out and encountered two problems:

1. what do you do if you miss the notification because somebody distracted you?
There's no feature to show you the remaining time / current phase on demand.

2. Is there a less sucking alternative to notify-osd? That project is
horrifically complex for it's purpose... (and e.g. keeps bugging me
because it can't contact a gnome screensaver service)

Thanks for sharing it,


v4hn


signature.asc
Description: PGP signature


Re: [dev] [libutp-c] ISO C90-ish ports of bittorrent c++ libutp

2016-02-05 Thread v4hn
On Sat, Feb 06, 2016 at 10:14:59AM +1100, Sylvain BERTRAND wrote:
> I'm trying to make this implementation distributed as an option
> with transmission bittorrent client package. I'm getting high
> resistance from the "dev in chief":
> http://trac.transmissionbt.com/ticket/6065

He is not "resisting". He simply wants to know whether you will
*maintain* your C port. He doesn't want to add a new dep if it
is dead code from the start. You didn't answer to that yet.


v4hn


signature.asc
Description: PGP signature


Re: [dev] [ANNOUNCE] slock-1.3

2016-02-14 Thread v4hn
On Sun, Feb 14, 2016 at 12:19:37AM +0100, hiro wrote:
> i.e. throw out all this platform dependent bullshit password checking code

This would still leave us with the platform dependent bullshit for screen 
locking.
Here's a refined proposal: lock your goddamn office instead of your screen,
or, in case you share your office: get yourself a wooden box and lock your
workstation in in when you leave the room.


v4hn


signature.asc
Description: PGP signature


Re: [dev] [sbase][RFC] patch: whitespace patches

2016-02-25 Thread v4hn
On Thu, Feb 25, 2016 at 11:24:25AM +, Dimitris Papastamos wrote:
> On Wed, Feb 24, 2016 at 08:54:13PM +0100, Mattias Andrée wrote:
> > I'm thinking about introducing an extension to the standard: -w.
> > When this flag is used, patch will verify that the patchfile
> > only changes whitespace in the file.
> > 
> > 1) Do you think this should be a flag or a separate tool?
> 
> Sounds like it could be a flag.

Sounds useless to me. What counts as whitespace change?
`if(x){ \n` -> `if(x){\n`, ok,
`\tif(x){\n` ->  `  if(x){\n`, in python and haskell probably not,
`if(x){\n` ->  `if(x) {\n`, seems simple enough,
`printf("%d",x);\n` -> `printf("% d",x);\n`, that's no simple whitespace change,
not to talk about the infamous bumblebee patch
`rm -rf /usr /share` -> `rm -rf /usr/share`

This does not belong into standard patch.

> > 2) Should it be able to do a dry run, would be another flag
> >that can be used independently of -w?
> 
> Yes it would be nice to support a dry run flag regardless of
> whether -w is specified or not.

gnu patch supports --dry-run. It probably makes sense
to support this flag either way.


v4hn


signature.asc
Description: PGP signature


Re: [dev] suckless shared tools

2016-02-29 Thread v4hn
On Mon, Feb 29, 2016 at 01:40:30AM -0800, Louis Santillan wrote:
> Got a link to google repo?

https://code.google.com/p/git-repo/
http://myrepos.branchable.com/
https://github.com/vcstools/wstool

It's a common problem, so there are a number of projects
trying to automate this (including git-submodules).
Though git-repo project is the first I know of
that throws xml at it...


v4hn


signature.asc
Description: PGP signature


[dev] [st] [patch] clipboard properties burn after reading

2016-05-19 Thread v4hn
Hey everyone,

I use synergy (for input device sharing) on a daily basis
and experienced this rather annoying bug in combination with st:

Whenever I paste something from another machine to st,
pasting succeeded only the first time. After about a year
of being annoyed by this bug (it's just too easy to work around it),
I finally digged into the issue today and eventually discovered that st
does not delete its CLIPBOARD and PRIMARY properties after pasting
the copied data. I don't know of any other x client that
cares about this, but synergy waits for st to clear the property
before sending the new selection data.

As ICCCM specifies that the client should delete the property
after handling the request, I adjusted st's behavior. Patch attached.
I have no idea why Christoph originally added the additional condition
there. The only two event types that get through to this code
are PropertyNotify and SelectionNotify and for both of them property
should be deleted.


v4hn
From dacb3e0593aedd191604d25571bf7f8fe9e35c6f Mon Sep 17 00:00:00 2001
From: v4hn 
Date: Thu, 19 May 2016 12:16:57 +0200
Subject: [PATCH] delete clipboard properties after pasting them

https://tronche.com/gui/x/icccm/sec-2.html#s-2.4 specifies:
> Once all the data in the selection has been retrieved,
> the requestor should delete the property in the SelectionNotify request

Most Clipboard-Owners ignore whether or not the property is already set,
so this is mostly a cosmetic change to keep the windows property list clean.

However, at least synergy decides to wait for the requestor to delete
the properties if they are already set by a previous paste (from synergy).
---
 st.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/st.c b/st.c
index 27536d2..6736464 100644
--- a/st.c
+++ b/st.c
@@ -1151,8 +1151,7 @@ selnotify(XEvent *e)
 * Deleting the property again tells the selection owner to send the
 * next data chunk in the property.
 */
-   if (e->type == PropertyNotify)
-   XDeleteProperty(xw.dpy, xw.win, (int)property);
+   XDeleteProperty(xw.dpy, xw.win, (int)property);
 }
 
 void
-- 
2.8.2



signature.asc
Description: PGP signature


Re: [dev] [st] [patch] clipboard properties burn after reading

2016-05-20 Thread v4hn
On Fri, May 20, 2016 at 02:00:34PM +0200, hiro wrote:
> please point out a working version of synergy.
> after the latest degradation into a startup company all their crap has
> stopped working for me.

I didn't notice (nor care). I still use 1.4.15 and that worked pretty stable
for my setup (two linux machines) for the last two years.
The only problem I ever encountered is caps-lock hanging on one machine
once a month or so. My build description can be found here[0].
The source is fetched from 
http://synergy.googlecode.com/files/synergy-1.4.15-Source.tar.gz
which is still available, although the project moved on to github to stay 
hipster...

I'll probably look into the new versions one of these days, thanks for the 
pointer.


v4hn

---
[0] - 
https://github.com/lunar-linux/moonbase-other/tree/master/x11-utils/synergy


signature.asc
Description: PGP signature


Re: [dev] which versions are dwm patches intended to apply to cleanly?

2016-06-16 Thread v4hn
On Thu, Jun 16, 2016 at 09:58:34AM +0200, Kamil Cholewiński wrote:
> On Thu, 16 Jun 2016, David Phillips  wrote:
> > What? Since when were any patches "supported"?
> 
> The amount of effort that goes into organising them (as evidenced by the
> thread) indicates that, in fact, there is some "support".

No. It indicates that individuals make use of some patches and contribute
their changes to make a patch work with whatever git checkout they use.

Threads such as this one only appear because people who are too lazy to
update patch files they find flying around somewhere on their own and
instead decide to waste everyones time by sending user-request-mails.
This is not launchpad.


v4hn


signature.asc
Description: PGP signature


Re: [dev] Proper window type for dwm and dmenu

2016-07-19 Thread v4hn
Where's the patch?

On Tue, Jul 19, 2016 at 07:43:26PM +0200, Jan Christoph Ebersbach wrote:
> Hi,
> 
> I just stumbled upon the compositor compton and came across this wiki
> page that describes that shadows don't work properly in combination with
> dwm and dmenu:
> https://wiki.archlinux.org/index.php/Compton#dwm_.26_dmenu  The reason
> for this is that _NET_WM_WINDOW_TYPE and _NET_WM_WINDOW_TYPE_DESKTOP
> aren't set for the bar/menu that is drawn.
> 
> The closest I could get in my research was
> http://comments.gmane.org/gmane.comp.misc.suckless/7688.  dwm implements
> _NET_WM_WINDOW_TYPE for client windows.
> 
> Is there a specific reason for not implementing _NET_WM_WINDOW_TYPE for
> dwm and dmenu other than that nobody did it so far?  I think it's worth
> the issue because a compositor greatly improves window tearing and it
> would make the tools more compatible to the expected behavior.
> 
> Btw, here is another issue related to compositors that might be worth
> considering again: http://lists.suckless.org/dev/1505/26735.html
> 
> Jan Christoph


signature.asc
Description: PGP signature


Re: [dev] [dmenu] [PATCH] Added option to prompt for passwords

2016-07-26 Thread v4hn
Hey everyone, hey hiro,

I did not yet look at the patch, but it would be a nice
(and imo reasonably small) addition to allow for password entry via dmenu.
If the asterisk-approach is too bloated for the maintainer's taste, I'm unsure
about this myself, I believe `dmenu -p "Enter Password" -g` where -g is a flag
that makes dmenu not print *anything* entered by the user would be
a neat, simple and possibly reusable solution.

If this would be merged upstream, I would like to make use of it in
snotes [0] to support encrypted notes via gnupg - a feature multiple people
asked for over the last years.


v4hn

[0] - https://github.com/v4hn/snotes


signature.asc
Description: PGP signature


Re: [dev] Xorg implementations

2017-07-02 Thread v4hn
On Sun, Jul 02, 2017 at 09:06:22AM +0200, Laslo Hunhold wrote:
> The way they did Wayland was kind of nice, but even it lacks
> some modern ideas which should've been implemented now that the entire
> windowing system is revamped anyway, and here I'm talking about
> color management, accessibility aspects and many other important things.

Let's quote everyone's favorite here:
``Do [they] hate handicapped people?'' [0,1 - starting 22:26]

> If you depend on the reference implementation to get even trivial things
> done, there's something wrong.

Sure, so let's add *more* stuff to the protocol.
Clearly, that would make it more easy to get things right.


v4hn

-- 
[0] https://events.ccc.de/congress/2010/Fahrplan/events/4017.en.html
[1] 
http://ftp.ccc.de/congress/27c3/mp4-h264-HQ/27c3-4017-en-desktop_on_the_linux.mp4


signature.asc
Description: PGP signature


Re: [dev] [surf] [patch] Optionally handle downloads through webkit.

2018-03-23 Thread v4hn
On Thu, Mar 22, 2018 at 08:54:34PM +, Nick wrote:
> I wonder whether it would be best to move to webkit handling
> downloads itself, like this, albeit with a basic user interface.

This is not a new thought.
Five years ago people thought it a bad idea.

https://lists.suckless.org/dev/1301/14371.html


v4hn


signature.asc
Description: PGP signature


Re: [dev] suckless too to minify CSS, JS and html

2018-05-22 Thread v4hn
On Tue, May 22, 2018 at 12:17:20PM +0200, harry666t wrote:
> I wonder how many people here that advise against minification, keep
> their compiled binaries "readable".

I wonder how many people here looked at this thread and thought
"stop that nonsense and do something useful with your life".

*The* main advantage of any interpreted language is readability at runtime.
If you don't want that, you might as well build ActionScript3 bundles.

There are regular discussions on this platform that end with
"www sucks; everything's too complex".
Sure, go ahead and minify. Nobody will look at your sources
and that might make you sleep better.
It's not likely people will ever try to read your websites anyway...


v4hn


signature.asc
Description: PGP signature


Re: [dev] (academic) reading suggestions associated to the minimalist/suckless design philosophy?

2018-07-02 Thread v4hn
One book in that domain I enjoyed quite a bit is

Beautiful Code - O'Reilly
http://shop.oreilly.com/product/9780596510046.do

It's not really about suckless software
(usually svn, xml, and js are not considered suckless...),
but it illustrates quite nicely many thought processes
involved with "elegant" software design.


v4hn

On Fri, Jun 29, 2018 at 11:42:36AM +0200, Jens Staal wrote:
> Dear all,
> 
> Do you have any reading suggestions (preferably academic papers, but books
> might also work) in alignment with the "suckless philosophy" (or 
> "minimalism"). 
> It does not have to be specifically programming, it could also be engineering 
> and design in general (art might be a stretch, but if you know some good
> litterature in that field I am open to that too).
> 
> 

-- 
Michael 'v4hn' Görner, M.Sc. Cognitive Science, PhD Student
Universität Hamburg
Faculty of Mathematics, Informatics and Natural Sciences
Department of Informatics
Group Technical Aspects of Multimodal Systems

Vogt-Kölln-Straße 30
D-22527 Hamburg

Room: F-315
Phone: +49 40 42883-2432
Website: https://tams.informatik.uni-hamburg.de/people/goerner/


signature.asc
Description: PGP signature


Re: [dev] [libgrapheme] announcement

2020-03-27 Thread v4hn
On Fri, Mar 27, 2020 at 09:49:46PM +0100, Laslo Hunhold wrote:
> thank you very much! Especially regarding understandability, given this
> topic is really a bit "specific". :)

On that note, do you work on this very specific subproblem out of curiosity
or do you work on concrete software projects that need this functionality?

Happy hacking,


v4hn

-- 
Michael 'v4hn' Görner, M.Sc. Cognitive Science, PhD Student
Universität Hamburg
Faculty of Mathematics, Informatics and Natural Sciences
Department of Informatics
Group Technical Aspects of Multimodal Systems

Vogt-Kölln-Straße 30
D-22527 Hamburg

Room: F-315
Phone: +49 40 42883-2432
Website: https://tams.informatik.uni-hamburg.de/people/goerner/


signature.asc
Description: PGP signature


Re: [dev] Scrollback utility for use with st

2020-04-06 Thread v4hn
On Mon, Apr 06, 2020 at 04:43:04PM +0200, Laslo Hunhold wrote:
> but I first wanted to test the waters and see how the general opinion here is.

Well, unless the hardcore scrollback-is-for-wimps-and-too-hard-to-maintain crew
hid somewhere until now, there seems to be general agreement that everyone 
either
uses the patch or something they think of as a workaround for a missing feature.
Either way people seem to welcome the idea to have it upstream.

So do I.


v4hn

-- 
Michael 'v4hn' Görner, M.Sc. Cognitive Science, PhD Student
Universität Hamburg
Faculty of Mathematics, Informatics and Natural Sciences
Department of Informatics
Group Technical Aspects of Multimodal Systems

Vogt-Kölln-Straße 30
D-22527 Hamburg

Room: F-315
Phone: +49 40 42883-2432
Website: https://tams.informatik.uni-hamburg.de/people/goerner/


signature.asc
Description: PGP signature


Re: [dev] [dwm] dwm breaks on synchronized screens

2021-11-12 Thread v4hn
Hey everyone,

I can verify issues with multi-monitor setups when screens are 
overlapping/mirrored.
I usually avoid this by working with independent screens as well.

With XINERAMA support in dwm you can dynamically configure monitors via xrandr.
If you configure them to coincide, e.g.,
`xrandr --output  --auto --same-as `,
it seems that at least for some configurations dwm creates separate `Monitor` 
structs
unconditionally and you can cycle through the monitors via shortcuts.
But because they overlap you will not even see the bar for one of the monitors
and window management is screwed up as well.
Notice that there is actually logic in the code that should prevent this
for the case where virtual screen positions coincide. (`isuniquegeom`)

Along the same lines of code I recently noticed that dynamically adding an
independent/unique screen via xrandr can change the Monitor->physical screen 
association
and thus move all existing windows to a different physical screen.
Maybe it's a different bug altogether though, I did not have time to 
investigate.


v4hn

On Fri, Nov 12, 2021 at 09:18:22AM +0100, Laslo Hunhold wrote:
> On Thu, 11 Nov 2021 19:34:08 +0100
> Thomas Oltmann  wrote:
> 
> Dear Thomas,
> 
> > What do I do about this?
> > Is it even a bug or just me using dwm for stuff it's not intended to
> > do? One way or another, how can I do my presentations without
> > fighting the WM all the time?
> 
> do you have a way so we can reproduce this?
> 
> With best regards
> 
> Laslo
> 

-- 
Michael 'v4hn' Görner, M.Sc. Cognitive Science, PhD Student
Universität Hamburg
Faculty of Mathematics, Informatics and Natural Sciences
Department of Informatics
Group Technical Aspects of Multimodal Systems

Vogt-Kölln-Straße 30
D-22527 Hamburg

Room: F-315
Phone: +49 40 42883-2432
Website: https://tams.informatik.uni-hamburg.de/people/goerner/


signature.asc
Description: PGP signature


Re: [dev] [dwm] swallow without patching dwm -- or losing focus

2023-05-26 Thread v4hn
On Fri, May 26, 2023 at 02:50:20AM -0300, Spenser Truex wrote:
> I just want my windows to open where I opened
> them. There is no kitchen sink included.

I would like that too, but the linked project doesn't do it.
It doesn't even work when ran through `dmenu`, but instead hides/unhides
whatever window you focused before you opened dmenu. :)


v4hn

-- 
Michael 'v4hn' Görner, M.Sc. Cognitive Science, Research Associate
Universität Hamburg
Faculty of Mathematics, Informatics and Natural Sciences
Department of Informatics
Group Technical Aspects of Multimodal Systems

Vogt-Kölln-Straße 30
D-22527 Hamburg

Room: F-315
Phone: +49 40 42883-2432
Website: https://tams.informatik.uni-hamburg.de/people/goerner/


signature.asc
Description: PGP signature


Re: [dev] Simple made Easy (Rich Hickey at StrangeLoop)

2011-10-22 Thread v4hn
On Sat, Oct 22, 2011 at 12:12:09PM +0200, hiro wrote:
> > rtmpdump -r 
> > 'rtmpe://video.infoq.com/cfx/st/presentations/11-sep-simplemadeeasy.mp4' -o 
> > simple_made_easy.mp4

thanks too.

> Thanks, now I don't have to restart my web browser, but compiling
> still sucks on this machine.
> Is there still no cloud service taking
> random URLs and bringing you download links to all embedded media?

What's suckless about software as a service?


v4hn


pgpcmESQVwtYZ.pgp
Description: PGP signature


Re: [dev] Simple made Easy (Rich Hickey at StrangeLoop)

2011-10-22 Thread v4hn
On Sat, Oct 22, 2011 at 01:07:38PM +0200, hiro wrote:
> > What's suckless about software as a service?
> 
> useful services?
> Sorry if I'm not using these buzzwords ansi conform.

At least I wouldn't call software/services which depend
on the availability of one IP/Domain on the internet suckless!

If you do, then I agree with you in the following...
 
> suckless people suck more and more.


v4hn


pgpIb5ZZ5smEV.pgp
Description: PGP signature


Re: [dev] [slock] kill slock with Ctrl+Alt+Multiply

2012-01-19 Thread v4hn
WTH?! Those freaking jerks!
They remove Ctrl+Alt+Backspace, but introduce a backdoor like this in passing?!


pgpZXc94gM0Hv.pgp
Description: PGP signature


[dev] dmenu, dwm and two screens

2012-08-14 Thread v4hn
Hey everyone,

I got a new monitor recently and started to work with
two screens and dwm.
No problem at all. Everything works fine, except for one
_really annoying_ issue with dmenu and dwm.

If no windows are open on the current tag of one screen
and I switch to this screen&tag using the keyboard
then if I invoke dmenu it doesn't always appear on the focused
screen, but on the screen where the cursor currently is!
The issue is gone if I open at least one client on the focused
screen before invoking dmenu.

I've got no time at the moment to investigate this and don't even know
where to start looking. Could someone who knows a bit more about
X internals than me please investigate this problem!


v4hn


pgprnaa8wbtim.pgp
Description: PGP signature


Re: [dev] dmenu, dwm and two screens

2012-08-16 Thread v4hn
Hey Martti,

these patches work like a charme, thanks!
If this is the most simple way of fixing this mess,
then I vote for adding it to upstream.

Still this looks like patchwork to me..
dmenu fails to detect the active screen in dwm.
So either the detection is broken or dwm does not support
the detection used. Is there a standardized way of doing this?

Could the authors of the respective code lines please have a look at this?


v4hn

On Tue, Aug 14, 2012 at 03:33:45PM +0200, Martti Kühne wrote:
> [1] for dwm, [2] for dmenu, accordingly.
> I did publish it before, no idea where it got lost.
> Otoh, it's a fairly simple addition, which to figure out isn't much to imo.
> 
> have a nice day.
> mar77i
> 
> [1] https://github.com/mar77i/dwm-patches/blob/master/dmenumon/dmenumon.patch
> [2] https://gist.github.com/3349298


pgpHg7qzhTWP2.pgp
Description: PGP signature


Re: [dev] I don't want to live on this planet anymore

2012-10-31 Thread v4hn
On Wed, Oct 31, 2012 at 02:59:26PM -0400, Calvin Morrison wrote:
> Except that we need to learn how to use the tools thst exist instead if
> implementing our own.
> You shouldn't need programing ability for something like this

yes and no,

there are two cases here. Either you could have done this exercise quickly
and really think that it's a bad idea to write such code yourself.

In that case: You're a jerk.
Hell, overcome adolescence and get real! He wanted to test your
knowledge. He never told you to replace paste with you own code
(though this could only improve quality for the gnu paste at least imho).
You should (just theoretically though because of time constraints..)
be able to start from scratch and rewrite every single standard application
or at least understand how it works. How else could you appreciate them?
Also, if you want to use software as a black box as a student of computer 
science,
quit university.

Or you were to lazy to care for the technical details and you could not write
this quickly without checking man pages or fighting compiler warnings.

In that case: You're a stupid jerk.
These are (the really first) basics and if you can't implement this
without further thinking, then how do you expect to properly understand 
anything else?

Decide for yourself.


v4hn


pgpR5kJADh6a0.pgp
Description: PGP signature


[dev] [surf-5.0] internal download manager

2013-01-27 Thread v4hn
Hey everyone,

because I hit a nasty bug with https and the wget
downloader("Not authorized") I ported the internal
downloader patch to surf 0.5. I tried to improve
the interface a bit and add a progress bar.

Feel free to improve the code. Some ideas would include
- cancel button (a bit tricky I suppose)
- /one/ window for all downloads
- when multiple downloads are open only some of them
  recieve callbacks for some reason
- fix frontend for <1K files. The download is finished,
  before the window is rendered. The JS misses the
  finish signal.
- reasonable default window sizes for non-tiling WM?
- further improve layout


v4hn
diff --git a/config.def.h b/config.def.h
index 1cba4d7..3065c73 100644
--- a/config.def.h
+++ b/config.def.h
@@ -11,6 +11,7 @@ static char *progress_proxy_untrust = "#FF6600";
 static char *stylefile  = "~/.surf/style.css";
 static char *scriptfile = "~/.surf/script.js";
 static char *cookiefile = "~/.surf/cookies.txt";
+static char *downdir= "/tmp";
 static time_t sessiontime   = 3600;
 static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
 static char *strictssl  = FALSE; /* Refuse untrusted SSL connections */
diff --git a/surf.c b/surf.c
index c9fa08d..6c95f6e 100644
--- a/surf.c
+++ b/surf.c
@@ -114,6 +114,7 @@ static void destroyclient(Client *c);
 static void destroywin(GtkWidget* w, Client *c);
 static void die(const char *errstr, ...);
 static void drawindicator(Client *c);
+static void download(WebKitDownload *o, GParamSpec *pspec, Client *c);
 static void eval(Client *c, const Arg *arg);
 static gboolean exposeindicator(GtkWidget *w, GdkEventExpose *e, Client *c);
 static void find(Client *c, const Arg *arg);
@@ -290,6 +291,29 @@ cookiejar_set_property(GObject *self, guint prop_id, const 
GValue *value,
 }
 
 static void
+download(WebKitDownload *o, GParamSpec *pspec, Client *c) {
+   WebKitDownloadStatus status;
+   char script[2048]; char* s= script;
+
+   status = webkit_download_get_status(o);
+   if(status == WEBKIT_DOWNLOAD_STATUS_STARTED || status == 
WEBKIT_DOWNLOAD_STATUS_CREATED) {
+   snprintf(script, 2048, "u(%d, %d, %d)",
+(gint)webkit_download_get_current_size(o),
+(gint)webkit_download_get_total_size(o),
+(gint)(webkit_download_get_progress(o) * 100));
+   const Arg a= {.v = (void*) &s};
+   eval(c, &a);
+   }
+   else if (status == WEBKIT_DOWNLOAD_STATUS_FINISHED){
+   snprintf(script, 2048, "c(%d, %d)",
+(gint)webkit_download_get_current_size(o),
+(gint)webkit_download_get_total_size(o));
+   const Arg a= {.v = (void*) &s};
+   eval(c, &a);
+   }
+}
+
+static void
 evalscript(JSContextRef js, char *script, char* scriptname) {
JSStringRef jsscript, jsscriptname;
JSValueRef exception = NULL;
@@ -496,12 +520,104 @@ geturi(Client *c) {
 
 static gboolean
 initdownload(WebKitWebView *view, WebKitDownload *o, Client *c) {
-   Arg arg;
+   gchar *uri, *path;
+   const gchar *filename;
+   Client *n;
+   const char template[] =
+"" \
+"" \
+"Download - %s" \
+"" \
+"function formText(x){" \
+"  if(x >= 1073741824)  { return (Math.floor(x/10737418.24)/100) + \"G\"; }" \
+"  else if(x >= 1048576){ return (Math.floor(x/10485.76)/100) + \"M\"; }" \
+"  else if(x >= 1024)   { return (Math.floor(x/10.24)/100) + \"k\"; }" \
+"  else { return x+\"b\"; }" \
+"}" \
+"function updateText(c,t){" \
+"  txt= formText(c) + \"/\" + formText(t);" \
+"  DLTEXT.textContent= txt;" \
+"  /* center text in bar */" \
+"  DLTEXT.setAttribute('x', 102-4.4*txt.length)" \
+"}" \
+"function c(c, t){" \
+"  DLGRAD.setAttribute('x2', 230);" \
+"  DLGRAD.setAttribute('x1', 205);" \
+"  updateText(c,t);" \
+"  document.getElementById('stop1').setAttribute('style', 
\"stop-color:#2020ff;\");" \
+"}" \
+"function u(c,t,p){" \
+"  DLGRAD.setAttribute('x2', Math.floor(p*205/100) + 25);" \
+"  DLGRAD.setAttribute('x1', Math.floor(p*205/100));" \
+"  updateText(c,t);" \
+"}" \
+"" \
+"" \
+"" \
+"" \
+"Downloading" \
+"%s" \
+"to %s" \
+"http://creativecommons.org/ns#\""; \
+"   xmlns:svg=\"http://www.w3.org/2000/svg\""; \
+"   xmlns=\"http://www.w3.org/2000/svg\"&quo

Re: [dev] [surf-5.0] internal download manager

2013-01-30 Thread v4hn
Hey again,

On Sun, Jan 27, 2013 at 06:00:16PM +0100, v4hn wrote:
> because I hit a nasty bug with https and the wget
> downloader("Not authorized") I ported the internal
> downloader patch to surf 0.5. I tried to improve
> the interface a bit and add a progress bar.

Digging further into that issue I found the webkit
engine adds the prefix "#HttpOnly_" to the relevant
cookie in the cookies.txt and wget therefore gladly ignores
the line. Someone should probably think up a patch for that.
It's enough to strip that prefix. Normally this seems to be
a security issue w.r.t. XSS-attacks, but I'm not sure
that's relevant in this specific case.

> - fix frontend for <1K files. The download is finished,
>   before the window is rendered. The JS misses the
>   finish signal.

I fixed that issue in the attached code. Not beautiful, but working.
If someone has an idea on how to improve that, do so. :)


v4hn
diff --git a/config.def.h b/config.def.h
index 1cba4d7..3065c73 100644
--- a/config.def.h
+++ b/config.def.h
@@ -11,6 +11,7 @@ static char *progress_proxy_untrust = "#FF6600";
 static char *stylefile  = "~/.surf/style.css";
 static char *scriptfile = "~/.surf/script.js";
 static char *cookiefile = "~/.surf/cookies.txt";
+static char *downdir= "/tmp";
 static time_t sessiontime   = 3600;
 static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
 static char *strictssl  = FALSE; /* Refuse untrusted SSL connections */
diff --git a/surf.c b/surf.c
index c9fa08d..4d589aa 100644
--- a/surf.c
+++ b/surf.c
@@ -114,6 +114,7 @@ static void destroyclient(Client *c);
 static void destroywin(GtkWidget* w, Client *c);
 static void die(const char *errstr, ...);
 static void drawindicator(Client *c);
+static void download(WebKitDownload *o, GParamSpec *pspec, Client *c);
 static void eval(Client *c, const Arg *arg);
 static gboolean exposeindicator(GtkWidget *w, GdkEventExpose *e, Client *c);
 static void find(Client *c, const Arg *arg);
@@ -289,6 +290,50 @@ cookiejar_set_property(GObject *self, guint prop_id, const 
GValue *value,
flock(COOKIEJAR(self)->lock, LOCK_UN);
 }
 
+struct client_size_tuple {
+   Client* c;
+   gint s;
+};
+
+static void
+late_download_update(WebKitWebView* view, GParamSpec *pspec, struct 
client_size_tuple* t){
+   char script[1024]; char* s= script;
+   snprintf(script, 1024, "c(%d, %d)", t->s, t->s);
+   const Arg a= {.v = (void*) &s};
+   eval(t->c, &a);
+   free(t);
+}
+
+static void
+download(WebKitDownload *o, GParamSpec *pspec, Client *c) {
+   WebKitDownloadStatus status;
+   char script[2048]; char* s= script;
+
+   status = webkit_download_get_status(o);
+   if(status == WEBKIT_DOWNLOAD_STATUS_STARTED || status == 
WEBKIT_DOWNLOAD_STATUS_CREATED) {
+   snprintf(script, 2048, "u(%d, %d, %d)",
+   (gint)webkit_download_get_current_size(o),
+   (gint)webkit_download_get_total_size(o),
+   (gint)(webkit_download_get_progress(o) * 100));
+   const Arg a= {.v = (void*) &s};
+   eval(c, &a);
+   }
+   else if (status == WEBKIT_DOWNLOAD_STATUS_FINISHED){
+   if( webkit_web_view_get_load_status(c->view) == 
WEBKIT_LOAD_FINISHED ){
+   snprintf(script, 2048, "c(%d, %d)",
+   (gint)webkit_download_get_current_size(o),
+   (gint)webkit_download_get_total_size(o));
+   const Arg a= {.v = (void*) &s};
+   eval(c, &a);
+   }
+   else {
+   struct client_size_tuple* t= calloc(1, sizeof(struct 
client_size_tuple));
+   t->c= c; t->s= 
(gint)webkit_download_get_current_size(o);
+   g_signal_connect(c->view, "document-load-finished", 
G_CALLBACK(late_download_update), t);
+   }
+   }
+}
+
 static void
 evalscript(JSContextRef js, char *script, char* scriptname) {
JSStringRef jsscript, jsscriptname;
@@ -496,12 +541,105 @@ geturi(Client *c) {
 
 static gboolean
 initdownload(WebKitWebView *view, WebKitDownload *o, Client *c) {
-   Arg arg;
+   gchar *uri, *path;
+   const gchar *filename;
+   Client *n;
+   const char template[] =
+"" \
+"" \
+"Download - %s" \
+"" \
+"function formText(x){" \
+"  if(x >= 1073741824)  { return (Math.floor(x/10737418.24)/100) + \"G\"; }" \
+"  else if(x >= 1048576){ return (Math.floor(x/10485.76)/100) + \"M\"; }" \
+"  else if(x >= 1024)   { return (Math.floor(x/10.24)/100) + \"k\"; }" \
+"  else

Re: [dev] [surf-5.0] internal download manager

2013-02-02 Thread v4hn
On Sat, Feb 02, 2013 at 09:34:11AM +0100, Christoph Lohmann wrote:
> I  don’t  like  your download manager because other tools can do it in a
> better and more UNIX way.

Totally agreed.
I only ported it to current surf and made it look a bit less stupid.
Doesn't mean that I want to use it. :)
/* On the other hand surf is based on webkit, which does not only render
web pages but also walks your dog. Just because you don't use all "features"
of the engine doesn't mean it's not in working memory for example.
Not sure I would call _that_ "a more UNIX way". */
There was enough discussion about that manager when someone wrote it
initially.

> But  anways,  do  you have an example URI for where the »Not authorized«
> bug appears?

Jochen's patch "fixes" this issue.
Sorry, but you can't test it for my example as this is my universities
students platform and you would need a login(obviously).

As I just saw, you provided a curl-patch that works. Thank you!


v4hn


pgpFZ2GBOywsK.pgp
Description: PGP signature


[dev] snotes v0.9 - a simple notes system

2013-02-03 Thread v4hn
Hey everyone,

I mentioned some days ago in a private conversation
that I've written a small notes organizer using dmenu
and git. People got curious and so I cleaned it up
a bit and hereby publish 

snotes version 0.9

If you find any flaws or like to propose improvements,
please write me a mail.

It is available from https://github.com/v4hn/snotes .

Its major selling points are independence from all big platforms
normally associated with note organizers, like Mono, GTK/Qt or emacs,
and simplicity by design. The whole project is approx. 200 lines of
sh code at the moment and integrates beautifully with dwm.

Enjoy!


v4hn


pgp2r7AOxzItl.pgp
Description: PGP signature


Re: [dev] snotes v0.9 - a simple notes system

2013-02-04 Thread v4hn
Hey everyone,

thanks for the suggestions, I've just included all of them.

On Mon, Feb 04, 2013 at 05:09:48PM +0800, Chris Down wrote:
> Since this issue cropped up I figured I might as well take a quick look at
> the script. There are two other things that might be worth changing after a
> quick skim:
> 
> - Not sure what's up with all the ''[ -n "`which foo`" ]'' idioms. Use
> ''type'' and just check the exit code.

funny thing: the type statement is actually longer because type does not
support -q and the usual >/dev/nul... line adds characters.
But sure, you're right.

> - Instead of escaping in heredocs, you can just use 'EOF' instead of EOF.

Thanks! I wrote this introduction last night at 4am and was too tired to look
up the right escaping for heredocs.

> On 4 February 2013 17:04, Chris Down  wrote:
> > On 4 February 2013 16:56, Thomas Dean <78...@web.de> wrote:
> > > One thing to mention: sh links to dash in my case, which has no built-in
> > > "source" command. Is there a standalone substitute?
> >
> > Use ''.'' instead of ''source'', it's POSIX.

I consider ``source'' more readable than ``.'' but given that the first
is less portable I changed it.

Is the rest of the code dash-friendly? Because I normally don't care about
debian & friends.


v4hn


pgpDD2N7P9_At.pgp
Description: PGP signature


Re: [dev] snotes v0.9 - a simple notes system

2013-02-04 Thread v4hn
On Mon, Feb 04, 2013 at 10:47:34AM +0100, Petr Šabata wrote:
> That looks quite usable.

I can assure you, it is. I've been using it for years, literally.
Sorry for not publishing it earlier.

> I'm not sure how many people have graphical vim installed,
> though.  Perhaps you could switch to 'xterm -e vi' or something
> like that.  Of course, no default will work for everybody but
> this one might cover somewhat more users.

Personally, I use luced [0] over here, which integrates well
with a suckless desktop (as long as you don't look at the code...).
However, that's definitely no sane default. :)
So I was looking for a common graphical editor.
"xterm -e vim" is a nice workaround, thanks.


v4hn
---
[0] -- http://luced.org


pgpfiCKlHmXPX.pgp
Description: PGP signature


Re: [dev] snotes v0.9 - a simple notes system

2013-02-04 Thread v4hn
On Mon, Feb 04, 2013 at 11:46:51PM +0800, Chris Down wrote:
> SNOTES_EDITOR=${VISUAL:+xterm -e $VISUAL}
> : "${SNOTES_EDITOR:=${EDITOR:-vim}}"

That would make the config do more than it is supposed to.
I agree that it makes sense to respect $VISUAL though.
I now changed the line to 

SNOTES_EDITOR=${VISUAL:-xterm -e vi}

to meet that requirement.

Also, I'm still waiting for a notice on whether this now works
with dash. If so, I would like to push out a 1.0 release
because snotes does everything it's supposed to do at the moment.

I would like to see this listed on http://tools.suckless.org .
How do I get a tarball pushed to dl.suckless.org/tools/?


v4hn


pgpwzpNLDVsSk.pgp
Description: PGP signature


Re: [dev] snotes v0.9 - a simple notes system

2013-02-04 Thread v4hn
On Mon, Feb 04, 2013 at 10:09:25PM +0100, markus schnalke wrote:
> [2013-02-04 20:57] v4hn 
> > On Mon, Feb 04, 2013 at 11:46:51PM +0800, Chris Down wrote:
> >> SNOTES_EDITOR=${VISUAL:+xterm -e $VISUAL}
> >> : "${SNOTES_EDITOR:=${EDITOR:-vim}}"
> >
> > That would make the config do more than it is supposed to.
> > I agree that it makes sense to respect $VISUAL though.
> > I now changed the line to
> >
> > SNOTES_EDITOR=${VISUAL:-xterm -e vi}
> >
> > to meet that requirement.
> 
> On my system VISUAL is set to `vi', which is a common situation.
> Your code assumes that VISUAL contains a graphical editor. Thus
> the setup breaks for me AFAICS.
> 

I see. Thanks for note. I've changed it to the following now,
which should work for all reasonable setups.
If this doesn't work for someone, honestly, I couldn't care less.
It's a default, not the final truth.

SNOTES_EDITOR="${EDITOR:+xterm -e $EDITOR}"
SNOTES_EDITOR="${SNOTES_EDITOR:-xterm -e vi}"


v4hn


pgpwSp6SKYt4O.pgp
Description: PGP signature


Re: [dev] snotes v0.9 - a simple notes system

2013-02-05 Thread v4hn
On Tue, Feb 05, 2013 at 12:10:12PM +0100, markus schnalke wrote:
> [2013-02-05 00:54] v4hn 
> > I see. Thanks for note. I've changed it to the following now,
> > which should work for all reasonable setups.
> > If this doesn't work for someone, honestly, I couldn't care less.
> > It's a default, not the final truth.
> >
> > SNOTES_EDITOR="${EDITOR:+xterm -e $EDITOR}"
> > SNOTES_EDITOR="${SNOTES_EDITOR:-xterm -e vi}"
> 
> Sorry, but you've missed the point. This setup does not solve
> the issue at all.

Missing the point(VISUAL) was the idea. Quoting from Wikibooks[0]:

Generally you will want to set it [VISUAL] to the same value as the EDITOR
variable. Originally EDITOR would have be set to ed (a line-based editor)
and VISUAL would've been set to vi (a screen-based editor). These days,
you're unlikely to ever find yourself using a teletype as your terminal,
so there is no need to choose different editors for the two.

ok, so either I'll keep the above two lines or I'll move the logic
to the initialization to retain a clean config file without sequential logic:

 SNOTES_EDITOR=${VISUAL:-${EDITOR:-vi}}
 SNOTES_EDITOR="xterm -e $SNOTES_EDITOR"
 cat > $HOME/.snotes/config <http://en.wikibooks.org/wiki/Guide_to_Unix/Environment_Variables#VISUAL


pgpp1xagscf3c.pgp
Description: PGP signature


Re: [dev] snotes v0.9 - a simple notes system

2013-02-05 Thread v4hn
On Tue, Feb 05, 2013 at 02:18:18PM +0100, markus schnalke wrote:
> [2013-02-05 13:16] v4hn 
> >  SNOTES_EDITOR=${VISUAL:-${EDITOR:-vi}}
> >  SNOTES_EDITOR="xterm -e $SNOTES_EDITOR"
> >  cat > $HOME/.snotes/config < > SNOTES_EDITOR="$SNOTES_EDITOR"
> > [...]
> >
> > You may choose.
> 
> The first two of my suggestions are very much ideoms, whereas
> both of your suggestions would produce unexpected behavior for me.

I honestly don't see any unexpected behaviour here.
This makes the config simply more readable than your solution
and as people will most likely not want to use xterm or a command line
editor they will in most cases edit the config anyway.

> Let my suggest a solution: [...]
> 
>   SNOTES_EDITOR="xterm -e ${VISUAL:-${EDITOR:-vi}}"

Fine with me, I just pushed this. Thank you for your criticism.


v4hn


pgpvZ7e1IPYN7.pgp
Description: PGP signature


Re: [dev] FTP script: how to store password?

2013-02-09 Thread v4hn
On Sat, Feb 09, 2013 at 12:20:58PM +0100, Hugues Moretto-Viry wrote:
> Hi guys,
> 
> I'm writing a little FTP client in pure shell + curl for my personal needs.
> Anyway, I need to store my passwords so I chose SQlite, because I don't
> want to put them in a regular file or in the script.

Why not? That would be suckless. And alright as long as the file permissions
are set correctly (but if they're not, SQLite doesn't help you as well).

By the way, you will want to make sure the password/hash does not appear
as a parameter, or else anyone on the machine can simply read it out with `ps 
-ax`.


v4hn


pgpYQFNQWC9OS.pgp
Description: PGP signature


Re: [dev] [st] Segmentation fault when clicking the top of window

2013-03-28 Thread v4hn
On Thu, Mar 28, 2013 at 01:18:53PM +0100, Martti Kühne wrote:
> wow. java...
> go team university coders! ;-)

excuse me, _what_?


v4hn


pgpzfageZU41W.pgp
Description: PGP signature


Re: [dev] [dmenu] handling space(?)

2013-04-17 Thread v4hn
On Wed, Apr 17, 2013 at 11:02:12PM +0200, Swiatoslaw Gal wrote:
> If I run `echo lorem|dmenu`
> and then type "lorem l"
> dmenu selects 'lorem' not 'lorem l'
> if I type "lorem i" the ouptput is "lorem i" as expected.
> Seems like a bug to me, am I wrong?

You're wrong, that's a feature.
(Although it can be pretty annoying when using snotes)

strings separated by space are considered to be separate tokens
describing the same menu entry. If you want to return
"lorem l" in your case press SHIFT+ENTER to select the string.


v4hn


pgp1VcamzveYQ.pgp
Description: PGP signature


Re: [dev] upload via html?

2013-05-13 Thread v4hn
On Mon, May 13, 2013 at 10:38:32PM +0200, Thuban wrote:
> But it's not easy to use for browser-addicted-humans...

These people are the reason we /are/ in this mess called "web".
If they can't use proper protocols for different tasks
but just their crappy bloated browser.. Fine by me!
Disregarded until they've learnt their lesson.


v4hn


pgp_fcb_3EQPm.pgp
Description: PGP signature


Re: [dev] lynx?

2013-05-28 Thread v4hn
On Tue, May 28, 2013 at 01:06:52PM +0200, markus schnalke wrote:
> these days, lynx was often mentioned when a text browser was meant.
> Is there really someone (apart from mirabilos) who uses lynx?

Yes, I routinely use it when looking for textual information:
wiki pages, software versions/package urls, word translations...

> Don't you rather use w3m?

Never tried it, let me have a look...

Hm, doesn't compile without patches with current glibc,
as well as with current gc. lynx does. :)


v4hn


pgpNU5SBxkGgf.pgp
Description: PGP signature


Re: [dev] [sbase] Adding tar

2013-07-06 Thread v4hn
Also

$ tar cjf file.tar.bz2 folder
$ tar cJf file.tar.xz folder

and

$ tar xf filename.tar.

On Sat, Jul 06, 2013 at 08:30:39PM +1000, Daniel Bryan wrote:
> tar xzf filename.tar.gz ~/scratch/
> On 06/07/2013 8:20 PM, "Dmitrij Czarkoff"  wrote:
> 
> > On Jul 6, 2013 12:16 PM, "Galos, David" 
> > wrote:
> > >
> > > In short, how do you fine folks invoke your tar?
> >
> > $ tar czf filename.tar.gz foldername
> > $ tar tzf filename.tar.gz
> > $ tar xzf filename.tar.gz
> >
> > 
> > Dmitrij D. Czarkoff
> >


pgp6f92mAa8jp.pgp
Description: PGP signature


Re: [dev] st: bracketed paste mode

2013-09-22 Thread v4hn
Just wanted to say thanks (for a change ;) )!

This is one of the many tiny quirks I never bothered
to look into but always found annoying!
Now I at least know how to work around that.


v4hn

On Wed, Sep 18, 2013 at 05:12:58PM +0100, Raphaël Proust wrote:
> On Wed, Sep 18, 2013 at 4:55 PM, Egmont Koblinger  wrote:
> >> Could you put an example when it is useful?
> 
> Vim has a special mode for that. See :h 'paste' for more details, including:
> 
> Put Vim in Paste mode.  This is useful if you want to cut or copy
> some text from one window and paste it in Vim.  This will avoid
> unexpected effects.
> Setting this option is useful when using Vim in a terminal, where Vim
> cannot distinguish between typed text and pasted text.  In the GUI, 
> Vim
> knows about pasting and will mostly do the right thing without 'paste'
> being set.  The same is true for a terminal where Vim handles the
> mouse clicks itself.
> 
> It avoids autoindentation, but also some keyboard mappings.


pgpaqKkUkhMaX.pgp
Description: PGP signature


Re: [dev] [st][patch] scrollback buffer

2013-10-16 Thread v4hn
On Wed, Oct 16, 2013 at 12:00:05PM -0500, Strake wrote:
> On 16/10/2013, Jochen Sprickerhof  wrote:
> > I've implemented a (limited) scrollback buffer for st. Thanks to v4hn
> > for testing and improving first versions.
> 
> Thanks! This was the last reason against my st adoption.

This was the same for me (and likely others).
Missing native scrollback was the only reason for me not to look into st
up to now, that's why I supported developing this patch.
I'm now a (more or less) happy user of st + a patch the maintainer doesn't
deem necessary. :-) Still, I would really like to see this upstream.

Thanks for the work again, Jochen!


v4hn


pgpPl9fQEBcMP.pgp
Description: PGP signature


Re: [dev] [st][patch] scrollback buffer

2013-10-21 Thread v4hn
On Sat, Oct 19, 2013 at 02:17:54PM +0300, Edgaras wrote:
> Well it seems it does not work for me on raspberry,
> not that it is a huge loss,
> as I said I got used to this.

The relevant kernel option is CONFIG_VGACON_SOFT_SCROLLBACK and
by default allocates 64K of RAM for software scrollback.
Maybe you dropped it for the pi? Premature optimization in my opinion.
screen consumes much more.

Concerning the rest of the discussion:

Using screen/tmux for scrollback is everything but suckless.
It's like using KDE to read your mail.
It tells you where your toothbrush is when you start cooking your meal.

Oh, and screen tries to simulate multiple terminals.
It _multiplexes_ the history.
it's not meant to _provide_ it in the first place.

Essentially, there are two suckless options here:

- provide a scrollback with st and configurable scrollback size (hell, just
  set it to 0 before compiling if you don't want it). The current behaviour
  of the mousewheel is not even touched with the proposed patch.
  The patch is clean and neat as Jochen spent quite some time on it.
- Write a clean standalone program which _only_ handles scrollback.
  This scatters responsibility quite far even in terms of suckless,
  but whatever. I only think this could result in worse code
  than the current patch..


v4hn


pgpgFHK_Vb_Bx.pgp
Description: PGP signature


Re: [dev] Article about suckless on root.cz

2013-12-02 Thread v4hn
On Mon, Dec 02, 2013 at 11:18:25AM +0100, FRIGN wrote:
> at least for me, not having to learn yet another config-
> interface for package xy.

/me nods.
The way dwm uses C syntax to encapsulate its config is
quite the standard when compared to e.g. YAML.


v4hn


pgpyGEtPg0Ij0.pgp
Description: PGP signature