Re: [dwm] Mouse over tile ...

2007-09-16 Thread Antoni Grzymala
Tako rzecze Anselm R. Garbe (w e-mailu datowanym 2007-09-16, 14:34):

 So there arises a question.  Traditionally in dwm Mod-Button2
 was introduced for zooming clients in tiled mode. But now I more
 and more come to the conclusing, that this should be
 togglefloating() instead. Is there anyone really using
 Mod-Button2 for zoom'ing?

Honestly -- first time I've heard about it. Go ahead.

[a]

-- 
. Antoni Grzymala - antoni (at) chopin.edu.pl ---.
| OpenPGP KeyID EB315583 available now from a keyserver near you |
| Fingerprint A819 6D2E D5EB D9E0 D2D9  7AF6 2FAF 4A11 EB31 5583 |
`'


pgphAONpfRWns.pgp
Description: PGP signature


Re: [dwm] Mouse over tile ...

2007-09-16 Thread Damjan Vrencur
 I think it's really useful. However I also implemented
 Mod-Button2 for toggling such floating clients back to tiled.

Sorry, part of a previous message was nonsense.


-- 
 Damjan Vrenčur ~ http://lmmri.fri.uni-lj.si/damjan/ ~ GPG key: C6A3146F



Re: [dwm] Mouse over tile ...

2007-09-16 Thread Anydot
On (16/09/07 15:13), Damjan Vrencur wrote:
 
 But since Mod-Button1 does the same provided you don't move mouse, isn't it 
 better to use Mod-Button2 for something else?
 
 I checked the latest tip and it seems to work nice except that now I got some 
 unused space between clients. Screenshot: 
 http://lmmri.fri.uni-lj.si/damjan/dwmScreenshot.png
 
 Peace,

change:
#define RESIZEHINTS True
in config.h to:
#define RESIZEHINTS False

-- 
Premysl Anydot Hruby  http://na.srck.net 



Re: [dwm] Mouse over tile ...

2007-09-16 Thread pancake
I have always find the mod-click2 feature quite useful and handy, I have been
using it since the beggining.

Please do not remove it. Mod-Click1 to make windows floating looks cleaner to 
me.

On Sun, 16 Sep 2007 15:13:17 +0200
Damjan Vrencur [EMAIL PROTECTED] wrote:

 On Sunday 16 of September 2007 14:48:22 Antoni Grzymala wrote:
 
  Honestly -- first time I've heard about it.
 
 Me too.
 
 But since Mod-Button1 does the same provided you don't move mouse, isn't it 
 better to use Mod-Button2 for something else?
 
 I checked the latest tip and it seems to work nice except that now I got some 
 unused space between clients. Screenshot: 
 http://lmmri.fri.uni-lj.si/damjan/dwmScreenshot.png
 
 Peace,
 -- 
  Damjan Vrenčur ~ http://lmmri.fri.uni-lj.si/damjan/ ~ GPG key: C6A3146F
 


  --pancake



[dwm] Unused space between clients

2007-09-16 Thread Xavier
On Sun, Sep 16, 2007 at 03:13:17PM +0200, Damjan Vrencur wrote:
 I checked the latest tip and it seems to work nice except that now I got some 
 unused space between clients. Screenshot: 
 http://lmmri.fri.uni-lj.si/damjan/dwmScreenshot.png
 

That space is much smaller here.
And this is actually a big improvment. Previously, I had some weird
corruptions at the place of this unused space.
This only happened with urxvt though, not xterm. Not sure why..
But I'm happier with urxvt anyway.

What I'm wondering is if it wouldn't be possible to only have unused space (when
necessary) at the bottom of the column, instead of between each clients, while
still fixing that same corruption bug of course.



Re: [dwm] Updated bottom stack patch

2007-09-16 Thread James Turner
On Sun, Sep 16, 2007 at 01:18:24PM +0200, Anselm R. Garbe wrote:
 Hi James,
 
 cool, I want to give an example how your patch should be
 reorganized that it works with less of a hassle beginning with dwm-4.5:

[snip]

Thanks for the great example, that will especially make things
easier while the code is still being changed.  I think before 4.4 was
released I probably rewrote my patch at least a dozen times to work with
the changing source tree.  This of course will eliminate that need all
together.

-- 
James Turner
BSD Group Consulting
http://www.bsdgroup.org



Re: [dwm] Proper way of monitoring battery level in DWM

2007-09-16 Thread Albert Cardona



MAX_BATTERY_CAPACITY=84240
while true
do
   echo `date '+%Y%m%d %H:%M'` `uptime | sed 's/.*: 
\(.\...\),.*/\1/'` $(( (`cat /proc/acpi/battery/BAT0/state | grep 
remaining capacity | sed 's/.*: \{5,\}\(.*\) mWh/\1/'` * 100) / 
$MAX_BATTERY_CAPACITY))%

   sleep 20
done | /home/albert/Programming/suckless/bin/dwm



Beware of email's silly line breaks.

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona




[dwm] Fwd: Auto-discard notification

2007-09-16 Thread Anselm R. Garbe
The attached message has been automatically discarded.

arg:
 On Sun, Sep 16, 2007 at 03:51:19PM +0200, pancake wrote:
  I have always find the mod-click2 feature quite useful and handy, I have 
  been
  using it since the beggining.
  
  Please do not remove it. Mod-Click1 to make windows floating looks cleaner 
  to me.
 
 Well there must be a simple way to put a temporarily moved
 _tiled_ window back to tiled state again.
 
 So Mod-Button2 seems natural for this. 

xmonad uses mod-t for re-tiling these guys, but it seems like a nice
idea to use a mouse button.

-- Don



- End forwarded message -

-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] I merged the whole source to one file and wanna let you know the implications

2007-09-16 Thread lobzang
That works, and I agree that's simpler.


On Sun, 2007-09-16 at 13:06 +0200, Anselm R. Garbe wrote:

 I think one can argue a lot about how to organize source code
 the right way. Especially if your codebase is huge.
 
 Anyway, I realized that I reorganized the dwm code base a couple
 of times, and this has been due to one fact: dwm's code base has
 been organized following two different paradigms - separating
 code into logically equal parts on one side (client.c, event.c,
 screen.c, layout.c, tag.c, ..) and functionally equal parts
 (draw.c, main.c, util.c)i on the other side...
 
 Due to this separation often the need arised to enforce
 consistency into the one or the other direction. I believe that
 also other projects who thought carefully about these questions
 noticed the same.
 
 However, I browsed through the old Unix tools several times, and
 they often cosist of only a single source file. That's because
 they want to meet the goal do only ONE thing, and do it well.
 
 So organizing dwm in a single dwm.c (see hg tip) will enforce
 to reach the ideal much more in my conlusion. There are also
 some positive benefits in this decision.
 
 The overhead to differentiate between static and extern
 variables/functions is gone now, you can call all functions and
 use all global variables within dwm.c. config.h can refer to any
 global variable or function now. This includes extending dwm
 with different layouts - you only need to write a .c file now
 (no need to write a .h file), include that .c file in config.h
 right before the Layout-array initialization and it will simply
 work. 
 
 You can declare all functions static in external layout
 implementations, simply because they will be part of dwm.c
 anyways after CPP did its job.
 
 I will do the same with dmenu as well.
 
 Regards,


Lobzang
___
http://lobzang.free.fr




Re: [dwm] Proper way of monitoring battery level in DWM

2007-09-16 Thread Amit
Thank you for all the responses.

Actually right now, I am using apm. I am not sure if acpi is supported
on my notebook. This is an old PowerBook G4 500MHz. I will try
modifying the scripts to use apm instead of acpi.

Amit



Re: [dwm] Proper way of monitoring battery level in DWM

2007-09-16 Thread Riccardo Murri
On 9/16/07, Amit [EMAIL PROTECTED] wrote:
 Actually right now, I am using apm. I am not sure if acpi is supported
 on my notebook. This is an old PowerBook G4 500MHz. I will try
 modifying the scripts to use apm instead of acpi.


If it's a PowerBook G4, then it's using PMU, not ACPI nor APM.

Under GNU/Linux, you can use the command `pbbcmd` to query the battery status::

  $ pbbcmd query powersource
  0   # -- outputs 0 if running on battery, and 1 if running on AC power.
::

  $ pbbcmd query timeremaining
  8760  # -- remaining running time in seconds.

Or you can directly parse the /proc/pmu/battery_0 file::

  $ cat /proc/pmu/battery_0
  flags  : 0011
  charge : 3251
  max_charge : 3251
  current: -1334
  voltage: 12613
  time rem.  : 8773

For instance you could define a `battstat` command::

  #! /bin/sh
  if [ -r /proc/pmu/battery_0 ]; then
sed -e 's/ *: */ /' /proc/pmu/battery_0 | ( \
   while read key value; do
 case $key in
charge) charge=$value;;
max_charge) max_charge=$value;;
current) if [ $value -eq 0 ]; then on_ac_power=yes; fi;;
 esac
  done
  if [ -z $on_ac_power ]; then
echo batt:$(expr $charge \* 100 / $max_charge )%
  else
echo (AC)
  fi
)
  fi

And then invoke dwm like::

  (while sleep 10; do battstat; done) | dwm

 Riccardo



Re: [dwm] Proper way of monitoring battery level in DWM

2007-09-16 Thread James Turner

On Sep 16, 2007, at 4:34 PM, Amit wrote:


Thank you for all the responses.

Actually right now, I am using apm. I am not sure if acpi is supported
on my notebook. This is an old PowerBook G4 500MHz. I will try
modifying the scripts to use apm instead of acpi.

Amit


I just use something like this echo `/usr/sbin/apm -l`%.  If all  
you want is

the remaining percentage it does the trick nicely.

--
James Turner
BSD Group Consulting
http://www.bsdgroup.org




[dwm] [patch] Multihead Layout

2007-09-16 Thread Timothy Elliott
I often connect my laptop to an external monitor and use it to extend my 
desktop. This patch adds a new layout 'multihead' which uses Xrandr to detect 
the configuration of monitors, and adjusts window sizes accordingly.

Here is my X screen layout:
--
| |  |
| |  |
--+  |
  

The left screen is the internal (widescreen) monitor on my laptop with 1280x800 
resolution. The right one is my external monitor with 1280x1024 resolution. The 
standard dwm tile layout has the problem that it uses the dead space underneath 
the left screen, and I am unable to see anything there. This patch detects how 
many monitors I have connected via a call to xrandr, and tiles windows so that 
they fit fullscreen in each window. As soon as you have more windows than 
monitors, one monitor is used for stacking and the others are used for 
fullscreen.

There is a lot of missing functionality:
   * Add the ability to move a window to different screens. Right now you are 
stuck with where this layout places them.
   * Don't re-detect monitor layout each time we tile windows. Instead use the 
Xrandr event mechanisms.
   * Disable this layout automatically when there is only one monitor connected.
   * Decide on the order of monitors based on x/y positions instead of whatever 
order we get them from Xrandr.

The patch is against the latest hg tip (with all sources merged into one file). 
I'm pretty new to this so I welcome even the most basic feedback.

You will need the Xrandr extension and dev headers to compile this patch 
(apt-get install libxrandr-dev in Ubuntu).

Cheers,
Tim

diff -r d036b2f17567 config.h
--- a/config.h  Sun Sep 16 13:42:37 2007 +0200
+++ b/config.h  Sun Sep 16 11:27:16 2007 -0700
@@ -21,9 +21,12 @@ static Rule rules[] = {
{ Acroread,   NULL,   True },
 };
 
+#include multihead.c
+
 /* layout(s) */
 static Layout layouts[] = {
/* symbol   function */
+   { UU=,multihead }, /* first entry is default */
{ []=,tile }, /* first entry is default */
{ ,floating },
 };
diff -r d036b2f17567 config.mk
--- a/config.mk Sun Sep 16 13:42:37 2007 +0200
+++ b/config.mk Sun Sep 16 11:27:16 2007 -0700
@@ -12,7 +12,7 @@ X11LIB = /usr/X11R6/lib
 
 # includes and libs
 INCS = -I. -I/usr/include -I${X11INC}
-LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
+LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXrandr
 
 # flags
 CFLAGS = -Os ${INCS} -DVERSION=\${VERSION}\
diff -r d036b2f17567 multihead.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/multihead.c   Sun Sep 16 11:27:16 2007 -0700
@@ -0,0 +1,41 @@
+/* See LICENSE file for copyright and license details. */
+#include stdio.h
+#include X11/extensions/Xrandr.h
+
+void
+multihead(void) {
+   unsigned int i, n, nw, nh, nx, ny;
+   Client *c;
+   XRRScreenResources  *res;
+   XRRCrtcInfo *crtc_info, *last_crtc_info;
+
+   for(n = 0, c = nexttiled(clients); c; c = nexttiled(c-next))
+   n++;
+
+   res = XRRGetScreenResources(dpy, root);
+   last_crtc_info = XRRGetCrtcInfo(dpy, res, res-crtcs[res-ncrtc-1]);
+
+   for(i = 0, c = nexttiled(clients); c; c = nexttiled(c-next), i++) {
+   c-ismax = False;
+   if(i  res-ncrtc - 1) { /* master */
+   crtc_info = XRRGetCrtcInfo(dpy, res, res-crtcs[i]);
+
+   nx = (wax  crtc_info-x) ? wax : crtc_info-x;
+   nw = (crtc_info-x + crtc_info-width) - nx - 2 * 
c-border;
+   ny = (way  crtc_info-y) ? way : crtc_info-y;
+   nh = (crtc_info-y + crtc_info-height) - ny - 2 * 
c-border;
+   }
+   else {  /* tile window */
+   nx = (wax  last_crtc_info-x) ? wax : 
last_crtc_info-x;
+   nw = (last_crtc_info-x + last_crtc_info-width) - nx - 
2 * c-border;
+   ny = (way  last_crtc_info-y) ? way : 
last_crtc_info-y;
+   nh = (last_crtc_info-y + last_crtc_info-height) - ny 
- 2 * c-border;
+
+   if(n - res-ncrtc != 0) {
+   nh = nh / (n - res-ncrtc + 1);
+   ny += (i - res-ncrtc + 1) * nh;
+   }
+   }
+   resize(c, nx, ny, nw, nh, False);
+   }
+}