Sponsored Content
Top Forums Programming [LUA] WindowManager: Awesome - Checking OS and assign different icon Post 302952039 by sea on Wednesday 12th of August 2015 08:53:56 PM
Old 08-12-2015
[LUA] WindowManager: Awesome - Checking OS and assign different icon

Heyas

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.

Situation:
Recently i actualy started to have 2 different kinds of gnu/linux installed, with this, the abition 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'.

rc.lua
Code:
-- 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
	end

-- Themes define colours, icons, and wallpapers
	beautiful.init(awful.util.getdir("config") .. "/themes/sea/theme.lua")

	os_icon = wibox.widget.imagebox()
	if file_exists("/etc/favicon.png")
	then	-- Its either fedora or provides same functionality
		os_icon:set_image(beautiful.icon_fedora)
		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 })
	end

-- 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:
Code:
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.

Any ideas or hints please?
Thank you

EDIT:
Note that 'beautiful' is the class providing the items of the active theme.

Last edited by sea; 08-13-2015 at 12:17 AM..
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

WindowManager

I Have Installed GARNOME but i don't know how i can start it in RedHat 7.3...it is very confusion to change WindowManagers in RedHat 7.3...in slackware i just changed in /etc/X11/xinit/xinitrc and it was it...but in RedHat 7.3 it is very diferent...please help (2 Replies)
Discussion started by: CreamHarry
2 Replies

2. UNIX for Dummies Questions & Answers

Installing PECL LUA on Centos for PHP

I'm kinda new to Linux, I'm mostly run websites, and it's rather easy to do everything... except install this PECL LUA plugin. :wall: I start by running this command: pecl install lua-0.9.4 downloading lua-0.9.4.tgz ... Starting to download lua-0.9.4.tgz (12,617 bytes) .....done: 12,617... (0 Replies)
Discussion started by: blackstar
0 Replies

3. Shell Programming and Scripting

[LUA-Awesome] Can i use $XDG_XY_DIR inside a lua script?

Heyas I'm a fan of AwesomeWM, but i had failed to learn lua, though, i'm quite satisfied with the cofniguration i have by now. Either way, i'd like to know if i could 'call' those XDG_XY_DIR variables which are located on my linux ~/.config/user-dirs.dirs. While to call scripts i use... (0 Replies)
Discussion started by: sea
0 Replies

4. UNIX Desktop Questions & Answers

[LUA / DE] AwesomeWM & Vicious Widgets

Hello Allthough i dont know LUA, despite its name, i do love the window manager that was created using that language. By now, I'm enough familiar with LUA so i could adapt (most of) the recent changes so i have vicous widgets working again - by the means of no error messages on start up. I... (1 Reply)
Discussion started by: sea
1 Replies

5. Programming

[LUA] Set variables according to if file exists

Heya I'm using Awesome WM with the Vicious widget library. As i'm using multi boot, Win8, Fedora and Arch, i have my WM-Config shared accross my GNU/Linux installations. The regarding snippet: -- Functions -- Its just a workaround for an 'unstable' 'hwmon/hwmon' definition of Fedora21 -... (0 Replies)
Discussion started by: sea
0 Replies

6. Programming

A make-like build utility based on Lua

xmake is a make-like build utility based on lua. (Link to project site: xmake) The project focuses on making development and building easier and provides many features (.e.g package, install, plugin, macro, action, option, task ...), so that any developer can quickly pick it up and enjoy the... (1 Reply)
Discussion started by: waruqi
1 Replies
XDG-ICON-RESOURCE(1)					     xdg-icon-resource Manual					      XDG-ICON-RESOURCE(1)

NAME
xdg-icon-resource - command line tool for (un)installing icon resources SYNOPSIS
xdg-icon-resource install [--noupdate] [--novendor] [--theme theme] [--context context] [--mode mode] --size size icon-file [icon-name] xdg-icon-resource uninstall [--noupdate] [--theme theme] [--context context] [--mode mode] --size size icon-name xdg-icon-resource forceupdate [--theme theme] [--mode mode] xdg-icon-resource {--help | --manual | --version} DESCRIPTION
The xdg-icon-resource program can be used to install icon resources into the desktop icon system in order to illustrate menu entries, to depict desktop icons or to graphically represent file types. The desktop icon system identifies icons by name. Depending on the required size, the choice of icon theme and the context in which the icon is used, the desktop icon system locates an appropriate icon resource to depict an icon. Icon resources can be XPM files or PNG files. The desktop icon system works according to the XDG Icon Theme Specification at http://www.freedesktop.org/wiki/Specifications/icon-theme-spec COMMANDS
install Installs the icon file indicated by icon-file to the desktop icon system under the name icon-name. Icon names do not have an extension. If icon-name is not provided the name is derived from icon-file. The icon file must have .png or .xpm as extension. If a corresponding .icon file exists in the same location as icon-file it will be installed as well. uninstall Removes the icon indicated by icon-name from the desktop icon system. Note that icon names do not have an extension. forceupdate Force an update of the desktop icon system. This is only useful if the last call to xdg-icon-resource included the --noupdate option. OPTIONS
--noupdate Postpone updating the desktop icon system. If multiple icons are added in sequence this flag can be used to indicate that additional changes will follow and that it is not necessary to update the desktop icon system right away. --novendor Normally, xdg-icon-resource checks to ensure that an icon file to be installed in the apps context has a proper vendor prefix. This option can be used to disable that check. A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated with a dash ("-"). Companies and organizations are encouraged to use a word or phrase, preferably the organizations name, for which they hold a trademark as their vendor prefix. The purpose of the vendor prefix is to prevent name conflicts. --theme theme Installs or removes the icon file as part of theme. If no theme is specified the icons will be installed as part of the default hicolor theme. Applications may install icons under multiple themes but should at least install icons for the default hicolor theme. --context context Specifies the context for the icon. Icons to be used in the application menu and as desktop icon should use apps as context which is the default context. Icons to be used as file icons should use mimetypes as context. Other common contexts are actions, devices, emblems, filesystems and stock. --size size Specifies the size of the icon. All icons must be square. Common sizes for icons in the apps context are: 16, 22, 32, 48, 64 and 128. Common sizes for icons in the mimetypes context are: 16, 22, 32, 48, 64 and 128 --mode mode mode can be user or system. In user mode the file is (un)installed for the current user only. In system mode the file is (un)installed for all users on the system. Usually only root is allowed to install in system mode. The default is to use system mode when called by root and to use user mode when called by a non-root user. --help Show command synopsis. --manual Show this manual page. --version Show the xdg-utils version information. ENVIRONMENT VARIABLES
xdg-icon-resource honours the following environment variables: XDG_UTILS_DEBUG_LEVEL Setting this environment variable to a non-zero numerical value makes xdg-icon-resource do more verbose reporting on stderr. Setting a higher value increases the verbosity. XDG_UTILS_INSTALL_MODE This environment variable can be used by the user or administrator to override the installation mode. Valid values are user and system. EXIT CODES
An exit code of 0 indicates success while a non-zero exit code indicates failure. The following failure codes can be returned: 1 Error in command line syntax. 2 One of the files passed on the command line did not exist. 3 A required tool could not be found. 4 The action failed. 5 No permission to read one of the files passed on the command line. SEE ALSO
xdg-desktop-icon(1), xdg-desktop-menu(1), xdg-mime(1) EXAMPLES
To install an icon resource to depict a launcher for the application myfoobar, the company ShinyThings Inc. can use: xdg-icon-resource install --size 64 shinythings-myfoobar.png To install an icon for a new application/x-foobar file type one can use: xdg-icon-resource install --context mimetypes --size 48 ./mime-foobar-48.png application-x-foobar xdg-icon-resource install --context mimetypes --size 64 ./mime-foobar-64.png application-x-foobar This will install two icons with the name application-x-foobar but with different sizes. AUTHORS
Kevin Krammer Author. Jeremy White Author. COPYRIGHT
Copyright (C) 2006 xdg-utils 1.0 08/18/2014 XDG-ICON-RESOURCE(1)
All times are GMT -4. The time now is 10:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy