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
end
-- Toggle pidgin conversation window
local toggle_pidgin = toggle_window(
-- Toggle IM conversation window
local toggle_im = toggle_window(
(function ()
local adding = true
local choose = function()
local cls = client.get()
local focus = client.focus
local rule = { class = "Pidgin",
role = "conversation" }
local rules = { { class = "Pidgin",
role = "conversation" },
{ class = "Skype",
role = "ConversationsWindow" } }
-- Score. We want a Pidgin window. Then:
-- 1. Urgent, visible, not focused
-- 2. Urgent, not visible, not focused.
@ -94,7 +96,14 @@ local toggle_pidgin = toggle_window(
-- 4. Focused
-- 5. Visible, not focused
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 focused = (focus == cl)
@ -113,7 +122,15 @@ local toggle_pidgin = toggle_window(
return s1 > s2
end)
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
if candidate == focus and adding then adding = false
@ -163,7 +180,7 @@ config.keys.global = awful.util.table.join(
end
end,
"Focus previously focused window"),
awful.key({ modkey, }, "u", toggle_pidgin,
awful.key({ modkey, }, "u", toggle_im,
"Toggle Pidgin conversation window"),
awful.key({ modkey, "Control" }, "j", function ()
screen_focus( 1)

View file

@ -35,6 +35,10 @@ awful.rules.rules = {
{ rule = { class = "Pidgin" },
except = { role = "buddy_list" }, -- buddy_list is the master
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
{ rule_any = { class =
{ config.termclass,

View file

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

View file

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