Large update to configs
This commit is contained in:
@ -1,33 +1,33 @@
|
||||
-- {{{ init environment
|
||||
local wakka = {}
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- {{{ display
|
||||
-- formats the lines for the notify
|
||||
local function display()
|
||||
local lines = "<u>AUR Updates:</u>\n"
|
||||
local f = io.popen("cower -u", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
local lines = "<u>AUR Updates:</u>\n"
|
||||
local f = io.popen("cower -u", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
end
|
||||
-- }}}
|
||||
-- }}}
|
||||
|
||||
function wakka.addToWidget(mywidget)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
end
|
||||
|
||||
return wakka
|
||||
|
@ -1,39 +1,39 @@
|
||||
-- {{{ init environment
|
||||
local wakka = {}
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- {{{ display
|
||||
-- formats the lines for the notify
|
||||
local function display()
|
||||
local lines = "<u>Bitcoin:</u>\n"
|
||||
local tick = "<u>Ask:</u>\n"
|
||||
local f = io.popen("bitcoind getbalance", "r")
|
||||
local t = io.popen("curl -q -s https://api.bitcoinaverage.com/ticker/global/AUD/ask", "r")
|
||||
local s = f:read('*all')
|
||||
local g = t:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
ticker = tick .. "\n" .. g .. "\n"
|
||||
f:close()
|
||||
t:close()
|
||||
-- return line, ticker
|
||||
return string.format('%s%s',line, ticker)
|
||||
local lines = "<u>Bitcoin:</u>\n"
|
||||
local tick = "<u>Ask:</u>\n"
|
||||
local f = io.popen("bitcoind getbalance", "r")
|
||||
local t = io.popen("curl -q -s https://api.bitcoinaverage.com/ticker/global/AUD/ask", "r")
|
||||
local s = f:read('*all')
|
||||
local g = t:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
ticker = tick .. "\n" .. g .. "\n"
|
||||
f:close()
|
||||
t:close()
|
||||
-- return line, ticker
|
||||
return string.format('%s%s',line, ticker)
|
||||
end
|
||||
|
||||
|
||||
function wakka.addToWidget(mywidget)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
run_display = display()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", run_display),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
run_display = display()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", run_display),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
end
|
||||
|
||||
return wakka
|
||||
|
@ -1,33 +1,33 @@
|
||||
-- {{{ init environment
|
||||
local wakka = {}
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- {{{ display
|
||||
-- formats the lines for the notify
|
||||
local function display()
|
||||
local lines = "<u>GFX Temp:</u>\n"
|
||||
local f = io.popen("/opt/bin/aticonfig --odgt | grep Temperature | cut -c 43-52", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
local lines = "<u>GFX Temp:</u>\n"
|
||||
local f = io.popen("/opt/bin/aticonfig --odgt | grep Temperature | cut -c 43-52", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
end
|
||||
-- }}}
|
||||
-- }}}
|
||||
|
||||
function wakka.addToWidget(mywidget)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
end
|
||||
|
||||
return wakka
|
||||
|
@ -11,8 +11,8 @@ local modkey = "Mod4"
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local capi = {
|
||||
root = root,
|
||||
client = client
|
||||
root = root,
|
||||
client = client
|
||||
}
|
||||
|
||||
module("keydoc")
|
||||
@ -23,101 +23,101 @@ local orig = awful.key.new
|
||||
|
||||
-- Replacement for awful.key.new
|
||||
local function new(mod, key, press, release, docstring)
|
||||
-- Usually, there is no use of release, let's just use it for doc
|
||||
-- if it's a string.
|
||||
if press and release and not docstring and type(release) == "string" then
|
||||
docstring = release
|
||||
release = nil
|
||||
end
|
||||
local k = orig(mod, key, press, release)
|
||||
-- Remember documentation for this key (we take the first one)
|
||||
if k and #k > 0 and docstring then
|
||||
doc[k[1]] = { help = docstring,
|
||||
group = currentgroup }
|
||||
end
|
||||
-- Usually, there is no use of release, let's just use it for doc
|
||||
-- if it's a string.
|
||||
if press and release and not docstring and type(release) == "string" then
|
||||
docstring = release
|
||||
release = nil
|
||||
end
|
||||
local k = orig(mod, key, press, release)
|
||||
-- Remember documentation for this key (we take the first one)
|
||||
if k and #k > 0 and docstring then
|
||||
doc[k[1]] = { help = docstring,
|
||||
group = currentgroup }
|
||||
end
|
||||
|
||||
return k
|
||||
return k
|
||||
end
|
||||
awful.key.new = new -- monkey patch
|
||||
|
||||
-- Turn a key to a string
|
||||
local function key2str(key)
|
||||
local sym = key.key or key.keysym
|
||||
local translate = {
|
||||
["#14"] = "#",
|
||||
[" "] = "Space",
|
||||
}
|
||||
sym = translate[sym] or sym
|
||||
if not key.modifiers or #key.modifiers == 0 then return sym end
|
||||
local result = ""
|
||||
local translate = {
|
||||
[modkey] = "⊞",
|
||||
Shift = "⇧",
|
||||
Control = "Ctrl",
|
||||
}
|
||||
for _, mod in pairs(key.modifiers) do
|
||||
mod = translate[mod] or mod
|
||||
result = result .. mod .. " + "
|
||||
end
|
||||
return result .. sym
|
||||
local sym = key.key or key.keysym
|
||||
local translate = {
|
||||
["#14"] = "#",
|
||||
[" "] = "Space",
|
||||
}
|
||||
sym = translate[sym] or sym
|
||||
if not key.modifiers or #key.modifiers == 0 then return sym end
|
||||
local result = ""
|
||||
local translate = {
|
||||
[modkey] = "⊞",
|
||||
Shift = "⇧",
|
||||
Control = "Ctrl",
|
||||
}
|
||||
for _, mod in pairs(key.modifiers) do
|
||||
mod = translate[mod] or mod
|
||||
result = result .. mod .. " + "
|
||||
end
|
||||
return result .. sym
|
||||
end
|
||||
|
||||
-- Unicode "aware" length function (well, UTF8 aware)
|
||||
-- See: http://lua-users.org/wiki/LuaUnicode
|
||||
local function unilen(str)
|
||||
local _, count = string.gsub(str, "[^\128-\193]", "")
|
||||
return count
|
||||
local _, count = string.gsub(str, "[^\128-\193]", "")
|
||||
return count
|
||||
end
|
||||
|
||||
-- Start a new group
|
||||
function group(name)
|
||||
currentgroup = name
|
||||
return {}
|
||||
currentgroup = name
|
||||
return {}
|
||||
end
|
||||
|
||||
local function markup(keys)
|
||||
local result = {}
|
||||
local result = {}
|
||||
|
||||
-- Compute longest key combination
|
||||
local longest = 0
|
||||
for _, key in ipairs(keys) do
|
||||
if doc[key] then
|
||||
longest = math.max(longest, unilen(key2str(key)))
|
||||
-- Compute longest key combination
|
||||
local longest = 0
|
||||
for _, key in ipairs(keys) do
|
||||
if doc[key] then
|
||||
longest = math.max(longest, unilen(key2str(key)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local curgroup = nil
|
||||
for _, key in ipairs(keys) do
|
||||
if doc[key] then
|
||||
local help, group = doc[key].help, doc[key].group
|
||||
local skey = key2str(key)
|
||||
result[group] = (result[group] or "") ..
|
||||
'<span font="DejaVu Sans Mono 10" color="' .. beautiful.fg_widget_clock .. '"> ' ..
|
||||
string.format("%" .. (longest - unilen(skey)) .. "s ", "") .. skey ..
|
||||
'</span> <span color="' .. beautiful.fg_widget_value .. '">' ..
|
||||
help .. '</span>\n'
|
||||
local curgroup = nil
|
||||
for _, key in ipairs(keys) do
|
||||
if doc[key] then
|
||||
local help, group = doc[key].help, doc[key].group
|
||||
local skey = key2str(key)
|
||||
result[group] = (result[group] or "") ..
|
||||
'<span font="DejaVu Sans Mono 10" color="' .. beautiful.fg_widget_clock .. '"> ' ..
|
||||
string.format("%" .. (longest - unilen(skey)) .. "s ", "") .. skey ..
|
||||
'</span> <span color="' .. beautiful.fg_widget_value .. '">' ..
|
||||
help .. '</span>\n'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
return result
|
||||
end
|
||||
|
||||
-- Display help in a naughty notification
|
||||
local nid = nil
|
||||
function display()
|
||||
local strings = awful.util.table.join(
|
||||
local strings = awful.util.table.join(
|
||||
markup(capi.root.keys()),
|
||||
capi.client.focus and markup(capi.client.focus:keys()) or {})
|
||||
|
||||
local result = ""
|
||||
for group, res in pairs(strings) do
|
||||
if #result > 0 then result = result .. "\n" end
|
||||
result = result ..
|
||||
'<span weight="bold" color="' .. beautiful.fg_widget_value_important .. '">' ..
|
||||
group .. "</span>\n" .. res
|
||||
end
|
||||
nid = naughty.notify({ text = result,
|
||||
replaces_id = nid,
|
||||
hover_timeout = 0.1,
|
||||
timeout = 30 }).id
|
||||
local result = ""
|
||||
for group, res in pairs(strings) do
|
||||
if #result > 0 then result = result .. "\n" end
|
||||
result = result ..
|
||||
'<span weight="bold" color="' .. beautiful.fg_widget_value_important .. '">' ..
|
||||
group .. "</span>\n" .. res
|
||||
end
|
||||
nid = naughty.notify({ text = result,
|
||||
replaces_id = nid,
|
||||
hover_timeout = 0.1,
|
||||
timeout = 30 }).id
|
||||
end
|
||||
|
@ -1,33 +1,33 @@
|
||||
-- {{{ init environment
|
||||
local wakka = {}
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- {{{ display
|
||||
-- formats the lines for the notify
|
||||
local function display()
|
||||
local lines = "<u>Namecoin:</u>\n"
|
||||
local f = io.popen("namecoind getbalance", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
local lines = "<u>Namecoin:</u>\n"
|
||||
local f = io.popen("namecoind getbalance", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
end
|
||||
-- }}}
|
||||
-- }}}
|
||||
|
||||
function wakka.addToWidget(mywidget)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
end
|
||||
|
||||
return wakka
|
||||
|
@ -1,33 +1,33 @@
|
||||
-- {{{ init environment
|
||||
local wakka = {}
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- {{{ display
|
||||
-- formats the lines for the notify
|
||||
local function display()
|
||||
local lines = "<u>Pacman Updates:</u>\n"
|
||||
local f = io.popen("pacman -Qqu", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
local lines = "<u>Pacman Updates:</u>\n"
|
||||
local f = io.popen("pacman -Qqu", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
end
|
||||
-- }}}
|
||||
-- }}}
|
||||
|
||||
function wakka.addToWidget(mywidget)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
end
|
||||
|
||||
return wakka
|
||||
|
@ -1,33 +1,33 @@
|
||||
-- {{{ init environment
|
||||
local wakka = {}
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
mouse = mouse,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- {{{ display
|
||||
-- formats the lines for the notify
|
||||
local function display()
|
||||
local lines = "<u>AUR Updates:</u>\n"
|
||||
local f = io.popen("archey", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
local lines = "<u>AUR Updates:</u>\n"
|
||||
local f = io.popen("archey", "r")
|
||||
local s = f:read('*all')
|
||||
line = lines .. "\n" .. s .. "\n"
|
||||
f:close()
|
||||
return line
|
||||
end
|
||||
-- }}}
|
||||
-- }}}
|
||||
|
||||
function wakka.addToWidget(mywidget)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
mywidget:add_signal('mouse::enter', function ()
|
||||
usage = naughty.notify({
|
||||
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
|
||||
timeout = 0,
|
||||
hover_timeout = 0.5,
|
||||
screen = capi.mouse.screen
|
||||
})
|
||||
end)
|
||||
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
|
||||
end
|
||||
|
||||
return wakka
|
||||
|
Reference in New Issue
Block a user