Re: How to set a default-icon for a window?

2011-11-04 Thread Wladyslaw Zbikowski
On Thu, Nov 3, 2011 at 3:27 AM, Uli Schlachter psyc...@znc.in wrote:
 Uhm, your two points don't make sense. If it doesnt work, how can it cause
 infinite recursion?

Sorry, my mistake - I didn't realize that c.class could change
depending on how the program was launched, which caused some temporary
confusion. The icon signal is really emitted every time the icon
changes.

 local recursion = false

Thanks, this trick works. I have custom icons working well now without
modifying Awful. The last part was to get per-window icons to be
persistent across restarting Awesome, using a temp file and rule
callback (I hope I am muddying the waters too much with bad practices
;)

# ~/.bashrc
function icon () {
if ! [ -f $* ]; then
echo $*: no such file
else
(
echo c=client.focus
echo capi={oocairo=oocairo}
echo c.icon=capi.oocairo.image_surface_create_from_png(\$*\)
) | awesome-client
echo $*  /tmp/run/$PPID.icon # make persistent
fi
}

# ~/.config/awesome/rc.lua

{ rule_any = { class = {X-terminal-emulator, Terminator} },
  callback = function(c)
local file = io.open(/tmp/run/ .. c.pid .. .icon, r)
if file then
   for line in file:lines() do
  c.icon = 
capi.oocairo.image_surface_create_from_png(line)
   end
   io.close(file)
else
   c.icon =
capi.oocairo.image_surface_create_from_png(/home/jesse/icons/plork.png)
end
  end },

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


Re: How to set a default-icon for a window?

2011-11-03 Thread Uli Schlachter
On 03.11.2011 01:27, Wladyslaw Zbikowski wrote:
 On Tue, Nov 1, 2011 at 6:50 PM, Anurag Priyam anurag08pri...@gmail.com 
 wrote:
 Does `property::icon`[1] signal work?

 [1]: https://awesome.naquadah.org/wiki/Signals#client
 
 Unfortunately not - two problems I run into intercepting the icon signal:
 
 1. Whatever causes the Emacs and Acrobat icons to change, does not
 emit the signal
 
 2. Setting the icon from within the icon change handler causes
 infinite recursion
 
 client.connect_signal(property::icon_name, function (c)
if c.class == Emacs then
   print(Emacs icon just changed)
   if c.icon ~= gnuimg then
  c.icon = gnuimg
  print(You won't get here 
 til you hit a stack overflow)
   end
end
 end)

Uhm, your two points don't make sense. If it doesnt work, how can it cause
infinite recursion?

Anyway:

local recursion = false
client.connect_signal(property::icon,
  -- Why were you using icon_name? That is the name when the client is iconified
  -- aka minimized
  function(c)
if recursion then return end
recursion = true
c.icon = gnuimg
-- I don't think your icon ~= gnuimg check does what you want.
-- It checks if it is the same image, not if the two images have the
-- same content
recursion = false
end)

-- 
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?

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


Re: How to set a default-icon for a window?

2011-11-02 Thread Daniel
 In case you didn't figure it out yet, setting icon in the rules table works.

 { rule = { name = irssi },
   properties = {floating = true, icon = image(beautiful.chat)}
 }

 `beautiful.chat` is a PNG.

I only get attempt to call global image (a nil value on this, and (fresh from
git) awesome crashes. What gives?



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


Re: How to set a default-icon for a window?

2011-11-02 Thread Uli Schlachter
On 02.11.2011 14:10, Daniel wrote:
 In case you didn't figure it out yet, setting icon in the rules table works.

 { rule = { name = irssi },
   properties = {floating = true, icon = image(beautiful.chat)}
 }

 `beautiful.chat` is a PNG.
 
 I only get attempt to call global image (a nil value on this, and (fresh 
 from
 git) awesome crashes. What gives?

image() is a awesome-3.4-ism. With git/master it's
oocairo.image_surface_create_from_png().

(create_from_png() only supports PNG files while image() could handle a number
of other formats, but people will have to live with that or invent magic)

Uli

-- 
- He made himself, me nothing, you nothing out of the dust
- Er machte sich mir nichts, dir nichts aus dem Staub

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


Re: How to set a default-icon for a window?

2011-11-01 Thread Klaus Umbach
On 29.10.11 20:22, Anurag Priyam wrote:
 On Thu, Sep 22, 2011 at 10:32 PM, Anurag Priyam
 anurag08pri...@gmail.com wrote:
  On Wed, Sep 21, 2011 at 1:21 PM, Klaus Umbach treibholz-awes...@uxix.de 
  wrote:
  On 19.09.11 02:33, Anurag Priyam wrote:
  [...]
  $ awesome-client
  c = client.focus
  c.icon = mailicon.image
 
  Where in rc.lua can I set this?
 
  That is for you to figure out and let us know too :). I would try it
  through rules or 'manage' signal first.
 
 In case you didn't figure it out yet, setting icon in the rules table works.
 
 { rule = { name = irssi },
   properties = {floating = true, icon = image(beautiful.chat)}
 }
 
 `beautiful.chat` is a PNG.

Yes, this works great for specific windows, but not as a default-rule. If I
set it for all windows, those which already have an icon get overwritten. I
only want the default-icon for those which have none.

-
Klaus



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


Re: How to set a default-icon for a window?

2011-11-01 Thread Uli Schlachter
On 31.10.2011 16:36, Klaus Umbach wrote:
 On 29.10.11 20:22, Anurag Priyam wrote:
 On Thu, Sep 22, 2011 at 10:32 PM, Anurag Priyam
 anurag08pri...@gmail.com wrote:
 On Wed, Sep 21, 2011 at 1:21 PM, Klaus Umbach treibholz-awes...@uxix.de 
 wrote:
 On 19.09.11 02:33, Anurag Priyam wrote:
 [...]
 $ awesome-client
 c = client.focus
 c.icon = mailicon.image

 Where in rc.lua can I set this?

 That is for you to figure out and let us know too :). I would try it
 through rules or 'manage' signal first.

 In case you didn't figure it out yet, setting icon in the rules table works.

 { rule = { name = irssi },
   properties = {floating = true, icon = image(beautiful.chat)}
 }

 `beautiful.chat` is a PNG.
 
 Yes, this works great for specific windows, but not as a default-rule. If I
 set it for all windows, those which already have an icon get overwritten. I
 only want the default-icon for those which have none.

{ rule = {},
  callback = function(c)
if not c.icon then
  c.cion = image(beautiful.chat)
end
  end
}

-- 
- Buck, when, exactly, did you lose your mind?
- Three months ago. I woke up one morning married to a pineapple.
  An ugly pineapple... But I loved her.

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


Re: How to set a default-icon for a window?

2011-11-01 Thread Klaus Umbach
On 01.11.11 17:43, Uli Schlachter wrote:
 On 31.10.2011 16:36, Klaus Umbach wrote:
  On 29.10.11 20:22, Anurag Priyam wrote:
  On Thu, Sep 22, 2011 at 10:32 PM, Anurag Priyam
  anurag08pri...@gmail.com wrote:
  On Wed, Sep 21, 2011 at 1:21 PM, Klaus Umbach treibholz-awes...@uxix.de 
  wrote:
  On 19.09.11 02:33, Anurag Priyam wrote:
  [...]
  $ awesome-client
  c = client.focus
  c.icon = mailicon.image
 
  Where in rc.lua can I set this?
 
  That is for you to figure out and let us know too :). I would try it
  through rules or 'manage' signal first.
 
  In case you didn't figure it out yet, setting icon in the rules table 
  works.
 
  { rule = { name = irssi },
properties = {floating = true, icon = image(beautiful.chat)}
  }
 
  `beautiful.chat` is a PNG.
  
  Yes, this works great for specific windows, but not as a default-rule. If I
  set it for all windows, those which already have an icon get overwritten. I
  only want the default-icon for those which have none.
 
 { rule = {},
   callback = function(c)
 if not c.icon then
   c.cion = image(beautiful.chat)
 end
   end
 }

Yippie! It works. Thanks

-
Klaus

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


Re: How to set a default-icon for a window?

2011-11-01 Thread Wladyslaw Zbikowski
On Sat, Oct 29, 2011 at 10:52 AM, Anurag Priyam
anurag08pri...@gmail.com wrote:
    { rule = { name = irssi },
      properties = {floating = true, icon = image(beautiful.chat)}
    }

Thanks for the tip about the rules table - it almost works for me. The
problem is applications change their icon while they run, so the icon
starts out correct but then reverts. For instance Adobe Reader has two
icons depending on state (one for when a document is loaded, and one
for no document). As soon as it changes state, I lose my custom icon.
Also Emacs asserts its old icon for no visible reason after some use.
Then I have to restart Awesome to get my custom icons back.

It would be great if there were a signal I could connect to when the
application changes its icon, or a way to block this from happening.

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


Re: How to set a default-icon for a window?

2011-11-01 Thread Anurag Priyam
On Wed, Nov 2, 2011 at 4:15 AM, Wladyslaw Zbikowski
embeddedlinux...@gmail.com wrote:
[...]
 It would be great if there were a signal I could connect to when the
 application changes its icon, or a way to block this from happening.

Does `property::icon`[1] signal work?

[1]: https://awesome.naquadah.org/wiki/Signals#client

P.S: The reference might be a little outdated.

-- 
Anurag Priyam

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


Re: How to set a default-icon for a window?

2011-10-29 Thread Anurag Priyam
On Thu, Sep 22, 2011 at 10:32 PM, Anurag Priyam
anurag08pri...@gmail.com wrote:
 On Wed, Sep 21, 2011 at 1:21 PM, Klaus Umbach treibholz-awes...@uxix.de 
 wrote:
 On 19.09.11 02:33, Anurag Priyam wrote:
 [...]
 $ awesome-client
 c = client.focus
 c.icon = mailicon.image

 Where in rc.lua can I set this?

 That is for you to figure out and let us know too :). I would try it
 through rules or 'manage' signal first.

In case you didn't figure it out yet, setting icon in the rules table works.

{ rule = { name = irssi },
  properties = {floating = true, icon = image(beautiful.chat)}
}

`beautiful.chat` is a PNG.

-- 
Anurag Priyam

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


Re: How to set a default-icon for a window?

2011-09-22 Thread Anurag Priyam
On Wed, Sep 21, 2011 at 1:21 PM, Klaus Umbach treibholz-awes...@uxix.de wrote:
 On 19.09.11 02:33, Anurag Priyam wrote:
[...]
 $ awesome-client
 c = client.focus
 c.icon = mailicon.image

 Where in rc.lua can I set this?

That is for you to figure out and let us know too :). I would try it
through rules or 'manage' signal first.

 I also tried it with awesome-client, but my xterm still has no icon.

If it helps, `aweseome -v` on my machines reads:

awesome debian/3.4.10-1 (Exploder)
 • Build: Jun 29 2011 15:03:07 for x86_64 by gcc version 4.6.1 (@cigue)
 • D-Bus support: ✔

-- 
Anurag Priyam

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


Re: How to set a default-icon for a window?

2011-09-21 Thread Klaus Umbach
On 19.09.11 02:33, Anurag Priyam wrote:
 On Mon, Sep 19, 2011 at 1:06 AM, Klaus Umbach treibholz-awes...@uxix.de 
 wrote:
  how can I set a default-icon for applications/windows, that do not have
  one? (e.g. rdesktop or mplayer)
 
 This seems to work:
 
 $ awesome-client
 c = client.focus
 c.icon = mailicon.image

Where in rc.lua can I set this?

I also tried it with awesome-client, but my xterm still has no icon.

 
 What is `mailicon` and `mailicon.image`?
 
 From my `rc.lua`:
 
 mailicon = widget({ type = imagebox })
 mailicon.image = image(beautiful.widget_mail)
 
 From `zenburn.lua` (theme):
 
 theme.widget_mail   = theme.confdir .. /icons/mail.png

-
Klaus

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


Re: How to set a default-icon for a window?

2011-09-18 Thread Anurag Priyam
On Mon, Sep 19, 2011 at 1:06 AM, Klaus Umbach treibholz-awes...@uxix.de wrote:
 how can I set a default-icon for applications/windows, that do not have
 one? (e.g. rdesktop or mplayer)

This seems to work:

$ awesome-client
c = client.focus
c.icon = mailicon.image

What is `mailicon` and `mailicon.image`?

From my `rc.lua`:

mailicon = widget({ type = imagebox })
mailicon.image = image(beautiful.widget_mail)

From `zenburn.lua` (theme):

theme.widget_mail   = theme.confdir .. /icons/mail.png

-- 
Anurag Priyam

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