Reno is the second iteration of the AWMTK-powered AwesomeWM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

69 lines
2.5 KiB

local awful = require("awful")
local pager = require("pager")
local beautiful = require("beautiful")
local gears = require("gears")
local wibox = require("wibox")
local awmtk2 = require("awmtk2")
local dkjson = require("dkjson")
local naughty = require("naughty")
return function(args)
local style = awmtk2.create_style("notifications",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("notifications",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local layout = wibox.widget({
layout = wibox.layout.fixed.vertical,
spacing = style.base.spacing
})
local test_xclip = os.execute("xclip -version")
local result = ((test_xclip ~= 0) or (test_xclip ~= true))
local popup = awful.popup(t.popup({
t.textbox({
markup = "Click to copy text"
}),
((not result) and t.textbox({
markup = "(xclip is not installed)"
})),
t.container(layout),
layout = wibox.layout.fixed.vertical
},{
visible = false
}))
naughty.config.notify_callback = function(update_args)
local w = wibox.widget(t.button(t.article({
icon = update_args.icon,
title = update_args.title or "(No title)",
description = update_args.text
}),{
forced_height = style.button.height,
forced_width = style.button.width
}))
w:connect_signal("button::press",style.button.onpress)
w:connect_signal("button::release",style.button.onrelease)
w:connect_signal("button::press",function(self)
clip = io.open("/tmp/clip","w")
clip:write(update_args.text)
clip:close()
awful.spawn.with_shell("cat /tmp/clip | xclip -selection clipboard")
end)
layout:insert(1,w)
return update_args
end
-- create popup button
local clip_widget = wibox.widget(t.button({
image = beautiful["notifications-area-symbolic"],
resize = true,
widget = wibox.widget.imagebox,
}))
clip_widget:connect_signal("button::press",style.button.onpress)
clip_widget:connect_signal("button::release",style.button.onrelease)
clip_widget:connect_signal("button::press",function(self,x,y,button)
if button == 1 then
popup.visible = (not popup.visible)
if popup.visible then
popup:move_next_to(mouse.current_widget_geometry)
end
end
end)
return clip_widget
end