-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathim.lua
61 lines (54 loc) · 1.82 KB
/
im.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require("awful")
require("screen")
require("tags")
require("client_algos")
module(..., package.seeall)
im_windows = {}
pidgin_conversations = {}
pidgin_buddy_lists = {}
skype_buddy_lists = {}
skype_conversations = {}
local function is_skype_conversation (client)
return string.find(client.name, "Skype%A+Chat")
end
local function is_skype_buddy_list (client)
return string.find(client.name, "Skype.+ for Linux")
end
client.add_signal('manage', function (c, startup)
if c.class == 'Pidgin' then
if c.role == 'conversation' then
table.insert(pidgin_conversations, c)
elseif c.role == 'buddy_list' then
table.insert(pidgin_buddy_lists, c)
end
table.insert(im_windows, c)
awful.client.movetotag(tags.tags['im'], c)
elseif c.class == 'Skype' then
if is_skype_conversation(c) then
print ("Found a chat window")
table.insert(skype_conversations, c)
elseif is_skype_buddy_list(c) then
print ("Found a buddy list")
table.insert(skype_buddy_lists, c)
end
table.insert(im_windows, c)
awful.client.movetotag(tags.tags['im'], c)
end
end)
client.add_signal('unmanage', function (c)
if c.class == 'Pidgin' then
if c.role == 'conversation' then
client_algos.remove_client (pidgin_conversations, c)
elseif c.role == 'buddy_list' then
client_algos.remove_client (pidgin_buddy_lists, c)
end
client_algos.remove_client (im_windows, c)
elseif c.class == 'Skype' then
if is_skype_conversation(c) then
client_algos.remove_client(skype_conversations, c)
elseif is_skype_buddy_list(c) then
client_algos.remove_client(skype_buddy_lists, c)
end
client_algos.remove_client(im_windows, c)
end
end)