Added debug info to windows

This commit is contained in:
Yessiest 2022-03-22 01:00:39 +04:00
parent 0dc2bd757e
commit cb5fbb5a48
5 changed files with 245 additions and 6 deletions

View File

@ -69,6 +69,13 @@ local menu_widget = menu({
function()
awful.spawn("kill -s KILL "..tostring(c.pid))
end
},
{ "Debug info",
{
before = {
require("widgets.window-debug")()
}
}
}
},
vertical = true

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="48"
height="48"
viewBox="0 0 12.7 12.7"
version="1.1"
id="svg5"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="warning.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="true"
units="px"
inkscape:zoom="12.429181"
inkscape:cx="32.021419"
inkscape:cy="23.171278"
inkscape:window-width="1866"
inkscape:window-height="1038"
inkscape:window-x="52"
inkscape:window-y="20"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid1562" />
</sodipodi:namedview>
<defs
id="defs2">
<inkscape:path-effect
effect="powermask"
id="path-effect28575"
is_visible="true"
lpeversion="1"
uri="#mask-powermask-path-effect28575"
invert="false"
hide_mask="false"
background="true"
background_color="#ffffffff" />
<rect
x="20"
y="23"
width="28"
height="29"
id="rect5107" />
<mask
maskUnits="userSpaceOnUse"
id="mask-powermask-path-effect28575">
<path
id="mask-powermask-path-effect28575_box"
style="fill:#ffffff;fill-opacity:1"
d="M 1.1424707,-3.0728638 H 48.857529 V 39.073072 H 1.1424707 Z" />
<text
xml:space="preserve"
style="font-size:42.6667px;line-height:1.25;font-family:sans-serif;stroke-width:0.999999"
x="19.083326"
y="32.677097"
id="text28573"><tspan
sodipodi:role="line"
id="tspan28571"
style="font-size:42.6667px;stroke-width:0.999999"
x="19.083326"
y="32.677097">!</tspan></text>
</mask>
<filter
id="mask-powermask-path-effect28575_inverse"
inkscape:label="filtermask-powermask-path-effect28575"
style="color-interpolation-filters:sRGB"
height="100"
width="100"
x="-50"
y="-50">
<feColorMatrix
id="mask-powermask-path-effect28575_primitive1"
values="1"
type="saturate"
result="fbSourceGraphic" />
<feColorMatrix
id="mask-powermask-path-effect28575_primitive2"
values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 "
in="fbSourceGraphic" />
</filter>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
sodipodi:type="star"
style="fill:#000000;stroke-width:4.14614178;stroke-linecap:round;stroke:#000000;stroke-opacity:1;stroke-miterlimit:4.0999999;stroke-dasharray:none;paint-order:stroke fill markers;stroke-linejoin:round"
id="path1855"
inkscape:flatsided="true"
sodipodi:sides="3"
sodipodi:cx="25"
sodipodi:cy="24"
sodipodi:r1="24"
sodipodi:r2="12"
sodipodi:arg1="-1.5707963"
sodipodi:arg2="-0.52359878"
inkscape:rounded="0"
inkscape:randomized="0"
d="m 25.000001,0 20.784608,36.000001 -41.569219,-2e-6 z"
transform="matrix(0.26458333,0,0,0.26458333,-0.26458316,1.5875)"
inkscape:transform-center-y="-1.5875001"
mask="url(#mask-powermask-path-effect28575)"
inkscape:path-effect="#path-effect28575" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -49,4 +49,6 @@ beautiful.mailbox_icon = gears.color.recolor_image(beautiful.icon_dir.."mail.svg
beautiful.username_logout_icon = gears.color.recolor_image(beautiful.icon_dir.."system-log-out-symbolic.svg",beautiful.fg_normal)
beautiful.drawer_open_icon = gears.color.recolor_image(beautiful.icon_dir.."drawer-open.svg",beautiful.fg_normal)
beautiful.drawer_closed_icon = gears.color.recolor_image(beautiful.icon_dir.."drawer-closed.svg",beautiful.fg_normal)
-- Generic icons
beautiful.warning_icon = gears.color.recolor_image(beautiful.icon_dir.."warning.svg",beautiful.fg_normal)

110
widgets/client-volume.lua Normal file
View File

@ -0,0 +1,110 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local awmtk = require("awmtk")
return function(args)
local style = awmtk.style(awmtk.defaults, args.style or {},"client_volume_")
local device = args.device or "default"
local icons = args.icons or {
high = style.client_volume_icon_high,
medium = style.client_volume_icon_medium,
low = style.client_volume_icon_low,
muted = style.client_volume_icon_muted,
warn = style.client_volume_warning_icon
}
local function get_icon(percent)
if percent >= 66 then
return icons.high
elseif percent >= 33 then
return icons.medium
elseif percent > 0 then
return icons.low
else
return icons.muted
end
end
local commands = args.commands or {
get_master = "amixer -D "..device.." sget Master",
set = "amixer -q -D "..device.." sset ",
get = "amixer -D "..device.." sget "
}
local list = {
layout = wibox.layout.fixed.horizontal
}
for k,v in pairs(controls) do
local widget = wibox.widget({
{
widget = wibox.widget.textbox,
markup = v,
ellipsize = "end",
font = style.volume_font
},
{
{
widget = wibox.widget.slider,
id = "widget_slider",
handle_width = style.volume_handle_width or 6,
bar_height = style.volumer_bar_width or 5,
bar_color = style.volume_bar_color or "#55CC60",
bar_shape = style.bar_shape,
handler_shape = style.handle_shape,
value = 100,
},
widget = wibox.container.rotate,
direction = "east"
},
layout = wibox.layout.fixed.vertical,
spacing = style.volume_container_spacing_horizontal,
forced_width = style.volume_slider_width or 40,
forced_height = style.volume_slider_height or 120
})
local slider = widget:get_children_by_id("widget_slider")[1]
awful.spawn.easy_async_with_shell(commands.get..v,function(out)
local volume_percent = out:match("%[(%d+)%%%]") or ""
volume_percent = tonumber(volume_percent)
if not volume_percent then
return
end
slider.value = volume_percent
end)
slider:connect_signal("widget::redraw_needed",function()
awful.spawn(commands.set..v.." "..slider.value.."%")
end)
table.insert(list,widget)
end
local tweaker_popup = awful.popup(style.container(list,{
visible = false,
ontop = true
}))
local icon = style.icon({
widget = wibox.widget.imagebox,
image = icons.muted,
id = "widget_icon"
},{},{
function()
if mouse.current_widget_geometry and (not tweaker_popup.visible) then
tweaker_popup:move_next_to(mouse.current_widget_geometry)
tweaker_popup.visible = true
else
tweaker_popup.visible = false
end
end
})
gears.timer {
autostart = true,
timeout = 0.5,
call_now = true,
callback = function()
awful.spawn.easy_async_with_shell(commands.get_master, function(out)
local volume_percent = out:match("%[(%d+)%%%]") or ""
volume_percent = tonumber(volume_percent)
if not volume_percent then
return
end
icon:get_children_by_id("widget_icon")[1].image = get_icon(volume_percent)
end)
end
}
return icon
end

View File

@ -14,8 +14,8 @@ local function generate_text(c)
end
return markup
end
return function(c)
local widget = {
return function()
local widget = wibox.widget {
{
widget = wibox.widget.textbox,
markup = "",
@ -27,12 +27,9 @@ return function(c)
max_size = 300,
speed = 100
}
widget[1].markup = generate_text(c)
widget = wibox.widget(widget)
widget:pause()
widget:connect_signal("button::press",function(self,lx,ly,button)
if button == 1 then
widget:get_children_by_id("text")[1].markup = generate_text(c)
widget:get_children_by_id("text")[1].markup = generate_text(client.focus)
end
end)
widget:connect_signal("mouse::enter",function()
@ -41,6 +38,9 @@ return function(c)
widget:connect_signal("mouse::leave",function()
widget:continue()
end)
client.connect_signal("focus",function()
widget:get_children_by_id("text")[1].markup = generate_text(client.focus)
end)
return widget
end