diff options
-rw-r--r-- | bindings.lua | 1 | ||||
-rw-r--r-- | rc.lua | 4 | ||||
-rw-r--r-- | urgent_wgt.lua | 2 | ||||
-rw-r--r-- | utils.lua | 16 | ||||
-rw-r--r-- | workspace.lua | 2 |
5 files changed, 20 insertions, 5 deletions
diff --git a/bindings.lua b/bindings.lua index 8e08aee..6cce4de 100644 --- a/bindings.lua +++ b/bindings.lua @@ -18,7 +18,6 @@ function M.create(workspace) function () local s = mouse.screen for o, _ in pairs(s.outputs) do - print('toggling ' .. o) awful.spawn('randr_output_toggle ' .. o) end end), @@ -86,9 +86,9 @@ mypromptbox = {} local wsp = workspace.Workspace:new(layouts) awful.screen.connect_for_each_screen(function(s) - print('Setting up screen:') + utils.log('screen', 'Setting up screen %d:', s.index) for k, v in pairs(s.outputs) do - print(k) + utils.log('screen', ' %s', k) end local panel_width = beautiful.xresources.apply_dpi(128, s) diff --git a/urgent_wgt.lua b/urgent_wgt.lua index cce4675..270d836 100644 --- a/urgent_wgt.lua +++ b/urgent_wgt.lua @@ -12,7 +12,7 @@ local function client_get_desk_idx(c) if desk_idx ~= nil and desk_idx >= 0 then return desk_idx else - print('cannot get desk idx: ' .. c.first_tag.name) + utils.warn('UrgentWgt', 'cannot get desk idx: ' .. c.first_tag.name) end end return false @@ -146,4 +146,20 @@ function M.notify_singleton(wsp, id, args) wsp.notify_tbl[id] = naughty.notify(args) end +function M.log(component, msg, ...) + local prefix = string.format('[awesome/%s] ', component) + local str = string.format(msg, ...) + + print(prefix .. str) + + return prefix, str +end + +function M.warn(component, msg, ...) + local prefix, str = M.log(component, msg, ...) + naughty.notify({ preset = naughty.config.presets.critical, + title = prefix, + text = str }) +end + return M diff --git a/workspace.lua b/workspace.lua index 9da5e4a..26e2e47 100644 --- a/workspace.lua +++ b/workspace.lua @@ -113,7 +113,7 @@ function Workspace:view(screen, desktop_idx, page_idx) -- take the topmost free one page_idx = desktop.indices_free:pop() if page_idx == nil then - print("No free pages on desktop") + utils.warn('Workspace', 'No free pages on desktop %d', desktop_idx) return end else |