alexander-yakushev / awesompd

Advanced mpd widget for Awesome WM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable find modules if when installed in <configdir>/widgets/awesompd

Ram-Z opened this issue · comments

It then fails to load the required modules in awesompd.lua.

Patch below fixes this, you should then be able to place awesompd anywhere below awful.util.getdir("config").

diff --git a/awesompd.lua b/awesompd.lua
index e4b6efe..8494003 100644
--- a/awesompd.lua
+++ b/awesompd.lua
@@ -10,6 +10,8 @@ local beautiful = require('beautiful')
 local naughty = require('naughty')
 local format = string.format

+local module_path = (...):match ("(.+/)[^/]+$") or ""
+
 local awesompd = {}

 -- Function for checking icons and modules. Checks if a file exists,
@@ -22,9 +24,9 @@ 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)
+   if awesompd.try_load(awful.util.getdir("config") .. '/'..
+                     module_path .. module .. ".lua") then
+      return require(module_path .. module)
    else
       return require(module)
    end

Thank you!