Migrate talkative to external repo
This commit is contained in:
parent
21f96586e7
commit
7fab902da6
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -7,3 +7,6 @@
|
||||||
[submodule "tapestry"]
|
[submodule "tapestry"]
|
||||||
path = tapestry
|
path = tapestry
|
||||||
url = https://github.com/crater2150/awesome-tapestry.git
|
url = https://github.com/crater2150/awesome-tapestry.git
|
||||||
|
[submodule "talkative"]
|
||||||
|
path = talkative
|
||||||
|
url = https://github.com/crater2150/awesome-talkative.git
|
||||||
|
|
2
rc.lua
2
rc.lua
|
@ -13,7 +13,7 @@ beautiful.init(awful.util.getdir("config") .. "/theme.lua")
|
||||||
require("tapestry")
|
require("tapestry")
|
||||||
|
|
||||||
-- {{{ Logging
|
-- {{{ Logging
|
||||||
log = require("separable.simplelog")
|
log = require("talkative")
|
||||||
log.add_logger(log.loggers.stdio, log.level.DEBUG)
|
log.add_logger(log.loggers.stdio, log.level.DEBUG)
|
||||||
log.add_logger(log.loggers.naughty, log.level.WARNING)
|
log.add_logger(log.loggers.naughty, log.level.WARNING)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
11
rules.lua
11
rules.lua
|
@ -3,6 +3,7 @@ awful.rules = require("awful.rules")
|
||||||
|
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local binder = binder or require("separable.binder")
|
local binder = binder or require("separable.binder")
|
||||||
|
local log = require("talkative")
|
||||||
|
|
||||||
-- create a notification when given client becomes urgent
|
-- create a notification when given client becomes urgent
|
||||||
local function popup_urgent(client, message)
|
local function popup_urgent(client, message)
|
||||||
|
@ -29,17 +30,17 @@ awful.rules.rules = {
|
||||||
screen = awful.screen.preferred,
|
screen = awful.screen.preferred,
|
||||||
placement = awful.placement.no_overlap+awful.placement.no_offscreen
|
placement = awful.placement.no_overlap+awful.placement.no_offscreen
|
||||||
},
|
},
|
||||||
-- print name and class of new windows for debugging purposes
|
-- log name and class of new windows for debugging purposes
|
||||||
callback = function(c)
|
callback = function(c)
|
||||||
print("-----------\nnew client\n")
|
log("-----------\nnew client\n")
|
||||||
if (c["name"] ~= nil) then
|
if (c["name"] ~= nil) then
|
||||||
print("name: " .. c["name"])
|
log("name: " .. c["name"])
|
||||||
end
|
end
|
||||||
if (c["class"] ~= nil) then
|
if (c["class"] ~= nil) then
|
||||||
print("class: " .. c["class"])
|
log("class: " .. c["class"])
|
||||||
end
|
end
|
||||||
if (c["type"] ~= nil) then
|
if (c["type"] ~= nil) then
|
||||||
print("type: " .. c["type"])
|
log("type: " .. c["type"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
local naughty = require("naughty")
|
|
||||||
local awful = require("awful")
|
|
||||||
|
|
||||||
local simplelog = { loggers = {}, mt = {}}
|
|
||||||
|
|
||||||
local defaults = {}
|
|
||||||
local settings = {}
|
|
||||||
|
|
||||||
defaults.loggers = { }
|
|
||||||
defaults.defaultlevel = 0
|
|
||||||
|
|
||||||
for key, value in pairs(defaults) do
|
|
||||||
settings[key] = value
|
|
||||||
end
|
|
||||||
|
|
||||||
simplelog.level = {
|
|
||||||
ERROR = 3,
|
|
||||||
WARNING = 2,
|
|
||||||
NORMAL = 1,
|
|
||||||
DEBUG = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
local function loglv(msg, level)
|
|
||||||
for _,logger in ipairs(settings.loggers) do
|
|
||||||
logger(msg, level)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.dbg(msg)
|
|
||||||
loglv(msg, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.log(msg)
|
|
||||||
loglv(msg, 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.warn(msg)
|
|
||||||
loglv(msg, 2)
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.error(msg)
|
|
||||||
loglv(msg, 3)
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.add_logger(logger, level)
|
|
||||||
if level == nil then
|
|
||||||
level = settings.defaultlevel
|
|
||||||
end
|
|
||||||
table.insert(settings.loggers, function(msg, severity)
|
|
||||||
if severity >= level then
|
|
||||||
logger(msg, severity)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.loggers.naughty(msg, severity)
|
|
||||||
if severity == simplelog.level.WARNING then
|
|
||||||
msg = "<span color=\"#ff6\">".. msg .. "</span>"
|
|
||||||
elseif severity == simplelog.level.ERROR then
|
|
||||||
msg = "<span color=\"#f66\">".. msg .. "</span>"
|
|
||||||
end
|
|
||||||
naughty.notify({ text = msg })
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.spawn(command)
|
|
||||||
simplelog.dbg("Executing: " .. command)
|
|
||||||
awful.util.spawn(command)
|
|
||||||
end
|
|
||||||
|
|
||||||
function simplelog.loggers.stdio(msg, severity)
|
|
||||||
print(msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
simplelog.mt.__call = function(t,message) simplelog.log(message) end
|
|
||||||
|
|
||||||
return setmetatable(simplelog, simplelog.mt)
|
|
1
talkative
Submodule
1
talkative
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 19f211ebec6f34fa921252c0933a9af00a697381
|
Loading…
Reference in a new issue