Re: [dev] [dwm] adding docking support

2011-10-17 Thread Petr Sabata
On Mon, Oct 17, 2011 at 09:08:04AM -0400, Kurt H Maier wrote:
 On Mon, Oct 17, 2011 at 8:52 AM, Bjartur Thorlacius
 svartma...@gmail.com wrote:
  Try clicking the title (selmon-bar IIRC). Wait for a terminal
  emulator to spawn.
 
 What?  No.  What code do you see that's supposed to do that?  Did you
 put that into your config.h?

It's in the default dwm config, line 93...

-- 
# Petr Sabata


pgppbAgz30VGI.pgp
Description: PGP signature


Re: [dev] Formatting emails

2011-10-03 Thread Petr Sabata
On Mon, Oct 03, 2011 at 03:37:15PM +, Bjartur Thorlacius wrote:
 On Sun, Oct 2, 2011 at 9:52 PM, Ethan Grammatikidis eeke...@fastmail.fm 
 wrote:
  On another note entirely, would you mind not wraping your text so wide,
  please? My eyes aren't too good so I use larger text, and anything
  wrapped over about 75-80 columns double-wraps which is unpleasant to
  read. It's not just you, there's quite a few people wrapping their
  emails too wide.
 
 fmt(1)
 
 Can we unify our evangelist forces and standardize on a message
 format? What about RFC 2646: text/plain; format=flowed?
 Embedding any more formatting characters in emails than strictly
 necessary sucks, and autogenerated HTML sucks hard.
 

+1

-- 
# Petr Sabata


pgp87w1pqcQZW.pgp
Description: PGP signature


Re: [dev] [dwm] [patch] USPosition, USSize

2011-08-09 Thread Petr Sabata
On Mon, Aug 08, 2011 at 11:37:55PM -0400, Kurt H Maier wrote:
 On Mon, Aug 8, 2011 at 10:08 PM, Connor Lane Smith c...@lubutu.com wrote:
  Basically these two fields state that the client's geometry has been
  chosen specifically by the user, and the window manager ought to
  respect that. But we don't, we just tile the window anyway. The
  traditional X utilities all set this field when the user passes them
  the '-geom' (or similar) flag, including xterm, rxvt, and so on.
 
 This might be the historical reason these exist, but they were
 conceived before the advent of modern tiling window managers, and imo
 clients shouldn't be managing themselves anyway.  Further, there's no
 telling what kind of weird-ass program might be abusing these without
 anyone as yet knowing.  Please don't merge this patch into mainline;
 I'd like xterm et al to behave just they way they have been.

+1

But I use resizehints = False; so it won't affect me anyway...

-- 
# Petr Sabata


pgpETF58pxB0X.pgp
Description: PGP signature


Re: [dev] [dmenu] Hide matching items if the search string is empty

2011-08-04 Thread Petr Sabata
On Thu, Aug 04, 2011 at 11:56:11AM +0200, Bastien Dejean wrote:
 Hi,
 
 I noticed that when dmenu is used as a program launcher (i.e. through
 dmenu_run) the initial display of all the items of stdin is kind of
 annoying.
 
 I'd prefer that the matching items appear only when a non empty search
 string exists.

...so you couldn't choose the item via cursor keys, great.

You could add yet another bloat option for this and use that in dmenu_run.

-- 
# Petr Sabata


pgpJO1ytBvwLD.pgp
Description: PGP signature


Re: [dev] color-scheme

2011-07-28 Thread Petr Sabata
On Thu, Jul 28, 2011 at 03:43:44PM +0200, ilf wrote:
 On 07-28 13:29, Ethan Grammatikidis wrote:
 http://ethanschoonover.com/solarized
 I've been playing a puzzle game which uses this scheme for partial
 solutions. I had to change the yellow
 
 I would use dark background and this one is too low contrast for me.
 
 I didn't reocmmend it, I just found it nice to have a solution for
 vim, XResources and mutt all in one.

There's actually a bug in their Xresources file, imo:
https://github.com/altercation/solarized/pull/109

This improves the contrast a lot, e.g. see my screenshot:
http://dwm.suckless.org/screenshots/dwm-20110720.png

-- 
# Petr Sabata


pgpgO6gnRYbWA.pgp
Description: PGP signature


Re: [dev] color-scheme

2011-07-26 Thread Petr Sabata
On Mon, Jul 25, 2011 at 06:22:58PM +0200, ilf wrote:
 What's your favorite color-scheme? I just came across this one:
 http://ethanschoonover.com/solarized
 
 While this may not be suckless core, we are pretty terminal focused.
 Also we did touch the topic before. I just hope, this won't get too
 religious.

Yep, I've been using Solarized for a few months now.  For me, it's the best
scheme I've tried so far...

The contrast's okay and my eyes don't hurt even after 16 hours coding.  The
downside is its author pretty much ignores everybody [1].

[1] https://github.com/altercation/solarized/issues

-- 
# Petr Sabata


pgpTjy6Mk0YYK.pgp
Description: PGP signature


Re: [dev] dmenu-4.4

2011-07-21 Thread Petr Sabata
On Thu, Jul 21, 2011 at 02:50:48AM +0100, Connor Lane Smith wrote:
 On 21 July 2011 02:19, Phillip Warner phillip.c.war...@gmail.com wrote:
  The only issue I have with the latest release is the file name 'lsx'.  It's
  already taken.
 
 Hmm, that's unfortunate, but lsx has been named that since 2006 [1],
 and some greedy alias is just annoying. That one package claims lrb,
 lrx, lsb, lsx, rb, rx, rz, sb, sx, and sz, just for symlinks? Jesus.
 Other distros appear to be fine, so I don't think it's really our
 problem.
 
 [1]: http://tools.suckless.org/lsx

I remember Gentoo had this binary/symlink too, ... some time ago at least.
They seem to get rid of it.

-- 
# Petr Sabata


pgpAIDRYUh5Je.pgp
Description: PGP signature


Re: [dev] [dwm] layers

2011-07-21 Thread Petr Sabata
On Thu, Jul 21, 2011 at 03:42:43PM +0200, Jean-Paul DEUX wrote:
 On 07/21/2011 02:55 PM, Andrew Hills wrote:
 On Thu, Jul 21, 2011 at 3:18 AM, Jean-Paul DEUXt...@rocketmail.com  wrote:
 I want to simultaneously have thunderbird in monocle mode and skype in
 tile mode in the same tag and switch between them (_all_ thunderbird
 windows and _all_ skype windows) like if they are simple windows.
 I think what you want is the pertag patch, which, if I'm not
 completely wrong, allows you to choose your layout per tag. Then you
 can have a tag for Thunderbird and a tag for Skype and set them to
 different layouts. Does that work for you?
 
 --Andrew Hills
 
 Actually, I already use the pertag patch and it's not what I'm looking
 for. 'Cause dwm use a fixed number of tags.

Is there something preventing you from defining more tags in your config.h?

 
 For example, if I want a third application for chat (I don't know, say
 pidgin) I have to create a new tag, and it's not very handy to create a
 new tag for each new application I install.
 
 Plus, this layer system may help to simulate tabs (even more powerful
 'cause we can have layouts).
 
 Thanks anyway, may be I should try to implement it myself.
 

-- 
# Petr Sabata


pgpFtkr52PJMv.pgp
Description: PGP signature


Re: [dev] hell with the Terminus font?

2011-06-21 Thread Petr Sabata
On Tue, Jun 21, 2011 at 11:01:35AM +0300, Le Tian wrote:
 I wonder why does dwm refuse to use terminus font? I get dwm missing
 fontset for several locales (if it is somehow related?) and a message that
 dwm failed to load terminus font. Whenever I rebuild dwm for terminus I get
 a crappy default font. Who does use terminus, and whats your config? My
 terminus installed to /usr/share/fonts/local and I add this path in
 .xinitrc, so everything should work.
 My default locale is set to utf-8 and I need it as I work with several
 languages.

I have Terminus in /usr/share/fonts/terminus/, my X server uses that (configured
by distribution).

dwm config.def.h:
static const char font[] = 
-*-terminus-medium-r-normal-*-16-*-*-*-*-*-iso10646-*;

And my locale is en_US.UTF-8.

No issues.

Can you see Terminus in xfontsel?

-- 
# Petr Sabata


pgpyRUdrbwMe2.pgp
Description: PGP signature


Re: [dev] Re: Cleanup of (hg.)suckless.org

2011-06-20 Thread Petr Sabata
On Sat, Jun 18, 2011 at 10:33:02PM +0100, garbeam wrote:
 Hi there again,
 
 On 3 June 2011 17:35, garbeam garb...@gmail.com wrote:
  DELETE
  - 9libs
  - diri
  - genosite
  - gentoo
  - godwm
  - libdraw.old
  - make
  - stali-toolchain (this is outdated and better stuff is in the works)
  - wmii-2.5 (obsolete)
  - wmii-3 (obsolete)
  - wmii-3.5 (obsolete)
  - wmii-3.6 (obsolete)
 
 I deleted those repos now.
 
  RELOCATE
  - last (google code) ??
  - libixp (google code) ??
  - r9p (google code) ??
  - vp (google code) ??
  - wmii (google code) ??
  - wmiirc-rumai (google code) ??
  - skvm (dunno, don't get it) ??
 
 I would like to hear about the status. Are things started to relocate
 those repos?

And why do you want to move them, actually?

 
  @Kris: Please let me know how much time you need for the transition
  and if you need any help. I guess a transition could take a couple of
  months quite easily and requires some time on your side as well.
 
 Any news on this please?
 
 Cheers,
 --garbeam
 

-- 
# Petr Sabata


pgpBZYChqO0JP.pgp
Description: PGP signature


Re: [dev] ideas on suckless file manager

2011-06-09 Thread Petr Sabata
On Wed, Jun 08, 2011 at 10:12:26PM +0200, Mate Nagy wrote:
 Hi,
 On Wed, Jun 08, 2011 at 08:40:48PM +0200, ilf wrote:
  On 06-08 12:13, Bert Münnich wrote:
  i dont think this is a task for an image viewer. we should
  probably write an ssetroot or so linking against imlib2 and
  allowing opaque colors like xsetroot does..
 I think developing another X background setter would make sense in only
 one scenario: if it finally had decent support for xinerama. Because
 currently there is _no_ _such_ _thing_.

How about bgs?
http://s01.de/~tox/index.cgi/proj_bgs

-- 
# Petr Sabata


pgp1ff1tydEzV.pgp
Description: PGP signature


Re: [dev] ideas on suckless file manager

2011-06-08 Thread Petr Sabata
On Tue, Jun 07, 2011 at 05:34:00PM +0200, pancake wrote:
 If you need thumbs use an image viewer. Gqview works quite well for this.
 

sxiv is my image viewer of choice, currently...

http://github.com/muennich/sxiv

-- 
# Petr Sabata


pgpmcotAqOQJu.pgp
Description: PGP signature


Re: [dev] [PATCH] [lsw] Create manpage directory if it's not there

2011-06-06 Thread Petr Sabata
On Mon, Jun 06, 2011 at 12:52:32PM +0100, Connor Lane Smith wrote:
 Hey,
 
 On 6 June 2011 09:35, Petr Sabata con...@redhat.com wrote:
  This is self-explanatory...
 
 Applied, thanks.

Awesome.

While you're updating those small tools, any chance of getting this in?
http://lists.suckless.org/dev/1105/8047.html

Thanks.

-- 
# Petr Sabata


pgpEaYQ6stinM.pgp
Description: PGP signature


Re: [dev] [PATCH] [lsw] Create manpage directory if it's not there

2011-06-06 Thread Petr Sabata
On Mon, Jun 06, 2011 at 04:36:24PM +0100, Ethan Grammatikidis wrote:
 On Mon,  6 Jun 2011 10:35:56 +0200
 Petr Sabata con...@redhat.com wrote:
 
  +   @mkdir -p ${DESTDIR}${MANPREFIX}/man1
 
 This is the sort of thing which has people symlinking man - share/man or 
 vice versa. 
 

I really don't see how that could possibly apply to this situation.

-- 
# Petr Sabata


pgpxx4DszyoVO.pgp
Description: PGP signature


Re: [dev] [st] Font issues

2011-05-31 Thread Petr Sabata
On Tue, May 31, 2011 at 09:33:59AM -0400, Bryan Bennett wrote:
 So far, this font issue and the lack of a scrollback buffer are
 my only issues with st. I'm having strange problems with urxvt
 under another (inferior / floating) window manager, which has
 pushed me towards st. I could be using xterm, but...eww.
 
 Terminus drew nice and quickly for me when I was using it
 and Tamsyn works wonderfully as well. I'm just curious what
 I could be doing wrong.
 

Terminus works fine. I have no issues with it, being it in st or anywhere else.

st seems pretty okay, quite usable.
My personal issues with it, preventing me from switching to it are:

- the lack of a scrollback buffer, already mentioned
- double-click-and-drag selection, like xterm has
  (st currently supports double-click word selection; implementing this
  should be no big deal... I might look at it)
- vim in st with Solarized [1] colorscheme draws invisible text
  (this is quite strange; not sure where the problem is...)

[1] http://ethanschoonover.com/solarized

-- 
# Petr Sabata


pgpNz4TmXJoMA.pgp
Description: PGP signature


[dev] [lsx] Assume cwd if no arguments are given.

2011-05-23 Thread Petr Sabata
This makes lsx a bit more usable.

Signed-off-by: Petr Sabata psab...@redhat.com
---
 lsx.c |   38 +++---
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/lsx.c b/lsx.c
index 5060b9c..7fa5e35 100644
--- a/lsx.c
+++ b/lsx.c
@@ -8,28 +8,36 @@
 #include unistd.h
 #include sys/stat.h
 
-int
-main(int argc, char *argv[]) {
-   int i;
+void
+lsx(char *dirpath) {
struct dirent *dp;
struct stat s;
DIR *dir;
 
+   if((dir = opendir(dirpath))) {
+   fchdir(dirfd(dir));
+   do
+   if((dp = readdir(dir))
+(stat(dp-d_name, s) != -1)
+S_ISREG (s.st_mode)
+!access(dp-d_name, X_OK))
+   puts(dp-d_name);
+   while(dp);
+   closedir(dir);
+   }
+}
+
+int
+main(int argc, char *argv[]) {
+   int i;
+
if((argc  1)  !strncmp(argv[1], -v, 3)) {
fputs(lsx-VERSION, (C)opyright MMVI Anselm R. Garbe\n, 
stdout);
exit(EXIT_SUCCESS);
}
-   for(i = 0; i  argc; i++)
-   if((dir = opendir(argv[i]))) {
-   fchdir(dirfd(dir));
-   do
-   if((dp = readdir(dir))
-(stat(dp-d_name, s) != -1)
-S_ISREG (s.st_mode)
-!access(dp-d_name, X_OK))
-   puts(dp-d_name);
-   while(dp);
-   closedir(dir);
-   }
+   if (argc == 1)
+   lsx(.);
+   for(i = 1; i  argc; i++)
+   lsx(argv[i]);
return 0;
 }
-- 
1.7.4.4




Re: [dev] dwm

2011-05-09 Thread Petr Sabata
On Sat, May 07, 2011 at 02:48:24PM +0200, v4hn wrote:
 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?

I spent like a half a second to find the message in that, unsuccessfully.

 
 Anselm wrote:
  I'm looking into mlmmj to let html mails bounce.
 
 Would be great to see this working, thanks!
 
 
 v4hn



-- 
# Petr Sabata


pgpDsgXCAUnGr.pgp
Description: PGP signature


Re: [dev] dwm

2011-05-09 Thread Petr Sabata
On Sat, May 07, 2011 at 02:43:49PM -0400, David Neu wrote:
 On Fri, May 6, 2011 at 10:17 AM, Kurt H Maier karmaf...@gmail.com wrote:
  On Fri, May 6, 2011 at 9:26 AM, m1...@web.de wrote:
 
  hm well that should be main-features of a dynamic-window-manager and
  not just available pver a patch..these were some of the main reasons I
  liked wmii..
 
  Incorrect.  Your desires are based on a misunderstanding of dwm.  You
  have a 'layout' (this is floating, tiled, monocle, etc) and then you
  have 'tags'.  Tags are used to determine which set of clients to
  display.  Layouts are used to determine how displayed clients are
  arranged.  Reordering windows within a layout is pointless, because
  when you are displaying two tags, and then toggle a third, what
  determines in which order the newly-displayed clients are arranged?
  If you only display one tag at a time, you're not using dwm properly.
  If you want wmii, you know where to find it.  dwm's current interface
  is basically sound, and while people temporarily patch it up to make
  it act like a regular 'workspaces' window manager, most people I know
  eventually stop doing that as they realize how superior dwm's
  interface is.  There isn't really another program out there that has
  this functionality in such a clean implementation -- dwm is the
  standard dynamic window manager.
 
  --
  # Kurt H Maier
 
 
 
 Hi Kurt,
 
  If you only display one tag at a time, you're not using dwm properly.
 
 I've been using dwm for years, it sounds like I haven't been *fully*
 using it, i.e. I haven't been making use of the ability to assign
 multiple tags to a single client.  Can you give me an example how you
 use this?
 
 Many thanks!
 
 Cheers,
 David
 

See your config file, look for TAGKEYS...

-- 
# Petr Sabata


pgpi72VX8FQIQ.pgp
Description: PGP signature


Re: [dev] dwm

2011-05-06 Thread Petr Sabata
On Fri, May 06, 2011 at 03:26:11PM +0200, m1...@web.de wrote:
 htmlhead/headbody bgcolor='#FF' 
 style='font-size:12px;background-color:#FF;font-family:Verdana, Arial, 
 sans-serif;'hm well that should be main-features of a dynamic-window-manager 
 andbr/not just available pver a quot;patchquot;..these were some of the 
 main reasons Ibr/liked wmii..br/br/blockquote style=border-left: 2px 
 solid blue; margin-left: 5px; padding-left: 5px; padding-top: 
 5px;hr/bVon:/b quot;Jacob Toddquot; 
 lt;jaketodd...@gmail.comgt;br/bGesendet:/b 06.05.2011 
 14:57:37br/bAn:/b quot;dev mail listquot; 
 lt;dev@suckless.orggt;br/bBetreff:/b Re: [dev] 
 dwmbr/br/pThere's a patch that provides that functionality. Check the 
 wiki./pdiv class=gmail_quoteOn May 6, 2011 8:56 AM, lt;a 
 href=mailto:m1...@web.de;m1...@web.de/agt; wrote:br/gt; 
 hi!br/gt;br/gt; there are a lot of important things from wmii which 
 cant be found in dwm anymore..br/gt; for example the 
 stacked/maximised-mode or the ability to change the positions ofbr/gt; 
 frames in a tag via Alt+Shift+[h/j/k/l]. I was thinking about to change to 
 dwm butbr/gt; without this main-features the dayly use of a wm is much 
 more tedious.br/gt; 
 ___br/gt; Schon 
 gehouml;rt? a href=http://WEB.DE;WEB.DE/a hat einen genialen 
 Phishing-Filter in diebr/gt; Toolbar eingebaut! a 
 href=http://produkte.web.de/go/toolbar;http://produkte.web.de/go/toolbar/abr/gt;/div/blockquotenbsp;nbsp;brbrtable
  cellpadding=0 cellspacing=0 border=0trtd bgcolor=#00img 
 src=https://img.ui-portal.de/p.gif; width=1 height=1 border=0 alt= 
 //td/trtrtd style=font-family:verdana; font-size:12px; 
 line-height:17px;Schon gehouml;rt? WEB.DE hat einen genialen 
 Phishing-Filter in dienbsp;nbsp;nbsp;brToolbar eingebaut! a 
 href=http://produkte.web.de/go/toolbar;bhttp://produkte.web.de/go/toolbar/b/a/td/tr/table
 /body/html
 

Oh that hurts...

-- 
Petr 'contyk' Sabata, Red Hat


pgpQNWFnJkt6k.pgp
Description: PGP signature


Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread Petr Sabata
On Wed, Apr 27, 2011 at 05:24:55PM +0200, am...@physik.tu-berlin.de wrote:
  On Wed, 27 Apr 2011 13:55:08 +0200, Kurt Van Dijck kurt.van.di...@eia.be
  wrote:
 
  why not just:
 dwm
 kill $statuspid
 
  I see no use in backgrounding dwm, and then waiting for it.
  What did I miss?
 
  Nothing; backgrounding dwm was left from trying a few other ways to do it.
  Thank you.
  Then it can be simplified further:
 
 while true; do
 xsetroot -name ...
 sleep 1
 done 
 dwm
 kill $!
 
 
 the following works for me:
 
 while xsetroot -name $(date +%a, %b %d %Y | %H:%M)
 do
 sleep 20
 done 
 exec dwm
 
 Andreas

That's quite nice.
I usually run a script instead of hardcoding the title in there...

  I wonder whether the README should be updated accordingly. But it is there
  for years and nobody seemed to notice before. I attach the trivial patch,
  just in case.
 
  --
  Thomas Dahms
 
 
 

-- 
Petr 'contyk' Sabata, Red Hat


pgp5jz4iqio6H.pgp
Description: PGP signature


Re: [dev] [slock] fixing the annoying combination with PAM

2011-04-20 Thread Petr Sabata
On Tue, Apr 19, 2011 at 10:24:38PM +0200, markus schnalke wrote:
 Hoi,
 
 at my university PAM is used for user login. They have slock installed
 because they have the suckless-tools package (Ubuntu) installed.
 
 If I run slock , X gets locked like it should. Unfortunately I'm not
 able to unlock it again because slock checks against /etc/passwd which
 does not contain an entry for my account. This leaves me stuck in an
 dead end. This is annoying.
 
 Of course, I could simply not use slock, but you know how things
 happen from time to time ... your habits take over. ;-) Hence I though
 that slock could check for an passwd entry before it locks. Thus it
 can prevent locking the screen when you won't be able to unlock it
 afterwards.
 
 Here is a patch against current tip which implements this check. I'm
 no expert in this topic, I just hacked it to work for me.
 
 
 meillo
 
 
 diff -r 4d3769ac5d02 slock.c
 --- a/slock.c   Thu Nov 26 12:53:26 2009 +
 +++ b/slock.c   Tue Apr 19 18:50:59 2011 +0200
 @@ -228,6 +228,10 @@
 else if(argc != 1)
 usage();
  
 +   if(!getpwuid(getuid()))
 +   die(no passwd entry for you);
 +
  #ifndef HAVE_BSD_AUTH
 pws = get_password();
  #endif
 

I wrote this for such situations:
http://lists.suckless.org/dev/1011/6405.html

-- 
Petr 'contyk' Sabata, Red Hat


pgp5da4dGLUAf.pgp
Description: PGP signature


[dev] [st] Better selection support?

2011-04-04 Thread Petr Sabata
Unfortunatelly, many X applications aren't compatible with just UTF8_STRING,
so we'll have to do a little more. The patch below checks COMPOUND_TEXT,
UTF8_STRING and XA_STRING targets. It makes it more complicated and possibly
ugly, but it works...

It would be nice to respond with all three supported types to TARGETS,
I suppose. I'm not sure how to do that correctly, though.

-- Petr

---
 st.c |   75 --
 1 files changed, 50 insertions(+), 25 deletions(-)

diff --git a/st.c b/st.c
index a6fb766..61b53b0 100644
--- a/st.c
+++ b/st.c
@@ -41,6 +41,11 @@
 #define DRAW_BUF_SIZ  1024
 #define UTF_SIZ   4
 
+/* Selection requests */
+#define REQ_CTEXT 1
+#define REQ_USTR  2
+#define REQ_STR   3
+
 #define SERRNO strerror(errno)
 #define MIN(a, b)  ((a)  (b) ? (a) : (b))
 #define MAX(a, b)  ((a)  (b) ? (b) : (a))
@@ -145,6 +150,12 @@ typedef struct {
} font, bfont;
 } DC;
 
+typedef struct {
+   Atom ctext;
+   Atom ustr;
+   Atom str;
+} SelectionTargets;
+
 /* TODO: use better name for vars... */
 typedef struct {
int mode;
@@ -152,7 +163,8 @@ typedef struct {
int ex, ey;
struct {int x, y;}  b, e;
char *clip;
-   Atom xtarget;
+   SelectionTargets tgt;
+   Atom deftgt;
 } Selection;
 
 #include config.h
@@ -219,7 +231,7 @@ static void selrequest(XEvent *);
 static void selinit(void);
 static inline int selected(int, int);
 static void selcopy(void);
-static void selpaste(void);
+static void selpaste(Atom);
 
 static int utf8decode(char *, long *);
 static int utf8encode(long *, char *);
@@ -371,9 +383,10 @@ selinit(void) {
sel.mode = 0;
sel.bx = -1;
sel.clip = NULL;
-   sel.xtarget = XInternAtom(xw.dpy, UTF8_STRING, 0);
-   if(sel.xtarget == None)
-   sel.xtarget = XA_STRING;
+   sel.tgt.ctext = XInternAtom(xw.dpy, COMPOUND_TEXT, 0);
+   sel.tgt.ustr = XInternAtom(xw.dpy, UTF8_STRING, 0);
+   sel.tgt.str = XA_STRING;
+   sel.deftgt = sel.tgt.ctext;
 }
 
 static inline int 
@@ -439,25 +452,35 @@ selnotify(XEvent *e) {
int format;
unsigned char *data;
Atom type;
-
-   ofs = 0;
-   do {
-   if(XGetWindowProperty(xw.dpy, xw.win, XA_PRIMARY, ofs, BUFSIZ/4,
-   False, AnyPropertyType, type, format,
-   nitems, rem, data)) {
-   fprintf(stderr, Clipboard allocation failed\n);
-   return;
-   }
-   ttywrite((const char *) data, nitems * format / 8);
-   XFree(data);
-   /* number of 32-bit chunks returned */
-   ofs += nitems * format / 32;
-   } while(rem  0);
+   static int req = REQ_CTEXT;
+
+   if (req == REQ_CTEXT  (*e).xselection.property == None) {
+   selpaste(sel.tgt.ustr);
+   req = REQ_USTR;
+   } else if (req == REQ_USTR  (*e).xselection.property == None) {
+   selpaste(sel.tgt.str);
+   req = REQ_STR;
+   } else {
+   ofs = 0;
+   do {
+   if(XGetWindowProperty(xw.dpy, xw.win, XA_PRIMARY, ofs, 
BUFSIZ/4,
+   False, AnyPropertyType, type, 
format,
+   nitems, rem, data)) {
+   fprintf(stderr, Clipboard allocation 
failed\n);
+   return;
+   }
+   ttywrite((const char *) data, nitems * format / 8);
+   XFree(data);
+   /* number of 32-bit chunks returned */
+   ofs += nitems * format / 32;
+   } while(rem  0);
+   req = REQ_CTEXT;
+   }
 }
 
 void
-selpaste() {
-   XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY, xw.win, 
CurrentTime);
+selpaste(Atom target) {
+   XConvertSelection(xw.dpy, XA_PRIMARY, target, XA_PRIMARY, xw.win, 
CurrentTime);
 }
 
 void
@@ -478,12 +501,14 @@ selrequest(XEvent *e) {
xa_targets = XInternAtom(xw.dpy, TARGETS, 0);
if(xsre-target == xa_targets) {
/* respond with the supported type */
-   Atom string = sel.xtarget;
+   Atom string = sel.deftgt;
XChangeProperty(xsre-display, xsre-requestor, xsre-property,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) string, 1);
xev.property = xsre-property;
-   } else if(xsre-target == sel.xtarget) {
+   } else if(xsre-target == sel.tgt.ctext ||
+ xsre-target == sel.tgt.ustr ||
+ xsre-target == sel.tgt.str) {
XChangeProperty(xsre-display, xsre-requestor, xsre-property,
xsre-target, 8, PropModeReplace,
 

[dev] [st] Selection should take BORDER into account

2011-04-03 Thread Petr Sabata
I use 10px BORDER and it's been quite annoying to start and end my selection
a row and a few columns off. The selection code should respect BORDER.

The patch below should do the thing.

-- Petr

---
 st.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/st.c b/st.c
index ed750e6..b1e74a6 100644
--- a/st.c
+++ b/st.c
@@ -392,8 +392,8 @@ getbuttoninfo(XEvent *e, int *b, int *x, int *y) {
if(b) 
*b = e-xbutton.button;
 
-   *x = e-xbutton.x/xw.cw;
-   *y = e-xbutton.y/xw.ch;
+   *x = (e-xbutton.x - BORDER)/xw.cw;
+   *y = (e-xbutton.y - BORDER)/xw.ch;
sel.b.x = sel.by  sel.ey ? sel.bx : sel.ex;
sel.b.y = MIN(sel.by, sel.ey);
sel.e.x = sel.by  sel.ey ? sel.ex : sel.bx;
@@ -403,8 +403,8 @@ getbuttoninfo(XEvent *e, int *b, int *x, int *y) {
 void
 bpress(XEvent *e) {
sel.mode = 1;
-   sel.ex = sel.bx = e-xbutton.x/xw.cw;
-   sel.ey = sel.by = e-xbutton.y/xw.ch;
+   sel.ex = sel.bx = (e-xbutton.x - BORDER)/xw.cw;
+   sel.ey = sel.by = (e-xbutton.y - BORDER)/xw.ch;
 }
 
 void
-- 
1.7.4




[dev] [st] Support UTF8 clipboard

2011-04-02 Thread Petr Sabata
This patch adds UTF8 clipboard support via UTF8_STRING, if it's available. This
is needed to correctly exchange UTF8 data with other applications.

-- Petr

---
 st.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/st.c b/st.c
index 561d5b0..366f681 100644
--- a/st.c
+++ b/st.c
@@ -248,6 +248,7 @@ static CSIEscape escseq;
 static int cmdfd;
 static pid_t pid;
 static Selection sel;
+static Atom seltarget;
 static char **opt_cmd  = NULL;
 static char *opt_title = NULL;
 static char *opt_class = NULL;
@@ -370,6 +371,9 @@ selinit(void) {
sel.mode = 0;
sel.bx = -1;
sel.clip = NULL;
+   seltarget = XInternAtom(xw.dpy, UTF8_STRING, 0);
+   if (seltarget == None)
+   seltarget = XA_STRING;
 }
 
 static inline int 
@@ -453,7 +457,7 @@ selnotify(XEvent *e) {
 
 void
 selpaste() {
-   XConvertSelection(xw.dpy, XA_PRIMARY, XA_STRING, XA_PRIMARY, xw.win, 
CurrentTime);
+   XConvertSelection(xw.dpy, XA_PRIMARY, seltarget, XA_PRIMARY, xw.win, 
CurrentTime);
 }
 
 void
@@ -474,12 +478,12 @@ selrequest(XEvent *e) {
xa_targets = XInternAtom(xw.dpy, TARGETS, 0);
if(xsre-target == xa_targets) {
/* respond with the supported type */
-   Atom string = XA_STRING;
+   Atom string = seltarget;
XChangeProperty(xsre-display, xsre-requestor, xsre-property,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) string, 1);
xev.property = xsre-property;
-   } else if(xsre-target == XA_STRING) {
+   } else if(xsre-target == seltarget || xsre-target == XA_STRING) {
XChangeProperty(xsre-display, xsre-requestor, xsre-property,
xsre-target, 8, PropModeReplace,
(unsigned char *) sel.clip, strlen(sel.clip));
-- 
1.7.4




Re: [dev] [st] bold as bright (again)

2011-04-01 Thread Petr Sabata
On Fri, Apr 01, 2011 at 03:06:09PM +0200, pancake wrote:
 Oh.. i was about to push the patch...until I realized the original thread.
 
 Check those pictures:
 
 I executed the scripts in hg.youterm.com/toys/ansi to check for 256
 colors and
 normal ansi escape codes. And here's the result:
 
http://lolcathost.org/stcolors.png
 (left one is xterm, and right one is st)

Not found.

 
 As you may see.. not all ansi scape codes are supported, and I would prefer
 to have a patch implementing support for those missing escape codes.
 
 
 Then I run irssi:
   http://lolcathost.org/stcolors2.png

Not found either.

 
 You may see some other differences... and the missuse of bright when bold
 sometimes hurts my eyes... but some programs just are hard to read without
 it...
 
 Another annoying thing I found in st is that text selection does not
 reflects it
 correctly until you release the mouse button, this is a bit annoying
 because you
 dont see what's going to be copied into the clipboard until it's too late.
 
 So, before adding this patch I would prefer some more discussion to make st
 more usable. and less eye-harmful.
 
 
 On 04/01/11 10:58, Stefan Mark wrote:
 Some time ago, i submitted a patch that makes colors bright for bold
 text. Most Terminals do that, and some programs rely on this (like
 htop). The patch was rejected unless more people ask for it.
 
 As it seems, i'm still the only one, but i modified the patch to make
 the bold-is-bright behavior optional. Now i try again.
 
 I attached two variants of the patch, one uses preprocessor directives
 (pp.diff), the other not. Maybe i'm more lucky this time :)
 
 greetings
 stefan
 
 

Speaking of colors -- another slightly annoying thing is you currently can't
define custom (not choosing one of the 16 colors) background, foreground and
cursor colors.

-- 
Petr 'contyk' Sabata, Red Hat


pgpR6QMviCtx4.pgp
Description: PGP signature


Re: [dev] which minimal os

2011-02-14 Thread Petr Sabata
On Mon, Feb 14, 2011 at 02:03:37AM -0500, Ammar James wrote:
 Gentoo. All day, every day.
 
 
 P.S. - Kurt H Maier is a wise sage and speaks the truth (for the most part).
 

The same here.

Yeah, everything is crap. I just find Gentoo being the Lesser Evil;
savedconfig sucks, though.

-- 
Petr 'contyk' Sabata -- Red Hat Inc.


pgpn78ZsNKtf5.pgp
Description: PGP signature


[dev] [slock] Linux-PAM support

2010-11-16 Thread Petr Sabata
Hey,

this patch should enable Linux-PAM support in slock. It's my first try with
Linux-PAM whatsoever so there's a chance it won't work everywhere :) Maybe
it could be useful to some...

-- 
Petr 'contyk' Sabata, Red Hat, Brno

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments
diff -r 4d3769ac5d02 config.mk
--- a/config.mk Thu Nov 26 12:53:26 2009 +
+++ b/config.mk Tue Nov 16 11:32:30 2010 +0100
@@ -20,6 +20,7 @@
 
 # On *BSD remove -DHAVE_SHADOW_H from CPPFLAGS and add -DHAVE_BSD_AUTH
 # On OpenBSD and Darwin remove -lcrypt from LIBS
+# To use Linux-PAM, use -DHAVE_PAM instead of SHADOW_H or BSD_AUTH in CPPFLAGS 
and add -lpam to LIBS
 
 # compiler and linker
 CC = cc
diff -r 4d3769ac5d02 slock.c
--- a/slock.c   Thu Nov 26 12:53:26 2009 +
+++ b/slock.c   Tue Nov 16 11:32:30 2010 +0100
@@ -1,6 +1,7 @@
 /* See LICENSE file for license details. */
 #define _XOPEN_SOURCE 500
-#if HAVE_SHADOW_H
+#define PASSLEN 256
+#if defined(HAVE_SHADOW_H)
 #include shadow.h
 #endif
 
@@ -17,11 +18,16 @@
 #include X11/Xlib.h
 #include X11/Xutil.h
 
-#if HAVE_BSD_AUTH
+#if defined(HAVE_BSD_AUTH)
 #include login_cap.h
 #include bsd_auth.h
 #endif
 
+#if defined(HAVE_PAM)
+#define PAM_REALM login
+#include security/pam_appl.h
+#endif
+
 struct st_lock {
int screen;
Window root, w;
@@ -44,7 +50,7 @@
exit(EXIT_FAILURE);
 }
 
-#ifndef HAVE_BSD_AUTH
+#if !defined(HAVE_BSD_AUTH)  !defined(HAVE_PAM)
 static const char *
 get_password(void) { /* only run as root */
const char *rval;
@@ -56,7 +62,7 @@
endpwent();
rval =  pw-pw_passwd;
 
-#if HAVE_SHADOW_H
+#if defined(HAVE_SHADOW_H)
{
struct spwd *sp;
sp = getspnam(getenv(USER));
@@ -73,29 +79,24 @@
 #endif
 
 static void
-#ifdef HAVE_BSD_AUTH
-read_password(Display *dpy)
-#else
-read_password(Display *dpy, const char *pws)
-#endif
+read_password(Display *dpy, char *passwd)
 {
-   char buf[32], passwd[256];
+   char buf[32];
int num;
 
unsigned int len;
-   Bool running = True;
KeySym ksym;
XEvent ev;
 
len = 0;
-   running = True;
 
/* As slock stands for Simple X display locker, the DPMS settings
 * had been removed and you can set it with xset or some other
 * utility. This way the user can easily set a customized DPMS
 * timeout. */
 
-   while(running  !XNextEvent(dpy, ev)) {
+   for(;;) {
+   XNextEvent(dpy, ev);
if(ev.type == KeyPress) {
buf[0] = 0;
num = XLookupString(ev.xkey, buf, sizeof buf, ksym, 
0);
@@ -112,14 +113,7 @@
switch(ksym) {
case XK_Return:
passwd[len] = 0;
-#ifdef HAVE_BSD_AUTH
-   running = !auth_userokay(getlogin(), NULL, 
auth-xlock, passwd);
-#else
-   running = strcmp(crypt(passwd, pws), pws);
-#endif
-   if (running != 0)
-   XBell(dpy, 100);
-   len = 0;
+   return;
break;
case XK_Escape:
len = 0;
@@ -127,11 +121,13 @@
case XK_BackSpace:
if(len)
--len;
-   break;
+   passwd[len] = 0;
+   break;
default:
-   if(num  !iscntrl((int) buf[0])  (len + num 
 sizeof passwd)) { 
+   if(num  !iscntrl((int) buf[0])  (len + num 
 PASSLEN)) { 
memcpy(passwd + len, buf, num);
len += num;
+   passwd[len] = 0;
}
break;
}
@@ -139,6 +135,40 @@
}
 }
 
+#if defined(HAVE_PAM)
+static int
+pamconv(int num_msg, const struct pam_message **msg, struct pam_response 
**resp, void *appdata_ptr) {
+   int i;
+   *resp = (struct pam_response *) calloc(num_msg, sizeof(struct 
pam_response));
+   for (i = 0; i  num_msg; ++i) {
+   if (msg[i]-msg_style == PAM_PROMPT_ECHO_OFF) {
+   if ((resp[i]-resp = malloc(PASSLEN)) == NULL )
+   die(Not enough memory);
+   read_password((Display *) appdata_ptr, resp[i]-resp);
+   }
+   resp[i]-resp_retcode = 0;
+   }
+   return PAM_SUCCESS;
+}
+#endif
+
+#if !defined(HAVE_PAM)
+static Bool
+#if defined(HAVE_BSD_AUTH)
+authenticate(const char *user, const char *passwd) {
+#else
+authenticate(const char *user, const 

Re: [dev] [slock] Linux-PAM support

2010-11-16 Thread Petr Sabata
On Tue, Nov 16, 2010 at 12:09:54PM +0100, pancake wrote:
 On 11/16/10 11:46, Petr Sabata wrote:
 Hey,
 
 this patch should enable Linux-PAM support in slock. It's my first try with
 Linux-PAM whatsoever so there's a chance it won't work everywhere :) Maybe
 it could be useful to some...
 
 few time ago i send a patch adding support for user defined password, which
 i find much more 'secure' than typing your user password to unlock
 the screen.
 i think slock should split the auth support in a different file, so
 one can choose at
 compile time which method to use and stop living maintaining patches or huge
 cpp usage.

Well, this is quite easy with PAM; one can just define their own service
name instead of 'login' and configure it accordingly.

 
 is somebody up to do this work?
 

-- 
Petr 'contyk' Sabata, Red Hat, Brno

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments


pgpD9duxXcHfJ.pgp
Description: PGP signature


Re: [dev] dmenu patch to return all matching items (for a new dmenu-powered music player interface)

2010-11-11 Thread Petr Sabata
On Thu, Nov 11, 2010 at 02:12:59PM +0100, markus schnalke wrote:
 [2010-11-11 12:47] Dieter Plaetinck die...@plaetinck.be
  On Thu, 11 Nov 2010 12:36:23 +0100
  sta...@cs.tu-berlin.de wrote:
  
   * Anselm R Garbe garb...@gmail.com [2010-11-11 12:19]:
On 11 November 2010 06:25, Dan Brown danbr...@gmail.com wrote:
 As part of a project to create a simple and fast music player
 interface, I patched dmenu to allow it to return all matching
 items instead of just the one at the cursor. dmenu is the browsing

This patch looks kinda useful to me and I'll think about probably
supporting this in mainstream dmenu.
 
   Can be very useful bound to some modkey + enter
  
  you mean you want to choose between return current result vs return
  all current matches at run-time?  What's a use case for that?
  I think this should be configured with a commandline argument, because
  the script that calls dmenu needs to know in advance what kind of
  output it will get anyway and it depends on what task the script will
  do. Or am I missing something?
 
 Note that the user might not be able to know in which mode dmenu acts
 at run-time. The mode should be made visible then. (I don't say that
 this is the right way to go, though.)
 

It might also be useful to allow the user to change the mode while dmenu
is running.

-- 
Petr 'contyk' Sabata, Red Hat, Brno

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments


pgpZb40CWLack.pgp
Description: PGP signature


Re: [dev] [st] multibyte patch

2010-11-08 Thread Petr Sabata
On Sun, Nov 07, 2010 at 10:09:28PM +0100, Damian Okrasa wrote:
 LC_CTYPE=en_US.UTF-8 should be set for UTF-8, it has some bugs and
 sometimes doesn't recognise good UTF-8 string.
 
 http://img51.imageshack.us/img51/4591/201011072157261024x768s.png

I started with something similar last week.  However, as already mentioned;
wouldn't it be better to go with just char* and Xutf8* functions instead
of wchar_t?

Anyhow, I appreciate this; it's good to have something working; non-utf8 st
is unusable for me.

-- Petr


pgp3M7l7TqX0U.pgp
Description: PGP signature


[dev] [dwm] Fedora package

2010-10-19 Thread Petr Sabata
Hi list,

I'd just like to announce I've packaged dwm for Fedora, releases 12+. It
should arrive in repositories soon.

The default package contains precompiled binary with almost unchanged dwm
default config. There's also a dwm-user subpackage which installs dwm sources
and dwm-start script; this:
 - checks for ~/.dwm/config.h; if it's present, the script builds a custom
   user dwm and installs it into ~/.dwm/dwm 
 - checks for ~/.dwm/dwm and runs it if possible; runs system precompiled dwm
   otherwise

SRPMs and SPEC: http://psabata.fedorapeople.org/packages/dwm/

Best regards,
-- 
Petr 'contyk' Sabata, Red Hat, Brno

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments


pgpSSex5wgHpb.pgp
Description: PGP signature


Re: [dev] [dwm] Fedora package

2010-10-19 Thread Petr Sabata
On Tue, Oct 19, 2010 at 12:23:56PM +, Kurt H Maier wrote:
 I understand that you software packagers are a special breed, and
 having even one binary not subject to the rigors of packaging can
 cause you to lose sleep, but every time you people pull this shit we
 get an influx of idiots in irc, spamming about how they can patch dwm
 to act like fluxbox, patch fluxbox to act like dwm, or convert their
 wm to use some kind of embedded python executable config syntax.
 
 For the love of god, can you at least include a notification in the
 package to the effect that, if someone thinks installing a binary dwm
 package is a good idea, they can fuck right off and never come to
 #suckless for support?
 -- 
 # Kurt H Maier


Would you feel more comfortable with this?

--- dwm-5.8.2/dwm.1 2010-10-15 13:39:41.239409647 +0200
+++ dwm-5.8.2/dwm.1.new 2010-10-15 13:47:01.870203726 +0200
@@ -4,6 +4,17 @@
 .SH SYNOPSIS
 .B dwm
 .RB [ \-v ]
+.SH FEDORA NOTES
+Due to the nature of this software, dwm has to be rebuilt for any configuration
+changes. To achieve this in Fedora, install the
+.BR dwm-user
+package and see
+.BR dwm-start (1) .
+.P
+All hints, questions and bug reports should be addressed to Fedora maintainer.
+File a bug in Red Hat Bugzilla:
+.P
+.BR http://bugzilla.redhat.com/
 .SH DESCRIPTION
 dwm is a dynamic window manager for X. It manages windows in tiled, monocle
 and floating layouts. Either layout can be applied dynamically, optimising the

Regards,

-- 
Petr 'contyk' Sabata, Red Hat, Brno

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments


pgprPtDlaMnUL.pgp
Description: PGP signature


Re: [dev] [dwm] Fedora package

2010-10-19 Thread Petr Sabata
On Tue, Oct 19, 2010 at 01:14:15PM +, Anselm R Garbe wrote:
 On Tue, Oct 19, 2010 at 03:11:05PM +0200, Petr Sabata wrote:
  On Tue, Oct 19, 2010 at 12:23:56PM +, Kurt H Maier wrote:
   I understand that you software packagers are a special breed, and
   having even one binary not subject to the rigors of packaging can
   cause you to lose sleep, but every time you people pull this shit we
   get an influx of idiots in irc, spamming about how they can patch dwm
   to act like fluxbox, patch fluxbox to act like dwm, or convert their
   wm to use some kind of embedded python executable config syntax.
   
   For the love of god, can you at least include a notification in the
   package to the effect that, if someone thinks installing a binary dwm
   package is a good idea, they can fuck right off and never come to
   #suckless for support?
   -- 
   # Kurt H Maier
  
  
  Would you feel more comfortable with this?
 
 If this is part of the fedora package I'd be very happy with this. Certainly I
 don't intend to include distro specific notes into the mainline man page as
 this doesn't sound like the right place.

I know it's not the best place but I think there isn't a better alternative
at the moment. The first paragraph is part of 5.8.2-3; the rest will be
added in 5.8.2-4.

Petr

 
 Cheers,
   Anselm
 

-- 
Petr 'contyk' Sabata, Red Hat, Brno

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments


pgp6xKYhjpmFA.pgp
Description: PGP signature