]> git.madduck.net Git - etc/awesome.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

contrib section started\!
authorluke bonham <dadasignificanulla@gmail.com>
Wed, 25 Sep 2013 13:08:11 +0000 (15:08 +0200)
committercopycat-killer <dada@archlinux.info>
Wed, 5 Aug 2015 11:30:30 +0000 (13:30 +0200)
README.rst
icons/taskwarrior.png [deleted file]
icons/taskwarrior/task.png [new file with mode: 0644]
icons/taskwarrior/tasksmall.png [new file with mode: 0755]
widgets/calendar.lua
widgets/contrib/init.lua [new file with mode: 0644]
widgets/contrib/task.lua [new file with mode: 0644]
widgets/mpd.lua
widgets/task.lua [deleted file]
wiki

index 779428d0a2c699e0242967776e8fed3501a25142..66d846c0ef494a2b7de48fe2ace22269c72d0ebe 100644 (file)
@@ -19,6 +19,23 @@ in order to improve Awesome_ usability and configurability.
 
 Read the wiki_ for all the info.
 
+Contributions
+-------------
+
+Any contribution is welcome! Feel free to make a pull request.
+
+Just make sure that:
+
+- Your code fits with the general style of the module. In particular, you should use the same indentation pattern that the code uses, and also avoid adding space at the ends of lines.
+
+- Your code its easy to understand, maintainable, and modularized. You should also avoid code duplication wherever possible by adding functions or using `lain.helpers`. If something is unclear, and you can't write it in such a way that it will be clear, explain it with a comment.
+
+- You test your changes before submitting to make sure that not only your code work, but have not broken other parts of the module too!
+
+- You update `wiki` submodule with a thorough section.
+
+Contributed widgets have to be put it in `lain/widget/contrib`.
+
 Screenshots
 -----------
 
diff --git a/icons/taskwarrior.png b/icons/taskwarrior.png
deleted file mode 100644 (file)
index 171af60..0000000
Binary files a/icons/taskwarrior.png and /dev/null differ
diff --git a/icons/taskwarrior/task.png b/icons/taskwarrior/task.png
new file mode 100644 (file)
index 0000000..859ca29
Binary files /dev/null and b/icons/taskwarrior/task.png differ
diff --git a/icons/taskwarrior/tasksmall.png b/icons/taskwarrior/tasksmall.png
new file mode 100755 (executable)
index 0000000..2de6946
Binary files /dev/null and b/icons/taskwarrior/tasksmall.png differ
index 57fadd946d03acff62d8828cbe40c5459ca9f34b..8c707c8e1745e8e35a042c08232fc34ed9c1a10f 100644 (file)
@@ -86,7 +86,6 @@ function calendar:show(t_out, inc_offset)
        f = io.popen('/usr/bin/cal ' .. month .. ' ' .. year)
     end
 
-
     c_text = "<tt><span font='" .. font .. " "
              .. calendar.font_size .. "'><b>"
              .. f:read() .. "</b>\n\n"
diff --git a/widgets/contrib/init.lua b/widgets/contrib/init.lua
new file mode 100644 (file)
index 0000000..81321c6
--- /dev/null
@@ -0,0 +1,20 @@
+
+--[[
+                                                   
+     Lain                                          
+     Layouts, widgets and utilities for Awesome WM 
+                                                   
+     User contributed widgets section              
+                                                   
+     Licensed under GNU General Public License v2  
+      * (c) 2013,      Luke Bonham                 
+      * (c) 2010-2012, Peter Hofmann               
+                                                   
+--]]
+
+local wrequire     = require("lain.helpers").wrequire
+local setmetatable = setmetatable
+
+local widgets = { _NAME = "lain.widgets.contrib" }
+
+return setmetatable(widgets, { __index = wrequire })
diff --git a/widgets/contrib/task.lua b/widgets/contrib/task.lua
new file mode 100644 (file)
index 0000000..88baa71
--- /dev/null
@@ -0,0 +1,131 @@
+
+--[[
+                                                  
+     Licensed under GNU General Public License v2 
+      * (c) 2013, Luke Bonham                     
+      * (c) 2013, Jan Xie                         
+                                                  
+--]]
+
+local icons_dir    = require("lain.helpers").icons_dir
+
+local awful        = require("awful")
+local beautiful    = require("beautiful")
+local naughty      = require("naughty")
+
+local io           = io
+local string       = { len = string.len }
+local tonumber     = tonumber
+
+local setmetatable = setmetatable
+
+-- Taskwarrior notification
+-- lain.widgets.task
+local task = {}
+
+local task_notification = nil
+
+function task:hide()
+    if task_notification ~= nil then
+        naughty.destroy(task_notification)
+        task_notification = nil
+    end
+end
+
+function task:show()
+    task:hide()
+
+    local f, c_text
+
+    f = io.popen('task')
+    c_text = "<tt><span font='"
+             .. task.font .. " "
+             .. task.font_size .. "'>"
+             .. f:read("*all"):gsub("\n*$", "")
+             .. "</span></tt>"
+    f:close()
+
+    task_notification = naughty.notify({ title = "[task next]",
+                                         text = c_text,
+                                         icon = task.notify_icon,
+                                         position = task.position,
+                                         fg = task.fg,
+                                         bg = task.bg,
+                                         timeout = task.timeout })
+end
+
+function task:prompt_add()
+  awful.prompt.run({ prompt = "Add task: " },
+      mypromptbox[mouse.screen].widget,
+      function (...)
+          local f = io.popen("task add " .. ...)
+          c_text = "\n<tt><span font='" 
+                   .. task.font .. " "
+                   .. task.font_size .. "'>"
+                   .. f:read("*all")
+                   .. "</span></tt>"
+
+          naughty.notify({
+              text = c_text,
+              icon = task.notify_icon,
+              position = task.position,
+              fg = task.fg,
+              bg = task.bg,
+              timeout = task.timeout
+          })
+      end,
+      nil,
+      awful.util.getdir("cache") .. "/history_task_add")
+end
+
+function task:prompt_search()
+  awful.prompt.run({ prompt = "Search task: " },
+      mypromptbox[mouse.screen].widget,
+      function (...)
+          local f = io.popen("task " .. ...)
+          c_text = f:read("*all")
+          f:close()
+
+          if string.len(c_text) == 0
+          then
+              c_text = "No results found."
+          else
+              c_text = "<tt><span font='"
+                       .. task.font .. " "
+                       .. task.font_size .. "'>"
+                       .. c_text .. "\n"
+                       .. "</span></tt>"
+          end
+
+          naughty.notify({
+              text = c_text,
+              icon = task.notify_icon,
+              position = task.position,
+              fg = task.fg,
+              bg = task.bg,
+              timeout = task.timeout
+          })
+      end,
+      nil,
+      awful.util.getdir("cache") .. "/history_task")
+end
+
+function task:attach(widget, args)
+    local args     = args or {}
+
+    task.font_size = tonumber(args.font_size) or 12
+    task.font      = beautiful.font:sub(beautiful.font:find(""),
+                     beautiful.font:find(" "))
+    task.fg        = args.fg or beautiful.fg_normal or "#FFFFFF"
+    task.bg        = args.bg or beautiful.bg_normal or "#FFFFFF"
+    task.position  = args.position or "top_right"
+    task.timeout   = args.timeout or 7
+
+    task.notify_icon = icons_dir .. "/taskwarrior/task.png"
+    task.notify_icon_small = icons_dir .. "/taskwarrior/tasksmall.png"
+
+    widget:connect_signal("mouse::enter", function () task:show() end)
+    widget:connect_signal("mouse::leave", function () task:hide() end)
+end
+
+return setmetatable(task, { __call = function(_, ...) return create(...) end })
index 41233cd39256e17125d4f67595f1f38972a2ce8a..e3ed50dcfc89af2843b8aeef8967d20bb62d2cc0 100644 (file)
@@ -28,7 +28,7 @@ local mpd = {}
 local function worker(args)
     local args        = args or {}
     local timeout     = args.timeout or 2
-    local password    = args.password or ""
+    local password    = args.password or "\"\""
     local host        = args.host or "127.0.0.1"
     local port        = args.port or "6600"
     local music_dir   = args.music_dir or os.getenv("HOME") .. "/Music"
diff --git a/widgets/task.lua b/widgets/task.lua
deleted file mode 100644 (file)
index f2b49f4..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-
---[[
-                                                  
-     Licensed under GNU General Public License v2 
-      * (c) 2013, Jan Xie
-                                                  
---]]
-
-local icons_dir    = require("lain.helpers").icons_dir
-
-local awful        = require("awful")
-local beautiful    = require("beautiful")
-local naughty      = require("naughty")
-
-local io           = io
-local tonumber     = tonumber
-
-local setmetatable = setmetatable
-
--- task notification
--- lain.widgets.task
-local task = {}
-local task_notification = nil
-
-function task:hide()
-    if task_notification ~= nil then
-        naughty.destroy(task_notification)
-        task_notification = nil
-    end
-end
-
-function task:show()
-    task:hide()
-
-    local f, c_text
-
-    f = io.popen('task')
-    c_text = "<tt><span font='" .. task.font .. " "
-             .. task.font_size+2 .. "'><b>Tasks next</b></span>\n"
-             .. "<span font='" .. task.font .. " "
-             .. task.font_size .. "'>"
-             .. f:read("*all") .. "\n"
-             .. "</span></tt>"
-    f:close()
-
-    task_notification = naughty.notify({ text = c_text,
-                                        icon = task.notify_icon,
-                                        position = task.position,
-                                        fg = task.fg,
-                                        bg = task.bg,
-                                        timeout = task.timeout })
-end
-
-function task:add(...)
-  local f = io.popen("task add " .. ...)
-  c_text = "<tt><span font='" .. task.font .. " "
-           .. task.font_size .. "'>"
-           .. f:read("*all") .. "\n"
-           .. "</span></tt>"
-
-  naughty.notify({ text = c_text,
-                   icon = task.notify_icon,
-                   position = task.position,
-                   fg = task.fg,
-                   bg = task.bg,
-                   timeout = task.timeout})
-end
-
-function task:prompt_add()
-  awful.prompt.run( { prompt = "Add task: " },
-                    mypromptbox[mouse.screen].widget,
-                    function (...)
-                      task:add(...)
-                    end,
-                    nil,
-                    awful.util.getdir("cache") .. "/history_task_add")
-end
-
-function task:execute(...)
-  local f = io.popen("task " .. ...)
-  c_text = "<tt><span font='" .. task.font .. " "
-           .. task.font_size .. "'>"
-           .. f:read("*all") .. "\n"
-           .. "</span></tt>"
-
-  naughty.notify({ text = c_text,
-                   icon = task.notify_icon,
-                   position = task.position,
-                   fg = task.fg,
-                   bg = task.bg,
-                   timeout = task.timeout})
-end
-
-function task:prompt()
-  awful.prompt.run( { prompt = "Task: " },
-                    mypromptbox[mouse.screen].widget,
-                    function (...)
-                      task:execute(...)
-                    end,
-                    nil,
-                    awful.util.getdir("cache") .. "/history_task")
-end
-
-function task:attach(widget, args)
-    local args = args or {}
-    task.font_size = tonumber(args.font_size) or 12
-    task.font = beautiful.font:sub(beautiful.font:find(""),
-                beautiful.font:find(" "))
-    task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
-    task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
-    task.position = args.position or "top_right"
-    task.timeout = args.timeout or 7
-
-    task.notify_icon = icons_dir .. "taskwarrior.png"
-
-    widget:connect_signal("mouse::enter", function () task:show() end)
-    widget:connect_signal("mouse::leave", function () task:hide() end)
-    widget:buttons(awful.util.table.join( awful.button({ }, 1, function ()
-                                              task:show(0, -1) end),
-                                          awful.button({ }, 3, function ()
-                                              task:show(0, 1) end) ))
-end
-
-return setmetatable(task, { __call = function(_, ...) return create(...) end })
diff --git a/wiki b/wiki
index 476e9f57bb66cec635ce61170a57f49299e6c715..91217d6bad68401ee926ca79d3ef917525507321 160000 (submodule)
--- a/wiki
+++ b/wiki
@@ -1 +1 @@
-Subproject commit 476e9f57bb66cec635ce61170a57f49299e6c715
+Subproject commit 91217d6bad68401ee926ca79d3ef917525507321