Hi people,

the attached patch allows dragging clients over a tag to move them to that
specific tag. It is a response to FlySpray feature request #157.

        Gregor Best
From 32d12f1044a7c1c1a83f85bbf5be264ab43ce3be Mon Sep 17 00:00:00 2001
From: Gregor Best <[EMAIL PROTECTED]>
Date: Thu, 4 Dec 2008 15:53:16 +0100
Subject: [PATCH] awful.mouse/widget: enable drag'n'dropping clients on tags

Signed-off-by: Gregor Best <[EMAIL PROTECTED]>
---
 lib/awful/mouse.lua.in  |   10 ++++++++++
 lib/awful/widget.lua.in |    4 ++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/lib/awful/mouse.lua.in b/lib/awful/mouse.lua.in
index a9443f2..c9da833 100644
--- a/lib/awful/mouse.lua.in
+++ b/lib/awful/mouse.lua.in
@@ -9,6 +9,7 @@ local layout = require("awful.layout")
 local tag = require("awful.tag")
 local hooks = require("awful.hooks")
 local aclient = require("awful.client")
+local widget = require("awful.widget")
 local type = type
 local math = math
 local ipairs = ipairs
@@ -154,6 +155,15 @@ function client.move(c, snap)
                                       return true
                                   end
                               end
+                              local w = widget_under_pointer()
+                              local tags = capi.screen[c.screen]:tags()
+                              for i, t in ipairs(widget.taglist.tags[c.screen]) do
+                                  if t == w then
+                                      aclient.movetotag(tags[i], c)
+                                      break
+                                  end
+                              end
+                              widget.taglist.tags[c.screen].selected = nil
                               return false
                           end, "fleur")
 end
diff --git a/lib/awful/widget.lua.in b/lib/awful/widget.lua.in
index 20f2b39..5eb5b9e 100644
--- a/lib/awful/widget.lua.in
+++ b/lib/awful/widget.lua.in
@@ -29,6 +29,7 @@ module("awful.widget")
 -- Various public structures
 taglist = {}
 taglist.label = {}
+taglist.tags = {}
 tasklist = {}
 tasklist.label = {}
 
@@ -38,6 +39,7 @@ tasklist.label = {}
 -- @param buttons A table with buttons binding to set.
 function taglist.new(scr, label, buttons)
     local w = {}
+    taglist.tags[scr] = { }
     local function taglist_update (screen)
         -- Return right now if we do not care about this screen
         if scr ~= screen then return end
@@ -50,11 +52,13 @@ function taglist.new(scr, label, buttons)
         if len < #tags then
             for i = len + 1, #tags do
                 w[i] = capi.widget({ type = "textbox", name = "taglist" .. i })
+                taglist.tags[scr][i] = w[i]
             end
         -- Remove widgets
         elseif len > #tags then
             for i = #tags + 1, len do
                 w[i] = nil
+                taglist.tags[scr][i] = nil
             end
         end
         -- Update widgets text
-- 
1.6.0.4

Attachment: signature.asc
Description: PGP signature

Reply via email to