im: enable the use of Skype instead of Pidgin

This commit is contained in:
Vincent Bernat 2013-12-02 15:22:50 +01:00
parent 60f42a11f2
commit be95a96534
4 changed files with 37 additions and 8 deletions

View file

@ -78,15 +78,17 @@ local function toggle_window(filter)
return toggle return toggle
end end
-- Toggle pidgin conversation window -- Toggle IM conversation window
local toggle_pidgin = toggle_window( local toggle_im = toggle_window(
(function () (function ()
local adding = true local adding = true
local choose = function() local choose = function()
local cls = client.get() local cls = client.get()
local focus = client.focus local focus = client.focus
local rule = { class = "Pidgin", local rules = { { class = "Pidgin",
role = "conversation" } role = "conversation" },
{ class = "Skype",
role = "ConversationsWindow" } }
-- Score. We want a Pidgin window. Then: -- Score. We want a Pidgin window. Then:
-- 1. Urgent, visible, not focused -- 1. Urgent, visible, not focused
-- 2. Urgent, not visible, not focused. -- 2. Urgent, not visible, not focused.
@ -94,7 +96,14 @@ local toggle_pidgin = toggle_window(
-- 4. Focused -- 4. Focused
-- 5. Visible, not focused -- 5. Visible, not focused
local function score(cl) local function score(cl)
if not awful.rules.match(cl, rule) then return -10 end local found = false
for _, rule in pairs(rules) do
if awful.rules.match(cl, rule) then
found = true
break
end
end
if not found then return -10 end
local urgent = cl.urgent local urgent = cl.urgent
local focused = (focus == cl) local focused = (focus == cl)
@ -113,7 +122,15 @@ local toggle_pidgin = toggle_window(
return s1 > s2 return s1 > s2
end) end)
local candidate = cls[1] local candidate = cls[1]
if candidate == nil or not awful.rules.match(candidate, rule) then return nil end if candidate == nil then return nil end
local found = false
for _, rule in pairs(rules) do
if awful.rules.match(candidate, rule) then
found = true
break
end
end
if not found then return nil end
-- Maybe we need to switch direction -- Maybe we need to switch direction
if candidate == focus and adding then adding = false if candidate == focus and adding then adding = false
@ -163,7 +180,7 @@ config.keys.global = awful.util.table.join(
end end
end, end,
"Focus previously focused window"), "Focus previously focused window"),
awful.key({ modkey, }, "u", toggle_pidgin, awful.key({ modkey, }, "u", toggle_im,
"Toggle Pidgin conversation window"), "Toggle Pidgin conversation window"),
awful.key({ modkey, "Control" }, "j", function () awful.key({ modkey, "Control" }, "j", function ()
screen_focus( 1) screen_focus( 1)

View file

@ -35,6 +35,10 @@ awful.rules.rules = {
{ rule = { class = "Pidgin" }, { rule = { class = "Pidgin" },
except = { role = "buddy_list" }, -- buddy_list is the master except = { role = "buddy_list" }, -- buddy_list is the master
properties = { }, callback = awful.client.setslave }, properties = { }, callback = awful.client.setslave },
-- Skype
{ rule = { class = "Skipe" },
except = { role = nil }, -- should be the master
properties = { }, callback = awful.client.setslave },
-- Should not be master -- Should not be master
{ rule_any = { class = { rule_any = { class =
{ config.termclass, { config.termclass,

View file

@ -65,7 +65,11 @@ os.execute(table.concat(execute, ";"))
-- Spawn various X programs -- Spawn various X programs
xrun("polkit-gnome-authentication-agent-1", xrun("polkit-gnome-authentication-agent-1",
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1") "/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1")
if config.hostname == "alucard" then
xrun("Skype", "skype")
else
xrun("pidgin", "pidgin -n") xrun("pidgin", "pidgin -n")
end
if config.hostname == "neo" then if config.hostname == "neo" then
xrun("keepassx", "keepassx -min -lock") xrun("keepassx", "keepassx -min -lock")

View file

@ -60,6 +60,10 @@ shifty.config.apps = {
match = { role = { "conversation", "buddy_list" } }, match = { role = { "conversation", "buddy_list" } },
tag = "im", tag = "im",
}, },
{
match = { class = { "Skype" } },
tag = "im",
},
{ {
match = { config.termclass }, match = { config.termclass },
startup = { startup = {