From be95a9653473cb5fc91052f9c909edab158066eb Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 2 Dec 2013 15:22:50 +0100 Subject: [PATCH] im: enable the use of Skype instead of Pidgin --- rc/bindings.lua | 31 ++++++++++++++++++++++++------- rc/rules.lua | 4 ++++ rc/start.lua | 6 +++++- rc/tags.lua | 4 ++++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/rc/bindings.lua b/rc/bindings.lua index ecd997a..9d19fde 100644 --- a/rc/bindings.lua +++ b/rc/bindings.lua @@ -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) diff --git a/rc/rules.lua b/rc/rules.lua index 95e7908..b24051d 100644 --- a/rc/rules.lua +++ b/rc/rules.lua @@ -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, diff --git a/rc/start.lua b/rc/start.lua index f528a0f..ddb20a1 100644 --- a/rc/start.lua +++ b/rc/start.lua @@ -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") diff --git a/rc/tags.lua b/rc/tags.lua index eccf5ba..cf9e155 100644 --- a/rc/tags.lua +++ b/rc/tags.lua @@ -60,6 +60,10 @@ shifty.config.apps = { match = { role = { "conversation", "buddy_list" } }, tag = "im", }, + { + match = { class = { "Skype" } }, + tag = "im", + }, { match = { config.termclass }, startup = {