Hi Hartmut,
first of all, thanks for your reply! I guess i have to save the
„runeonce“ code as a new library in /usr/share/awesome/lib?
I did this, added the code you provided at the end of my rc.lua but got
no effect save the tags in the panel appeared twice.
Sorry if i seem a bit clumsy, maybe i am missing something essential here.
Is it necessary to install gnome if i want to run the applet?
Thank you,
Levent
On 29.02.2012 20:17, Hartmut Bischoff wrote:
Hi,
I did the same:
Installed Ubuntu, ran gnome and installed awesome.
In Gnome, I could access the nm-applet.
Same in awesome, providing this in the rc.lua
local r = require("runonce")
r.run("nm-applet")
r.run("gnome-power-manager")
r.run("dropbox start -i")
r.run("/usr/lib/gnome-disk-utility/gdu-notification-daemon")
r.run("firefox")
where "runconce" is
-- @author Peter J. Kranz (Absurd-Mind, [email protected]
<mailto:[email protected]>)
-- Any questions, criticism or praise just drop me an email
local M = {}
-- get the current Pid of awesome
local function getCurrentPid()
-- get awesome pid from pgrep
local fpid = io.popen("pgrep -u " .. os.getenv("USER") .. " -o
awesome")
local pid = fpid:read("*n")
fpid:close()
-- sanity check
if pid == nil then
return -1
end
return pid
end
local function getOldPid(filename)
-- open file
local pidFile = io.open(filename)
if pidFile == nil then
return -1
end
-- read number
local pid = pidFile:read("*n")
pidFile:close()
-- sanity check
if pid <= 0 then
return -1
end
return pid;
end
local function writePid(filename, pid)
local pidFile = io.open(filename, "w+")
pidFile:write(pid)
pidFile:close()
end
local function shallExecute(oldPid, newPid)
-- simple check if equivalent
if oldPid == newPid then
return false
end
return true
end
local function getPidFile()
local host = io.lines("/proc/sys/kernel/hostname")()
return awful.util.getdir("cache") .. "/awesome." .. host .. ".pid"
end
-- run Once per real awesome start (config reload works)
-- does not cover "pkill awesome && awesome"
function M.run(shellCommand)
-- check and Execute
if shallExecute(M.oldPid, M.currentPid) then
awful.util.spawn_with_shell(shellCommand)
end
end
have fun!
--
Dr. Hartmut Bischoff
Stuttgart