summaryrefslogtreecommitdiff
path: root/fs-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2021-06-12 22:24:50 -0400
committerstreetturtle <streetturtle@gmail.com>2021-06-12 22:24:50 -0400
commit92a9170d9ce537693b2bdfe566f119b444bbe2e7 (patch)
tree7175174bffdc22ef8297fc67a36e911a5b56db0b /fs-widget
parent3a26ea67bef3fb6dde898d59f0972724ed2bccea (diff)
[fs] add onclick highlightning
Diffstat (limited to 'fs-widget')
-rw-r--r--fs-widget/fs-widget.lua50
1 files changed, 30 insertions, 20 deletions
diff --git a/fs-widget/fs-widget.lua b/fs-widget/fs-widget.lua
index fa90af2..b5f75f2 100644
--- a/fs-widget/fs-widget.lua
+++ b/fs-widget/fs-widget.lua
@@ -12,22 +12,32 @@ local function worker(user_args)
local timeout = args.timeout or 60
storage_bar_widget = wibox.widget {
- max_value = 100,
- forced_height = 20,
- forced_width = 35,
- paddings = 1,
- margins = 4,
- border_width = 1,
- border_radius = 2,
- border_color = beautiful.fg_normal,
- background_color = beautiful.bg_normal,
- bar_border_width = 1,
- bar_border_color = beautiful.bg_focus,
- color = "linear:150,0:0,0:0,"
- .. beautiful.fg_normal
- .. ":0.3," .. beautiful.bg_urgent .. ":0.6,"
- .. beautiful.fg_normal,
- widget = wibox.widget.progressbar,
+ {
+ id = 'progressbar',
+ max_value = 100,
+ forced_height = 20,
+ forced_width = 35,
+ paddings = 1,
+ margins = 4,
+ border_width = 1,
+ border_radius = 2,
+ border_color = beautiful.fg_normal,
+ background_color = beautiful.bg_normal,
+ bar_border_width = 1,
+ bar_border_color = beautiful.bg_focus,
+ color = "linear:150,0:0,0:0,"
+ .. beautiful.fg_normal
+ .. ":0.3," .. beautiful.bg_urgent .. ":0.6,"
+ .. beautiful.fg_normal,
+ widget = wibox.widget.progressbar
+ },
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, 4)
+ end,
+ widget = wibox.container.background,
+ set_value = function(self, new_value)
+ self:get_children_by_id("progressbar")[1].value = new_value
+ end
}
local disk_rows = {
@@ -68,15 +78,15 @@ local function worker(user_args)
awful.button({}, 1, function()
if popup.visible then
popup.visible = not popup.visible
+ storage_bar_widget:set_bg('#00000000')
else
+ storage_bar_widget:set_bg(beautiful.bg_focus)
popup:move_next_to(mouse.current_widget_geometry)
end
end)
)
)
- local disk_widget = wibox.container.margin(storage_bar_widget, 0, 0, 0, 0)
-
local disks = {}
watch([[bash -c "df | tail -n +2"]], timeout,
function(widget, stdout)
@@ -92,7 +102,7 @@ local function worker(user_args)
disks[mount].mount = mount
if disks[mount].mount == mounts[1] then
- widget.value = tonumber(disks[mount].perc)
+ widget:set_value(tonumber(disks[mount].perc))
end
end
@@ -148,7 +158,7 @@ local function worker(user_args)
storage_bar_widget
)
- return disk_widget
+ return storage_bar_widget
end
return setmetatable(storage_bar_widget, { __call = function(_, ...)