[dev] sshd?

2021-07-06 Thread Patrick
Hi all,

What's a good minimal sshd?

Or should we just run stunnel + telnetd?


Patrick




Re: [dev] Pandoc replacement that sucks less

2019-04-28 Thread Patrick
On 2019-04-28 21:44, Thomas Meulendijks wrote:
> I am currently using pandoc to convert my markdown files into pdf.

1) use TeX
2) create the TeX macros that you want to use
3) write a script to convert the old non-TeX docs
4) ditch markdown.




Re: [dev] [dmenu] 4.9 segfault on input

2019-02-18 Thread Patrick Smith
On Sat, Feb 16, 2019 at 12:47 AM Ivan Tham  wrote:
> By the way, Patrick. Why use anthy instead of mozc for japanese input? I
> heard anthy is a dead project (from arch wiki).

Further follow-up: I switched from scim+anthy to fcitx+mozc, and the
previous problems went away. Now (printf 'foo\nbar' | dmenu; press
enter) doesn't crash, and in (printf 'ふ\nば' | dmenu), I can use mozc
to select the second option. In the latter case, there is a
peculiarity; when the input focus returns to the (termite) terminal
window after dmenu returns, i3 still has the window marked as active,
but termite is displaying the cursor for an inactive window, and the
fcitx icon at the top of the screen is incorrectly indicating mozc,
not regular mode. But when I move the mouse out of the terminal window
and back in, both issues disappear.



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-18 Thread Patrick Smith
On Sat, Feb 16, 2019 at 12:47 AM Ivan Tham  wrote:
> By the way, Patrick. Why use anthy instead of mozc for japanese input? I
> heard anthy is a dead project (from arch wiki).

I started using scim+anthy several years ago, and it has continued to
work for me, so I've continued to use it. I never noticed that the
last release of anthy was 10 years ago.

When I started to look at alternatives just now, I noticed this from
https://wiki.archlinux.org/index.php/Fcitx#XIM :

Warning: Using XIM can sometimes cause problems including not being
able to input, no cursor following, word selection window issue,
application freeze on input method restart. For these XIM related
problems, Fcitx cannot provide any fix or support. This is the same
with any other input method framework, so please use the GTK+ and Qt
input method modules instead of xim whenever possible

I don't know whether that statement is accurate, but if it is, maybe
one should expect that using XOpenIM in dmenu and st will cause
problems. On the other hand, the desire to keep these programs small
and simple may recommend against using the GTK+ or Qt methods, so
there might not be a better option.



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-15 Thread Patrick Smith
On Fri, Feb 15, 2019 at 11:33 AM Silvan Jegen  wrote:
> With the suggested patch applied, everything worked for me when using
> IBus and in st we use a similar pattern to what this patch is proposing
> (x.c:1007-1014). I am not sure why Patrick's IME (SCIM) is working in
> st but not in dmenu with the patch applied...

To be clear... the terminal I normally use is termite, not st. In
termite, scim+anthy works fine for me. As a test, I just now did a git
clone of st and built it. Result: scim+anthy does not work in st for
me. It doesn't crash; it just doesn't do anything.

If I were looking for a terminal program, I probably would not
consider st because of this. But in a menu program such as dmenu, I
don't care whether I can use non-ASCII characters or not.



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-13 Thread Patrick Smith
On Wed, Feb 13, 2019 at 12:29 AM Hiltjo Posthuma  wrote:
> Please try the latest git version and report back.

It works for me. That is, there is no segfault from, for example,
printf 'foo\nbar' | ./dmenu

When I test with: printf 'あ\nお' | ./dmenu, I can't see a way to select
the second option (scim doesn't seem to be enabled inside dmenu). I
never use such menus, so I don't care about this; I suppose other
people might care, but at least dmenu doesn't crash.

Thanks!



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-12 Thread Patrick Smith
I have:

GTK_IM_MODULE=scim
XMODIFIERS=@im=SCIM
QT_IM_MODULE=scim

If I unset XMODIFIERS, dmenu works correctly. If I set
XMODIFIERS=@im=scim, dmenu segfaults.

XSetLocaleModifiers returns '@im=SCIM', as expected.

On Tue, Feb 12, 2019 at 1:57 AM Silvan Jegen  wrote:
>
> Hi Patrick
>
> On February 12, 2019 7:35:20 AM GMT+00:00, Patrick Smith 
>  wrote:
> >On Mon, Feb 11, 2019 at 12:43 PM Silvan Jegen 
> >wrote:
> >> I found that the XSetLocaleModifiers("") call returns "@im=ibus" in
> >my
> >> case which is not surprising because the env variable XMODIFIERS is
> >> set to @im=ibus on my machine. If Ibus is not running, however, I get
> >> a segfault just like Jordan ("XOpenIM"  returns NULL in that case).
> >If
> >> IBus is running, everything works fine.
> >
> >In my case, scim is running and can be used from a terminal or Chrome.
> >But dmenu still crashes, with XOpenIM returning NULL.
>
> Is XMODIFIERS set? What does XSetLocaleModifiers return in your case?
>
>
> Cheers,
>
> Silvan
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-11 Thread Patrick Smith
On Mon, Feb 11, 2019 at 12:43 PM Silvan Jegen  wrote:
> I found that the XSetLocaleModifiers("") call returns "@im=ibus" in my
> case which is not surprising because the env variable XMODIFIERS is
> set to @im=ibus on my machine. If Ibus is not running, however, I get
> a segfault just like Jordan ("XOpenIM"  returns NULL in that case). If
> IBus is running, everything works fine.

In my case, scim is running and can be used from a terminal or Chrome.
But dmenu still crashes, with XOpenIM returning NULL.



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-10 Thread Patrick Smith
Jordan, I tried a similar patch, and yes it does work for me. My
message reporting that may have been delayed by moderation or
something, I'm not sure.

One drawback to this is that seems to disable the user's input method.
If, for example, I do

printf 'あ\nお' | ./dmenu

(that contains Japanese hiragana characters in the menu), then I can
select the first option by just pressing enter, but I can't find a way
to select the second option.

This doesn't bother me; my actual menus only use English. But it might
possibly bother other dmenu users.

On Sun, Feb 10, 2019 at 4:30 PM Jordan Timmerman  wrote:
>
> I believe I have a patch to fix this issue. It is attached.
>
> Taken from: https://www.mail-archive.com/fltk-bugs@easysw.com/msg01159.html
>
> The link was pointed to by the Servo issue that Patrick Smith linked
> to. (Thanks, Patrick!)
>
> Patrick, can you please try (from a clean 4.9 dmenu sourcetree) `git
> apply fix-xim-failure.patch` and rebuild and test? This solves the
> issue for me.
>
> Jordan
>
>
> Jordan
>
> On Sun, Feb 10, 2019 at 6:29 PM Jordan Timmerman  wrote:
> >
> > Patrick,
> >
> > Can you also try reverting 377bd37e212b1ec4c03a481245603c6560d0be22 ?
> >
> > It certainly sounds like the same issue I experience; if so, reverting
> > that commit will cause dmenu to work correctly again. This may be able
> > to help guide your search if you continue debugging.
> >
> > On Sun, Feb 10, 2019 at 6:18 PM Patrick Smith  wrote:
> > >
> > > Another point of information... after seeing
> > > https://github.com/servo/servo/issues/9938, I tried these two commands
> > > with my instrumented dmenu:
> > >
> > > >>>> printf 'foo\nbar' | ./dmenu
> > > Calling XOpenIM
> > > Back from XOpenIM, xim=0x0
> > > Calling XCreateIC
> > > Back from XCreateIC, xic=0x0
> > > xic = 0x0, event type = 2
> > > calling XmbLookupString
> > > Segmentation fault (core dumped)
> > > >>>>
> > > >>>> printf 'foo\nbar' | LANG=en_US.UTF-8 ./dmenu
> > > Calling XOpenIM
> > > Back from XOpenIM, xim=0x67c3b660
> > > Calling XCreateIC
> > > Back from XCreateIC, xic=0x67c3c3b0
> > > xic = 0x67c3c3b0, event type = 2
> > > calling XmbLookupString
> > > back from XmbLookupString
> > > foo
> > >
> > > In the first case, $LANG is set to my default value, en_CA.UTF-8.
> > > There is another difference, not visible in the above output. In the
> > > first command, I can press enter immediately after entering the
> > > command, and this causes dmenu to terminate with the segfault. In the
> > > second case, immediately pressing enter does nothing. I have to move
> > > the cursor to the menu prepared by dmenu at the top of the screen, and
> > > then press enter (fwiw, my window manager is i3).
> > >
> > > On Sun, Feb 10, 2019 at 3:54 PM Jordan Timmerman  
> > > wrote:
> > > >
> > > > With a little finagling, I've managed to produce a backtrace by using
> > > > Quentin's suggested flag modifications to config.mk. This is attached.
> > > > It seems to me only to confirm what we've already learned: the failure
> > > > occurs in XmbLookupString. Perhaps with the additional diagnostic
> > > > information Patrick was able to provide we'll figure it out.
> > > >
> > > > As an aside: thanks to everyone who has patiently helped me figure out
> > > > how to provide debugging information! Sorry I can't be more help.
> > > >
> > > > On Sun, Feb 10, 2019 at 5:39 PM Patrick Smith  
> > > > wrote:
> > > > >
> > > > > I'm experiencing a problem that appears very similar to this one, and
> > > > > I can add a bit of information.
> > > > >
> > > > > Summary: When I have scim+anthy installed as an input method, the call
> > > > > to XOpenIM fails, returning a null pointer. But I don't know much
> > > > > about the internals of X, so can't be 100% sure this is the root of
> > > > > the problem. Nor do I know what to look at next.
> > > > >
> > > > > My environment: up to date Arch Linux, dmenu 4.9. For X input methods,
> > > > > using scim and anthy by setting environment variables:
> > > > >
> > > > > export XMODIFIERS=@im=SCIM
> > > > > export GTK_IM_MODULE=scim

Re: [dev] [dmenu] 4.9 segfault on input

2019-02-10 Thread Patrick Smith
I tried patching the dmenu 4.9 source code similarly to
https://www.mail-archive.com/fltk-bugs@easysw.com/msg01159.html.

Result: printf 'foo\nbar' | ./dmenu now works correctly. And I do not
need to move the mouse cursor before pressing the enter key.

Of course, I don't know whether that would be an appropriate fix in
the context of dmenu.

On Sun, Feb 10, 2019 at 4:17 PM Patrick Smith  wrote:
>
> Another point of information... after seeing
> https://github.com/servo/servo/issues/9938, I tried these two commands
> with my instrumented dmenu:
>
> >>>> printf 'foo\nbar' | ./dmenu
> Calling XOpenIM
> Back from XOpenIM, xim=0x0
> Calling XCreateIC
> Back from XCreateIC, xic=0x0
> xic = 0x0, event type = 2
> calling XmbLookupString
> Segmentation fault (core dumped)
> >>>>
> >>>> printf 'foo\nbar' | LANG=en_US.UTF-8 ./dmenu
> Calling XOpenIM
> Back from XOpenIM, xim=0x67c3b660
> Calling XCreateIC
> Back from XCreateIC, xic=0x67c3c3b0
> xic = 0x67c3c3b0, event type = 2
> calling XmbLookupString
> back from XmbLookupString
> foo
>
> In the first case, $LANG is set to my default value, en_CA.UTF-8.
> There is another difference, not visible in the above output. In the
> first command, I can press enter immediately after entering the
> command, and this causes dmenu to terminate with the segfault. In the
> second case, immediately pressing enter does nothing. I have to move
> the cursor to the menu prepared by dmenu at the top of the screen, and
> then press enter (fwiw, my window manager is i3).
>
> On Sun, Feb 10, 2019 at 3:54 PM Jordan Timmerman  wrote:
> >
> > With a little finagling, I've managed to produce a backtrace by using
> > Quentin's suggested flag modifications to config.mk. This is attached.
> > It seems to me only to confirm what we've already learned: the failure
> > occurs in XmbLookupString. Perhaps with the additional diagnostic
> > information Patrick was able to provide we'll figure it out.
> >
> > As an aside: thanks to everyone who has patiently helped me figure out
> > how to provide debugging information! Sorry I can't be more help.
> >
> > On Sun, Feb 10, 2019 at 5:39 PM Patrick Smith  wrote:
> > >
> > > I'm experiencing a problem that appears very similar to this one, and
> > > I can add a bit of information.
> > >
> > > Summary: When I have scim+anthy installed as an input method, the call
> > > to XOpenIM fails, returning a null pointer. But I don't know much
> > > about the internals of X, so can't be 100% sure this is the root of
> > > the problem. Nor do I know what to look at next.
> > >
> > > My environment: up to date Arch Linux, dmenu 4.9. For X input methods,
> > > using scim and anthy by setting environment variables:
> > >
> > > export XMODIFIERS=@im=SCIM
> > > export GTK_IM_MODULE=scim
> > > export QT_IM_MODULE=scim
> > >
> > > To reproduce the crash, I can do
> > >
> > > printf 'foo\nbar' | dmenu
> > >
> > > and then press return. With the Arch Linux 4.9, this produces a
> > > segmentation fault. After I downgraded to the Arch version of dmenu
> > > 4.8, it works correctly.
> > >
> > > So I downloaded the 4.9 source code and built it myself, with no
> > > changes to config.mk or anything else. This version produces still
> > > produces the segfault.
> > >
> > > Then I added debugging code to print some information to stderr. From
> > > this, I see that the crash seems to be inside XmbLookupString, as
> > > reported previously; the xic pointer returned from XCreateIC and
> > > passed to XmbLookupString is null, and the xim pointer returned from
> > > XOpenIM and passed to XCreateIC is also null.
> > >
> > > After this, I restarted X with scim disabled by commenting out the
> > > exports mentioned above, and retried the printf into dmenu. Now it
> > > works correctly, and reports that both XOpenIM and XCreateIC return
> > > non-null pointers.
> > >
> > > I'm not sure what to look at next, so I hope that helps someone else
> > > to diagnose the problem...
> > >



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-10 Thread Patrick Smith
Another point of information... after seeing
https://github.com/servo/servo/issues/9938, I tried these two commands
with my instrumented dmenu:

>>>> printf 'foo\nbar' | ./dmenu
Calling XOpenIM
Back from XOpenIM, xim=0x0
Calling XCreateIC
Back from XCreateIC, xic=0x0
xic = 0x0, event type = 2
calling XmbLookupString
Segmentation fault (core dumped)
>>>>
>>>> printf 'foo\nbar' | LANG=en_US.UTF-8 ./dmenu
Calling XOpenIM
Back from XOpenIM, xim=0x67c3b660
Calling XCreateIC
Back from XCreateIC, xic=0x67c3c3b0
xic = 0x67c3c3b0, event type = 2
calling XmbLookupString
back from XmbLookupString
foo

In the first case, $LANG is set to my default value, en_CA.UTF-8.
There is another difference, not visible in the above output. In the
first command, I can press enter immediately after entering the
command, and this causes dmenu to terminate with the segfault. In the
second case, immediately pressing enter does nothing. I have to move
the cursor to the menu prepared by dmenu at the top of the screen, and
then press enter (fwiw, my window manager is i3).

On Sun, Feb 10, 2019 at 3:54 PM Jordan Timmerman  wrote:
>
> With a little finagling, I've managed to produce a backtrace by using
> Quentin's suggested flag modifications to config.mk. This is attached.
> It seems to me only to confirm what we've already learned: the failure
> occurs in XmbLookupString. Perhaps with the additional diagnostic
> information Patrick was able to provide we'll figure it out.
>
> As an aside: thanks to everyone who has patiently helped me figure out
> how to provide debugging information! Sorry I can't be more help.
>
> On Sun, Feb 10, 2019 at 5:39 PM Patrick Smith  wrote:
> >
> > I'm experiencing a problem that appears very similar to this one, and
> > I can add a bit of information.
> >
> > Summary: When I have scim+anthy installed as an input method, the call
> > to XOpenIM fails, returning a null pointer. But I don't know much
> > about the internals of X, so can't be 100% sure this is the root of
> > the problem. Nor do I know what to look at next.
> >
> > My environment: up to date Arch Linux, dmenu 4.9. For X input methods,
> > using scim and anthy by setting environment variables:
> >
> > export XMODIFIERS=@im=SCIM
> > export GTK_IM_MODULE=scim
> > export QT_IM_MODULE=scim
> >
> > To reproduce the crash, I can do
> >
> > printf 'foo\nbar' | dmenu
> >
> > and then press return. With the Arch Linux 4.9, this produces a
> > segmentation fault. After I downgraded to the Arch version of dmenu
> > 4.8, it works correctly.
> >
> > So I downloaded the 4.9 source code and built it myself, with no
> > changes to config.mk or anything else. This version produces still
> > produces the segfault.
> >
> > Then I added debugging code to print some information to stderr. From
> > this, I see that the crash seems to be inside XmbLookupString, as
> > reported previously; the xic pointer returned from XCreateIC and
> > passed to XmbLookupString is null, and the xim pointer returned from
> > XOpenIM and passed to XCreateIC is also null.
> >
> > After this, I restarted X with scim disabled by commenting out the
> > exports mentioned above, and retried the printf into dmenu. Now it
> > works correctly, and reports that both XOpenIM and XCreateIC return
> > non-null pointers.
> >
> > I'm not sure what to look at next, so I hope that helps someone else
> > to diagnose the problem...
> >



Re: [dev] [dmenu] 4.9 segfault on input

2019-02-10 Thread Patrick Smith
I'm experiencing a problem that appears very similar to this one, and
I can add a bit of information.

Summary: When I have scim+anthy installed as an input method, the call
to XOpenIM fails, returning a null pointer. But I don't know much
about the internals of X, so can't be 100% sure this is the root of
the problem. Nor do I know what to look at next.

My environment: up to date Arch Linux, dmenu 4.9. For X input methods,
using scim and anthy by setting environment variables:

export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim

To reproduce the crash, I can do

printf 'foo\nbar' | dmenu

and then press return. With the Arch Linux 4.9, this produces a
segmentation fault. After I downgraded to the Arch version of dmenu
4.8, it works correctly.

So I downloaded the 4.9 source code and built it myself, with no
changes to config.mk or anything else. This version produces still
produces the segfault.

Then I added debugging code to print some information to stderr. From
this, I see that the crash seems to be inside XmbLookupString, as
reported previously; the xic pointer returned from XCreateIC and
passed to XmbLookupString is null, and the xim pointer returned from
XOpenIM and passed to XCreateIC is also null.

After this, I restarted X with scim disabled by commenting out the
exports mentioned above, and retried the printf into dmenu. Now it
works correctly, and reports that both XOpenIM and XCreateIC return
non-null pointers.

I'm not sure what to look at next, so I hope that helps someone else
to diagnose the problem...



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

2018-07-01 Thread Patrick Bucher
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").

Paul Graham: Taste for Makers (http://www.paulgraham.com/taste.html) --
an essay about good design.

Felix von Leitner: Writing Small And Fast Software
(https://www.fefe.de/dietlibc/diet.pdf) -- slides for his talk where he
introduces his lobowfat. The emphasis is on small software, but also on
API design.

In general, I suggest you browse through Dijkstra's writings:
http://www.cs.utexas.edu/users/EWD/

> 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).

In literature, Čechov was the ultimate champion of simplicity:

> On Sept. 3, 1899, Chekhov gave his most prescriptive advice to Gorki,
> a tip that influenced many 20th century writers like George Orwell and
> teachers of the craft such as Strunk and White.
> 
> "Here is more advice; when you read proof, [galley proofs publishers
> provide authors for corrections, deletions and other changes] take out
> adjectives and adverbs whenever you can. You use so many of them that
> the reader finds it hard to concentrate and he gets tired. You
> understand what I mean when I say, 'The man sat on the grass.' You
> understand because the sentence is clear and there is nothing to
> distract your attention. Conversely, the brain has trouble
> understanding me if I say, 'A tall, narrow-chested man of medium
> height with a red beard sat on green grass trampled by passers-by, sat
> mutely, looking about timidly and fearfully.' This doesn't get its
> meaning through to the brain immediately, which is what good writing
> must do, and fast."

https://www.poynter.org/news/writing-lessons-master-chekhov-writing-coach
(Source)

In music, take Bach's E-Major Fugue from the second volume of the Well
Tempered Clavier. Here's Glenn Gould's commented interpretation:
https://www.youtube.com/watch?v=iFOqX3JGERo

This is just a random collection of things that spontaneously came to my
mind on a sunday morning.

Patrick



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

2018-05-18 Thread Patrick Bucher
On Fri, May 18, 2018 at 07:38:36PM +0200, Hiltjo Posthuma wrote:
> On Fri, May 18, 2018 at 05:22:43PM +0100, Martin Tournoij wrote:
> 
> Don't create pages with 3MB of Javascript, that's insane.
> 
True
>
> I think concatenation/bundling in one file is fine, but not minification,
> because it makes the source unreadable. Carefully evaluate what you actually
> use in the site. Don't use bloated Javascript (such as jQuery) and CSS 
> frameworks
> (such as Bootstrap).
> 
jQuery looks almost reasonable nowadays, compared to the shitpile that
comes out of a Angular «Web App».
>
> Make sure to "gracefully fallback" so Javascript is not required.
> 
> One of the latest trends in Javascript bundle compilation. For example have a
> look at the new Reddit layout. There all the CSS classnames are randomized.
> 
Must reduce the HTTP payload big time, especially when gzipped M-(
>
> Stop this madness.
> 
Yes, please!

Patrick



Re: [dev] ASCII Delimited Text

2018-05-16 Thread Patrick Bucher
On Wed, May 16, 2018 at 03:46:52PM +0100, Martin Tournoij wrote:
> On Wed, May 16, 2018, at 15:05, Adrian Grigore wrote: In a perfect
> world it would deal well with it, but Notepad still can't handle Unix
> newlines...

It actually does:
https://hackaday.com/2018/05/08/windows-notepad-now-supports-unix-line-endings/

Patrick



Re: [dev] Sane GPIO library (esp. for Raspi)

2017-10-31 Thread Patrick
On 2017-10-31 08:46, Kurt Van Dijck wrote:
> I deal with GPIO for my projects by creating a device-tree overlay that
> describes the hardware (input/output, active-low, ...).

NICE



[dev] Sane GPIO library (esp. for Raspi)

2017-10-30 Thread Patrick Bucher
Dear suckless community,

which do you consider the GPIO libary for C that least sucks? I need it
especially for a Raspberry Pi project. Wiring Pi (http://wiringpi.com/)
looks easy and sane, but I wasn't able to try it out yet (still waiting
for a hardware shipment, but I don't want to sit around idle in the
meantime...).

Thanks,
Patrick



Re: [dev] Font problems in st, dwm, dmenu

2017-06-25 Thread Patrick Bucher
On Fri, Jun 23, 2017 at 07:52:28AM -0400, cinde...@hushmail.com wrote:
> Now, I'm having problems getting st, dwm, and dmenu to render fonts. 
> Specifically, I am trying to
> use terminus fonts, which I have used with suckless software for years. On my 
> new machine,
> though, these fonts (and all other fonts) dont render well. Instead, some 
> default font is displayed
> with spacing/kerning messed up so that letters overlap one another.

I had a similar problem, but was able to fix it with the following
configuration:

char font[] = "xos4 Terminus:pixelsize=16:antialias=true:autohint=true:lang=ru";

The important part is to use "xos4 Terminus" instead of just "Terminus".
It's related to a fontconfig update a couple of months ago. Maybe that's
your problem.

Patrick



Re: [dev] [st/dwm] Alt-Shift-C and Mod1-Shift-C

2017-01-13 Thread Patrick Bucher
On Fri, Jan 13, 2017 at 11:23:28PM +0800, Ivan Tham wrote:
> On Thu, Jan 12, 2017 at 07:25:06PM +0100, Patrick Bucher wrote:
> > I'm using st and dwm at the same time, and today I discovered a little 
> > problem
> > when using the default config of both programs. st uses Alt-Shift-C to copy 
> > text
> > into the clipboard, dwm uses Mod1-Shift-C for closing the selected window,
> > whereas Mod1 is Alt by default, at least on my machine. (Maybe some of you 
> > use
> > Super_L, vulgo "the Windows key".)
> 
> Windows key is a better choice most of the time since it's unused except
> in qemu where windows uses super key so it clashes. Alt would be bad
> since most applications uses Alt like Alt+1 in firefox, Alt+f in
> terminal.
> 
As you and many others suggested, I am now using the Windows key as well. It's a
bit strange at the beginning, for my thumb has to move a bit more to the left,
but at the same time I can use a lot more key combinations that require Alt,
such as the one mentioned in st, but also some emacs-style readline commands.

> > So guess what happened when I was trying to copy some code into the 
> > clipboard
> > today ;-)
> 
> Try using the primary clipboard, I use that most of the time. I only use
> the clipboard when it comes to Google drive stuff since they clipboard
> sucks and don't support primary keyboard.
> 
Now Alt also works here, but I also started using autocutsel, as an other user
suggested; thank you, it's working fine.

> > PS: Anybody using Arch Linux here? Since the fontconfig update today st no
> > longer works with my font of choice Terminus. Just in case somebody has the 
> > same
> > problem... here's my font[] definition:
> > 
> > static char font[] = 
> > "Terminus:pixelsize=24:antialias=true:autohint=true:lang=ru";
> 
> I use Arch here with Void (Musl is broken with locale so no Chinese
> LC_DATETIME), I heard that there is some issues with the latest update
> where my friend can't use Inifinity but I am still be able to use
> ttf-mononoki here fine.
> 
> I don't know how to solve that but still hope you good luck!
> 
As somebody else already pointed out, the freetype library has a different
behaviour, requiring "xos4 Terminus" instead of "Terminus" to find the font. It
works for me, but there is still a discussion going on:

https://bugs.gentoo.org/show_bug.cgi?id=605168

Thank you for all your help!

Patrick



[dev] [st/dwm] Alt-Shift-C and Mod1-Shift-C

2017-01-12 Thread Patrick Bucher
Hi there,

I'm using st and dwm at the same time, and today I discovered a little problem
when using the default config of both programs. st uses Alt-Shift-C to copy text
into the clipboard, dwm uses Mod1-Shift-C for closing the selected window,
whereas Mod1 is Alt by default, at least on my machine. (Maybe some of you use
Super_L, vulgo "the Windows key".)

So guess what happened when I was trying to copy some code into the clipboard
today ;-)

How do you deal with that?

Thanks for suggestions,
Patrick

PS: Anybody using Arch Linux here? Since the fontconfig update today st no
longer works with my font of choice Terminus. Just in case somebody has the same
problem... here's my font[] definition:

static char font[] = 
"Terminus:pixelsize=24:antialias=true:autohint=true:lang=ru";



Re: [dev] environment variables versus runtime configuration (rc) files versus X resources

2014-11-03 Thread Patrick
On 2014-11-03 14:32, Greg Reagle wrote:
> It occurred to me that environment variables can be used to configure a
> program, instead of programming in a parser or extension language

Things to think over and critique:

http://www.catb.org/esr/writings/taoup/html/ch10s04.html

extern char **environ;
int main (int argc, char **argv) {
environ = argv;



Re: [dev] [dwm] cfacts patch

2014-01-13 Thread Patrick Steinhardt
Hi,

On Fri, Jan 10, 2014 at 05:33:07PM +0100, Christoph Lohmann wrote:
> Greetings.
> 
> On Fri, 10 Jan 2014 17:33:07 +0100 Patrick Steinhardt  wrote:
> > Hi,
> > 
> > I've written a patch that enables per-client 'cfacts'. This
> > allows users to modify a clients weight in the stack it is
> > currently located in. So if a client has an increased or
> > decreased weight it will be allocated more or less space
> > respectively than the other clients in its stack.
> > 
> > Attached is the patch and a description. Feel free to add this to
> > the patches-section.
> 
> Thanks  for  the patch. Please do that on your own, the wiki is free for
> changes: http://suckless.org/wiki
> 
> 
> Sincerely,
> 
> Christoph Lohmann

thanks for the hint, I've pushed it to the sites-repo.

Regards
Patrick


pgp0QVZzHNKrU.pgp
Description: PGP signature


[dev] [dwm] cfacts patch

2014-01-09 Thread Patrick Steinhardt
Hi,

I've written a patch that enables per-client 'cfacts'. This
allows users to modify a clients weight in the stack it is
currently located in. So if a client has an increased or
decreased weight it will be allocated more or less space
respectively than the other clients in its stack.

Attached is the patch and a description. Feel free to add this to
the patches-section.

Regards
Patrick
diff --git a/config.def.h b/config.def.h
index 875885b..809788b 100644
--- a/config.def.h
+++ b/config.def.h
@@ -65,6 +65,9 @@ static Key keys[] = {
{ MODKEY,   XK_d,  incnmaster, {.i = -1 } },
{ MODKEY,   XK_h,  setmfact,   {.f = -0.05} 
},
{ MODKEY,   XK_l,  setmfact,   {.f = +0.05} 
},
+   { MODKEY|ShiftMask, XK_h,  setcfact,   {.f = +0.25} 
},
+   { MODKEY|ShiftMask, XK_l,  setcfact,   {.f = -0.25} 
},
+   { MODKEY|ShiftMask, XK_o,  setcfact,   {.f =  0.00} 
},
{ MODKEY,   XK_Return, zoom,   {0} },
{ MODKEY,   XK_Tab,view,   {0} },
{ MODKEY|ShiftMask, XK_c,  killclient, {0} },
diff --git a/dwm.c b/dwm.c
index 1bbb4b3..4ff74cc 100644
--- a/dwm.c
+++ b/dwm.c
@@ -86,6 +86,7 @@ typedef struct Client Client;
 struct Client {
char name[256];
float mina, maxa;
+   float cfact;
int x, y, w, h;
int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
@@ -200,6 +201,7 @@ static void setclientstate(Client *c, long state);
 static void setfocus(Client *c);
 static void setfullscreen(Client *c, Bool fullscreen);
 static void setlayout(const Arg *arg);
+static void setcfact(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
 static void showhide(Client *c);
@@ -1027,6 +1029,7 @@ manage(Window w, XWindowAttributes *wa) {
c->w = c->oldw = wa->width;
c->h = c->oldh = wa->height;
c->oldbw = wa->border_width;
+   c->cfact = 1.0;
 
if(c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
c->x = c->mon->mx + c->mon->mw - WIDTH(c);
@@ -1473,6 +1476,23 @@ setlayout(const Arg *arg) {
drawbar(selmon);
 }
 
+void setcfact(const Arg *arg) {
+   float f;
+   Client *c;
+
+   c = selmon->sel;
+
+   if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
+   return;
+   f = arg->f + c->cfact;
+   if(arg->f == 0.0)
+   f = 1.0;
+   else if(f < 0.25 || f > 4.0)
+   return;
+   c->cfact = f;
+   arrange(selmon);
+}
+
 /* arg > 1.0 will set mfact absolutly */
 void
 setmfact(const Arg *arg) {
@@ -1602,9 +1622,15 @@ tagmon(const Arg *arg) {
 void
 tile(Monitor *m) {
unsigned int i, n, h, mw, my, ty;
+   float mfacts = 0, sfacts = 0;
Client *c;
 
-   for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+   for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
+   if(n < m->nmaster)
+   mfacts += c->cfact;
+   else
+   sfacts += c->cfact;
+   }
if(n == 0)
return;
 
@@ -1614,14 +1640,16 @@ tile(Monitor *m) {
mw = m->ww;
for(i = my = ty = 0, c = nexttiled(m->clients); c; c = 
nexttiled(c->next), i++)
if(i < m->nmaster) {
-   h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+   h = (m->wh - my) * (c->cfact / mfacts);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - 
(2*c->bw), False);
my += HEIGHT(c);
+   mfacts -= c->cfact;
}
else {
-   h = (m->wh - ty) / (n - i);
+   h = (m->wh - ty) * (c->cfact / sfacts);
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - 
(2*c->bw), h - (2*c->bw), False);
ty += HEIGHT(c);
+   sfacts -= c->cfact;
}
 }
 
ctags
=

Description
---

This patch provides the ability to assign different weights to
clients in their respective stack in tiled layout. It implements
a new function setcfact which will modify the cfact-value for the
currently selected client. It accepts the following values:

* A positive float to increase a clients weight, thus increasing
  the space the client is allocated in its current stack.

* A negative float to decrease a clients weight, thus decreasing
  the space the client is allocated in its current stack.

* A zero-value float to reset a clients weig

Re: [dev] wswsh: a mksh web framework

2013-12-12 Thread Patrick
On 2013-12-13 14:25, Chris Down wrote:
> > Is there an easier way to encourage clean URLs?
> If masking files with directories is considered "clean", then I don't
> want to live on this planet any more.

Maybe give him the benefit of the doubt that he meant something like
'maintains hierarchical taxonomy'.

Kai probably didn't mean 'taxa with file suffices are bad', just as he
probably didn't mean 'racially pure' or 'std free'. ;)



Re: [dev] New utility "when"

2013-12-11 Thread Patrick
On 2013-12-11 22:46, Andrew Gwozdziewycz wrote:
> On Wed, Dec 11, 2013 at 6:02 PM, Charlie Kester  wrote:
> > Maybe I'm have a dumb day (it happens, all too often), but is there a
> > way to get the exit code of the longrunningscript in case it fails
> > *after* the timebomb goes off?
> There will be at some point tonight. Thanks for the suggestion! It was
> on my list, but forgotten about.

Isn't this rewriting /sbin/init? ;)

It seems like there are two parts: IPC and process control. Shells offer
both, however we want better semantics ("when ...").

Is process control really the part that needs the most help?



Re: [dev] New utility "when"

2013-12-11 Thread Patrick
On 2013-12-11 12:21, Andrew Gwozdziewycz wrote:
> Yes. You can do exactly that. But you *can't* do:
> when -t "ssh user@host" "xmessage 'Connected'"

Time to rock the IPC?

#!/bin/bash
MAGIC=5

system_time_epoch() { date +%s; }
file_time_mod() { stat --printf='%Y' $1 ; }
file_age() { echo $(( $(system_time_epoch) - $(file_time_mod "$1") )); }

tmp="/tmp/michael_jackson_touched_my_$$"
touch $tmp

(
while test $( file_age $tmp) -lt $MAGIC; do sleep 1; done
xmessage "wtf? you let him touch your $$"
) &

while ! ssh $there ; do
touch $tmp
done




Re: [dev] New utility "when"

2013-12-11 Thread Patrick
On 2013-12-11 11:31, Andrew Gwozdziewycz wrote:
> Maybe one of you will stop laughing long enough to find it useful.

So why isn't this a standard unix utility?



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 21:03, Markus Teich wrote:
> I had to smile on this one. But i don't treat „rm music-track.mp3“ any 
> different
> than „rm important-file“. I think before I hit enter. And if by any chance I
> learn this was a mistake 10 years later, then ffs I deserve to rip that disc
> again.

You need a cheap N TB drive/SAN. We shouldn't ever have to delete; just
archive it, and when the archive gets full, get another cheap TB SAN.



Re: [dev] slm - music curation && where the fuck is Kurt?

2013-11-28 Thread Patrick
On 2013-11-28 11:06, Charlie Kester wrote:
> Hmm.  I'm in the hardlinks-as-default camp

BTW, anyone heard from Kurt M recently? It seems like it's been a while
and he never seemed like the kind of guy to sit in the corner quietly
nursing a beer unless some serious shit was happening.



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 11:06, Charlie Kester wrote:
> Here's a use-case that argues for hardlinks:  I've often encountered
> situations where ripping a CD or downloading from Amazon has resulted in
> the same artist appearing in my collection under two slightly different
> names. (I like world music, for example,  and there doesn't seem to any
> consistency in the way some names are spelled.)  If I correct this by
> moving all the files under the same artist subdir, I would break any
> symlinks pointing to the subdir using the variant artist name I don't
> want to keep.

Canonicalization sucks.

We have to do it by hand because a) every other company / person is
dumb, and b) we have personal recordings not captured by CDDB /
allmusic / server-in-countryX-to-avoid-copyright.com



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 19:33, Markus Teich wrote:
> I for example see my music collection not as only-growing but also delete 
> stuff
> I don't want to hear anymore regularly.

Instead of rm'ing, tag it with a keyword e.g.
'lady-gaga-strangled-by-baboons-sounds-better-than-this-shit' and patch
slm to export the tags so you can grep -v them.

Cause you know that in 10 years you'll enjoy hearing lady gaga strangled
by baboons. ;)



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 19:22, Markus Teich wrote:
> > I would recommend to rebuild the farm before usage. Hardlinks seem to be 
> > more
> > sane since they maintain a stable state (no links can be broken), while a
> > symlink can suddenly point to /tim/buck/too or nowhere at all.

An example use-case shows why you would rm a file in your central media
repository. .e.g. It was rm'd because it was Thursday and that's the day
that I let Chaos Monkey fuck up my tunes.



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 16:26, FRIGN wrote:
> However, I don't see a definite reason to favor one solution over the
> other. It may just be another question of what your needs are, so I'd
> propose to offer a compile-time solution to select symbolic or hard
> links.

I concur.



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 18:06, Markus Teich wrote:
> I would recommend to rebuild the farm before usage. Hardlinks seem to be more
> sane since they maintain a stable state (no links can be broken), while a
> symlink can suddenly point to /tim/buck/too or nowhere at all.

Imagine a use-case where I would rm a file in the central repository,
so that it would break a symlink. Why would that happen?

And what happens if a symlink points nowhere?



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 18:47, Roberto E. Vargas Caballero wrote:
> Offer one of them as default option, but I think it should have the
> runtime option to select one or other.

Compile time; this seems to be a huge philosophical divide. ;)

Maybe at some point I change my philosophy, so I just update the
executable instead of touching all the scripts.



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 18:51, Markus Teich wrote:
> As I posted earlier, I would favor the hardlinks as default.

Can we get a couple concrete reasons / use-cases why?



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 10:06, Charlie Kester wrote:
> Well, for one thing, it solves the problem of stale symbolic links that
> was mentioned earlier.

Do you think we delete files accidentally?

Assume that we treat our repo of music as non-rm, non-mv, since we only
ever upgrade a file's quality.



Re: [dev][announce] slm - music curation

2013-11-28 Thread Patrick
On 2013-11-28 17:48, Roberto E. Vargas Caballero wrote:
> I think having the option in runtime can be good, and I agree with you
> that symlinks are more discoverable than hardlinks, so I think
> symlinks should be the default option.

WTF? Can I get a cogent discussion of sym vs hard links?

sym  =? recognition of canonical hierarchy
hard =? anarchy

Anarchy can be good in the bitcoin / there is no one true value sense.
That said, it's our own media repository. And we can't organize it?



Re: [dev][announce] slm - music curation

2013-11-27 Thread Patrick
On 2013-11-27 23:01, Charlie Kester wrote:
> In fact, now that you mention it, I think this should be the default.

Why?



Re: [dev][announce] slm - music curation

2013-11-27 Thread Patrick
On 2013-11-27 23:50, Nick wrote:
> Have you considered writing this using FUSE instead?

Likely overkill. What's the cost of a stale link vs the cost to fix?

Underlying all this is a need for a canonical directory structure for
the source media files, i.e. never rm or mv, only ever upgrade quality.



Re: [dev] Some thoughts about XML

2013-10-23 Thread Patrick
On 2013-10-24 14:43, Chris Down wrote:
> On 2013-10-24 01:04, Samuel Holland wrote:
> > [body]
> > content="%ol%%p%"
> > [ol]
> > style="list-style-type: decimal"
> > content="%li.1%%li.2%%li.3"
> > [li]
> > style="display: list-item"
> > content1="Lack of proper hierarchy, for one;"
> > content2="Lack of proper heterogeneous containers, for two;"
> > content3="%b%:\nlack of multiline strings."
>
> I'm hoping this is devil's advocate, this is the worst thing I've ever seen.

This is criticism by proof of concept. I award 100 points to Ravenclaw!



Re: [dev] [st] RFC halt function

2013-04-26 Thread Patrick Haller
On 2013-04-26 23:11, hiro wrote:
> just mod your shell to always copy all stdout of commands into a temp
> file, then open the file with less after one of these stupidly long
> commands.

Or run them via 'at'
Or run 'script' when you login

And sed out all the terminal carp later on.



Re: [dev] [st] RFC halt function

2013-04-25 Thread Patrick Haller
On 2013-04-25 20:05, Christoph Lohmann wrote:
> while  trying to copy some stuff from iotop I came to the idea of having
> some ??halt?? function in st. This is like the ??halt?? in 9term, where  ev???
> erything  will  stand still but the terminal is working on the output in
> the background.

Why not let tmux or screen handle that? Does st really need an
(xon/xoff)++ feature?



Re: [dev] ii IPv6 support

2013-04-11 Thread Patrick Haller
On 2013-04-11 21:17, Carlos Torres wrote:
> it was there just a little hidden
> http://git.suckless.org/sites/tree/tools.suckless.org/ii/patches/ii-ipv6.diff

i mean in the ii repo -> http://git.suckless.org/ii



Re: [dev] ii IPv6 support

2013-04-11 Thread Patrick Haller
On 2013-04-11 20:53, Nico Golde wrote:
> http://tools.suckless.org/ii/patches/ii-ipv6.diff

Aw fsck. Can we put the patches in the git repo? Either as plain files
in patches/, or create a branch based on the commit they diff'd at?



Re: [dev] Call for pkgsrc users

2013-04-10 Thread Patrick Haller
On 2013-04-10 13:13, William Giokas wrote:
> There are extremely strong technical arguments for using systemd as a
> simple, easy to use and easy to configure initialization system.

systemd trades simplicity for boot-speed and stack integration.

There are always trade-offs. It's just this seems like a bad trade from
a suckless point of view which calls for orthogonality and composability,
not integrated software superstructures.

Anyway, pancake's contributing to voidlinux so I'll try void. Any other
good rolling release distros?



[dev] ii IPv6 support

2013-04-08 Thread Patrick
Attached is a patch to add IPv6 support to ii, based on where it was as
of 7a99152ce64d7006730006094b333edbecbe505a

Enjoy, scream, whatever...
diff --git a/ii.c b/ii.c
index d93266c..0ebeee3 100644
--- a/ii.c
+++ b/ii.c
@@ -37,6 +37,7 @@ static int irc;
 static time_t last_response;
 static Channel *channels = NULL;
 static char *host = "irc.freenode.net";
+static char *port = "6667";
 static char nick[32];			/* might change while running */
 static char path[_POSIX_PATH_MAX];
 static char message[PIPE_BUF]; /* message buf used for communication */
@@ -151,24 +152,23 @@ static void login(char *key, char *fullname) {
 	write(irc, message, strlen(message));	/* login */
 }
 
-static int tcpopen(unsigned short port) {
+static int tcpopen(char * port) {
 	int fd;
-	struct sockaddr_in sin;
-	struct hostent *hp = gethostbyname(host);
+	struct addrinfo hints, *ai;
 
-	memset(&sin, 0, sizeof(struct sockaddr_in));
-	if(!hp) {
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = SOCK_STREAM;
+
+	if (getaddrinfo(host, port, &hints, &ai) != 0) {
 		perror("ii: cannot retrieve host information");
 		exit(EXIT_FAILURE);
 	}
-	sin.sin_family = AF_INET;
-	memcpy(&sin.sin_addr, hp->h_addr, hp->h_length);
-	sin.sin_port = htons(port);
-	if((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+	if ( (fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) < 0) {
 		perror("ii: cannot create socket");
 		exit(EXIT_FAILURE);
 	}
-	if(connect(fd, (const struct sockaddr *) &sin, sizeof(sin)) < 0) {
+	if (connect(fd, ai->ai_addr, ai->ai_addrlen) < 0) {
 		perror("ii: cannot connect to host");
 		exit(EXIT_FAILURE);
 	}
@@ -403,7 +403,10 @@ static void handle_channels_input(Channel *c) {
 static void handle_server_output() {
 	static char buf[PIPE_BUF];
 	if(read_line(irc, PIPE_BUF, buf) == -1) {
-		perror("ii: remote host closed connection");
+		if (errno == EEXIST)
+			perror("ii: remote host closed connection, clients per IP probably limited");
+		else
+			perror("ii: remote host closed connection");
 		exit(EXIT_FAILURE);
 	}
 	proc_server_cmd(buf);
@@ -455,7 +458,6 @@ static void run() {
 
 int main(int argc, char *argv[]) {
 	int i;
-	unsigned short port = SERVER_PORT;
 	struct passwd *spw = getpwuid(getuid());
 	char *key = NULL, *fullname = NULL;
 	char prefix[_POSIX_PATH_MAX];
@@ -472,7 +474,7 @@ int main(int argc, char *argv[]) {
 		switch (argv[i][1]) {
 			case 'i': snprintf(prefix,sizeof(prefix),"%s", argv[++i]); break;
 			case 's': host = argv[++i]; break;
-			case 'p': port = strtol(argv[++i], NULL, 10); break;
+			case 'p': port = argv[++i]; break;
 			case 'n': snprintf(nick,sizeof(nick),"%s", argv[++i]); break;
 			case 'k': key = getenv(argv[++i]); break;
 			case 'f': fullname = argv[++i]; break;


Re: [dev] Makefile/markdown based static site generator

2013-02-21 Thread Patrick Haller
On 2013-02-21 10:19, sta...@cs.tu-berlin.de wrote:
> of course:
>   sed -n '/^\s*

Re: [dev] Makefile/markdown based static site generator

2013-02-20 Thread Patrick Haller
On 2013-02-21 14:19, Kai Hendry wrote:
> If you are a Makefile demi-god, you could please help me support input
> files blighted with spaces. For example running the Makefile on my
> blog, it chokes and stops with
> https://github.com/kaihendry/natalian/blob/master/archives/tag/fair%20use.mdwn

http://www.cmcrossroads.com/article/gnu-make-meets-file-names-spaces-them

OR

Fix the naming convention. Don't support arbitrary idiocy; let it die.



Re: [dev] [dwm] Optional status bar

2012-01-28 Thread Patrick Haller
On 2012-01-28 14:22, Bjartur Thorlacius wrote:
> When I think of it, I can't but wonder if we could write a program
> that does tagging and tagging only, and a selection of separate
> layout managers that automatically tile or maximize mapped windows.
> Interoperability with (other) no-wm tools would be an ultimate win.

An script with xdotool might suffice since it can map/unmap, resize.
cf. the following script for map/unmap based on wm name:

wm_name="$1"
tf="${HOME}/.wm-unmapped-${wm_name}"

[[ ! -e $tf ]] && {
xdotool search $wm_name windowunmap
touch $tf
exit 0
}

xdotool search $wm_name windowmap
xdotool search $wm_name windowraise
xdotool search $wm_name windowsize 100% 100%  windowmove 0 0
rm $tf



Re: [dev] [surf] make error

2012-01-04 Thread Patrick Haller
On 2012-01-04 21:28, Hannes Blut wrote:
> When making surf on my setup i get

do what the error says, add it to your libs in your config.mk, like:

LIBS = -L/usr/lib -lc -lX11 -ljavascriptcoregtk-1.0 ${GTKLIB} -lgthread-2.0



Re: [dev] wmii falling out of favor

2012-01-02 Thread Patrick Haller
On 2012-01-02 12:26, hiro wrote:
> I don't understand how this is related to your quote?

Suraj re-evaluated his toolset. I think the re-evaluation part is a good
idea, however it seems you could spend too much time doing it.

> You always execute ls when you cd to a different folder?

in interactive shells, yes.

I examined my interactive shell history and found that I had too many cd
then ls, amongst other things.

However, it's not as easy to do the same analysis with my X11 interactions.

Do people do this? How? Just guessing at my usage, I would think that
sync'ing cut buffers, selections, vim last yank, and screen/tmux buffers
would be a win. No clue without data, though



Re: [dev] wmii falling out of favor

2012-01-01 Thread Patrick Haller
On 2012-01-01 21:13, Suraj N. Kurapati wrote:
> So I considered the trade-offs between SLOC minimalism, project and
> community activity, and my productivity in DWM vs. WMII and finally
> decided to switch back to WMII (which I used since six years prior).

How often do people re-evaluate their toolsets?

With my shell, I can examine shell history and do stuff like:
cd() {
dir="$1"
test -f $1 && dir=`dirname $1`
builtin cd "$dir" && ls | sed 10q | fmt -w $COLUMNS
}

With X11, do we screencast a day's work and watch it in fast-forward?

Every three months I look at
https://wiki.archlinux.org/index.php/Lightweight_Software

and occasionally find stuff (like zathura).



Re: [dev] network usage graphs

2011-12-23 Thread Patrick Haller
On 2011-12-23 23:16, hiro wrote:
> Only so nobody falls in the same pits: gnuplot sucks, bourne shell
> sucks (better use awk for tabular calculations)

post the scripts?

also, check out http://www.colorcombos.com/



Re: [dev] network usage graphs

2011-12-22 Thread Patrick Haller
On 2011-12-22 13:58, hiro wrote:
> What tools do you know that are able to render such graphics and
> update once per second or so?

push the burden of making pretty crap on the client; drop the data to
json and let the clients use a javascript library like highcharts.



Re: [dev] Shameless patch request

2011-12-07 Thread Patrick Haller
On 2011-12-07 11:04, Justin Pogue wrote:
> At work, I typically have a terminal doing something like "while true;
> do ls -l /var/cores && sleep 10 && clear; done"

Jobs need two scriptable pathways to your brain: 1) an immediate
attention interrupt, and 2) a handle when not busy interrupt.

statusbar, sms texts, xosd, email, use whatever fits your personal
preferences to create those pathways.



Re: [dev] dmenu's lsx binary naming conflicts with lrzsz!

2011-11-27 Thread Patrick Haller
On 2011-11-27 15:32, Roger wrote:
> locate "stest" |grep ^stest$

08:53:31 Err 130 /Volumes/Users/phaller
> locate ls | grep ^ls$
08:53:34 Err 1 /Volumes/Users/phaller
> locate ls | grep ^/bin/ls$
/bin/ls
08:53:43 /Volumes/Users/phaller>



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Patrick Haller
On 2011-11-25 22:42, Julian Dammann wrote:
> > It's all about spatial locality.
> Ever tried ":!your_terminal &" in vim? Maybe that's good enough for you if 
> bound to some key.

autocmd BufEnter * cd %:p:h
for when you use multiple buffers in vim.



Re: [dev] semicolons

2011-11-18 Thread Patrick Haller
On 2011-11-18 13:24, pancake wrote:
> should we support code written by bitches?

K&R v1, page 59:

for (i = 0, j = strlen(s)-1; i < j; i++, j--) {

SLoC count? Bitch count? ;)



Re: [dev] semicolons

2011-11-18 Thread Patrick Haller
On 2011-11-18 11:40, pancake wrote:
>
> $ cat dwm.c | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l

use cpp to deal with the includes, defines, comments.

__sloc()
{
grep -v '^#include.*<' "$1" | cpp - | grep -v '^#' | grep -v '^$'
}

sloc()
{
__sloc "$1" | wc -l
__sloc "$1" | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l
__sloc "$1" | sed -e 's,(,ROFL\n,g' |grep ROFL |wc -l
}

worrying about stuff like the next seems tree/forest-y

if (error)
    return printf("boot->head => missed?"), -1;

btw, anyone recommend a suckless AST tool for C?


Patrick



Re: [dev] Trouble with Gmail in surf

2011-11-17 Thread Patrick Haller
On 2011-11-17 09:05, Karl Eklund wrote:
>I'm having trouble with Gmail and surf. Almost always I get this in the
>chat widget: "Oops. Your chat connection may have been interrupted."

Seems you can maybe use the load-error signal:
http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-load-error

something like:

void
loaderror(WebKitWebView *v, WebKitWebFrame *f, gchar *u, gpointer e, gpointer 
d, Client *c) {
return printf("err %s\n", e->message), FALSE;
}


Patrick



Re: [dev] [surf] downloads

2011-11-04 Thread Patrick Haller
On 2011-11-03 16:30, Peter John Hartman wrote:
>
> Second of all, and instead, it just prints to stdout (a) the fact that the
> Download has started, together with the filename, and (b) the fact that it
> has finished/cancelled/errored, together with the filename.

Not much more to add a progress bar to that patch.


Patrick
diff -urN surf-tip/surf.c surf-dl/surf.c
--- surf-tip/surf.c 2011-11-04 22:21:52.077749801 +0800
+++ surf-dl/surf.c  2011-11-04 23:35:55.630343708 +0800
@@ -42,6 +42,15 @@
gboolean zoomed;
 } Client;
 
+typedef struct Download {
+   WebKitDownload *download;
+   Client *client;
+   gboolean is_done;
+   char *filename;
+   char *filename_partial;
+   struct Download *next;
+} Download;
+
 typedef struct {
char *label;
void (*func)(Client *c, const Arg *arg);
@@ -58,6 +67,7 @@
 static Display *dpy;
 static Atom atoms[AtomLast];
 static Client *clients = NULL;
+static Download *downloads = NULL;
 static GdkNativeWindow embed = 0;
 static gboolean showxid = FALSE;
 static char winid[64];
@@ -340,14 +350,82 @@
soup_cookies_free(l);
 }
 
+int 
+downloadstatus(WebKitDownload *download, GParamSpec *pspec, gpointer 
user_data) {
+   WebKitDownloadStatus status;
+   Download *d;
+
+   for (d = downloads; d != NULL && d->download != download ; d = d->next )
+   ;
+   if (d == NULL)
+   return fprintf(stderr, "lost download?\n"), -1;
+
+   g_object_get(download, "status", &status, NULL);
+
+   switch(status) {
+   case WEBKIT_DOWNLOAD_STATUS_CREATED:
+   d->client->progress = 0;
+   update(d->client);
+   break;
+   case WEBKIT_DOWNLOAD_STATUS_STARTED:
+   case WEBKIT_DOWNLOAD_STATUS_ERROR:
+   case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
+   break; /* these are irrelevant */
+   case WEBKIT_DOWNLOAD_STATUS_FINISHED: {
+   unlink(d->filename);
+   rename(d->filename_partial, d->filename);
+   g_free(d->filename_partial);
+   g_free(d->filename);
+   d->is_done = TRUE;
+   d->client->progress = 100;
+   update(d->client);
+   }
+   }
+   return 0;
+}
+
+void
+downloadprogress(WebKitDownload *download, GParamSpec *pspec, gpointer 
user_data) {
+   Download *d;
+   gdouble progress;
+
+   g_object_get(download, "progress", &progress, NULL);
+   for (d = downloads; d != NULL && d->download != download ; d = d->next )
+   ;
+   if (d == NULL)
+   return;
+   if ( (d->client->progress = (int)(progress * 100)) == 0)
+   d->client->progress = 1;
+   update(d->client);
+}
+
 gboolean
 initdownload(WebKitWebView *view, WebKitDownload *o, Client *c) {
-   Arg arg;
+   char *f;
+   Download *d;
 
-   updatewinid(c);
-   arg = (Arg)DOWNLOAD((char *)webkit_download_get_uri(o));
-   spawn(c, &arg);
-   return FALSE;
+   if (!(d = malloc(sizeof(Download
+   die("Cannot malloc!\n");
+   d->next = downloads;
+   d->client = c;
+   d->download = o;
+   d->is_done = FALSE;
+   downloads = d;
+   d->client->progress = 1;
+   update(d->client);
+   g_signal_connect(o, "notify::status", G_CALLBACK(downloadstatus), NULL);
+   g_signal_connect(o, "notify::progress", G_CALLBACK(downloadprogress), 
NULL);
+   d->filename = g_strconcat(downloaddir, "/",
+   (char *)webkit_download_get_suggested_filename(o), NULL
+   );
+   d->filename_partial = g_strconcat(d->filename, ".part", NULL);
+   unlink(d->filename_partial);
+
+   f = g_strconcat("file://", d->filename_partial, NULL);
+   webkit_download_set_destination_uri(o, f);
+   webkit_download_start(o);
+   g_free(f);
+   return TRUE;
 }
 
 gboolean


Re: [dev] Some 2wm questions

2011-10-31 Thread Patrick Haller
On 2011-10-31 19:58, Stephen Paul Weber wrote:
> 2) Is there any way to bring a window to the front programatically
> under 2wm?  I tried xdotool windowactivate and it says the window
> manager does not support that, so I tried xdotool windowraise and
> that did nothing.

If you want to control every window, you don't need a window manager.


Patrick



Re: [dev] [dwm] 2000 SLOC

2011-10-31 Thread Patrick Haller
On 2011-10-31 10:49, pancake wrote:
> I dont understand the point of documentation.

Neither do I, so let's triage:

Deviation from Convention
served by README

Commentary on the Code
served by IRC, mailing list

What is this? How do I?
bless some wiki/forum someplace as *the* place for users


Patrick



Re: [dev] ssh-agent stanza in POSIX shell

2011-10-30 Thread Patrick Haller
On 2011-10-30 20:04, Sime Ramov wrote:
> I've found the following clever ssh-agent stanza in Richard Crowley's
> `.profile`[https://raw.github.com/rcrowley/home/master/.profile]:
...
> It works partially, i.e. it spawns a new agent on every shell
> invocation.

It should probably test for functionality, something like:

ssh_agent_check ()
{
for sock in {$TMPDIR,/tmp}/ssh-*/agent*
do
export SSH_AUTH_SOCK=$sock
ssh-add -l && return
done
    eval `ssh-agent`
}


Patrick



Re: [dev] Please recommend a suckless rss reader

2011-10-29 Thread Patrick Haller
On 2011-10-29 19:22, Christoph Lohmann wrote:
>>> I'm looking for a cli newsreader, suckless, less dependencies. Thanks!
>> cron + curl + xmlstarlet + md5 = lighter than rss2email.py
> Would you mind sharing your script for that?

Not exactly posix, so it's got 1/2 of running code, rough concensus ;)

rss() splits an rss feed, drops each article to disk with a filename =
the md5sum of the article, then prints all the new articles since last
cron run that match a basic grep.

things it could do better:
be POSIX
use ETAG / HEAD check
not use perl for the filter

filter has been a ridiculously useful script, being a hash of  common
encoding transforms. It could be a sed scripts or in C; anyone seen
or written something like it?


Patrick


wcat() {
which curl > /dev/null 2>&1 && curl -s "$1";
if [[ $? != 0 ]]; then
which wget > /dev/null 2>&1 && wget -q -O - "$1";
fi;
return $?
}

rss_disk() {
split='#'
xmlstarlet sel -t -m "//*[local-name()='description']" -v '.' -n -o 
"$split" -n | while read line; do
[[ "$line" != $split ]] && {
article="${article} ${line}"
continue
}
d=$( md5sum <<< "$article" | sed -e 's/ .*//' )
[[ ! -e "$d" ]] && { echo "$article" > $d ; }
article=""
done
}

# lgab = https://github.com/patrickhaller/linux-gnu-admin-bash
rss() {
dir=$1
url=$2
pattern="$3"
cd $dir
wcat $url | rss_disk &
lgab_kill_after 30
find $dir -type f -cmin -9 -print | while read f; do
tmp="${f}.html"
filter htmldecode < $f > $tmp
grep -qEi "$pattern" $tmp && lynx -dump $tmp
/bin/rm $tmp
done
find $dir -type f -ctime +7 -delete
}


# filter
#!/usr/bin/perl
use MIME::Base64;
use CGI ':standard';
use HTML::Entities;
my $action = shift;

my %block = (
email  => '/($s)/i and print $1 . "\n"',
url=> '/href\s*=\s*(?:\'|\")($s)(?:\'|\")/i and print $1 . "\n"',
base64 => 'if (/^[a-zA-Z0-9\+\/]{78,}/) { print 
MIME::Base64::decode_base64($_) } else { print }',
urlencode => 'print CGI::escape($_)',
htmlencode => 'print HTML::Entities::encode_entities($_)',
htmldecode => 'print HTML::Entities::decode_entities($_)',
crlf   => q{ s/\r//g; print },
);

my %re = (
email  => qr/ ? /x,
url=> qr/ [^\"\']+ /x,
);
my $s = $re{$action};

map { eval($block{$action}) } <>;





Re: [dev] Please recommend a suckless rss reader

2011-10-29 Thread Patrick Haller
On 2011-10-29 23:22, Yue Wu wrote:
> I'm looking for a cli newsreader, suckless, less dependencies. Thanks!

cron + curl + xmlstarlet + md5 = lighter than rss2email.py


Patrick



Re: [dev] Linux sucks!

2011-10-28 Thread Patrick Haller
On 2011-10-29 01:44, Connor Lane Smith wrote:
> This thread is demented... *very* irritating.

Trolls have to perform some socially useful function or else we'd all
have learned by now.


Patrick
* yeah, I know it's only October. ;)



Re: [dev] Focusing on windows by name

2011-10-26 Thread Patrick Haller
On 2011-10-26 11:48, Manolo Martínez wrote:
>
> In openbox I have a key bound to the following:"wmctrl -xa mutt ||
> urxvt -name mutt -e mutt"

xlsclients | grep -q mutt || urxvt -e mutt



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

2011-10-22 Thread Patrick Haller
On 2011-10-22 09:35, Connor Lane Smith wrote:
>
> the representation of data would be a concern of each program, not of
> the terminal, which would probably result in ugly.

Let's separate the concerns: UI and Data

UI = users should be able to be retarded && dd if=/dev/zero of=/dev/face
This is a good thing.

Data = we don't have good backwards compatibility protection; we insert
another column output to `ls -al` and all hell breaks loose.

Our current workaround = run POSIX only commands and don't change.

> The type inference would be done per command, so cat(1) would be of a
> type such that if you were to try catting an image (directly) to wc(1)
> it would fail, because the types (Image, String) would not match. You
> could also have awesome higher-order functions, so 'map' would remove
> the need for find(1), etc.

It seems like too much; probably only need a few generic ones: string,
number, binary, list, hash.

Too many types will hurt us just like re-inventing tar as MIME as output
delimiter hurt us.

> we ought to optimise for effectiveness of use by the user

Absolutely; perhaps by reducing the output options of our programs. ;)


Patrick



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

2011-10-21 Thread Patrick Haller
On 2011-10-22 00:08, Connor Lane Smith wrote:
On 21/10/2011, Pierre Chapuis  wrote:
> > http://www.infoq.com/presentations/Simple-Made-Easy
> Thanks, I enjoyed watching this.

"Let's all write parsers."

Hickey kicks unix because although pipes = composability, output and
input = free-form text. We combined data exchange with user interface,
and user interface usually won that fight.

Say data exchange won; would it help us to rewrite our programs to
output JSON and our shells to pretty-print* JSON?


Patrick

[*] The cynic points out that people would then spend time customizing
their pretty-printers.



Re: [dev] Suckless way of checking Nagios?

2011-10-16 Thread Patrick Haller
On 2011-10-16 20:12, Sime Ramov wrote:
> Hello. I need to keep track of one remote Nagios instance output, which
> excludes cnagios[1].

While nagios output can be made "lite" [1], watching system stats all
day does suck.

Is permanently allocating visual space really your best interrupt vector
(and not an sms)? If so, I'd do something stoopid like parse the output
of [1] and for every warning, put up a picture of kitty cat, and for
every critical, put up an angry tiger.

It sounds like w3m and a sed script would work just GRRReat!


Patrick

[1] 
http://ligers_kick_ass/cgi-bin/nagios3/status.cgi?host=all&type=detail&servicestatustypes=20



Re: [dev] Make dmenu sensitive to user aliases ("Hello world")

2011-10-02 Thread Patrick Haller
On 2011-10-02 22:52, Ethan Grammatikidis wrote:
> On Sat, 01 Oct 2011 21:55:56 +0300
> "Kiriakos at Kindstudios"  wrote:
>
> > Hi there,
> >
> > I'm using many aliases in my terminal sessions and want to be able to use
> > them with dmenu
> > (which I use as the default menu in all of my xmonad installations) aswell.
> >
> > Is that possible? I haven't gotten a real chance to look at the code yet
> > (just downloaded it).
> > I'm a total noob when it comes to actually modifying C sources so I
> > thought that I should
> > fire off a request in the offchance somebody has already done that or can
> > point in the right
> > direction.
>
> I'm using scripts where I once used aliases, mostly because it's far
> more convenient to write or alter a script than to update an alias or
> function in all my open terminals.

??? something like?

update_config() { [ `mtime $cfg` -gt `mtime $history` ] && . $cfg ; }
export PS1='`update_config`> '


Patrick



Re: [dev] [surf] download patch updated

2011-09-28 Thread Patrick Haller
On 2011-09-28 14:51, Nick wrote:
> Quoth Troels Henriksen:
> > Nick  writes:
> > Huh?  I have not had trouble using wget for this.
> Can anyone else confirm / deny this?

Not for those sites, however I did see enough fails to add the same to
https://github.com/patrickhaller/surf-ph


Patrick



Re: [dev] New utility

2011-09-24 Thread Patrick Haller
On 2011-09-25 03:19, Christoph Lohmann wrote:
> ocaml;wu (ocaml; won't use)

use the bringer_obsolete.bash [1] from the package?

why ocaml;wu? because it's outside the C/sh stack, or ?


Patrick

[1] send 
"https://github.com/cfuehrmann/bringer/raw/master/bringer_obsolete.bash \r"
expect "bash;wu"



Re: [dev] A dmenu that includes all additional features

2011-09-12 Thread David J Patrick
On Mon, Sep 12, 2011 at 10:05:16PM +0100, Rob wrote:
> I don't think this would be worth it, suckless tools are supposed to be
> lightweight, even someone who hasn't seen the code before can make
> changes, they don't have to be an expert at C, so merging a few lines
> here and there is no big deal.

speak for youself Rob, I like the suckless tools, and dmenu especially.
I could program my way out of a paper bag, and would be delighted if
extending dmenu were made easier (possible) for me.

diffrnt strokes,
djp



Re: [dev] Simple application launcher?

2011-06-30 Thread Patrick Haller
On Thu, Jun 30, 2011 at 04:40:23PM +0200, f...@snakeoilproductions.net wrote:
> perhaps _20h_'s thingmenu fits your need?
> http://git.r-36.net/thingmenu/

or clock from http://www.jessies.org/~enh/software/x11/



Re: [dev] ideas on suckless file manager

2011-06-13 Thread David J Patrick
On Mon, Jun 13, 2011 at 08:49:45PM +0200, Jakub Lach wrote:
> To add another one, I'm not entirely sure LCD vs CRT 
> eyes health debate is settled. 
> 
I'm fairly sure the "Cathode ray cannon pointed at your head; is it safe ?"
debate is well over.. 
djp



Re: [dev] ideas on suckless file manager

2011-06-08 Thread Patrick Haller
On Wed, Jun 08, 2011 at 08:01:10AM +0200, Petr Sabata wrote:
> On Wed, Jun 08, 2011 at 12:57:40PM +0800, Patrick Haller wrote:
> >
> > define $EDITOR then ^x^e
>
> I guess this is just something bash-specific?

yeah, edit the current command using $EDITOR

file manager
= file selection + file (pre)viewing
= ls/awk/$EDITOR + i_give_my_files_retarded_names
=> fix your naming convention


Patrick



Re: [dev] ideas on suckless file manager

2011-06-07 Thread Patrick Haller
On Tue, Jun 07, 2011 at 09:03:06PM -0700, Noah Birnel wrote:
> ls >listing && vim listing && mv `cat listing` dest

define $EDITOR then ^x^e


Patrick



Re: [dev] dwm taskbar config

2011-03-23 Thread Patrick Haller
On Wed, Mar 23, 2011 at 10:34:57PM +0200, Le Tian wrote:
>Yeah, your variant is better, but why should I make exec dwm?

I highly recommend writing a tiny looping shell script .e.g. each of the
various ideas below, and watching what they do with pstree or 'ps fax'.

#1
while true; do
exec sleep 30 &
done

#2
while true; do
exec sleep 30
done

#3
while true; do
    sleep 30
done


Patrick



Re: [dev] Not Using a Window Manager?

2011-03-02 Thread Patrick Haller
On Wed, Mar 02, 2011 at 09:32:40AM +0100, Anselm R Garbe wrote:
>
> If you understand some of the C functions of dwm as Unix processes
> than you are pretty close to realise, one can play things pretty much
> Unix like, but if the LOC adds up dramatically at the bottom line, it
> is probably not worth it.

One of the many things I like about surf is the SETPROP hack. Using X11
properties as IPC seems like a fertile and ignored technique.*

I think there's a great deal of good in making it easy for people to
hack things up and then piece them together. Adding X11 properties in
would help, so whether someone wants to try a different layout engine or
something, they can hack it up in perl or pure or whatnot.


Patrick

* yes, i'm declaring ICCCM/EWMH a wasteland for users. There's only apps
and window managers in there. With surf, it's easy to check for any
about:blank windows, send one a URL, unmap it, and push it on the things
to read queue; or any number of inane things users do. ;)



Re: [dev] Not Using a Window Manager?

2011-03-01 Thread Patrick Haller
On Wed, Mar 02, 2011 at 11:36:46AM +0800, sqweek wrote:
> 
>  Nice. Each task is so simple broken down like this :)

Thanks. I just added a focus manager that just makes sure focus is
returned to PointerRoot. It's not absolutely necessary to run, because
apps that exit taking focus with them can be fixed with a 
DISPLAY=:0.0 x-alt-tab 

and from then on, add x-alt-tab to the end of what spawned that beast.


Patrick



Re: [dev] Unix philosophy window manager

2011-02-28 Thread Patrick Haller
On Mon, Feb 28, 2011 at 09:30:26AM +0100, Kurt Van Dijck wrote:
> 
> To make it work smoothly, 1 such program needs a SubstructureRedirectMask.
> Technically, IMHO, that 1 program _is_ the window manager.
> 
> I think the subject of the thread was a bit misleading.

Perhaps. With X11 and no window manager, the top-most window under the
pointer receives Key* events. By tying XCirculateSubwindows to
XSetInputFocus'ing back to the root window, we can get around clients
that focus themselves. 

However, that provides a certainly limited Focus / Stack setup ;)


Patrick



Re: [dev] Not Using a Window Manager?

2011-02-26 Thread Patrick Haller
On Sat, Feb 26, 2011 at 11:17:50AM -0500, Kurt H Maier wrote:
> Precisely what value do you get out of hacking up shell scripts to do
> this with a dozen tools?

It's at least a good way to understand exactly what one gets from X11. ;)


Patrick



Re: [dev] Not Using a Window Manager?

2011-02-26 Thread Patrick Haller
On Sat, Feb 26, 2011 at 11:22:50AM -0500, Steve Ryan wrote:
> 
> This is very cool, however I have one question. Correct me if
> I'm wrong, but you're replacing window-manager functionality with
> various small scripts and built-in X tools, right? So wouldn't you
> just be creating a (very minimalist) window manager out of those
> tools?

yup. WMs usually bind several orthogonals: window manipulation / 
decoration, keyboard shortcuts. focus management.

Separate them. ;)


Patrick



Re: [dev] Not Using a Window Manager?

2011-02-26 Thread Patrick Haller
On Sat, Feb 26, 2011 at 12:42:04PM +, Bjartur Thorlacius wrote:
> 
> Sounds really cool, but have you figured out how to manage detached
> (off-screen) windows? Maybe windows that aren't on screen suck too
> much.

unmapped windows =>
xdotool search stupid_window windowmap

mapped not viewable =>
xdotool search stupid_window windowmove 0 0 

I keep a stack of unmapped windows (especially for surf, which i open unmapped),
managed via the script below.


Patrick


#!/bin/bash
dir="${HOME}/.wm-banished"
[[ ! -d $dir ]] && mkdir -p $dir

[[ "$1" = "push" ]] && {
# no window manager = we don't know what's focus'd, use getmouselocation or 
selectwindow
w_id=$(xdotool selectwindow ) 
xdotool windowunmap $w_id
touch "${dir}/${w_id}"
exit
}

w_id=$( ls -tr $dir | tail -1)
[[ "$w_id" = "" ]] && {
echo -e "\n Bad news... \n no souls remain banished \n" | xmessage 
-file -
exit
}
xdotool windowmap $w_id
rm -f "${dir}/${w_id}"



[dev] Not Using a Window Manager?

2011-02-26 Thread Patrick Haller
Anyone here try using X11 without a window manager? 

Just using Xresources + specific tools: xbindkeys, xdotool, etc... I'm
documenting the setup and adding small tools as needed (x-alt-tab,
x-move-resize, x-session). 

https://github.com/patrickhaller/no-wm


Patrick



Re: [dev] which minimal os

2011-02-11 Thread Patrick Haller
On Fri, Feb 11, 2011 at 07:34:48PM +0100, Benoit Chesneau wrote:
> 
> What would you choose for a really minimal OS?

arch linux, rolling binary releases reduce maintenance time.

what do you want a minimal os for? 



Patrick



Re: [dev] Config files

2011-02-09 Thread Patrick Haller
On Wed, Feb 09, 2011 at 02:28:42PM +0100, c...@wzff.de wrote:
> 
> An alternative to this would be exporting these variables as
> environment variables. This way you don't have to do any parsing on
> your own (well, maybe inside the strings but not externally). Of
> course it only works for very simple use cases which don't need dozens
> of variables

well, don't beat up only one of the twins:

extern char **environ; 
extern char **argv;

char *foo = NULL;
foo = getenv("foo");
environ = argv;
if (getenv("foo") != NULL) 
foo = getenv("foo");


Patrick 



Re: [dev] A Suckless Filesystem

2011-02-06 Thread Patrick Haller
On Sat, Feb 05, 2011 at 05:06:20PM -0500, Brandon LaRocque wrote:
> Which one do you use? Why do you use it? What does it have that the
> others don't?

XFS because http://www.jukie.net/bart/blog/usb2-enclosure-benchmark

Lots of tradeoffs with FSs, how about tackle userland first?


Patrick



Re: [dev] wmii unicode in the status?

2011-01-23 Thread Patrick Haller
On Sat, Jan 22, 2011 at 11:28:20AM -0500, Eitan Goldshtrom wrote:
> Hi. I'm trying to print out a progress bar sort of thing that
> represents my remaining battery life. 

Why use python? dc and printf suffice.


Patrick

percent=$1
buckets=10
# annoying math
decimal=$( dc -e "5 k $buckets $percent * 100 / p")
count=$( dc -e "0 k $decimal 1 / p" )
remainder=$( dc -e "5 k $decimal $count - p" )
offset=$( dc -e "0 k $remainder 8 * 1 / p" )
char_hex="200A" # unicode space
test $offset != 0 && {
# see http://www.fileformat.info/info/unicode/char/258f/index.htm
char_dec=$( dc -e "0 k 9616 $offset - p" )
char_hex=$( printf "%08x" $char_dec )
}

for y in $( yes | head -n $count)  ; do 
$( which printf ) "\U2588"
done
$( which printf ) "\U${char_hex}\n"




[dev] Re: [dwm] screen locker -> sinac

2010-12-10 Thread Patrick Haller
On Sat, 13 Dec 2008 13:20:33, Thayer Williams  wrote:
> On Sat, Dec 13, 2008 at 9:57 AM, Neale Pickett  wrote: 
> > Since the list is talking about slock, now might be an appropriate time 
> > for me to mention again my xss project: 
> > 
> > http://woozle.org/~neale/src/xss/ 
> > 
> > When I mailed the list about this in April someone responded with a neat 
> > thing called "sinac", which is a little smaller than xss, but polls, and 
> > only replaces one of the 6 programs in my package. Some folks may 
> > prefer it, combined with slock or xlock: 
> > 
> > http://lists.suckless.org/dwm/0804/5534.html 
> 
> Thanks for the info! I have been using xautolock until now. I'll 
> give xss a try soon. 
> 
> FWIW, I tried sinac before xautolock and I found that it consumed an 
> unusual amount of CPU resources in the range of 30-50%. Perhaps there 
> was an incompatibility with the latest Xorg server, I'm not sure. I 
> didn't stay with it long enough to find out. 

That's cause sinac.c as posted used usleep while working with seconds. 

I fixed the usleep, switched to ulongs, and removed the argv code
because processing arguments is retarded.


Patrick



/*
 *
 * xidletime
 *
 * derived from xautolock supplied by
 * Authors: Michel Eyckmans (MCE) & Stefan De Troch (SDT)
 *
 * --
 *
 * Copyright 1990,1992-1999,2001-2002 by Stefan De Troch and Michel Eyckmans.
 * Copyright 2005 by Stefan Siegl <[EMAIL PROTECTED]>
 * Copyright 2007 by Christian Dietrich <[EMAIL PROTECTED]>
 *
 * Versions 2.0 and above of xautolock are available under version 2 of the
 * GNU GPL.
 *
 * xidletime.c -Wall -L/usr/X11R6/lib -lX11 -lXss -lXext -o xidletime
 *
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define VERSION "0.1.3"

static XScreenSaverInfo* xss_info = 0;

unsigned long
msecs_idle(Display *d)
{
  if (! xss_info )
xss_info = XScreenSaverAllocInfo();
  XScreenSaverQueryInfo(d, DefaultRootWindow(d), xss_info);
  return xss_info->idle;
}

int
main (int argc, char* argv[])
{
  Display* d;
  unsigned long wait = 0, idle;

  if (getenv("X_IDLE_SECONDS") != NULL)
wait = atol(getenv("X_IDLE_SECONDS")) * 1000;

  if (!(d = XOpenDisplay (0))) {
fprintf (stderr, "Couldn't connect to %s\n", XDisplayName (0));
return 1;
  }
  (void) XSync (d, 0);

  if (wait)
while ((idle = msecs_idle(d)) < wait)
  usleep( (wait - idle) * 1000 );
  else
fprintf(stdout, "%ld\n", msecs_idle(d));

  return 0;
}




[dev] [slock] getopt + disable XBell option

2010-09-17 Thread Patrick Haller
Hi, 

I got sick of the XBell in slock, so I added getopt support and a silent
option (default = False), patched against the mercurial tip. 

I read the manifest and some of the source code; some of the projects
use getopt, others push config elsewhere. Am not sure which should apply
to slock.


Patrick
diff -urN slock-1.0/slock.c slock-1.0-getopt//slock.c
--- slock-1.0/slock.c   2009-11-26 20:53:26.0 +0800
+++ slock-1.0-getopt//slock.c   2010-09-18 12:34:56.761712744 +0800
@@ -74,9 +74,9 @@
 
 static void
 #ifdef HAVE_BSD_AUTH
-read_password(Display *dpy)
+read_password(Display *dpy, Bool silent)
 #else
-read_password(Display *dpy, const char *pws)
+read_password(Display *dpy, const char *pws, Bool silent)
 #endif
 {
char buf[32], passwd[256];
@@ -117,7 +117,7 @@
 #else
running = strcmp(crypt(passwd, pws), pws);
 #endif
-   if (running != 0)
+   if (running != 0 && silent == False)
XBell(dpy, 100);
len = 0;
break;
@@ -209,7 +209,13 @@
 
 static void
 usage(void) {
-   fprintf(stderr, "usage: %s -v", __progname);
+   fprintf(stderr, "slock-%s, © 2006-2008 Anselm R Garbe\n"
+   "usage: %s [-h|-s|-v]\n"
+   "\t-h show this message\n"
+   "\t-s silent (don't ring bell on password failure)\n"
+   "\t-v show this message\n"
+   , VERSION, __progname
+   );
exit(EXIT_FAILURE);
 }
 
@@ -219,14 +225,19 @@
const char *pws;
 #endif
Display *dpy;
-   int nscreens, screen;
+   int nscreens, screen, opt;
+   Bool silent = False;
 
struct st_lock **locks;
 
-   if((argc == 2) && !strcmp("-v", argv[1]))
-   die("slock-%s, © 2006-2008 Anselm R Garbe", VERSION);
-   else if(argc != 1)
-   usage();
+   while ( (opt = getopt(argc, argv, "hsv")) != -1) {
+   switch (opt) {
+   case 's': 
+   silent = True; break;
+   default:
+   usage();
+   }
+   }
 
 #ifndef HAVE_BSD_AUTH
pws = get_password();
@@ -248,9 +259,9 @@
 
/* Everything is now blank. Now wait for the correct password. */
 #ifdef HAVE_BSD_AUTH
-   read_password(dpy);
+   read_password(dpy, silent);
 #else
-   read_password(dpy, pws);
+   read_password(dpy, pws, silent);
 #endif
 
/* Password ok, unlock everything and quit. */


Re: [dev] A language similar to Markdown that sucks less

2010-08-22 Thread David J Patrick

On 10-08-22 12:47 PM, David J Patrick wrote:



pandoc extends markdown and has some table support,


I think.. or maybe it doesn't..

anyhow, it's a noble effort, best of luck, keep us posted,
djp



Re: [dev] A language similar to Markdown that sucks less

2010-08-22 Thread David J Patrick

On 10-08-22 12:37 PM, Alexander Teinum wrote:

What doesn’t work well for me, is that I cannot easily extend
Markdown. The design that I propose is simpler and more strict. All
tags work the same way. The input is close to a data structure, and it
doesn’t need complex parsing. The drawback is that tables and lists
need more characters:


pandoc extends markdown and has some table support,
djp



Re: [dev] A language similar to Markdown that sucks less

2010-08-22 Thread David J Patrick

On 10-08-22 11:52 AM, Alexander Teinum wrote:

I didn’t want to start a completely off-topic discussion in the
typesetting thread, so I created a new thread. I’m playing with the
idea of creating a language that is simple to read like Markdown, but
that has a stricter syntax. It looks like Common Lisp. I think the
parser should be implemented in Go.


personaly, I would be hesitant to re-invent something that already works 
well and is part of a rich software ecosystem. I use werc extensively, 
and it's markdown centric, so it would take wild horses to drag me away.

djp



Re: [dev] Usable typesetting system?

2010-08-22 Thread David J Patrick

On 10-08-22 07:15 AM, Martin Kopta wrote:

Hi everyone,

   I wrote my bachelor thesis using LaTeX and now I am going to write my
master thesis. I would rather avoid TeX and everything TeX based this time.


consider writing in markdown and transforming via pandoc.
http://johnmacfarlane.net/pandoc/
djp



Re: [dev] flo - a command line program for organizing events, to-dos, and deadlines

2010-08-17 Thread David J Patrick

On 10-08-17 02:57 AM, Alexander Teinum wrote:

I don’t have time to try it out right now, but I see how an
interactive interface might be practical.


Don't have time right now, hence that task management application ?  ;-)

taskwarrior is also purely cli at the moment, but working towards adding 
an (optional) interactive interface.




The following line adds one event for the course IS-403 every week
between 35 and 35, and it places it on friday. The lab is between
08:15 and 16:00.


very cool
I'll be keeping an eye on flo (if only to steal the best ideas) and I 
hope it is "just the thing", thanks for sharing it.

djp



Re: [dev] flo - a command line program for organizing events, to-dos, and deadlines

2010-08-16 Thread David J Patrick

On 10-08-14 08:18 AM, Alexander Teinum wrote:

I have been working on a program that makes it easy to keep myself,
and perhaps others, in check. It’s inspired by suckless. I now
consider it stable enough to share it with you.


Sounds intriguing, and I'm going to check it out, but I have to admit to 
being the "Designer" of a competing bit of software at 
http://taskwarrior.org


Task may well "suck more" by some standards, but it is in roaring 
development, and getting (i.m.h.o.) very interesting.


djp



  1   2   >