diff options
-rw-r--r-- | awesompd.lua | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/awesompd.lua b/awesompd.lua index 2ba1473..e770b56 100644 --- a/awesompd.lua +++ b/awesompd.lua @@ -4,8 +4,28 @@ -- @release v1.0.7 --------------------------------------------------------------------------- -require('awesompd/utf8') -require('awesompd/jamendo') +awesompd = {} + +-- Function for checking icons and modules. Checks if a file exists, +-- and if it does, returns the path to file, nil otherwise. +function awesompd.try_load(file) + if awful.util.file_readable(file) then + return file + end +end + +-- Function for loading modules. +function awesompd.try_require(module) + if awesompd.try_load(awful.util.getdir("config") .. + "/awesompd/" .. module .. ".lua") then + return require('awesompd/' .. module) + else + return require(module) + end +end + +awesompd.try_require("utf8") +awesompd.try_require("jamendo") local beautiful = require('beautiful') local naughty = naughty local awful = awful @@ -20,8 +40,6 @@ local function dbg (...) end end -awesompd = {} - -- Constants awesompd.MOUSE_LEFT = 1 awesompd.MOUSE_MIDDLE = 2 @@ -44,14 +62,6 @@ awesompd.ESCAPE_MENU_SYMBOL_MAPPING["&"] = "'n'" -- /// Helper functions /// --- Function for loading icons. Checks if an icon exists, and --- if it does, returns the path to icon, nil otherwise. -function awesompd.try_load(file) - if awful.util.file_readable(file) then - return file - end -end - -- Just like awful.util.pread, but takes an argument how to read like -- "*line" or "*all". function awesompd.pread(com, mode) |