View Full Version : [LUA] WindowManager 'Awesome': Checking OS and assign different icon

13th August 2015, 04:25 PM

I'm having a bad time to fix this.
Code is just related samples, paths are edited, take: ~/.config/awesome as 'base/config' (dot) dir.

Recently i actualy started to have 2 different kinds of gnu/linux installed, with this, the ambition raised, to get a distro specific icon displayed in the shared WM configuration because of the shared /home partition.

After some tweakings i've managed to get the WM reloaded without issues, but still, no icon is displayed, in neither of the OS'.


-- Functions
-- Its just a workaround for an 'unstable' 'hwmon/hwmon[12]' definition of Fedora21 - Rawhide
-- Function (only) from: http://stackoverflow.com/questions/4990990/lua-check-if-a-file-exists
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end

-- Themes define colours, icons, and wallpapers
beautiful.init(awful.util.getdir("config") .. "/themes/sea/theme.lua")
-- Note that 'beautiful.*' is the class providing the items of the active theme.

os_icon = wibox.widget.imagebox()
if file_exists("/etc/favicon.png")
then -- Its either fedora or provides same functionality
naughty.notify({ preset = naughty.config.presets.critical, title = "Its fedora", text = err })
else -- Probably Arch
os_icon:set_image( beautiful.icon_arch )
naughty.notify({ preset = naughty.config.presets.critical, title = "Its arch", text = err })

-- Show the menu entry with icon
mylauncher = awful.widget.launcher({ image = beautiful.os_icon,
menu = mymainmenu })

And within the ./themes/sea/theme.lua there is:

theme.icon_fedora = "/etc/favicon.png"
theme.icon_arch = themes .. "/sea/arch_icon_16.png"

I do get a msgbox saying "Its arch", but i dont get an icon, which is what confuses me.
AND, most confusing, on Fedora, i dont get a Fedora icon, but also the msgbox saying that it is fedora...

Any ideas, thoughts, (or commands of a LUA coder) please?
Thank you