packages: awesome-plugin-eminent/awesome-plugin-eminent.spec (NEW), awesome...

uzsolt uzsolt at pld-linux.org
Fri Feb 11 00:26:17 CET 2011


Author: uzsolt                       Date: Thu Feb 10 23:26:17 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- initial

---- Files affected:
packages/awesome-plugin-eminent:
   awesome-plugin-eminent.spec (NONE -> 1.1)  (NEW), eminent.lua (NONE -> 1.1)  (NEW), README (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/awesome-plugin-eminent/awesome-plugin-eminent.spec
diff -u /dev/null packages/awesome-plugin-eminent/awesome-plugin-eminent.spec:1.1
--- /dev/null	Fri Feb 11 00:26:17 2011
+++ packages/awesome-plugin-eminent/awesome-plugin-eminent.spec	Fri Feb 11 00:26:12 2011
@@ -0,0 +1,49 @@
+# $Revision$, $Date$
+%define	shortname	eminent
+Summary:	Quick wmii-style dynamic tagging
+Name:		awesome-plugin-%{shortname}
+Version:	20101006
+Release:	1
+License:	GPL v2
+Group:		X11/Window Managers/Tools
+Source0:	eminent.lua
+URL:		https://awesome.naquadah.org/wiki/Eminent
+Requires:	awesome >= 3.4
+Source1:	README
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Eminent is a small lua library that monkey-patches awful to provide
+you with effortless and quick wmii-style dynamic tagging. Unlike
+shifty, eminent does not aim to provide a comprehensive tagging
+system, but tries to make dynamic tagging as simple as possible. In
+fact, besides importing the eminent library, you do not have to change
+your rc.lua at all, eminent does all the work for you.
+
+%prep
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_datadir}/awesome/lib/%{shortname}
+install %{SOURCE0} $RPM_BUILD_ROOT%{_datadir}/awesome/lib/%{shortname}
+install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc %{_docdir}/%{name}-%{version}
+%{_datadir}/awesome/lib/%{shortname}
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2011/02/10 23:26:12  uzsolt
+- initial
+

================================================================
Index: packages/awesome-plugin-eminent/eminent.lua
diff -u /dev/null packages/awesome-plugin-eminent/eminent.lua:1.1
--- /dev/null	Fri Feb 11 00:26:17 2011
+++ packages/awesome-plugin-eminent/eminent.lua	Fri Feb 11 00:26:12 2011
@@ -0,0 +1,125 @@
+----------------------------------------------------------------
+-- Effortless wmii-style dynamic tagging.
+----------------------------------------------------------------
+-- Lucas de Vries <lucas at glacicle.org>
+-- Licensed under the WTFPL version 2
+--   * http://sam.zoy.org/wtfpl/COPYING
+----------------------------------------------------------------
+-- To use this module add:
+--   require("eminent")
+-- to the top of your rc.lua. 
+--
+-- That's it. Through magical monkey-patching, all you need to
+-- do to start dynamic tagging is loading it.
+--
+-- Use awesome like you normally would, you don't need to
+-- change a thing.
+----------------------------------------------------------------
+
+-- Grab environment
+local ipairs = ipairs
+local pairs = pairs
+local awful = require("awful")
+local table = table
+local capi = {
+    tag = tag,
+    mouse = mouse,
+    client = client,
+    screen = screen,
+    wibox = wibox,
+    timer = timer,
+    keygrabber = keygrabber,
+}
+
+-- Eminent: Effortless wmii-style dynamic tagging
+module("eminent")
+
+-- Grab the original functions we're replacing
+local deflayout = nil
+local orig = {
+    new = awful.tag.new,
+    viewidx = awful.tag.viewidx,
+
+    taglist = awful.widget.taglist.new,
+    label = awful.widget.taglist.label.all,
+}
+
+-- Return tags with stuff on them, mark others hidden
+function gettags(screen)
+    local tags = {}
+
+    for k, t in ipairs(capi.screen[screen]:tags()) do
+        if t.selected or #t:clients() > 0 then
+            awful.tag.setproperty(t, "hide", false)
+            table.insert(tags, t)
+        else
+            awful.tag.setproperty(t, "hide", true)
+        end
+    end
+
+    return tags
+end
+
+-- Pre-create tags
+awful.tag.new = function (names, screen, layout)
+    deflayout = layout and layout[1] or layout
+    return orig.new(names, screen, layout)
+end
+
+-- View tag by relative index
+awful.tag.viewidx = function (i, screen)
+    -- Hide tags
+    local s = screen and screen.index or capi.mouse.screen
+    local ctags = capi.screen[s]:tags()
+    local tags = gettags(s)
+    local sel = awful.tag.selected()
+
+    -- Check if we should "create" a new tag
+    local selidx = awful.util.table.hasitem(tags, sel)
+    local tagidx = awful.util.table.hasitem(ctags, sel)
+
+    -- Create a new tag if needed
+    if selidx == #tags and i == 1 and #sel:clients() > 0 then
+        -- Deselect all
+        awful.tag.viewnone(s)
+
+        if #ctags >= tagidx+1 then
+            -- Focus next
+            ctags[tagidx+1].selected = true
+        else
+            -- Create new
+            local tag = capi.tag { name = ""..(tagidx+1) }
+            tag.screen = s
+            tag.selected = true
+            awful.tag.setproperty(tag, "layout", deflayout)
+        end
+    else
+        -- Call original
+        orig.viewidx(i, screen)
+    end
+end
+
+-- Taglist label functions
+awful.widget.taglist.label.all = function (t, args)
+    if t.selected or #t:clients() > 0 then
+        return orig.label(t, args)
+    end
+end
+
+
+-- Update hidden status
+local function uc(c) gettags(c.screen) end
+local function ut(s, t) gettags(s.index) end
+
+capi.client.add_signal("unmanage", uc)
+capi.client.add_signal("new", function(c)
+    c:add_signal("property::screen", uc)
+    c:add_signal("tagged", uc)
+    c:add_signal("untagged", uc)
+end)
+
+for screen=1, capi.screen.count() do
+    awful.tag.attached_add_signal(screen, "property::selected", uc)
+    capi.screen[screen]:add_signal("tag::attach", ut)
+    capi.screen[screen]:add_signal("tag::detach", ut)
+end

================================================================
Index: packages/awesome-plugin-eminent/README
diff -u /dev/null packages/awesome-plugin-eminent/README:1.1
--- /dev/null	Fri Feb 11 00:26:17 2011
+++ packages/awesome-plugin-eminent/README	Fri Feb 11 00:26:12 2011
@@ -0,0 +1,25 @@
+Eminent is a small lua library that monkey-patches awful to provide you with 
+effortless and quick wmii-style dynamic tagging. Unlike shifty, eminent does 
+not aim to provide a comprehensive tagging system, but tries to make dynamic 
+tagging as simple as possible. In fact, besides importing the eminent library, 
+you do not have to change your rc.lua at all, eminent does all the work for you.
+
+
+Setting Up Eminent
+
+Setting up eminent is as simple as adding require("eminent") to the top of your 
+rc.lua, after including awful.
+You don't need to change anything else in your rc.lua. If something does go 
+wrong (awesome is so versatile one can't possible test every setup), don't 
+hesitate to send an email to lucas at glacicle.org with your bug report.
+
+
+Using Eminent
+
+Use your awesome installation the same way you always did. You'll notice that 
+any tags that have no clients on them are automatically hidden. Moving to the 
+next tag after the last one will "create" (either re-use an existing but empty 
+tag or actually create a new one dynamically) a new tag for you to use.
+If you have any bindings set up on your number keys you should be able to use 
+those to jump to a specific tag irregardless of what eminent thinks.
+Happy tagging !
================================================================


More information about the pld-cvs-commit mailing list