add first working development release
This commit is contained in:
65
notifications/init.lua
Normal file
65
notifications/init.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
--[[
|
||||
-- notifications and debug
|
||||
--]]
|
||||
|
||||
-- needs
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
--local addkeymap = require("strangesome.bindings").addkeymap
|
||||
local wrequire = require("strangesome.loader").wrequire
|
||||
|
||||
-- define standard commands local to speed up things a little bit
|
||||
local setmetatable = setmetatable
|
||||
local next = next
|
||||
|
||||
-- strangesome.notifications
|
||||
local notifications = { _NAME = "strangesome.notifications" }
|
||||
|
||||
-- debug settings
|
||||
local debug = false
|
||||
local debug_window = nil
|
||||
local debug_window_title = "Strangesome Debug Window"
|
||||
local debug_text = ""
|
||||
local debug_text_max_lines = 30
|
||||
|
||||
function notifications.enable_debug()
|
||||
debug = true
|
||||
init_debug_window()
|
||||
|
||||
return debug_window
|
||||
end
|
||||
|
||||
function notifications.debug_enabled()
|
||||
return debug
|
||||
end
|
||||
|
||||
function notifications.debug_msg(msg)
|
||||
if not debug then return false end
|
||||
debug_text = debug_text.."<span>"..msg.."</span>\n"
|
||||
naughty.replace_text(debug_window, debug_window_title, debug_text)
|
||||
|
||||
return debug_text
|
||||
end
|
||||
|
||||
function init_debug_window()
|
||||
debug_window = naughty.notify({
|
||||
title = debug_window_title,
|
||||
text = "<span>Starting Debug Window</span>\n",
|
||||
timeout = 0,
|
||||
position = "bottom_right",
|
||||
ontop = false,
|
||||
height = 500,
|
||||
width = 950,
|
||||
opacity = 0.7,
|
||||
ignore_suspend = true
|
||||
})
|
||||
|
||||
return debug_window
|
||||
end
|
||||
|
||||
function toggle_debug_window()
|
||||
notifications.debug_msg("Toggle debug window")
|
||||
end
|
||||
|
||||
return setmetatable(notifications, { __index = wrequire })
|
||||
Reference in New Issue
Block a user