[PATCH] add 'autoexec' argument to awful.prompt

2010-10-11 Thread koniu
Hullo,

To celebrate hdd crash and some cleanups, I'd like to push these two
patches that I have lying around.

Basic idea is to have a command execute automatically on completion if
it's the only match. So instead of mod+r firetab enter we can
have mod+r firetab and there's firefox on our screen :)

2nd patch adds support for autoexec in awful.completion by returning
the table of matches from its callback functions. This  could also be
used for displaying a list of available completions (think dmenu).

koniu
From 9e5cad8b3b3a45b4af1d919ef20e166325f0db35 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Mon, 11 Oct 2010 11:33:38 +0100
Subject: [PATCH 1/2] awful.prompt: add 'autoexec' argument

If set the prompt will execute the command upon completion which returns
only one match.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/prompt.lua.in |   24 +---
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in
index 2275e6d..a229660 100644
--- a/lib/awful/prompt.lua.in
+++ b/lib/awful/prompt.lua.in
@@ -143,7 +143,7 @@ local function prompt_text_with_cursor(args)
 end
 
 --- Run a prompt in a box.
--- @param args A table with optional arguments: fg_cursor, bg_cursor, ul_cursor, prompt, text, selectall, font.
+-- @param args A table with optional arguments: fg_cursor, bg_cursor, ul_cursor, prompt, text, selectall, font, autoexec.
 -- @param textbox The textbox to use for the prompt.
 -- @param exe_callback The callback function to call with command as argument when finished.
 -- @param completion_callback The callback function to call to get completion.
@@ -178,6 +178,14 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
 font = font, prompt = prettyprompt }
 
+local exec = function()
+textbox.text = 
+history_add(history_path, command)
+capi.keygrabber.stop()
+exe_callback(command)
+if done_callback then done_callback() end
+end
+
 capi.keygrabber.run(
 function (modifiers, key, event)
 if event ~= press then return true end
@@ -193,11 +201,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 elseif (mod.Control and (key == j or key == m))
 or (not mod.Control and key == Return)
 or (not mod.Control and key == KP_Enter) then
-textbox.text = 
-history_add(history_path, command)
-capi.keygrabber.stop()
-exe_callback(command)
-if done_callback then done_callback() end
+exec()
 -- We already unregistered ourselves so we don't want to return
 -- true, otherwise we may unregister someone else.
 return true
@@ -269,9 +273,15 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 command_before_comp = command
 cur_pos_before_comp = cur_pos
 end
-command, cur_pos = completion_callback(command_before_comp, cur_pos_before_comp, ncomp)
+local matches
+command, cur_pos, matches = completion_callback(command_before_comp, cur_pos_before_comp, ncomp)
 ncomp = ncomp + 1
 key = 
+-- execute if only one match found and autoexec flag set
+if matches and #matches == 1 and args.autoexec then
+exec()
+return true
+end
 else
 ncomp = 1
 end
-- 
1.7.1

From 32bc9356126a334ee7eff3d8a2a5774e8a366956 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Mon, 11 Oct 2010 11:34:58 +0100
Subject: [PATCH 2/2] awful.completion: callback functions return table of matches

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/completion.lua.in |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/awful/completion.lua.in b/lib/awful/completion.lua.in
index db0391d..e964b53 100644
--- a/lib/awful/completion.lua.in
+++ b/lib/awful/completion.lua.in
@@ -56,7 +56,7 @@ end
 -- @param cur_pos The cursor position.
 -- @param ncomp The element number to complete.
 -- @param shell The shell to use for completion (bash (default) or zsh).
--- @return The new command and the new cursor position.
+-- @return The new command, the new cursor position, the table of all matches.
 function shell(command, cur_pos, ncomp, shell)
 local wstart = 1
 local wend = 1
@@ -146,7 +146,7 @@ function shell(command, cur_pos, ncomp, shell)
 local str = command:sub(1, cword_start - 1) .. output[ncomp] .. command:sub(cword_end)
 cur_pos = cword_end + #output[ncomp] + 1
 
-return str, cur_pos
+return str, cur_pos

Re: #664 status [PATCH]

2010-01-08 Thread koniu
 What about replacing the withcurrent() call with a:
 capi.client.add_signal(manage, withcurrent)

These any better?

k
From afb6d08775c74f5393a73414b41ca58c657e2bc5 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Fri, 8 Jan 2010 15:16:37 +
Subject: [PATCH 1/2] awful.tag: register 'withcurrent' explicitly

This explicitly registers withcurrent(c) as a manage signal handler so
that it can be removed if necessary.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/tag.lua.in |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index 949a83d..a984ed5 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -374,10 +374,11 @@ capi.client.add_signal(manage, function(c, startup)
 c.screen = capi.mouse.screen
 end
 end
-withcurrent(c, startup)
 c:add_signal(property::screen, withcurrent)
 end)
 
+capi.client.add_signal(manage, withcurrent)
+
 for s = 1, capi.screen.count() do
 capi.screen[s]:add_signal(tag::history::update, history.update)
 end
-- 
1.6.6

From f8cf40eca613a73b6efa084cf800a63c2a0ff336 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Fri, 8 Jan 2010 15:26:21 +
Subject: [PATCH 2/2] awful.rules: tag clients without flicker (FS#664)

We unregister the default awful.tag.withcurrent 'manage' signal handler
and have awful.rules.apply handle initial client tagging.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/rules.lua.in |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/awful/rules.lua.in b/lib/awful/rules.lua.in
index 5ca3c73..420ec44 100644
--- a/lib/awful/rules.lua.in
+++ b/lib/awful/rules.lua.in
@@ -112,7 +112,7 @@ function apply(c)
 if property == floating then
 aclient.floating.set(c, value)
 elseif property == tag then
-aclient.movetotag(value, c)
+c:tags({ value })
 elseif property == switchtotag and value and props.tag then
 atag.viewonly(props.tag)
 elseif property == height or property == width or
@@ -127,6 +127,11 @@ function apply(c)
 end
 end
 
+-- If untagged, stick the client on the current one.
+if #c:tags() == 0 then
+atag.withcurrent(c, startup)
+end
+
 -- Apply all callbacks from matched rules.
 for i, callback in pairs(callbacks) do
 callback(c)
@@ -140,5 +145,6 @@ function apply(c)
 end
 
 client.add_signal(manage, apply)
+client.remove_signal(manage, atag.withcurrent)
 
 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
-- 
1.6.6



Re: #664 status [PATCH]

2009-12-22 Thread koniu
 The patch fixing that problem should not touch the call to
 with_current(), or make awful requires definitively awful.rules. But I
 guess that if you do that, people using other rules system such as
 shifty will start crying, because last time I heard about it, shifty was
 explicitely unregistering withcurrent().

zomg, i've been experiencing flickering in my (shifty based) config
for ages now and couldnt be bothered to check.
shifty unregisters withcurrent in manage signal which doesnt do
anything since the function that's registered is an unnamed, inline
function that calls withcurrrent.

- i've hacked awful.tag with the attached patch (sorry I couldnt think
of a better name for that function)
- unregistered the function in shifty: client.remove_signal(manage,
awful.tag.scrtag_client)
- and no more flicker \o/

however a patch for awful.rules would have to also deal with screen setting.

alternatively awful.tag patch could split the screen-setting function
out into something public, remove withcurrent call from it and
register withcurrent and the screensetting functions separately with
manage signal (not sure if that's cool in terms of concurrency).

k
From 0547db73f978432d4d31b4fa2f263008a492bc6a Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Tue, 22 Dec 2009 13:02:29 +
Subject: [PATCH] awful.tag: allow unregistering of withcurrent

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/tag.lua.in |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index 949a83d..cd368a1 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -356,8 +356,8 @@ function attached_add_signal(screen, ...)
 end
 end
 
--- Register standards signals
-capi.client.add_signal(manage, function(c, startup)
+--- Sets correct screen and tags a client.
+function scrtag_client(c, startup)
 -- If we are not managing this application at startup,
 -- move it to the screen where the mouse is.
 -- We only do it for normal windows (i.e. no dock, etc).
@@ -376,7 +376,10 @@ capi.client.add_signal(manage, function(c, startup)
 end
 withcurrent(c, startup)
 c:add_signal(property::screen, withcurrent)
-end)
+end
+
+-- Register standards signals
+capi.client.add_signal(manage, scrtag_client)
 
 for s = 1, capi.screen.count() do
 capi.screen[s]:add_signal(tag::history::update, history.update)
-- 
1.6.5.7



Re: shifty and 3.4rc

2009-09-27 Thread koniu
On Sat, Sep 26, 2009 at 19:18, Andreas Klöckner li...@informa.tiker.net wrote:
 shifty doesn't appear to work with 3.4rc1, i.e. I get an unresponsive screen
 that says AWESOME in the middle. The .xsession-errors file has some warnings
 about function deprecations, but nothing immediately incriminating. Is this
 supposed to work? Any clues why that may be?

 I used the shifty for git master link at
 http://awesome.naquadah.org/wiki/Shifty

try this, works with a master from a week ago:
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/shifty-masterhack

i need to clean it up some day but now i've got a bunch of other stuff to do.

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] 0001-awful.tag-fix-typo-in-viewmore.patch

2009-09-27 Thread koniu
a trivial fix for viewmore()
From ee779ae5f3648474e1ccddb511cf3cba10005e9d Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Mon, 28 Sep 2009 03:18:57 +0100
Subject: [PATCH] awful.tag: fix typo in viewmore

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/tag.lua.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index 308afbf..aecd586 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -265,7 +265,7 @@ end
 function viewmore(tags, screen)
 local screen_tags = capi.screen[screen or capi.mouse.screen]:tags()
 for _, tag in pairs(screen_tags) do
-tag.selected = (table.hasitem(tags, tag) ~= nil)
+tag.selected = (util.table.hasitem(tags, tag) ~= nil)
 end
 capi.screen[screen]:emit_signal(tag::history::update)
 end
-- 
1.6.4.3



Re: Multiple wibox on same 'position'

2009-09-16 Thread koniu
On Wed, Sep 16, 2009 at 10:34, Julien Danjou jul...@danjou.info wrote:
 Usefulness is questionnable since you can do the same kind of stuff with
 widget layout.

I have some arguments for usefulness - here's one as discussed with farhaven:

15:44  koniu why don't u fix stacking wiboxes at the same position
while ur at it
15:44  farhaven because that's what we have widget layouts for :P
15:45  koniu and there can be only one way of doing things and it's
farhaven's way =]
15:45  koniu (aka widget layouts)
15:46  koniu btw i've seen a shot of your on-screen kbd, nice one
15:46  farhaven thx
15:46  farhaven needs a lot of work to be usable though
15:46  koniu now say someone had a wibox on the bottom
15:47  koniu and then they wanted to toggle the on-screen kbd at bottom too
15:47  koniu they'd have to go thru meddling with changing widget
table of the wibox, its height etc
15:47  koniu where they could only be hiding/showing the extra wibox
15:50  farhaven koniu: damn, you are right
15:50  farhaven though wait
15:50  farhaven nope :D
15:50  farhaven the onscreen keyboard would still be visible
15:50  farhaven people could just offset it after creating it
15:50  farhaven but that's kludgy...
15:50  farhaven ah what the heck, i'll try fixing that too :P
15:52  koniu it's just an example but the bottom line is that
there's a number of ways of achieving something, and we should provide
as many options as we can. it shouldnt be too difficult to check the
current struts while creating a new docked wibox

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [PATCH] awful: add tooltip

2009-09-08 Thread koniu
Yey, this was on my unofficial todo list but pretty low since I found
that naughty is good enough to display the few tooltips I use - very
glad someone got it together and implemented it :)

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] luadoc client.lua fix

2009-09-02 Thread koniu
%s/@name client./@name /
From a0405723c131273ff77a39afcca5f70a95d5a00f Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Wed, 2 Sep 2009 09:46:57 +0100
Subject: [PATCH] luadoc: remove module name from functions in client.lua

Signed-off-by: koniu gkusni...@gmail.com
---
 luadoc/client.lua |   32 
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/luadoc/client.lua b/luadoc/client.lua
index 92cd94f..6cabe24 100644
--- a/luadoc/client.lua
+++ b/luadoc/client.lua
@@ -47,89 +47,89 @@ module(client)
 --- Get all clients into a table.
 -- @param screen An optional screen number.
 -- @return A table with all clients.
--- @name client.get
+-- @name get
 -- @class function
 
 --- Check if a client is visible on its screen.
 -- @param -
 -- @return A boolean value, true if the client is visible, false otherwise.
--- @name client.isvisible
+-- @name isvisible
 -- @class function
 
 --- Return client geometry.
 -- @param arg1 A table with new coordinates, or none.
 -- @return A table with client coordinates.
--- @name client.geometry
+-- @name geometry
 -- @class function
 
 --- Return client struts (reserved space at the edge of the screen).
 -- @param struts A table with new strut values, or none.
 -- @return A table with strut values.
--- @name client.struts
+-- @name struts
 -- @class function
 
 --- Get or set mouse buttons bindings for a client.
 -- @param buttons_table An array of mouse button bindings objects, or nothing.
 -- @return A table with all buttons.
--- @name client.buttons
+-- @name buttons
 -- @class function
 
 --- Get or set keys bindings for a client.
 -- @param keys_table An array of key bindings objects, or nothing.
 -- @return A table with all keys.
--- @name client.keys
+-- @name keys
 -- @class function
 
 --- Access or set the client tags.
 -- @param tags_table A table with tags to set, or none to get the current tags table.
 -- @return A table with all tags.
--- @name client.tags
+-- @name tags
 -- @class function
 
 --- Kill a client.
 -- @param -
--- @name client.kill
+-- @name kill
 -- @class function
 
 --- Swap a client with another one in global client list.
 -- @param c A client to swap with.
--- @name client.swap
+-- @name swap
 -- @class function
 
 --- Raise a client on top of others which are on the same layer.
 -- @param -
--- @name client.raise
+-- @name raise
 -- @class function
 
 --- Lower a client on bottom of others which are on the same layer.
 -- @param -
--- @name client.lower
+-- @name lower
 -- @class function
 
 --- Redraw a client by unmapping and mapping it quickly.
 -- @param -
--- @name client.redraw
+-- @name redraw
 -- @class function
 
 --- Stop managing a client.
 -- @param -
--- @name client.unmanage
+-- @name unmanage
 -- @class function
 
 --- Add a signal.
 -- @param name A signal name.
 -- @param func A function to call when the signal is emitted.
--- @name client.add_signal
+-- @name add_signal
 -- @class function
 
 --- Remove a signal.
 -- @param name A signal name.
 -- @param func A function to remove.
--- @name client.remove_signal
+-- @name remove_signal
 -- @class function
 
 --- Emit a signal.
 -- @param name A signal name.
 -- @param ... Various arguments, optional.
--- @name client.emit_signal
+-- @name emit_signal
 -- @class function
-- 
1.6.3.3



Re: [PATCH + RFC] awful.doc reactivation

2009-09-02 Thread koniu
Another little update on a previously discussed matter:

16:37  koniu lol i tried retrieving keybinding descriptions for the
cheat-sheet from descriptions of functions they're bound to and it's
unimpressive :) http://omploader.org/vMjlwNg
16:40  koniu too many inline functions in the default rc
16:42  koniu i think i'm gonna stick with documenting everything as
it is, at least it gives pretty verbose explanation to anyone who's
looking at the default config

Having said that, I will keep the attempt to retrieve descriptions
from functions in awful.key but these will be overridden by any
definitions made in awful.key.new(). At least people who haven't
migrated their configs to include descriptions will have _something_
there.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [PATCH + RFC] awful.doc reactivation

2009-09-02 Thread koniu
On Wed, Sep 2, 2009 at 16:39, Julien Danjoujul...@danjou.info wrote:
 At 1251904856 time_t, koniu wrote:
 There's incremental commits that will eventually be squashed.
 Please do so if you think it reduce the review size. ;)

I'll keep the increments for now, since it's easier for me to track
progress and squash them when we'll be getting closer to finalizing
the review.

  - just implement a callback system where you give a function to
   awful.doc that will be called with text to be printed as argument.

 That's what I was thinking. Question is, where ought the default
 callback function(s) be defined.

Actually, looking at the extent of naughty dependency (and therefore a
necessity to do a lot of different callbacks) I'm leaning towards your
first suggestion which is splitting it out of awful and calling it
'handy' instead (unless someone has a better name - ideas welcome).


 Another small issue - awful.help.get(widget) doesn't get descriptions
 for 'buttons' and 'extents': http://omploader.org/vMjlvYg.

 We should probably export object methods to their module also:
 mywidget:buttons() and mywidget.buttons(mywidget) already
 That's something I can add as soon as I've time, if no one goes into it
 before me.

That would be great. I'll leave this to you (or whomever wants to
boost their commit rank, hint hint psychon :p).

kk

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] prompt fixes/improvements

2009-09-01 Thread koniu
As suggested, splitting unrelated patches from awful-doc branch -
here's couple of patches to awful.prompt:

0001: is useful eg. if you have a textbox with custom font and then
try to run prompt in it and don't want the font to change to default.
0002: fixes resetting of selectall argument, i wonder if anybody apart
from me uses it.
0003: makes ^w a bit more useful

koniu
From 2ebc0564e78aba163d696da84ba7214892d4b7a9 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Mon, 31 Aug 2009 20:34:46 +0100
Subject: [PATCH 1/3] awful.prompt: add 'font' to run() args

Also changes prompt_text_with_cursor() to take a table instead of
list of arguments allowing to incorporate font setting and
'prettyprompt' settings into the function.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/prompt.lua.in |   59 +++---
 1 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in
index 9fdac86..1d20f10 100644
--- a/lib/awful/prompt.lua.in
+++ b/lib/awful/prompt.lua.in
@@ -104,35 +104,45 @@ end
 
 
 -- Draw the prompt text with a cursor.
+-- @param args The table of arguments.
 -- @param text The text.
+-- @param font The font.
+-- @param prompt The text prefix.
 -- @param text_color The text color.
 -- @param cursor_color The cursor color.
 -- @param cursor_pos The cursor position.
--- @param cursor_pos The cursor underline style.
+-- @param cursor_ul The cursor underline style.
 -- @param selectall If true cursor is rendered on the entire text.
-local function prompt_text_with_cursor(text, text_color, cursor_color, cursor_pos, cursor_ul, selectall)
-local char, spacer, text_start, text_end
-if not text then text =  end
-if #text  cursor_pos then
+local function prompt_text_with_cursor(args)
+local char, spacer, text_start, text_end, ret
+local text = args.text or 
+local prompt = args.prompt or 
+local underline = args.cursor_ul or none
+
+if args.selectall then
+if #text == 0 then char =   else char = util.escape(text) end
+spacer =  
+text_start = 
+text_end = 
+elseif #text  args.cursor_pos then
 char =  
 spacer = 
+text_start = util.escape(text)
+text_end = 
 else
-char = util.escape(text:sub(cursor_pos, cursor_pos))
+char = util.escape(text:sub(args.cursor_pos, args.cursor_pos))
 spacer =  
+text_start = util.escape(text:sub(1, args.cursor_pos - 1))
+text_end = util.escape(text:sub(args.cursor_pos + 1))
 end
-text_start = util.escape(text:sub(1, cursor_pos - 1))
-text_end = util.escape(text:sub(cursor_pos + 1))
-if selectall then
-char = text_start .. char .. text_end
-text_start = 
-text_end = 
-end
-local underline = cursor_ul or none
-return text_start .. span background=\ .. util.color_strip_alpha(cursor_color) .. \ foreground=\ .. util.color_strip_alpha(text_color) .. \ underline=\ .. underline .. \ .. char .. /span .. text_end .. spacer
+
+ret = prompt .. text_start .. span background=\ .. util.color_strip_alpha(args.cursor_color) .. \ foreground=\ .. util.color_strip_alpha(args.text_color) .. \ underline=\ .. underline .. \ .. char .. /span .. text_end .. spacer
+if args.font then ret = span font_desc=' .. args.font .. ' .. ret .. /span end
+return ret
 end
 
 --- Run a prompt in a box.
--- @param args A table with optional arguments: fg_cursor, bg_cursor, ul_cursor, prompt, text, selectall .
+-- @param args A table with optional arguments: fg_cursor, bg_cursor, ul_cursor, prompt, text, selectall, font.
 -- @param textbox The textbox to use for the prompt.
 -- @param exe_callback The callback function to call with command as argument when finished.
 -- @param completion_callback The callback function to call to get completion.
@@ -150,6 +160,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 local cur_col = args.bg_cursor or theme.bg_focus or white
 local cur_ul = args.ul_cursor
 local text = args.text or 
+local font = args.font or theme.font
 
 history_check_load(history_path, history_max)
 local history_index = history_items(history_path) + 1
@@ -160,7 +171,11 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 if not textbox or not exe_callback then
 return
 end
-textbox.text = prettyprompt .. prompt_text_with_cursor(text, inv_col, cur_col, cur_pos, cur_ul, args.selectall)
+textbox.text = prompt_text_with_cursor{
+text = text, text_color = inv_col, cursor_color = cur_col,
+cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = args.selectall,
+font = font, prompt = prettyprompt }
+
 capi.keygrabber.run(
 function (modifiers, key, event)
 if event ~= press then return true end
@@ -240,7 +255,10 @@ function run(args, textbox, exe_callback

Re: [PATCH + RFC] awful.doc reactivation

2009-09-01 Thread koniu
On Tue, Sep 1, 2009 at 13:05, Julien Danjoujul...@danjou.info wrote:
 I've a couple of things to add:
 - awful.{button,key}: you set description only on ret[1], which seems
  not right, all returned objects should have a description set.

Ha, yes, I don't like this either - it's a hack.

It allows avoiding duplicates in the keybinding cheat-sheet. The
function retrieves root.keys() and client.focus.keys() and displays
those. There we don't care about Caps + Mod4 + x being lua prompt
along Mod4 + x.

Alternative solution is to catch these duplicates in
awful.help.format.kb_list(), perhaps under condition that the
modifiers might be different but keysym is the same + the
doc.description is the same. This would add yet another loop to
format.kb_list() which is already pretty loaded, which is why I chose
this shortcut. I could try hack up duplicate detection tho.

 - awful.help require naughty. That's not a bad thing IMHO, but that
  raises again the awful-naughty dependency. We should discuss that.

My initial plan was to clearly split help generation into frontend
and backend where everything is returned in some standard manner and
then you can display it in naughty or just get a string or whatever.
Eventually my awful.help functions ended up in having a load of pango
markup so I just left naughty as a dependency. Having used it for more
than 3 months now I have to say that I've experienced no ill-effects
to that.

What's your view?

 - I did not tried you branch (I can't right now), but I'm not sure if
  you amended correctly my patch generating documentation. The C API
  documentation is no more auto-generated. Be careful.

As mentioned on irc, I'm working on that atm.

 thought of would be automagic description retrieval for
 buttons/keybindings based on the functions that they execute. So
 instead of having to do

 I'm not sure (i.e. I can't recall) but I wonder if there's not 2 part in
 a function documentation in luadoc (a summary and a complete
 description). I unfortunately cannot check right now, but you can take a
 look by hacking lua-doc-generate.lua to see what type of documentation
 is available from luadoc data structure.

This is something I'm gonna be looking into. Also luadoc is pretty
flexible and you can have any fields you want so perhaps we could look
into closer integration.

 Btw, you should send me (patch or pull request) the patch totally unrelated
 to awful.doc, I'll review and merge. That should split the workload of
 rebasing/reviewing. :)

Done and merged - thanks.

cheers,
k

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH + RFC] awful.doc reactivation

2009-08-31 Thread koniu
Heyup. I finally got around to clean up my awful-doc branch a bit.

Starting a new thread not to cause too much confusion. Original one is here:
http://www.mail-archive.com/awesome-devel@naquadah.org/msg02191.html

Current version of the branch is available here:
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/awful-doc

There's a couple of patches for awful.prompt but only the 'font' one
is related. Other ones are general improvments/fixes.

There's not much news in terms of functionality (it's been fairly
complete for months now) and now after a bunch of rebases with plenty
of edits and squashes the branch and code proposed should be cleanish,
maybe lacking a bit of comments which I will be happy to provide in
the near future.

I'm most interested in feedback regarding adding actual descriptions
to the default rc.lua and awful submodules, and their content. As you
can see I've added a bunch of descriptions inside awful.widget.* and
I'm wondering if taglist/tasklist should be handled the same way or
whether it should be as it is now - inside rc.lua.

Perhaps this could be a post-merge target, but one nice thing I
thought of would be automagic description retrieval for
buttons/keybindings based on the functions that they execute. So
instead of having to do

   awful.button({ }, 4, awful.tag.viewnext, nil, Switch to next tag)

to set the description in rc.lua, the function trying to display docs
for that button would check description for awful.tag.viewnext. That
would make transition from non-described rc.lua to having a keybinding
cheatsheet much easier. There are a few problems with it however:

- descriptions taken from luadoc are a bit dirty (eg
awful.tag.viewnext it's View next tag. This is the same as
tag.viewidx(1) which obviously is a bit too long for a summary of
bindings. so luadoc for everything would need to be cleaned up a bit
which seems like a big task.
- grouping of bindings (try mod+f1 and k to see what i mean) is done
in rc.lua by setting a default group before each section of binding
definitions, eg:
awful.doc.set_default({ group = Navigation }),
awful.key({ modkey,   }, Left,   awful.tag.viewprev
 , nil, View previous tag),
awful.key({ modkey,   }, Right,  awful.tag.viewnext
 , nil, View next tag),
...
so if we do that keybinding grouping would have be done in a slightly
different way, not sure how.
- there's a bunch of inline functions in rc.lua already so inline
descriptions for those are unavoidable.


Phew.

lets get it going.
k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [PATCH] awful.tag: fix tag history

2009-08-30 Thread koniu
On Fri, Aug 28, 2009 at 09:57, Julien Danjoujul...@danjou.info wrote:

 +        if not data.history[screen] then
 +          data.history[screen] = {}
 Bad indent.

Fixed.

 +        -- limit history
 +        elseif #data.history[screen] == history.limit then
 +            table.remove(data.history[screen])
 Be careful that the limit might have been reduced to let's say 20 to 10.
 So you won't hit it with a ==, you should do a while  history, remove
 lines I guess.

That's probably not gonna be a very common case but better be safe
than sorry - fixed.

 +        data.history.current[screen] = selectedlist(screen)
 Hum if you want to store tags object I'm ok with that but you should
 probably use a weak-value table in that case. And be careful if tags are
 removed from the screen and/or collected by the GC, since your array
 will be (partially) empty.

That's what I was thinking especially being a shifty-man where tags
come and go. Should be fixed now.

 +function history.restore(screen, idx)
 I think that should be split in 2 functions. Add another function like
 goback that goes back N elements in history for example, but leave
 restore as it is, e.g. only switch between 2 elements.

I'll allow myself to disagree, splitting it would result in pointless
code duplication whereas this approach makes certain things easier
(eg. falling back onto further history entries when restoring to
'previous') etc. 'previous' is, for me, a just a special case of this
function so making it 2 separate functions seems like an overkill.

Can you give some solid arguments for splitting it?

 Otherwise, the code actually works. :)

And even better now, see attached patches. And yeah - sorry for the
delay - turned out to be a busy weekend ;].

koniu
From 0052beccbb7e6c3f95cec5ff40c5c07ddffa5652 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 27 Aug 2009 15:03:45 +0100
Subject: [PATCH 1/3] awful.tag: fix and improve tag history

This fixes a long standing tag history breakage. To store history
of tag switching we rely on a special signal tag::history::update
which needs to be emitted by any function which deals with tag
selection.

History is multi-level with a configurable limit:
awful.tag.history.limit = 20 (by default).

awful.tag.history.restore function gets a new argument 'idx' which can
be either 'previous' (default) which will revert to the previously
selected set of tags, or a numerical index in the tag history table.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/tag.lua.in |   87 --
 1 files changed, 49 insertions(+), 38 deletions(-)

diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index c54066d..1fe1706 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -24,37 +24,11 @@ module(awful.tag)
 -- Private data
 local data = {}
 data.history = {}
-data.history.past = {}
-data.history.current = {}
 data.tags = setmetatable({}, { __mode = 'k' })
 
 -- History functions
 history = {}
-
--- Compare 2 tables of tags.
--- @param a The first table.
--- @param b The second table of tags.
--- @return True if the tables are identical, false otherwise.
-local function compare_select(a, b)
-if not a or not b then
-return false
-end
--- Quick size comparison
-if #a ~= #b then
-return false
-end
-for ka, va in pairs(a) do
-if b[ka] ~= va.selected then
-return false
-end
-end
-for kb, vb in pairs(b) do
-if a[kb].selected ~= vb then
-return false
-end
-end
-return true
-end
+history.limit = 20
 
 --- Create a set of tags and attach it to a screen.
 -- @param names The tag name, in a table
@@ -77,26 +51,56 @@ function new(names, screen, layout)
 end
 
 --- Update the tag history.
--- @param screen The screen number.
-function history.update(screen)
-local curtags = capi.screen[screen]:tags()
-if not compare_select(curtags, data.history.current[screen]) then
-data.history.past[screen] = data.history.current[screen]
-data.history.current[screen] = {}
-for k, v in ipairs(curtags) do
-data.history.current[screen][k] = v.selected
+-- @param obj Screen object.
+function history.update(obj)
+local s = obj.index
+local curtags = capi.screen[s]:tags()
+-- create history table
+if not data.history[s] then
+data.history[s] = {}
+-- limit history
+elseif #data.history[s] = history.limit then
+for i = history.limit, #data.history[s] do
+data.history[s][i] = nil
 end
 end
+-- store previously selected tags in the history table
+table.insert(data.history[s], 1, data.history[s].current)
+data.history[s].previous = data.history[s][1]
+-- store currently selected tags
+data.history[s].current = setmetatable(selectedlist(s), { __mode = 'v' })
 end
 
 --- Revert tag history.
 -- @param screen The screen number.
-function

Re: [PATCH] awful.tag: fix tag history

2009-08-27 Thread koniu
 W: awesome: luaA_dofunction:113: error while running function
 stack traceback:
        /usr/local/share/awesome/lib/awful/tag.lua:107: in function 'press'
        /usr/local/share/awesome/lib/awful/key.lua:36: in function 
 /usr/local/share/awesome/lib/awful/key.lua:36
 error: /usr/local/share/awesome/lib/awful/tag.lua:107: table index is nil

 Sometimes meaning right after reload or after repeated restore until
 you run out of history entries? Indeed, I didnt add handling of
 restore when there's nothing recorded.

Actually this is different issue, L107:s/screen/s/ ? Try the amended
patch as attached.
From 067a6ea8ddfe4b5a302a29fe479018f79dc833fd Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 27 Aug 2009 15:03:45 +0100
Subject: [PATCH 1/3] awful.tag: fix tag history

This fixes a long standing tag history breakage. To store history
of tag switching we rely on a special signal tag::history::update
which needs to be emitted by any function which deals with tag
selection.

History is now also multi-level with a 20 step limit.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/tag.lua.in |   36 ++--
 1 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index 8ec1bbd..980e008 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -24,7 +24,6 @@ module(awful.tag)
 -- Private data
 local data = {}
 data.history = {}
-data.history.past = {}
 data.history.current = {}
 data.tags = setmetatable({}, { __mode = 'k' })
 
@@ -77,15 +76,22 @@ function new(names, screen, layout)
 end
 
 --- Update the tag history.
--- @param screen The screen number.
-function history.update(screen)
+-- @param obj Screen object.
+function history.update(obj)
+local screen = obj.index
 local curtags = capi.screen[screen]:tags()
-if not compare_select(curtags, data.history.current[screen]) then
-data.history.past[screen] = data.history.current[screen]
-data.history.current[screen] = {}
-for k, v in ipairs(curtags) do
-data.history.current[screen][k] = v.selected
+if not compare_select(curtags, data.history.current[screen]) and #selectedlist(screen)  0 then
+-- create history table
+if not data.history[screen] then
+  data.history[screen] = {} 
+-- limit history to 20 steps
+elseif #data.history[screen] == 20 then
+table.remove(data.history[screen])
 end
+-- store previously selected tags in the history table
+table.insert(data.history[screen], 1, data.history.current[screen])
+-- store currently selected tags
+data.history.current[screen] = selectedlist(screen)
 end
 end
 
@@ -94,9 +100,12 @@ end
 function history.restore(screen)
 local s = screen or capi.mouse.screen
 local tags = capi.screen[s]:tags()
-for k, t in pairs(tags) do
-t.selected = data.history.past[s][k]
+viewnone(s)
+for _, t in ipairs(data.history[s][1]) do
+t.selected = true
 end
+data.history.current[s] = data.history[s][1]
+table.remove(data.history[s], 1)
 end
 
 --- Return a table with all visible tags
@@ -231,6 +240,7 @@ function viewidx(i, screen)
 showntags[util.cycle(#showntags, k + i)].selected = true
 end
 end
+capi.screen[screen]:emit_signal(tag::history::update)
 end
 
 --- View next tag. This is the same as tag.viewidx(1).
@@ -250,6 +260,7 @@ end
 function viewonly(t)
 viewnone(t.screen)
 t.selected = true
+capi.screen[t.screen]:emit_signal(tag::history::update)
 end
 
 --- View only a set of tags.
@@ -260,6 +271,7 @@ function viewmore(tags, screen)
 for i, t in pairs(tags) do
 t.selected = true
 end
+capi.screen[screen]:emit_signal(tag::history::update)
 end
 
 --- Get tag data table.
@@ -339,6 +351,10 @@ capi.client.add_signal(manage, function(c)
 c:add_signal(property::screen, withcurrent)
 end)
 
+for s = 1, capi.screen.count() do
+capi.screen[s]:add_signal(tag::history::update, history.update)
+end
+
 setmetatable(_M, { __call = function (_, ...) return new(...) end })
 
 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
-- 
1.6.3.3



Re: [PATCH] awful.tag: fix tag history

2009-08-27 Thread koniu
A little amendment to the 1st patch - typo in a comment + dirty whitespace.

k
From 275eeb31ab4e2e9badc63cbcf637efff3b0c8a8b Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 27 Aug 2009 15:03:45 +0100
Subject: [PATCH 1/4] awful.tag: fix and improve tag history

This fixes a long standing tag history breakage. To store history
of tag switching we rely on a special signal tag::history::update
which needs to be emitted by any function which deals with tag
selection.

History is multi-level with a configurable limit:
awful.tag.history.limit = 20 (by default).

awful.tag.history.restore function gets a new argument 'idx' which can
be either 'previous' (default) which will revert to the previously
selected set of tags, or a numerical index in the tag history table.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/tag.lua.in |   53 +++--
 1 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index 8ec1bbd..be316c4 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -24,12 +24,12 @@ module(awful.tag)
 -- Private data
 local data = {}
 data.history = {}
-data.history.past = {}
 data.history.current = {}
 data.tags = setmetatable({}, { __mode = 'k' })
 
 -- History functions
 history = {}
+history.limit = 20
 
 -- Compare 2 tables of tags.
 -- @param a The first table.
@@ -77,26 +77,50 @@ function new(names, screen, layout)
 end
 
 --- Update the tag history.
--- @param screen The screen number.
-function history.update(screen)
+-- @param obj Screen object.
+function history.update(obj)
+local screen = obj.index
 local curtags = capi.screen[screen]:tags()
-if not compare_select(curtags, data.history.current[screen]) then
-data.history.past[screen] = data.history.current[screen]
-data.history.current[screen] = {}
-for k, v in ipairs(curtags) do
-data.history.current[screen][k] = v.selected
+if not compare_select(curtags, data.history.current[screen]) and #selectedlist(screen)  0 then
+-- create history table
+if not data.history[screen] then
+  data.history[screen] = {}
+-- limit history
+elseif #data.history[screen] == history.limit then
+table.remove(data.history[screen])
 end
+-- store previously selected tags in the history table
+table.insert(data.history[screen], 1, data.history.current[screen])
+data.history[screen].previous = data.history[screen][1]
+-- store currently selected tags
+data.history.current[screen] = selectedlist(screen)
 end
 end
 
 --- Revert tag history.
 -- @param screen The screen number.
-function history.restore(screen)
+-- @param idx Index in history. Defaults to previous which is a special index
+-- toggling between last two selected sets of tags. Number (eg 1) will go back
+-- to the given index in history.
+function history.restore(screen, idx)
 local s = screen or capi.mouse.screen
 local tags = capi.screen[s]:tags()
-for k, t in pairs(tags) do
-t.selected = data.history.past[s][k]
+local i = idx or previous
+local previous = selectedlist(s)
+-- do nothing if history empty
+if not data.history[s] or not data.history[s][i] then return end
+-- deselect all tags
+viewnone(s)
+-- select tags from the history entry
+for _, t in ipairs(data.history[s][i]) do
+t.selected = true
 end
+-- update currently selected tags table
+data.history.current[s] = data.history[s][i]
+-- store previously selected tags
+data.history[s][previous] = previous
+-- remove the reverted history entry
+if i ~= previous then table.remove(data.history[s], i) end
 end
 
 --- Return a table with all visible tags
@@ -231,6 +255,7 @@ function viewidx(i, screen)
 showntags[util.cycle(#showntags, k + i)].selected = true
 end
 end
+capi.screen[screen]:emit_signal(tag::history::update)
 end
 
 --- View next tag. This is the same as tag.viewidx(1).
@@ -250,6 +275,7 @@ end
 function viewonly(t)
 viewnone(t.screen)
 t.selected = true
+capi.screen[t.screen]:emit_signal(tag::history::update)
 end
 
 --- View only a set of tags.
@@ -260,6 +286,7 @@ function viewmore(tags, screen)
 for i, t in pairs(tags) do
 t.selected = true
 end
+capi.screen[screen]:emit_signal(tag::history::update)
 end
 
 --- Get tag data table.
@@ -339,6 +366,10 @@ capi.client.add_signal(manage, function(c)
 c:add_signal(property::screen, withcurrent)
 end)
 
+for s = 1, capi.screen.count() do
+capi.screen[s]:add_signal(tag::history::update, history.update)
+end
+
 setmetatable(_M, { __call = function (_, ...) return new(...) end })
 
 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
-- 
1.6.3.3



Re: [PATCH] awful.autofocus: restore focus on hide/minimize

2009-08-27 Thread koniu
On Tue, Aug 25, 2009 at 14:19, Julien Danjoujul...@danjou.info wrote:
 At 1251205054 time_t, koniu wrote:
 Confirmed. However, if you do the same without awesome-client, just
 from lua prompt the behaviour is as I described.

 keyboard grab - focusout - - minimize the window RETURN -
 focusin event - unminimize the window - give it focus back

OK, so that's yet another issue.

 It starts ok, but then if i try to minimize it while its in focus
 (using binding which launches above function) it will just lose focus
 but not go away. Only if I press the combo again (while it's not
 focused anymore) it minimizes.

 You do not grab the mouse/keyboard, aren't you?

Nope, it's just a regular function spawned by awful.key. Curiously
enough it works fine when I use c.hidden but c.minimized bears the
described effect.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [PATCH] awful.autofocus: restore focus on hide/minimize

2009-08-25 Thread koniu
On Tue, Aug 25, 2009 at 09:06, Julien Danjoujul...@danjou.info wrote:
 2. client.focus.minimized = true fails to minimized the client and but
 switches the focus to the previous in history

 It works fine here.

Can you try with two clients in the tag (tile layout helps), it's
definitely broken here - just tested with default config.

cheers,
koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] naughty: port sizing to the new widget margin code

2009-08-25 Thread koniu
my notifications look ugly without it

k
From 8c245ae57c4961ef8359e9788a6492d8f3dc4505 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Tue, 25 Aug 2009 18:05:05 +0100
Subject: [PATCH] naughty: port sizing to the new widget margin code

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/naughty.lua.in |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index bf415fd..551c71c 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -325,8 +325,9 @@ function notify(args)
 -- create textbox
 local textbox = capi.widget({ type = textbox, align = flex })
 textbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die)))
-textbox:margin({ right = margin, left = margin, bottom = margin, top = margin })
+layout.margins[textbox] = { right = margin, left = margin, bottom = margin, top = margin }
 textbox.text = string.format('span font_desc=%sb%s/b%s/span', font, title, text)
+textbox.valign = middle
 
 -- create iconbox
 local iconbox = nil
@@ -339,6 +340,7 @@ function notify(args)
 -- if we have an icon, use it
 if icon then
 iconbox = capi.widget({ type = imagebox, align = left })
+layout.margins[iconbox] = { right = margin, left = margin, bottom = margin, top = margin }
 iconbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die)))
 local img
 if type(icon) == string then
@@ -364,16 +366,16 @@ function notify(args)
 
 -- calculate the height
 if not height then
-if iconbox and iconbox:extents().height  textbox:extents().height then
-height = iconbox:extents().height
+if iconbox and iconbox:extents().height + 2 * margin  textbox:extents().height + 2 * margin then
+height = iconbox:extents().height + 2 * margin
 else
-height = textbox:extents().height
+height = textbox:extents().height + 2 * margin
 end
 end
 
 -- calculate the width
 if not width then
-width = textbox:extents().width + (iconbox and iconbox:extents().width or 0)
+width = textbox:extents().width + (iconbox and iconbox:extents().width or 0) + 2 * margin
 end
 
 -- crop to workarea size if too big
-- 
1.6.3.3



[PATCH] naughty: fix margin when using icon

2009-08-25 Thread koniu
missed one, and sent it to wrong ml.
From 11f1b0d22564d930078da5d66c6627a577946d43 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Tue, 25 Aug 2009 20:21:41 +0100
Subject: [PATCH] naughty: fix margin when using icon

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/naughty.lua.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index 551c71c..d5b82ea 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -375,7 +375,7 @@ function notify(args)
 
 -- calculate the width
 if not width then
-width = textbox:extents().width + (iconbox and iconbox:extents().width or 0) + 2 * margin
+width = textbox:extents().width + (iconbox and iconbox:extents().width + 2 * margin or 0) + 2 * margin
 end
 
 -- crop to workarea size if too big
-- 
1.6.3.3



[PATCH] naughty: fix hover_timeout

2009-08-24 Thread koniu
Broken since introduction of timers.

There's also an issue with sloppy focus that I've noticed while testing this.
1. open a few terminals in tiled layout
2. naughty.notify{ text = 'test', timeout = 0, hover_timeout = 0.2 }
3. move the mouse over the terminal with the popup above it (without
hovering over the popup)
4. focus away from the terminal using keyboard
5. move the mouse over the popup
6. the popup disappears and the terminal it was above gets focus

The client should not get a mouse_enter just because a wibox
disappears from below it. I trust you'll know how to fix that ;]

k
From 354fc80108c487902c79bfafb0360f62d194328b Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Tue, 25 Aug 2009 00:19:46 +0100
Subject: [PATCH] naughty: fix hover_timeout

Fixes regression since e899ca769610c01073c148112b8e8e5bb72fba45.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/naughty.lua.in |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index ca5d912..bf415fd 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -314,8 +314,11 @@ function notify(args)
 local hover_destroy = function ()
 if hover_timeout == 0 then
 die()
-elseif timer_die then
-timer_die:stop()
+else
+if notification.timer then notification.timer:stop() end
+notification.timer = capi.timer { timeout = hover_timeout }
+notification.timer:add_signal(timeout, die)
+notification.timer:start()
 end
 end
 
-- 
1.6.3.3



Re: [PATCH] awful.autofocus: restore focus on hide/minimize

2009-08-24 Thread koniu
Hmm, i did some more testing and this doesn't quite work as expected.
I've seen this problem before, prior to signals and all that jazz but
I did have it working right with the following hook (where
restore_focus is a function like one in autofocus):

awful.hooks.property.register(function (c, prop)
  if type(c) == client and (prop == minimized or prop == hide) then
restore_focus(c.screen, c)
end

Right now, with the patch applied:

1. client.focus.hidden = true hides the client but doesn't restore focus
2. client.focus.minimized = true fails to minimized the client and but
switches the focus to the previous in history

I'm confused.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [patch] awful.client: add annotation support

2009-08-18 Thread koniu
This seems to duplicate the unpolished tho fully functional awful.doc
that I was working on a while back, before stuff ranging from my
laptop to master branch started breaking.

The module provides more generic means of describing  clients (among
other objects) and it would be pretty trivial to add prompt and
naughty output whilst still using the generic backend.

For the curious current wip revision of my local branch is here:
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/awful-doc

Cleanup and submission of that code is next on my awesome todolist
which is high on my general todolist. I'm not sure what the timescale
for 3.4 looks like atm but I would like to try and make it before
freeze happens.

koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [Patch] Fix naughty's margin calculation

2009-07-29 Thread koniu
On Wed, Jul 29, 2009 at 13:41, Uli Schlachterpsyc...@znc.in wrote:

 no idea when this break, but the attached patch fixes it (for me).
 Tested with notify-sent, with and without an icon.

 No idea where this comes from or why it worked before, but it's obviously 
 wrong.

Dont ask me:
http://www.mail-archive.com/awesome-devel@naquadah.org/msg02336.html

Nice one with the other patch dealing with heavy code duplication
introduced by the widget layout commit.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [Draft] Introduction of Widget Layouts

2009-07-17 Thread koniu
I've updated to see what its like and apart of my widgetbar being a
mess, but I have a problem with the naughty patch which renders it
unusable under certain condition:

W: awesome: event_handle_key:549: error running function:
/usr/share/awesome/lib/naughty.lua:385: attempt to perform arithmetic
on field 'border_width' (a nil value)

that should be s/config.border_width/border_width:

 lib/naughty.lua.in |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index ce17024..7ed0769 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -380,17 +380,17 @@ function notify(args)

 -- position the wibox
 if iconbox and iconbox.image.height  textbox:extents()[height] then
-notification.height = iconbox.image.height + (2 * config.border_width)
+notification.height = iconbox.image.height + (2 * border_width)
 else
-notification.height = textbox:extents()[height] + (2 *
config.border_width)
+notification.height = textbox:extents()[height] + (2 * border_width)
 end
-notification.width = (iconbox and iconbox:extents()[width] or
0) + textbox:extents()[width] + (2 * config.border_width)
+notification.width = (iconbox and iconbox:extents()[width] or
0) + textbox:extents()[width] + (2 * border_width)

 if capi.screen[screen].workarea.width  notification.width then
-notification.width = capi.screen[screen].workarea.width - (2
* config.border_width) - (2 * config.padding)
+notification.width = capi.screen[screen].workarea.width - (2
* border_width) - (2 * config.padding)
 end
 if capi.screen[screen].workarea.height  notification.height then
-notification.height = capi.screen[screen].workarea.height -
(2 * config.border_width) - (2 * config.padding)
+notification.height = capi.screen[screen].workarea.height -
(2 * border_width) - (2 * config.padding)
 end

BUT when i corrected that (so it shows some notifications), after
displaying one it seems to segfault. havent investigated closer, but
i'm wondering if it works for other people.

kk

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: Receiving SIGABRT when starting a client

2009-07-02 Thread koniu
The lesson here being, watch your upgrades with bleeding edge
dependencies and if necessary revert/investigate possibility of
upstream upgrade  (which seem to follow library release cycle). Sadly
enough distros seem to be having issues with this stuff - the same
problem popped up in Debian unstable a month ago (unresolved for some
weeks with no binary fo libxcb-util 0.3.5):

http://www.mail-archive.com/awes...@naquadah.org/msg01442.html
http://www.mail-archive.com/awesome-devel@naquadah.org/msg02640.html
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531310

So also have faith in our wonderful mailing lists ;o]

Now be at peace

kkk

ps. forwarding to user list for reference


On Thu, Jul 2, 2009 at 16:22, Alexandre Perrinalexandre.per...@epfl.ch wrote:
 On Thu, Jul 02, 2009 at 04:37:02PM +0200, Gregor Best wrote:
 Hi people,

 I'm having kind of a big problem here:
 After running an update of my system (which, among others, updated
 libxcb), awesome receives a SIGABRT as soon as I try starting something
 from the prompt.

 Below is a backtrace:

 #0  0xe424 in __kernel_vsyscall ()
 #1  0xb7b13980 in raise () from /lib/libc.so.6
 #2  0xb7b151c8 in abort () from /lib/libc.so.6
 #3  0xb7b0ca5e in __assert_fail () from /lib/libc.so.6
 #4  0xb7b584e0 in _int_malloc () from /lib/libc.so.6
 #5  0xb7b5970b in calloc () from /lib/libc.so.6
 #6  0xb80b26bb in _dl_new_object () from /lib/ld-linux.so.2
 #7  0xb80ae523 in _dl_map_object_from_fd () from /lib/ld-linux.so.2
 #8  0xb80afed3 in _dl_map_object () from /lib/ld-linux.so.2
 #9  0xb80bad00 in dl_open_worker () from /lib/ld-linux.so.2
 #10 0xb80b6a66 in _dl_catch_error () from /lib/ld-linux.so.2
 #11 0xb80ba6ae in _dl_open () from /lib/ld-linux.so.2
 #12 0xb7bf1b32 in do_dlopen () from /lib/libc.so.6
 #13 0xb80b6a66 in _dl_catch_error () from /lib/ld-linux.so.2
 #14 0xb7bf1c31 in dlerror_run () from /lib/libc.so.6
 #15 0xb7bf1d5b in __libc_dlopen_mode () from /lib/libc.so.6
 #16 0xb7bcdc58 in init () from /lib/libc.so.6
 #17 0xb7bcde05 in backtrace () from /lib/libc.so.6
 #18 0xb7b4f8c3 in __libc_message () from /lib/libc.so.6
 #19 0xb7b557c4 in malloc_printerr () from /lib/libc.so.6
 #20 0xb7b56946 in munmap_chunk () from /lib/libc.so.6
 #21 0xb7dd8f3e in xcb_get_wm_size_hints_reply (c=0x91d9188, cookie={sequence 
 = 2097}, hints=0x92ed520, e=0x0) at icccm.c:475
 #22 0xb7dd8f82 in xcb_get_wm_normal_hints_reply (c=0x91d9188, 
 cookie={sequence = 2097}, hints=0x92ed520, e=0x0) at icccm.c:513
 #23 0x0806003f in property_update_wm_normal_hints (c=0x92ed464, reply=0x0) 
 at /home/gregor/sourcecode/awesome/property.c:130
 #24 0x0805855d in client_manage (w=4194310, wgeom=0x92ea490, phys_screen=0, 
 startup=false) at /home/gregor/sourcecode/awesome/client.c:490
 #25 0x0805d91e in event_handle_maprequest (data=0x0, connection=0x91d9188, 
 ev=0x92c5db8) at /home/gregor/sourcecode/awesome/event.c:625
 #26 0xb7dc0f64 in xcb_event_handle (evenths=0x808ba44, event=0x92c5db8) at 
 event.c:75
 #27 0x0805314e in a_xcb_check_cb (loop=0xb7cc71c0, w=0xbfac5388, 
 revents=32768) at /home/gregor/sourcecode/awesome/awesome.c:216
 #28 0xb7cc2d86 in ev_loop () from /usr/lib/libev.so.3
 #29 0x08054151 in main (argc=1, argv=0xbfac5454) at 
 /home/gregor/sourcecode/awesome/awesome.c:561

 I'm not sure what to make of this, but as a layman, I'd guess libev
 fails here. The version I currently use is 3.53, but that has been
 installed for over 4 month now without any problems.

 libxcb is at version 1.3 (was 1.2 before the upgrade) and xcb-util is
 still at 0.3.3

 Does anyone have _ANY_ idea what this is related to and how I could
 solve it? I'm happy for even the slightest hints.


 Hi!
 I ran into the same kind of problem after an update some days ago,
 awesome started but crashed when I tried to launch any client. I had to
 update xcb-util to 0.3.5 and the problem was solved.

 Here is the IRC log with a link to my bt which looks like yours:

 13:53 [ kAworu] jd_: you were right! I've got a new bt :D
 13:53 [ kAworu] jd_: http://pastebin.com/f41c6d562
 13:54 [ jd_] kAworu: I am always right :)
 13:54 [ kAworu] jd_: looks like a xcb-util issue to me, I'm using
 xcb-util-0.3.4_1
 13:54 [ jd_] kAworu: which version of libxcb and xcb-util do you use ?
 13:54 [ jd_] aaah
 13:54 [ jd_] upgrade to 0.3.5 then
 13:54 [ kAworu] libxcb-1.3
 13:54 [ jd_] ok, that's why

 What I read here it that you need xcb-util-0.3.5 if you're using
 libxcb-1.3. jd might know why ;)

 Hope this can help :)

 Alex.


--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: next branch - titlebar problem with tiled layout

2009-05-31 Thread koniu
On Thu, May 28, 2009 at 14:15, Julien Danjou jul...@danjou.info wrote:
 Yes, I can reproduce. Could you do some bisect to find where it fails?

Frankly I don't have the time to do lots of testing these days but I
might get round to it at some point.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [PATCH] awful.util: add linewrap()

2009-05-29 Thread koniu
On Thu, May 28, 2009 at 13:14, Julien Danjou jul...@danjou.info wrote:
 Pushed.

Ay, sorry, forgot to add string to the environment, see amended patch.

kk
From fa95409bee45053474ab50f0422ca147913dd5ed Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Wed, 27 May 2009 16:49:20 +0100
Subject: [PATCH] awful.util: add linewrap()

Signed-off-by: koniu gkusni...@gmail.com
Signed-off-by: Julien Danjou jul...@danjou.info
---
 lib/awful/util.lua.in |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in
index 5965bda..95d6717 100644
--- a/lib/awful/util.lua.in
+++ b/lib/awful/util.lua.in
@@ -15,6 +15,7 @@ local print = print
 local type = type
 local rtable = table
 local pairs = pairs
+local string = string
 local capi =
 {
 awesome = awesome,
@@ -261,4 +262,24 @@ function table.hasitem(t, item)
 end
 end
 
+--- Split a string into multiple lines
+-- @param text String to wrap.
+-- @param width Maximum length of each line. Default: 72.
+-- @param indent Number of spaces added before each wrapped line. Default: 0.
+-- @return The string with lines wrapped to width.
+function linewrap(text, width, indent)
+local text = text or 
+local width = width or 72
+local indent = indent or 0
+
+local pos = 1
+return text:gsub((%s+)()(%S+)(),
+function(sp, st, word, fi)
+if fi - pos  width then
+pos = st
+return \n .. string.rep( , indent) .. word
+end
+end)
+end
+
 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
-- 
1.6.3.1



[PATCH] awful.util: add linewrap()

2009-05-27 Thread koniu
Heya,

The patch adds a function for wrapping lines on long strings. I'm
using it in awful.help and it could also be used in naughty and
otherwise.

I'm wondering, by the way, perhaps this should be called string.wrap()
and therefore string.escape(), string.unescape() - to follow
table.hasitem/join example.
To take the idea further, at least as far as awful.util goes, we could:

checkfile - file.validate
file_readable - file.readable
subsets - table.subsets

And maybe more. The problem is that these functions are bound to be
explicitly used by some users and this would be breaking API (again).
We could of course deprecate them to make the process smoother but
still. In fact, there's a lot more in the namespace that could be
unified - think awful.tag.getproperty vs awful.client.property.get -
at what stage would we be cleaning all of this up?

cheers,
koniu
From f827aacf9d44cad13d5d582e89b64b35c74b1e25 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Wed, 27 May 2009 16:49:20 +0100
Subject: [PATCH] awful.util: add linewrap()

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/util.lua.in |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in
index 5965bda..9878ffa 100644
--- a/lib/awful/util.lua.in
+++ b/lib/awful/util.lua.in
@@ -261,4 +261,24 @@ function table.hasitem(t, item)
 end
 end
 
+--- Split a string into multiple lines
+-- @param text String to wrap.
+-- @param width Maximum length of each line. Default: 72.
+-- @param indent Number of spaces added before each wrapped line. Default: 0.
+-- @return The string with lines wrapped to width.
+function linewrap(text, width, indent)
+local text = text or 
+local width = width or 72
+local indent = indent or 0
+
+local pos = 1
+return text:gsub((%s+)()(%S+)(),
+function(sp, st, word, fi)
+if fi - pos  width then
+pos = st
+return \n .. string.rep( , indent) .. word
+end
+end)
+end
+
 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
-- 
1.6.3.1



Re: [PATCH] awful.util: add linewrap()

2009-05-27 Thread koniu
On Wed, May 27, 2009 at 17:21, Julien Danjou jul...@danjou.info wrote:
 So, for unification we should do it ASAP, but first, we should make a
 clear decision, written in marble and in STYLES, about how we name
 things.

 (So for your patch, tell me if you want me to merge it right now or if
 you want to rename the function now.)

I don't really want to rename it since we don't have the styles
written in marble so I don't know what to rename it to. If the big
cleanup happens before next is merged into master we could just rename
it then (without deprecation stage). If, otoh, next is merged with
master before the cleanup (which would then happen in master or maybe
a new branch), it's better that we don't have just one function that
is called awful.util.string.something() in master for the time being.
For this reason I'd say merge it as it is.

cheers,
koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: next branch - wibox removal gives errors

2009-05-27 Thread koniu
This patch seems to help.
From 1170df36a4d7d2f04589b4abd2561746db1e05a2 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 28 May 2009 05:30:34 +0100
Subject: [PATCH] wibox: run hook before detaching

Signed-off-by: koniu gkusni...@gmail.com
---
 wibox.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/wibox.c b/wibox.c
index d490a77..53329f7 100644
--- a/wibox.c
+++ b/wibox.c
@@ -389,10 +389,10 @@ wibox_detach(wibox_t *wibox)
 break;
 }
 
-wibox-screen = NULL;
-
 hook_property(wibox, wibox, screen);
 
+wibox-screen = NULL;
+
 wibox_unref(globalconf.L, wibox);
 }
 }
-- 
1.6.3.1



next branch - titlebar problem with tiled layout

2009-05-27 Thread koniu
Another one after last rebase (HEAD 5adb01ae), and not too sure where
to look to fix

I have a tag with tile bottom layout and 3 clients some of which have titlebars:
1. http://omploader.org/vMXFyOA

Whenever I switch to some other tag and back, the arrangement on the
slave client gets messed up:
2. http://omploader.org/vMXFyOQ

When I switch focus it gets rearranged correctly [2]. Its as if
arrange on tag change didnt respect titlebars.

Hope this suffices :P

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: next branch - titlebar problem with tiled layout

2009-05-27 Thread koniu
Forgot to that this was fine before that rebase (as in May 26th).

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] client: allow setting skip_taskbar

2009-05-27 Thread koniu
As per subject.

cheers,
koniu
From 50e6c26eb608694b53bd1aed813246faac21f4c9 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 28 May 2009 06:37:17 +0100
Subject: [PATCH] client: allow setting skip_taskbar

Signed-off-by: koniu gkusni...@gmail.com
---
 client.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/client.c b/client.c
index ddc1856..3222ba2 100644
--- a/client.c
+++ b/client.c
@@ -1508,6 +1508,11 @@ luaA_client_newindex(lua_State *L)
 else
 titlebar_client_attach(c);
 break;
+  case A_TK_SKIP_TASKBAR:
+c-skiptb = luaA_checkboolean(L, 3);
+if(globalconf.hooks.clients != LUA_REFNIL)
+luaA_dofunction_from_registry(L, globalconf.hooks.clients, 0, 0);
+break;
   default:
 return 0;
 }
-- 
1.6.3.1



focus problem in next

2009-05-25 Thread koniu
Hello, here's me complaining about next again  :P

The issue, in general terms, seems to be sloppy focus somehow taking
precedence over manage focus.

Here's the steps:

1. go to an empty tag (tile layout)
2. open a terminal
3. type something (eg. 111) in, so you know which client is which
4. open another one and type in 222
5. move the mouse cursor over the top part of 111 client
6. open another terminal (without moving the mouse)
7. focus ends up on 222 client instead of the last terminal opened

Reproducible with default rc.lua.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: c.hide broken in next

2009-05-25 Thread koniu
On Mon, May 25, 2009 at 16:28, Julien Danjou jul...@danjou.info wrote:
 At 1243264813 time_t, koniu wrote:
 jd_, u mess with all those properties :)

 Did I? :)
 I've amended the commit responsible of that.

Fixed, thanks. Can you do the same magic for c.minimized (same issue)?

cheers
kk

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: c.hide broken in next

2009-05-25 Thread koniu
On Mon, May 25, 2009 at 20:39, Julien Danjou jul...@danjou.info wrote:
 At 1243272624 time_t, koniu wrote:
 Fixed, thanks. Can you do the same magic for c.minimized (same issue)?

 Should be ok.

Confirmed.

Btw, build of current next (6c1d20) went kuku, see patch.
From 36fab45e55efad297f0c6ec56c7fd9fa3b5d0c53 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Mon, 25 May 2009 21:47:33 +0100
Subject: [PATCH] fix typo

Signed-off-by: koniu gkusni...@gmail.com
---
 tag.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/tag.c b/tag.c
index e3e6123..1d206f4 100644
--- a/tag.c
+++ b/tag.c
@@ -69,7 +69,6 @@ tag_view(tag_t *tag, bool view)
 lua_pushliteral(globalconf.L, select);
 else
 lua_pushliteral(globalconf.L, unselect);
-luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0);
 luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.tags, 3, 0);
 }
 }
-- 
1.6.3.1



tag history broken in next

2009-05-25 Thread koniu
With the new select/unselect events the history is always empty?

I've attempted to hack a better tag history implementation which would
be multi-level and allowed a variable number of tags.
The problem I keep facing is that eg. each tag switch with viewonly()
triggers a bunch of unselect's by running viewnone() which results in
useless history entries with all tags unselected.

Any hints welcome :)

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


next branch keybinding weirdness

2009-05-24 Thread koniu
Hi,

I've more or less ported my config/shifty to work with the recent
commits on next branch  (arrange-tag hooks) but I'm running into a
very strange issue which I'm quite stuck trying to debug.

Imagine that these are my tags:
A1, A2, A3, B1, B2, B3, B4

I have a global binding for XF86Back/Forward to run awful.tag.viewprev/next().

1. When on tag A1 XF86Forward will switch to A2 (as expected)
2. When on tag A2 XF86Forward will switch to A3 (as expected)
3. When on tag A3 XF86Forward will switch to B2 (as opposed to expected B1)
4. When on tag B1 XF86Forward will switch to B2 (as expected)
5. When on tag B2 XF86Forward will switch to B3 (as expected)
6 .When on tag B3 XF86Forward will switch to B4 (as expected)
7. When on tag B4 XF86Forward will switch to A1 (as expected)
8. When on tag A1 XF86Back will switch to B3 (as opposed to expected B4)

Quick investigation shows that, for some reason, in situations 3 and 8
awful.tag.view{prev,next} function is executed twice.
So, in simple terms, when switching from A-type tag to B-type tag (and
vice versa) it switches to 2nd tags over instead of next/previous one.


For the difference between tags A and B...

To achieve per-tag keybindings in Shifty I run a function like this
(with awful.hooks.tags.register):
function tagkeys(s, t, v)
  if v == select then
local keys = awful.tag.getproperty(t, keys) or config.globalkeys
if keys then root.keys(keys) end
  end
end

This basically sets root.keys to either:
A. table of globalkeys -- by default
B. table of globalkeys + per-tag keys stored in tag property 'keys'
-- when tag has some special keybindings listed

I've checked what root.keys() returns for both types of tags and
grepping for XF86Forward gives the same number of entries which
indicates that I do not have the same function bound to the same
keybinding twice.

I've also tried storing globalkeys table in the tag property 'keys'
for A-tags (to make tagkeys() get key tables from the same source) and
it doesn't make any difference.

My best conclusion so far is that when re-setting root.keys with
different length tables (note that I still run root.keys({ ... }) even
when switching A1-A2 and it works fine) something goes wrong and the
keybinding/function is done twice.

For the record, this worked perfectly fine before when I was using
'arrange' hook to check for tag switch.

Any insight as to why that or at least how to debug it further would
be *greatly* appreciated.

cheers,
koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] 0001-hooks-add-exit-hook

2009-05-24 Thread koniu
Hey,

How about adding a hook that's executed right before awesome exits?
This would allow eg. dumping some stuff to a file thus making session
saving possible.

The proposed patch will run the hooked functions inside
awesome_atexit() which also takes effect during awesome restart
(including xrandr enabling/rotating screens etc). Unfortunately it
won't do anything on ctrl-alt-backsp or xserver crash but I guess
that's not really possible.

thanks,
koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [PATCH] 0001-hooks-add-exit-hook

2009-05-24 Thread koniu
and the patch :P
From 625468d430714577ae6ec5a87004442ca7348117 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Sat, 23 May 2009 16:56:41 +0100
Subject: [PATCH] hooks: add exit hook

Signed-off-by: koniu gkusni...@gmail.com
---
 awesome.c |5 +
 hooks.c   |   13 +
 luaa.c|1 +
 structs.h |2 ++
 4 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/awesome.c b/awesome.c
index 5035a72..630820b 100644
--- a/awesome.c
+++ b/awesome.c
@@ -62,6 +62,11 @@ awesome_atexit(void)
 {
 int screen_nbr, nscreens;
 
+if(globalconf.hooks.exit != LUA_REFNIL)
+{
+luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.exit, 0, 0);
+}
+
 a_dbus_cleanup();
 
 /* reparent systray windows, otherwise they may die with their master */
diff --git a/hooks.c b/hooks.c
index b2ec266..f124193 100644
--- a/hooks.c
+++ b/hooks.c
@@ -202,6 +202,18 @@ luaA_hooks_timer(lua_State *L)
 return 1;
 }
 
+/** Set the function called on awesome exit
+ * \param L The Lua VM state.
+ * \return The number of elements pushed on stack.
+ * \luastack
+ * \lparam A function to call on awesome exit.
+ */
+static int
+luaA_hooks_exit(lua_State *L)
+{
+HANDLE_HOOK(L, globalconf.hooks.exit);
+}
+
 #ifdef WITH_DBUS
 /** Set the function to be called when a D-Bus event is received.
  * The first argument passed to this function is the type of the message we
@@ -236,6 +248,7 @@ const struct luaL_reg awesome_hooks_lib[] =
 { tagged, luaA_hooks_tagged },
 { startup_notification, luaA_hooks_startup_notification },
 { timer, luaA_hooks_timer },
+{ exit, luaA_hooks_exit },
 #ifdef WITH_DBUS
 { dbus, luaA_hooks_dbus },
 #endif
diff --git a/luaa.c b/luaa.c
index 9b5d4c1..9a69743 100644
--- a/luaa.c
+++ b/luaa.c
@@ -742,6 +742,7 @@ luaA_init(xdgHandle* xdg)
 globalconf.hooks.property = LUA_REFNIL;
 globalconf.hooks.startup_notification = LUA_REFNIL;
 globalconf.hooks.timer = LUA_REFNIL;
+globalconf.hooks.exit = LUA_REFNIL;
 #ifdef WITH_DBUS
 globalconf.hooks.dbus = LUA_REFNIL;
 #endif
diff --git a/structs.h b/structs.h
index 56d4d17..3a11872 100644
--- a/structs.h
+++ b/structs.h
@@ -120,6 +120,8 @@ struct awesome_t
 luaA_ref property;
 /** Command to run on time */
 luaA_ref timer;
+/** Command to run on awesome exit */
+luaA_ref exit;
 /** Startup notification hooks */
 luaA_ref startup_notification;
 #ifdef WITH_DBUS
-- 
1.6.3.1



Re: Shifty: Don't create tags on non-existing screens

2009-05-21 Thread koniu
On Thu, May 21, 2009 at 15:45, Andreas Klöckner li...@informa.tiker.net wrote:
 See it as guarding against user error--creating tags on non-existing screens
 is kind of pointless. On top of that, this fix makes dynamic dual-screen
 setups work with relative ease. What's not to like? :)

Agreed and pushed - thanks :).

Also, please let me know if you experience any other issues/weirdness
with multi-screen setup and shifty - testing that properly is high on
my todo list and I could definitely use some hints from someone who
uses multiple screens on a more regular basis.

cheers,
koniu

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: Shifty: Don't create tags on non-existing screens

2009-05-20 Thread koniu
On Thu, May 21, 2009 at 01:28, Andreas Klöckner li...@informa.tiker.net wrote:
 attached diff does what subject says--this makes shifty usable for me with a
 laptop with a varying number of screens attached.

Hi,

For the record please:
awesome ver?
shifty-master HEAD? (patch applies clean)

The patch seems to be good but (before I push it) can you be a bit
more specific as to what breaks (config snippets very helpful) if you
run without it? I can only assume that the problem is that you're
setting screen = 2 in somewhere in shifty.config and that breaks when
running only on LVDS?

Btw, I've been using this sort of statement in rc.lua to force screen
in various settings (shifty, naughty etc.) on my laptop, but I have to
admit that I don't use multi-screen every day:

   if screen.count() == 2 then LCD = 2 else LCD = 1 end

Your solution might make more sense - shifty is supposed to be
dynamic, so validation of screen could be done internally.

thanks,
koniu

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [RFC + PATCH] awful.doc

2009-05-10 Thread koniu
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/awful-doc

Nope, I haven't been dead or anything, on the contrary I've made some
progress with this stuff. Recent commits in the branch re-organize
some functions and make the whole thing a bit smarter.

Some of the differences are:
- working prompt with completion of anything in global environment
(needs some more tweaking tho)
- a new generic awful.help.get() function which can (ultimately) take
any object and describe it using a particular function crafted to deal
with that type of object
- get() is called by whatsthis() [point and click helper] and the
prompt so you can safely click or ask about anything

There's more but I cant be bothered to do full changelogs since all of
this will end up squashed to 'import' anyway. Here's some recent
screenshots, tho I plea to you to try it in action as that could
generate some constructive feedback.

http://omploader.org/vMW5qOQ
http://omploader.org/vMW5qYg
http://omploader.org/vMW5qYw
http://omploader.org/vMW5qZA

Anyway, so how would we go about generating doc.set()s for modules
other than awful (including capi)?

and now i'm going to sleep :P
k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: RFC/Testing: jd/padding branch

2009-05-10 Thread koniu
On Thu, May 7, 2009 at 19:23, Julien Danjou jul...@danjou.info wrote:
 At 1241720263 time_t, Andrei Thorp wrote:
 Alright, I'm out of bugs  thanks for patience. Good work.
 And thank you for taking time to test. :)

OK, so now its in next and I have no choice but to take that time and test :)

One thing I can say so far is that having get_workarea() in
awful.wibox is a bit counter-intuitive, it should go to awful.screen.
That would require adding a function to export the local 'wiboxes'
table in awful.wibox. Can provide patches if this sounds like a good
idea.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] naughty environment cleanup

2009-05-08 Thread koniu
Hullo, a little continuation of recent naughty love - tidy environment
is important :)

More (importantly) to come - I'm trying to tackle a pretty severe bug
I've been seeing recently. When we have a single notification in the
screen which takes up the whole space, as soon as another popup
replaces it, positioning of any further notifications goes to deep
misery. This is not easy to track down since I can't watch variable
values using... naughty and print doesn't help much these days.

koniu
From 03fe4ad49e7123749152c435b6192a799099e194 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Fri, 8 May 2009 08:01:14 +0100
Subject: [PATCH] naughty: environment cleanup

Makes naughty environment handling same as awful modules:
- relevant capi members all go to local capi = {}
- relevant awful members are all implicitly required

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/naughty.lua.in |   47 +++
 1 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index 3122083..1528fd7 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -7,19 +7,18 @@
 -- Package environment
 local pairs = pairs
 local table = table
-local wibox = wibox
-local image = image
 local type = type
-local hooks = require(awful.hooks)
 local string = string
-local widget = widget
+local capi = { screen = screen,
+   awesome = awesome,
+   dbus = dbus,
+   widget = widget,
+   wibox = wibox,
+   image = image }
+local hooks = require(awful.hooks)
 local button = require(awful.button)
 local util = require(awful.util)
-local capi = { screen = screen, awesome = awesome }
 local bt = require(beautiful)
-local screen = screen
-local awful = awful
-local dbus = dbus
 
 --- Notification library
 module(naughty)
@@ -103,7 +102,7 @@ local counter = 1
 -- @class table
 
 notifications = {}
-for s = 1, screen.count() do
+for s = 1, capi.screen.count() do
 notifications[s] = {
 top_left = {},
 top_right = {},
@@ -202,7 +201,7 @@ local function getIcon(name)
 for d, dir in pairs(config.icon_dirs) do
 for f, format in pairs(config.icon_formats) do
 local icon = dir .. name .. . .. format
-if awful.util.file_readable(icon) then
+if util.file_readable(icon) then
 return icon
 end
 end
@@ -309,7 +308,7 @@ function notify(args)
 end
 
 -- create textbox
-local textbox = widget({ type = textbox, align = flex })
+local textbox = capi.widget({ type = textbox, align = flex })
 textbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die)))
 textbox:margin({ right = margin, left = margin, bottom = 2 * margin })
 textbox.text = string.format('span font_desc=%sb%s/b%s/span', font, title, text)
@@ -319,17 +318,17 @@ function notify(args)
 local iconbox = nil
 if icon then
 -- try to guess icon if the provided one is non-existent/readable
-if type(icon) == string and not awful.util.file_readable(icon) then
+if type(icon) == string and not util.file_readable(icon) then
 icon = getIcon(icon)
 end
 
 -- if we have an icon, use it
 if icon then
-iconbox = widget({ type = imagebox, align = left })
+iconbox = capi.widget({ type = imagebox, align = left })
 iconbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die)))
 local img
 if type(icon) == string then
-img = image(icon)
+img = capi.image(icon)
 else
 img = icon
 end
@@ -344,11 +343,11 @@ function notify(args)
 end
 
 -- create container wibox
-notification.box = wibox({ position = floating,
-   fg = fg,
-   bg = bg,
-   border_color = border_color,
-   border_width = border_width })
+notification.box = capi.wibox({ position = floating,
+fg = fg,
+bg = bg,
+border_color = border_color,
+border_width = border_width })
 
 -- calculate the height
 if not height then
@@ -398,8 +397,8 @@ end
 
 -- DBUS/Notification support
 -- Notify
-if awful.hooks.dbus then
-awful.hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
+if hooks.dbus then
+hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
 args = { preset = { } }
 if data.member == Notify then
 if text ~=  then
@@ -449,7 +448,7 @@ if awful.hooks.dbus then
 end

Re: [PATCH] naughty environment cleanup

2009-05-08 Thread koniu
OK, that was for next and it can as well go to master, here's the
patch on top of that.

Dunno how it will behave with patches in next tho, maybe better push
the 1st one to next and forget this one... your choice B^]

koniu
From d3b27865c7de7adaac1306a365650d736395d554 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Fri, 8 May 2009 08:01:14 +0100
Subject: [PATCH] naughty: environment cleanup

Makes naughty environment handling same as awful modules:
- relevant capi members all go to local capi = {}
- relevant awful members are all implicitly required

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/naughty.lua.in |   47 +++
 1 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index 45ec3b5..8a34527 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -7,20 +7,19 @@
 -- Package environment
 local pairs = pairs
 local table = table
-local wibox = wibox
-local image = image
 local type = type
+local string = string
 local tostring = tostring
+local capi = { screen = screen,
+   awesome = awesome,
+   dbus = dbus,
+   widget = widget,
+   wibox = wibox,
+   image = image }
 local hooks = require(awful.hooks)
-local string = string
-local widget = widget
 local button = require(awful.button)
 local util = require(awful.util)
-local capi = { screen = screen, awesome = awesome }
 local bt = require(beautiful)
-local screen = screen
-local awful = awful
-local dbus = dbus
 
 --- Notification library
 module(naughty)
@@ -139,7 +138,7 @@ local counter = 1
 -- @class table
 
 notifications = {}
-for s = 1, screen.count() do
+for s = 1, capi.screen.count() do
 notifications[s] = {
 top_left = {},
 top_right = {},
@@ -238,7 +237,7 @@ local function getIcon(name)
 for d, dir in pairs(config.icon_dirs) do
 for f, format in pairs(config.icon_formats) do
 local icon = dir .. name .. . .. format
-if awful.util.file_readable(icon) then
+if util.file_readable(icon) then
 return icon
 end
 end
@@ -327,7 +326,7 @@ function notify(args)
 end
 
 -- create textbox
-local textbox = widget({ type = textbox, align = flex })
+local textbox = capi.widget({ type = textbox, align = flex })
 textbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die)))
 textbox:margin({ right = config.margin, left = config.margin })
 textbox.text = string.format('span font_desc=%sb%s/b%s/span', font, title, text)
@@ -337,17 +336,17 @@ function notify(args)
 local iconbox = nil
 if icon then
 -- try to guess icon if the provided one is non-existent/readable
-if type(icon) == string and not awful.util.file_readable(icon) then
+if type(icon) == string and not util.file_readable(icon) then
 icon = getIcon(icon)
 end
 
 -- if we have an icon, use it
 if icon then
-iconbox = widget({ type = imagebox, align = left })
+iconbox = capi.widget({ type = imagebox, align = left })
 iconbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die)))
 local img
 if type(icon) == string then
-img = image(icon)
+img = capi.image(icon)
 else
 img = icon
 end
@@ -362,11 +361,11 @@ function notify(args)
 end
 
 -- create container wibox
-notification.box = wibox({ position = floating,
-   fg = fg,
-   bg = bg,
-   border_color = args.preset and args.preset.border_color or config.presets.normal.border_color,
-   border_width = config.border_width })
+notification.box = capi.wibox({ position = floating,
+fg = fg,
+bg = bg,
+border_color = args.preset and args.preset.border_color or config.presets.normal.border_color,
+border_width = config.border_width })
 
 -- position the wibox
 local lines = 1; for i in string.gmatch(title..text, \n) do lines = lines + 1 end
@@ -397,8 +396,8 @@ end
 
 -- DBUS/Notification support
 -- Notify
-if awful.hooks.dbus then
-awful.hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
+if hooks.dbus then
+hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
 args = { preset = { } }
 if data.member == Notify then
 if text ~=  then
@@ -448,7 +447,7 @@ if awful.hooks.dbus then
 end
 end
 if imgdata

[PATCH] naughty bugfix - reindexing on popup removal if no space for a new one

2009-05-08 Thread koniu
After long struggle here it is - applicable to master. I tested it
extensively with next branch and it loads/seems to behave once
backported to master. Please test briefly if you can. I'm going to
sleep.

Thanks!
koniu
From 0b626dabc3fe032983b9ac4620e93931fd459c6a Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Fri, 8 May 2009 12:08:09 +0100
Subject: [PATCH] naughty: fix bug in re-indexing popups if removing older to make space

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/naughty.lua.in |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index 45ec3b5..5299253 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -153,11 +153,12 @@ end
 -- @param position top_right | top_left | bottom_right | bottom_left
 -- @param height Popup height
 -- @param width Popup width (optional)
--- @return Absolute position in {x, y} dictionary
+-- @return Absolute position and index in { x = X, y = Y, idx = I } table
 local function get_offset(screen, position, idx, width, height)
 local ws = capi.screen[screen].workarea
 local v = {}
 width = width or notifications[screen][position][idx].width or config.width
+local idx = idx or #notifications[screen][position] + 1
 
 -- calculate x
 if position:match(left) then
@@ -185,6 +186,7 @@ local function get_offset(screen, position, idx, width, height)
 destroy(notifications[screen][position][1])
 v = get_offset(screen, position, idx, width, height)
 end
+if not v.idx then v.idx = idx end
 
 return v
 end
@@ -196,7 +198,7 @@ local function arrange(screen)
 for i,notification in pairs(notifications[screen][p]) do
 local offset = get_offset(screen, p, i, notification.width, notification.height)
 notification.box:geometry({ x = offset.x, y = offset.y, width = notification.width, height = notification.height })
-notification.idx = i
+notification.idx = offset.idx
 end
 end
 end
@@ -303,7 +305,6 @@ function notify(args)
 end
 
 notification.position = args.position or (args.preset and args.preset.position) or config.presets.normal.position
-notification.idx = #notifications[screen][notification.position] + 1
 
 local title = 
 if args.title then title = tostring(args.title) .. \n  end
@@ -376,7 +377,7 @@ function notify(args)
 else
 notification.height = lines * height end
 notification.width = width
-local offset = get_offset(screen, notification.position, notification.idx, notification.width, notification.height)
+local offset = get_offset(screen, notification.position, nil, notification.width, notification.height)
 notification.box:geometry({ width = notification.width,
 height = notification.height,
 x = offset.x,
@@ -384,6 +385,7 @@ function notify(args)
 notification.box.ontop = ontop
 notification.box.opacity = opacity
 notification.box.screen = screen
+notification.idx = offset.idx
 
 -- populate widgets
 notification.box.widgets = { iconbox, textbox }
-- 
1.6.2.4



Re: [PATCH] naughty environment cleanup

2009-05-08 Thread koniu
On Fri, May 8, 2009 at 13:21, Andrei Thorp gar...@gmail.com wrote:
 You can write files to relay data pretty reliably, btw. You can then
 tail -f to have something like stdout... -_-

Yes,  io.stderr:write() is my new friend :]

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


naughty in next branch broken after rebase

2009-05-08 Thread koniu
19:27  koniu jd_: u there? next is broken
19:28  koniu this commit (after rebase?)
http://git.naquadah.org/?p=awesome.git;a=commitdiff;h=b18238919a838f5c29aab5cf0a093a6e12e0c2f4
mustnt:
19:28  koniu -local idx = idx or #notifications[screen][position] + 1

Corrected version here:
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/next

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [ANNOUNCE] awesome 3.3-rc2 released

2009-05-08 Thread koniu
On Fri, May 8, 2009 at 15:48, Alex Cornejo acorn...@gmail.com wrote:

 am sure debian-unstable has all the packages (since jd probably
 maintains them, and I believe that's his distro of choice). Anyway, it
 would be really cool if there was a debian repository with all the
 awesome dependencies to compile awesome-git, that way we people on
 debian based distros could just use that repo. I know something like
 this would be possible using the standard debian-unstable repos, but
 this requires pinning and what not.

You said it yourself - there is a repo like that and it is debian
unstable. Maybe it would be worth putting together an updated guide
for debian based distros that explains in simple steps how to add
debian unstable repo to sources.list and something to paste into
/etc/apt/preferences to pin them correctly.

If someone's up for it II could help someone who's on Ubuntu thru the
process and we can make a wiki page out of that.

cheers

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [RFC + PATCH] awful.doc

2009-05-07 Thread koniu
Work still in progress tho slowed down a bit as I'm stuck with some stuff.

I pushed some changes to:
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/awful-doc

1. cleanups - split some stuff into separate functions. There's more
to come, I'm trying to come up with sensible unified way of generating
help output for different kinds of objects (from widget instances to
function objects)  which should bring slightly arbitrary functions
such as gui_object_help() and function_resolver() together - please
don't pay attention to function names at this point, this is all gonna
change once I have a clear vision of the framework.

2. function_resolver_prompt: this doesn't quite work and I need some
expertise here.

Calling awful.help.function_resolver(awful.tag) from awesome-client or
lua prompt works nicely because awful.tag is present in global
environment. Now, if we call that function from inside awful.help
(like in function_resolver_prompt()) the environment is local to the
module and has no concept of awful.tag object.

Ideally I'd like to have all global environment available to allow
retrieving documentation for any keyword, I tried workarounds
involving awful.help.env = _G at the end of my rc.lua and then:

 local a = env[n] - works for anything without a dot in it (not very useful)
 local a = loadstring(return env. .. n)() - invariably bitches about
indexing global 'env' which is nil (even tho it's not).

I would very much appreciate some input on this.


3. minor: renamed grouping key for keybindings from 'class' to
'group', I think we can use 'class' for something a lot more useful.


I will continue to push individual commits so that we can track devel
progress, we can squash them later for merging.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [RFC + PATCH] awful.doc

2009-05-07 Thread koniu
On Thu, May 7, 2009 at 19:22, Julien Danjou jul...@danjou.info wrote:
 At 1241713358 time_t, koniu wrote:

 Maybe add:
 local env = _G
 before you call module() in awful.help.

I think I've tried this and concluded that it gets environment of...
awful/init.lua.
This is not major of the problems tho.

  local a = env[n] - works for anything without a dot in it (not very useful)

 I guess you need to hack 'n' by splitting it on '.' :-(
 For each word before '.' you retrieve env2 = env[first_word] then
 env2[second_word] etc..
 Just an idea.

Yea, I was considering that but it's dirty dirty. I don't understand
why loadstring() way doesn't work, I have a similar thing working in
function_resolver(f) for getting member function descriptions if 'f'
is a module:
  fm = doc.get(loadstring(return ..d.name.fname)())

It doesn't complain about neither d or fname both of which are in
function_resolver local environment (like env is in environment of
function_resolver_prompt() if I do awful.help.environment = _G in
rc.lua or however.

 Take a look at getfenv/setfenv() also. Not sure it can help, just a free hint.

I've played with these too, not much joy.

Anyway, I'll keep trying :P

k

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [RFC + PATCH] awful.doc

2009-05-07 Thread koniu
On Thu, May 7, 2009 at 17:22, koniu gkusni...@gmail.com wrote:
  local a = loadstring(return env. .. n)() - invariably bitches about
 indexing global 'env' which is nil (even tho it's not).

OK, loadstring works in global environment no matter what, so turns
out that a simple:
  a = loadstring(return  .. n)()
does the job so a working version of the prompt is now in the branch.

And now for the completion... ;]

koniu

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] fix delete in awful.prompt

2009-05-07 Thread koniu
Yo,

I've noticed that delete stopped working in prompt recently, this
patch fixes it.

kk
From a6b61838856318fdede51f50df2ec5f5e3f0a273 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 7 May 2009 21:03:04 +0100
Subject: [PATCH] awful.prompt: fix delete

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/prompt.lua.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in
index 21939d5..37e3db5 100644
--- a/lib/awful/prompt.lua.in
+++ b/lib/awful/prompt.lua.in
@@ -279,7 +279,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 cur_pos = cur_pos - 1
 end
 -- That's DEL
-elseif key:byte() == 127 then
+elseif key == Delete then
 command = command:sub(1, cur_pos - 1) .. command:sub(cur_pos + 1)
 elseif key == Left then
 cur_pos = cur_pos - 1
-- 
1.6.2.4



Re: [PATCH] fix delete in awful.prompt

2009-05-07 Thread koniu
And we also don't need that comment anymore, here's updated patch.
From 20c7666a5b7bf2646bba04a8e0a41287c813c634 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 7 May 2009 21:03:04 +0100
Subject: [PATCH] awful.prompt: fix delete

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/prompt.lua.in |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in
index 21939d5..9fdac86 100644
--- a/lib/awful/prompt.lua.in
+++ b/lib/awful/prompt.lua.in
@@ -278,8 +278,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 command = command:sub(1, cur_pos - 2) .. command:sub(cur_pos)
 cur_pos = cur_pos - 1
 end
--- That's DEL
-elseif key:byte() == 127 then
+elseif key == Delete then
 command = command:sub(1, cur_pos - 1) .. command:sub(cur_pos + 1)
 elseif key == Left then
 cur_pos = cur_pos - 1
-- 
1.6.2.4



Re: [Patch] Export :extents() to master and automagically resize naughtyfications

2009-05-06 Thread koniu
 Good work Gregor, thank you very very much.

Ditto. Haven't had any issues with this so far.

 I'm glad to announce this 2 patches are inaugurating the next branch,
 for 3.4. :-)

And to celebrate, I would like to propose a couple more patches to
naughty which I pushed here:
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/naughty-fixes

I have something to report regarding the 1st one tho (add vertical margin):
http://git.mercenariesguild.net/?p=awesome.git;a=commitdiff;h=f5e2e1b560b8fdd8144455f2985c1e78790dc551;hp=a4de441d9bf3606d5cc5ae183e445bbf6082e741

If you look at the diff it's actually:
 textbox:margin({ ..., bottom = 2 * margin }).

For some reason if I do
 textbox:margin({ ..., top = margin, bottom = margin })

The widget gets the right size, but the text is, in vertical axis,
aligned to the bottom while the first one it's centered (as it should
with margin). I blame textbox?

The other two patches are cleanups and as far as I can tell, none of
them should break any configs but please briefly test.

And here's the candy (try repeating that without 3rd patch :P)
http://omploader.org/vMW13bw

Also is there a way to have margins around imagebox?

thanks,
koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [RFC + PATCH] awful.doc

2009-05-01 Thread koniu
Quick update (yay!):

 Anyway here's what I've got so far - NOT QUITE READY FOR MERGING:
 http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/awful-doc

 2. should we add shortcut descriptions to default rc.lua
 I started making this and will soon push it to the branch

Preliminary version of a documented awesomerc.lua.in is in the branch
now. global/client-keys are documented and so are tag/task-list
widgets and their buttons. More to come when I get to do some testing.
I rearranged the shortcut definitions a bit so they're grouped by
context.

 - the list ends up being very long which kinda uncovers a bug in
 naughty (if too long for the screen)
 - it gets even worse if i add any descriptions to the mod+1..9 loop,
 i'm not sure how to handle that

I'm thinking of making a sub-procedure which will aggregate numerical
keybindings into one entry (mod + 1..9) if they have identical
descriptions.

 m - mouse helper
 Preliminary grabber function done, haven't hooked up any actual
 awful.doc code to it yet. This could perhaps be a lot more useful if
 we were able to get capi documentation thru 'function resolver' to be
 able to also display available textbox/wibox/etc params.

This is now implemented to a big extent and will show you buttons:
http://omploader.org/vMWx4bA

I had to hack awful/widget/common.lua so that we can set a description
for a whole array of widgets (tag/tasklist) and the update function
will pass them to individual img/textboxes.

That's it for now, more to come.

k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] 0001-awful.titlebar-allow-titlebar_font-in-themes

2009-04-30 Thread koniu
A quickie allowing users to set a custom titlebar_font in their themes.

k
From 2b357b7e51d8ea29fe3f47263d05aee8ce8bc96c Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Fri, 1 May 2009 03:16:17 +0100
Subject: [PATCH] awful.titlebar: allow titlebar_font in themes

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/titlebar.lua.in |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in
index a0c8b9c..ba6981e 100644
--- a/lib/awful/titlebar.lua.in
+++ b/lib/awful/titlebar.lua.in
@@ -66,12 +66,14 @@ function add(c, args)
 data[c].fg_focus = args.fg_focus or theme.titlebar_fg_focus or theme.fg_focus
 data[c].bg_focus = args.bg_focus or theme.titlebar_bg_focus or theme.bg_focus
 data[c].width = args.width
+data[c].font = args.font or theme.titlebar_font or theme.font
 
 local tb = capi.wibox(args)
 
 local title = capi.widget({ type = textbox, align = flex })
 if c.name then
-title.text =   .. util.escape(c.name) ..  
+title.text = span font_desc=' .. data[c].font .. '  ..
+ util.escape(c.name) ..  /span
 end
 
 -- Redirect relevant events to the client the titlebar belongs to
@@ -119,7 +121,8 @@ function update(c, prop)
 local widgets = c.titlebar.widgets
 if prop == name then
 if widgets.title then
-widgets.title.text =   .. util.escape(c.name) ..  
+widgets.title.text = span font_desc=' .. data[c].font ..
+ ' .. util.escape(c.name) ..  /span
 end
 elseif prop == icon then
 if widgets.appicon then
-- 
1.6.2.1



Re: [RFC + PATCH] awful.doc

2009-04-25 Thread koniu
On Sat, Apr 25, 2009 at 13:46, Julien Danjou jul...@danjou.info wrote:
 At 1240658186 time_t, koniu wrote:
 I see. Could you explain the rationale? If we where to use this, we
 could as well limit it to this:
  function getdata()
    return data
  end

 Yes, that's another possibility.
 There's no rationale, I just think your filter is too limited and
 narrow-minded.

Haha, thanks :P. I do believe that you must still be talking about the
first version of it because the 2nd one allows just as much as
getdata() except it internalizes some, I believe, typical stuff for
ease of use.

 I'd prefer my solution or getdata() in a first time. Then, if many
 people want to filter on string matching we could add a funtion filter
 based on string matching.

 So, I'd probably stick with getdata() before we dig too much in a
 unrelated direction. ;-)

Agreed, as discussed, a squashed version without filtering and with
getdata is here
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/awful-doc
along with awful.key patch. Should I prepare awful.button same way?

 But then, you'll ask why we don't have a filter function everywhere,
 like for getting visible clients from awful.client.visible().

 So we will start writing awful.filter that takes a table of data as
 first arguement and a filter function as a second arg, so we can filter
 any type of data from documentation table to client table, etc.

Haha, über-modular huh, starts feeling a bit like splitting a hair
into four but that's fine by me, the more sensibly reusable code the
better. Newcomers will have a lot of fun figuring out what's what in
awful tho ;].

Yey,
koniu

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [RFC + PATCH] awful.doc

2009-04-25 Thread koniu
Anyway, remaining questions relating to shortcut documenting:

1. where would we put the default function to display the cheatsheet?
(likely requires: awful, beautiful, naughty)
2. should we add shortcut descriptions to default rc.lua
3. what should be the default keybinding for [1].

I'm willing take up the coding, just wanna know how this should be organized..

thanks,
k

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[RFC + PATCH] awful.doc

2009-04-23 Thread koniu
 problem is
that I can't seem to be able to override the default formats, after
require awful in rc.lua I do
  awful.doc.desc_format = %-50s %s
  awful.doc.desc_sep =  + 
but to no avail.

3.3 luadoc - I'm not really sure if the proposed luadoc comments are
clear enough.

3.4 namespace - some names of vars could possibly be made more
intuitive (esp the ones added to awful.key as per 3.2)


OK, I'm sick of writing this post tho at least there's gonna be decent
documentation for this module ;]. So you at least skimmed thru all of
it? Here's the prize, this is what all of this enables in a format
which supposedly is worth more than 1k words:
http://silenceisdefeat.com/~koniu/awesome/shots/2009-04-19-042807_1024x768_scrot.png

Tell me what you think.
koniu
From d538a38bf627f0351f9df15909911dcf4a5141f4 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 23 Apr 2009 04:38:24 +0100
Subject: [PATCH 1/3] awful.doc: import

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/doc.lua.in |   73 ++
 1 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 lib/awful/doc.lua.in

diff --git a/lib/awful/doc.lua.in b/lib/awful/doc.lua.in
new file mode 100644
index 000..9cb83fe
--- /dev/null
+++ b/lib/awful/doc.lua.in
@@ -0,0 +1,73 @@
+---
+-- @author koniu lt;gkusni...@gmail.comgt;
+-- @copyright 2009 koniu
+-- @release @AWESOME_VERSION@
+---
+
+-- Grab environment
+local type = type
+local pairs = pairs
+local util = require(awful.util)
+
+--- Documentation module for awful
+module(awful.doc)
+
+-- initialize local structures
+local data = {}
+local def = {}
+
+--- Document an object
+-- @usage This function can be used to document any object in Lua code. The
+-- description (desc) is stored as a table with a key 'text' which is a string
+-- containing the actual description. It may also contain other keys which can
+-- be used by any function retrieving the docs. Another standard key is 'class'
+-- which is meant for grouping different types of descriptions. For convenience,
+-- if the 'desc' argument provided is a string, it will automagically be
+-- converted into a table { text = desc }. For the same reason, the function
+-- returns the documented object, so you can use it as a wrapper around another
+-- function which returns the object we wish to document.
+-- @param obj Object to document
+-- @param desc String or table with description
+-- @return Object given in the argument
+function set(obj, desc)
+if not obj or not desc then return obj end
+if type(desc) == string then desc = { text = desc } end
+data[obj] = util.table.join(def, desc)
+return obj
+end
+
+--- Get object's description
+-- @param obj Object to retrieve description for
+-- @return Table with the description
+function get(obj)
+if obj then return data[obj] end
+end
+
+--- Get a filtered list of objects and their descriptions
+-- @param filter Table with keys to be matched (optional). The values are
+-- matched using string.find so you can use non-exact/regex strings.
+-- @return Table of all descriptions that match the filter
+function list(filter)
+local ret = {}
+for obj, desc in pairs(data) do
+local match = true
+if filter then
+for k, v in pairs(filter) do
+if not desc[k] or (desc[k] and not desc[k]:find(v)) then
+match = false
+end
+end
+end
+if match then ret[obj] = desc end
+end
+return ret
+end
+
+--- Set a default table of description keys.
+-- The keys will be merged with keys provided in arguments to set(),
+-- with the latter overriding the defaults if present.
+-- @param desc Default description table
+-- @return None
+function set_default(desc) def = desc end
+
+-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
-- 
1.6.2.1

From c1f600cb04a338b717e2a1dd88b584132f2c1d35 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 23 Apr 2009 04:39:14 +0100
Subject: [PATCH 2/3] awful.key: add awful.doc support

This adds an extra argument 'desc' to awful.key() which is passed
along with the first returned key object to awful.doc.set(). This is
meant for easy documentation of keybindings.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/key.lua.in |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/awful/key.lua.in b/lib/awful/key.lua.in
index 18a8097..ecac562 100644
--- a/lib/awful/key.lua.in
+++ b/lib/awful/key.lua.in
@@ -10,6 +10,7 @@ local ipairs = ipairs
 local unpack = unpack
 local capi = { key = key }
 local util = require(awful.util)
+local doc = require(awful.doc)
 
 --- Key helper for awful
 module(awful.key)
@@ -25,14 +26,19 @@ ignore_modifiers = { Lock, Mod2

[PATCH] 0001-awful.util-add-missing-to-show-pread-in-luadoc.patch

2009-04-23 Thread koniu
A missing '-' prevents awful.util.pread from being show in the api reference.

k
From b3643d7fdb3908dd6dab4ce978528295ee383631 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 23 Apr 2009 09:12:53 +0100
Subject: [PATCH] awful.util: add missing - to show pread in luadoc

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/util.lua.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in
index d310204..7074096 100644
--- a/lib/awful/util.lua.in
+++ b/lib/awful/util.lua.in
@@ -74,7 +74,7 @@ function spawn(cmd, sn, screen)
 end
 end
 
--- Read a program output and returns its output as a string.
+--- Read a program output and returns its output as a string.
 -- @param cmd The command to run.
 -- @return A string with the program output.
 function pread(cmd)
-- 
1.6.2.1



Re: [RFC + PATCH] awful.doc

2009-04-23 Thread koniu
On Thu, Apr 23, 2009 at 11:21, Andrei Thorp gar...@gmail.com wrote:
 somewhat easier is making Awesome modal -- press a binding to switch
 your binding mode based on keybinding class. This may or may not make
 sense, but it's kind of nifty-sounding as a VIM geek.

You bet it makes sense, especially with per-tag/client keybindings
(first big Shifty upgrade since long ago). Not that I really need the
cheat-sheets so badly as I tend to remember all the bindings I use,
but having installed awesome for a couple of people who've never even
seen the config this should put say again, what do i press for... to
a definite end :]

 Great initiative, spectacular to have you back :)

Cheers man, I'm myself extremely happy to be back in the game, took
some sleepless nights to tune back in but it was definitely worth it -
awesome [hacking] über alles.

kk

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] awful.util-table.join-ignore-nil-arguments.patch

2009-04-18 Thread koniu
Once again, the title reveals it all. I thought it doesn't really need
to bail out on something that's supposed to return a table but doesnt.

koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] awful.titlebar typo

2009-04-17 Thread koniu
anrxc on irc picked this up, one dot missing

k
From 24766c8c9ec7d33395949dc697d37b714bc23675 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Fri, 17 Apr 2009 18:45:20 +0100
Subject: [PATCH] awful.titlebar: fix typo

---
 lib/awful/titlebar.lua.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in
index cdc8feb..46f3a38 100644
--- a/lib/awful/titlebar.lua.in
+++ b/lib/awful/titlebar.lua.in
@@ -63,7 +63,7 @@ function add(c, args)
 end
 
 -- Redirect relevant events to the client the titlebar belongs to
-local bts = util.tablejoin(
+local bts = util.table.join(
 button({ }, 1, function (t) capi.client.focus = t.client t.client:raise() mouse.client.move(t.client) end),
 button({ args.modkey }, 1, function (t) mouse.client.move(t.client) end),
 button({ args.modkey }, 3, function (t) mouse.client.resize(t.client) end)
-- 
1.6.2.1



[PATCH] awful.util.table.concat - name and number of arguments

2009-04-15 Thread koniu
Hi,

I'm very happy about this functionality making it into awful.util but
I see two issues:

1. Why not allow adding together more than 2 tables? (there's also
inconsistency about this in the comments)

2. table.concat is an existing lua function which does something
else - takes a table and returns a string of all its elements
concatenated with a given separator. To avoid confusion I would rename
the function in awful.util to table.join.

Patches for both attached.

cheers,
koniu
From b17eb642d8bdd3c6ad4375cc97ceee62e9ecde7a Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Wed, 15 Apr 2009 20:29:00 +0100
Subject: [PATCH 1/2] awful.util.table.concat: take any number of arguments

Allows joining more than 2 tables at a time

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/util.lua.in |   16 ++--
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in
index 1a24068..6467c3b 100644
--- a/lib/awful/util.lua.in
+++ b/lib/awful/util.lua.in
@@ -218,18 +218,14 @@ function subsets(set)
 end
 
 --- Concat all tables given as parameters.
--- This will iterate both tables and insert value from 1 to N.
+-- This will iterate all tables and insert value from 1 to N.
 -- Non integer keys are ignored.
--- @param t1 First table.
--- @param t2 Second table.
--- @return A new table with t1 and t2 concatened.
-function table.concat(t1, t2)
+-- @param args A list of tables to concatenate
+-- @return A new table with arguments concatened.
+function table.concat(...)
 local ret = {}
-for k, v in ipairs(t1) do
-ret[#ret + 1] = v
-end
-for k, v in ipairs(t2) do
-ret[#ret + 1] = v
+for i = 1, arg.n do
+for k, v in ipairs(arg[i]) do table.insert(ret, v) end
 end
 return ret
 end
-- 
1.6.2.1

From c18a0f72033deb158a45c6fae0d50f4440f6e490 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Wed, 15 Apr 2009 20:33:21 +0100
Subject: [PATCH 2/2] awful.util: rename table.concat to table.join

This is to avoid confusion with Lua's table.concat which takes a table
and returns a string of all its elements concatenated with a given
separator.

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/button.lua.in |2 +-
 lib/awful/key.lua.in|2 +-
 lib/awful/util.lua.in   |8 
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/awful/button.lua.in b/lib/awful/button.lua.in
index 4c9d4db..3ba02e4 100644
--- a/lib/awful/button.lua.in
+++ b/lib/awful/button.lua.in
@@ -31,7 +31,7 @@ local function new(_, mod, ...)
 local ret = {}
 local subsets = util.subsets(ignore_modifiers)
 for _, set in ipairs(subsets) do
-ret[#ret + 1] = capi.button(util.table.concat(mod, set), unpack(arg))
+ret[#ret + 1] = capi.button(util.table.join(mod, set), unpack(arg))
 end
 return unpack(ret)
 end
diff --git a/lib/awful/key.lua.in b/lib/awful/key.lua.in
index d50066c..bf8a422 100644
--- a/lib/awful/key.lua.in
+++ b/lib/awful/key.lua.in
@@ -31,7 +31,7 @@ local function new(_, mod, ...)
 local ret = {}
 local subsets = util.subsets(ignore_modifiers)
 for _, set in ipairs(subsets) do
-ret[#ret + 1] = capi.key(util.table.concat(mod, set), unpack(arg))
+ret[#ret + 1] = capi.key(util.table.join(mod, set), unpack(arg))
 end
 return unpack(ret)
 end
diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in
index 6467c3b..2712bb8 100644
--- a/lib/awful/util.lua.in
+++ b/lib/awful/util.lua.in
@@ -217,12 +217,12 @@ function subsets(set)
 return ret
 end
 
 Concat all tables given as parameters.
+--- Join all tables given as parameters.
 -- This will iterate all tables and insert value from 1 to N.
 -- Non integer keys are ignored.
--- @param args A list of tables to concatenate
--- @return A new table with arguments concatened.
-function table.concat(...)
+-- @param args A list of tables to join
+-- @return A new table containing all interger keys from the arguments.
+function table.join(...)
 local ret = {}
 for i = 1, arg.n do
 for k, v in ipairs(arg[i]) do table.insert(ret, v) end
-- 
1.6.2.1



Re: [PATCH] awful.util.table.concat - name and number of arguments

2009-04-15 Thread koniu
On Wed, Apr 15, 2009 at 21:13, Julien Danjou jul...@danjou.info wrote:
 At 1239824491 time_t, koniu wrote:
 Patches for both attached.
 I agree with you, pushed.

Thanks Julien, I'm afraid I didn't do enough testing, turns out to be
rtable.insert not table.insert, here's a quickie to amend that.

Sorry about that :)

kkk
From 29ac6c1ecdb18fec634c2a2e08b7dc545734e9cb Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Wed, 15 Apr 2009 21:53:14 +0100
Subject: [PATCH] awful.util.table.join: fix typo

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/util.lua.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in
index 2712bb8..87aadf9 100644
--- a/lib/awful/util.lua.in
+++ b/lib/awful/util.lua.in
@@ -225,7 +225,7 @@ end
 function table.join(...)
 local ret = {}
 for i = 1, arg.n do
-for k, v in ipairs(arg[i]) do table.insert(ret, v) end
+for k, v in ipairs(arg[i]) do rtable.insert(ret, v) end
 end
 return ret
 end
-- 
1.6.2.1



[PATCH] awful.widget.taglist: remove needless taglist_squares conditions

2009-04-13 Thread koniu
Moorning,

Here's another taglist tweak, also Julien's favourite - deletion! :]

Some time ago I noticed that the margin to the left of the tag name
disappeared.
Looks like this:   http://omploader.org/vMWlvaw  - eyesore

If you look at the screenshot, you will notice that I don't use taglist_squares,
which turned out to be the reason - if I uncommented those in the theme, the
padding was correct.

I think we need the additional space in front of the text whether
there are squares
or not, so the if's are just in the way.

Also the condition for t.name will always be met (tag has to have a name,
doesn't it?), so I removed that.

kk
From 28f06b746fecbb578b606cfd9756d846b12b96e1 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Mon, 13 Apr 2009 11:36:09 +0100
Subject: [PATCH] awful.widget.taglist: remove needless taglist_squares conditions

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/widget/taglist.lua.in |   18 +++---
 1 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/lib/awful/widget/taglist.lua.in b/lib/awful/widget/taglist.lua.in
index 3d58477..c831858 100644
--- a/lib/awful/widget/taglist.lua.in
+++ b/lib/awful/widget/taglist.lua.in
@@ -134,25 +134,13 @@ function label.all(t, args)
 end
 end
 end
-local taglist_squares = false
-if taglist_squares_sel or taglist_squares_unsel then
-taglist_squares = true
-end
-if t.name and not tag.getproperty(t, icon_only) then
+if not tag.getproperty(t, icon_only) then
 if fg_color then
 text = text .. span color='..util.color_strip_alpha(fg_color)..'
-if taglist_squares then
-text = text ..  
-end
-text = text..util.escape(t.name).. /span
+text =   .. text..util.escape(t.name).. /span
 else
-if taglist_squares then
-text = text ..  
-end
-text = text .. util.escape(t.name) ..  
+text = text ..   .. util.escape(t.name) ..  
 end
-elseif taglist_squares then
-text = text ..  
 end
 text = text .. /span
 if tag.geticon(t) and type(tag.geticon(t)) == image then
-- 
1.6.2.1



Re: New Lua object system

2009-04-12 Thread koniu
 Good catch, should be fixed now.

Works like a charm, death to FS493 :]

thanks o/
koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] awful.widget.taglist: dont show name if icon_only property is set

2009-04-12 Thread koniu
Hi,

Here's a trivial patch which allows users to have a tag displayed with
an icon only if they set 'icon_only' property for it.
Choice of the name might not be the best one, but taglist_icon_only
seems terribly long for what it is.

awful.tag.setproperty(t, icon_only)
koniu
From e3ecdd4284db1545f8b5ef8ae5fafc6d1871f255 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Mon, 13 Apr 2009 03:54:46 +0100
Subject: [PATCH] awful.widget.taglist: dont show name if icon_only property is set

Signed-off-by: koniu gkusni...@gmail.com
---
 lib/awful/widget/taglist.lua.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/awful/widget/taglist.lua.in b/lib/awful/widget/taglist.lua.in
index 552316e..3d58477 100644
--- a/lib/awful/widget/taglist.lua.in
+++ b/lib/awful/widget/taglist.lua.in
@@ -138,7 +138,7 @@ function label.all(t, args)
 if taglist_squares_sel or taglist_squares_unsel then
 taglist_squares = true
 end
-if t.name then
+if t.name and not tag.getproperty(t, icon_only) then
 if fg_color then
 text = text .. span color='..util.color_strip_alpha(fg_color)..'
 if taglist_squares then
-- 
1.6.2.1



Re: New Lua object system

2009-04-11 Thread koniu
Hey,

 I've pushed the branch as jd/new-object. I did not found any bug (in
 fact I fixed half a dozen in the process), but I'd like some test before
 I merge it into master.

Maybe here's one - screen:tags(arg) fails to set the tag table
properly for #arg  1. Only the first tag in arg table makes it into
the screen.

t1 = tag('1')
t2 = tag('2')
screen[1]:tags({t1, t2})
return(#screen[1]:tags())
1

This is what I get:
W: awesome: luaA_dofunction:268: error running function: invalid key to 'next'

kk

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: [PATCH] why hardcode the 'default' tag

2009-04-09 Thread koniu
Hi,

 if you restart awesome and the rc.lua doesnt create any tags at all, what
 happens? When I was using shifty I used to lose a couple of windows across
 awesome restart. They just disappeared, but the app was still running.

If rc.lua doesn't create tags when awesome is restarted, by default,
there will be no tags. Shifty deals with this situation by attaching
its match() function to the 'manage' hook which is executed for each
client (window) that is opened. match() function should place the
client in a relevant tag which either exist (then the client is merely
moved to the tag) or not (in which case shifty will create the tag and
then move the client there).

 Would this patch cause something like this to happen more easily? Is this 
 issue
 completely unrelated and I should report it instead of blaming myself for the
 lost windows?

Having said that, shifty is still fairly experimental and some
glitches may occur. With the current version I haven't had any windows
vanishing but if it does happen then there' a bug which should be
fixed. If you're experiencing such behavior you should post a report
with detailed information as to what gets lost in what circumstances,
with what configuration values (and hopefully a reproducible test
case). This way we can try to hunt the issue down.

thanks,
koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


[PATCH] why hardcode the 'default' tag

2009-04-08 Thread koniu
Hi,

I was wondering if there's a strong reason for having the hardcoded
bit forcing default tag to be created if there are no tags in the
screen. I think that this should be left to lua side - with the
current default rc.lua never even touching the problem (static tags)
and users/libraries (like shifty) possibly knowing what they're doing.

I've been using the attached patch for the whole of today and haven't
hit any issues.

thanks
koniu
From c0cddd4e24510f4d163d35eca1535bf4d6b79e82 Mon Sep 17 00:00:00 2001
From: koniu gkusni...@gmail.com
Date: Thu, 9 Apr 2009 01:04:41 +0100
Subject: [PATCH] screen: do not hardcode the 'default' tag

Signed-off-by: koniu gkusni...@gmail.com
---
 luaa.c   |5 -
 screen.c |9 -
 2 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/luaa.c b/luaa.c
index 583c6dd..5ad97da 100644
--- a/luaa.c
+++ b/luaa.c
@@ -899,11 +899,6 @@ bailout:
 
 p_delete(confpath);
 
-/* Assure there's at least one tag */
-for(screen = 0; screen  globalconf.nscreen; screen++)
-if(!globalconf.screens[screen].tags.len)
-tag_append_to_screen(tag_new(default, sizeof(default) - 1),
- globalconf.screens[screen]);
 return ret;
 }
 
diff --git a/screen.c b/screen.c
index adf023b..d31b7d6 100644
--- a/screen.c
+++ b/screen.c
@@ -443,15 +443,6 @@ luaA_screen_tags(lua_State *L)
 tag_append_to_screen(*tag, s);
 lua_pop(L, 1);
 }
-
-/* check there's at least one tag! */
-if(!s-tags.len)
-{
-luaA_warn(L, screen %d has no tag, taking last resort action and adding default tag\n,
-  s-index);
-tag_append_to_screen(tag_new(default, sizeof(default) - 1), s);
-return 1;
-}
 }
 else
 {
-- 
1.6.2.1



Re: key redirection

2008-12-29 Thread koniu
On Mon, Dec 29, 2008 at 17:12, Julien Danjou jul...@danjou.info wrote:
 At 1230295231 time_t, Nicolau Werneck wrote:
 I am using teamspeak, and I would like to select a certain key so that
 whenever I press it, awesome just behave as if I were focused in that
 program's window, sending it to the program.

 I've just commited such a functionnality.

\o/ Im gonna have so much fun when I come back from my voyages, thanks =)

koniu

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.


Re: More patches

2008-12-11 Thread koniu
On Thu, Dec 11, 2008 at 09:39, Julien Danjou [EMAIL PROTECTED] wrote:
 Kudos for doing such an ungrateful job, Maarten.

Ungrateful? He's personally my awesome hero of the month. Keep it up man!

koniu

ps. sorry for this slight ot, but lists of patches like this just
gotta get praise.

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: spawn+tag switch bug

2008-11-27 Thread koniu
On Thu, Nov 27, 2008 at 17:54, Julien Danjou [EMAIL PROTECTED] wrote:
 At 1227807090 time_t, Sebastien Gross wrote:
 Now click on OpenOffice menu tag 1 would become visible, tag 2 is now
 hidden. It's kinda messy.

Look, I really dont want to sound like an ad (again) but if you think
that things get messy (which I agree, does happen) and you want to
have control over your tags and how clients interact with them, I'd
recommend trying shifty extension.  Check the wiki page for more
explanation:
http://awesome.naquadah.org/wiki/index.php?title=Shifty

Note that even tho it's a dynamic tagging library and can do quite a
few things, you can also quite easily configure it to emulate static
tags and just use the client control functionality.

koniu

ps. (sorry, had to be done :P)

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: Lua layouts in next

2008-11-27 Thread koniu
Hey, you probably realize but to even keep track - there's somethings
wrong with the lua layouts in next as they are now (unless i managed
to misconfigure something badly) but anyway there's some obvious
artifacts like missing tiles and such:

http://omploader.org/veXc1

Also I've noticed that max layout is now identical to say tile bottom
with only one client - there's a gap between the focused (and only
visible) client and the bottom/right edges of the workarea, makes my
terminal look real bad so I reverted to next before the lua layouts.

Someone is looking into this, right? :)

o/
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: [EMAIL PROTECTED]: Bug#506803: awesome: naughty's notify should return 'notification']

2008-11-25 Thread koniu
 Subject: Bug#506803: awesome: naughty's notify should return 'notification'

 Since a48e71af18644af61fbbb536d88fb1dcad856631 destroy() takes a notification
 object instead. Unfortunately notify() doesn't return the created 
 notification,
 so destroy() is pretty much useless at the moment.
 The attached patch fixes the api doc of destroy and adds an according return
 statement to notify().

 koniu ?


Whoa, I made a bug in debian \o/

Anyway, I see you got the returning notification that I pushed earlier
http://git.naquadah.org/?p=awesome.git;a=commit;h=a1008c1506885b973287a4e8b6224058b3ee2852

Luadoc fix for destroy is in the branch now:
http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=0cbdd6e17ecec8755f85b602e15bb4742115f35a

thanks for heads up
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: Unfocus handling in move-not-unmap patch

2008-11-25 Thread koniu
On Tue, Nov 25, 2008 at 10:32, Julien Danjou [EMAIL PROTECTED] wrote:
 Now that awesome only move them, they just keep focus. That means that
 if you switch to an empty tag, that latest window focused stil has the
 focus and still receive keys event. :)

Hey, I noticed this behaviour just recently and thought that it was me
messing something up with shifty. Good to read an explanation :P

k

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: [PATCH] naughty: hover_timeout can now be used in notify()

2008-11-24 Thread koniu
And one more tweak, even if clicking the popup runs a function it
should still destroy i:
http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=3deaafdc512ede2809ed995146735396e6728aa8
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/naughty

cheers,
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


naughty improvements + awful.util file_exists()

2008-11-22 Thread koniu
There's 2 updates to naughty:

* naughty: never scale icon to text height
  Also removes default icon_size of 16 to avoid confusion.
  
http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=f88011c82602090d8b03c9718b055cd08fb30657

* naughty: notify() returns notification object
  This makes notification mangling outside of naughty.lua much easier:
  Eg. http://awesome.naquadah.org/wiki/index.php?title=Naughty#Popup_calendar

And a proposed patch to awful.util that adds a function to check if
file exists/is readable:
  
http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=06f3155ec11786d36332a00eebc5f9c4d8264bbc

All bunch on top of current 'next' in naughty branch:
http://git.mercenariesguild.net/?p=awesome.git;a=shortlog;h=refs/heads/naughty

Also, courtesy of lwi, naughty icon detection coming!

cheers,
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: naughty improvements + awful.util file_exists()

2008-11-22 Thread koniu
On Sat, Nov 22, 2008 at 16:40, koniu [EMAIL PROTECTED] wrote:
 And a proposed patch to awful.util that adds a function to check if
 file exists/is readable:
  
 http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=06f3155ec11786d36332a00eebc5f9c4d8264bbc

As rightfully suggested by farhaven the name file_exist doesn't give
it full justice as it returns nil when file is not readable. Here's
updated commit (s/exists/readable):

http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=57b0d6b28eddd3550e58eb444d82a4446fbbf6de

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


[PATCH] add awful.prompt.run() 'selectall'' argument

2008-11-19 Thread koniu
http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=ee0d82afb15f231b08bf8dc1a62a5e78988560e9
branch prompt

awful.prompt: new arg 'selectall' in add()

If set along with 'text' (prefilled content) it will position the cursor at
the beginning of the line and and on text input (and not control keys,
arrows, etc.) will overwrite the prefilled content with the new input.

JD, would you like to merge this? Allows easy deletion of prefilled
text emulating editbox 'selectall' on focus.

cheers,
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


[PATCH] awful.prompt: add trail space in prompt_text_with_cursor()

2008-11-19 Thread koniu
Hi,

http://git.mercenariesguild.net/?p=awesome.git;a=commit;h=4c031ba398db963a196e03d2d5d22fd7e819a215
branch prompt

awful.prompt: add trail space in prompt_text_with_cursor()

Adds a trailing space after text if cursor position  text length to
prevent width of the widget changing particularly useful when using
'text' and 'selectall' to do eg. in-place renaming.

Sample textbox content (# space, _ cursor).

Before:
textbox before prompt: #term#
selectall prompt textbox : #_erm   - shorter than other cases
  after pressing end : #term_

After:
textbox before prompt: #term#
selectall prompt textbox : #_erm#
  after pressing end : #term_


Julien, will you accept this one - makes shifty very very very shiny. :)

thanks
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: segfaults with new tag/tasklist

2008-10-21 Thread koniu
 I've pushed a fix in a5640330d95ed1ca0393844563f75a79d5368fbf which may,
 or may not fix that bug.

 Could you give it a try?

Worked! Thanks :)

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


segfaults with new tag/tasklist

2008-10-20 Thread koniu
Hello,

I updated to current git and re-did my config to use tables instead of
functions checking against the updated default rc.lua. Now, as soon as
I open a client awesome segfaults. This doesn't happen if I comment
out the line inserting the tasklist into a wibox. Same thing occurs
when I try to dynamically create tags with shifty, pre-created tags
show up fine but first attempt to create a tag on-the-fly results in a
segfault.

My rc.lua: http://silenceisdefeat.org/~koniu/awesome/rc.lua.trans
Shifty needed for it to work:
http://silenceisdefeat.org/~koniu/awesome/shifty.lua
gdb log with regular and long backtracks is attached.

Both files are a bit messy, partially due to me desperately trying to
make the current git to work so I can get on with coding.

Default rc.lua works fine, but I just can't see what I'm doing
different/wrong, at least as far as tasklist goes. Instead I've been
going around in circles and my only workarounds is to disable
task/taglist (not very useful) or revert to git before the big commit.
I would appreciate some insight on the matter.

cheers,
koniu


bt.log
Description: Binary data


Re: invaders.lua bug report

2008-10-17 Thread koniu
Heyup,

So how's this going? I just updated to latest git and I'm getting the
same invaders behavior:
- trash in alpha areas and
- no keyboard input

I don't use a background pixmap, instead I set a solid color with xsetroot.

On Wed, Oct 15, 2008 at 19:35, Julien Danjou [EMAIL PROTECTED] wrote:
 I think awesome should draw a black rectangle if it fails to copy
 background image (widget.c:widget_render()).

 Anyone want to test my assumption, I'm in the middle of something else
 right now?

If I understand correctly that would cause black outlines on objects
in invaders when there's no background pixmap at all. drawing a wibox
as a background for the whole game would solve that but i  think it
has issues of its own.

just my 5p.

cheers,
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


Re: naughty - popup notifications for awesome3

2008-10-14 Thread koniu
Ahoy,

On Mon, Oct 13, 2008 at 19:26, Julien Danjou [EMAIL PROTECTED] wrote:
 At 1223918862 time_t, Gregor Best wrote:
 How would you setup a timer hook to be executed only once? I could need that
 for Space Invaders :)

 Call unregister() ?

I've spent some time trying to figure it out but unregisters() is not
documented anywhere and I have no clue how to refer to a timer once
it's been created.

Check out current version:
http://silenceisdefeat.org/~koniu/naughty.lua

It creates a timer for every notification (much better behavior) at
the end of notify(), but it should be unregistered in destroy(). Could
you help with a line?

thanks,
koniu

-- 
To unsubscribe, send mail to [EMAIL PROTECTED]