summaryrefslogtreecommitdiff
path: root/gerrit-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2019-10-01 21:49:58 -0400
committerstreetturtle <streetturtle@gmail.com>2019-10-01 21:49:58 -0400
commit79e22c694062d99f96a0746ffdb81823002745e8 (patch)
treef0101c02e5f419df82638ae0d7d320aa03f596bf /gerrit-widget
parent097daa7d44bc6eb758c45653b1c24413c4c11fdb (diff)
added icon
Diffstat (limited to 'gerrit-widget')
-rw-r--r--gerrit-widget/gerrit.lua41
-rw-r--r--gerrit-widget/gerrit_icon.svg (renamed from gerrit-widget/Gerrit_icon.svg)0
2 files changed, 30 insertions, 11 deletions
diff --git a/gerrit-widget/gerrit.lua b/gerrit-widget/gerrit.lua
index 5cf5b75..a9a3ca1 100644
--- a/gerrit-widget/gerrit.lua
+++ b/gerrit-widget/gerrit.lua
@@ -39,7 +39,6 @@ local function worker(args)
local rows = {
{
- text = 'asdR',
widget = wibox.widget.textbox
},
layout = wibox.layout.fixed.vertical,
@@ -56,15 +55,33 @@ local function worker(args)
}
gerrit_widget = wibox.widget {
- --{
- id = txt,
+ {
+ {
+ image = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg',
+ widget = wibox.widget.imagebox
+ },
+ margins = 4,
+ layout = wibox.container.margin
+ },
+ {
+ id = "txt",
+ widget = wibox.widget.textbox
+ },
+ {
+ id = "new_rev",
widget = wibox.widget.textbox
- --},
- --{
- -- image = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/gerrit-widget/Gerrit_icon.svg',
- -- widget = wibox.widget.imagebox
- --},
- --layout = wibox.layout.fixed.horizontal,
+ },
+ layout = wibox.layout.fixed.horizontal,
+ set_text = function(self, new_value)
+ self.txt.text = new_value
+ end,
+ set_unseen_review = function(self, is_new_review)
+ if is_new_review then
+ self.new_rev.text = '*'
+ else
+ self.new_rev.text = ''
+ end
+ end
}
local function get_name_by_id(id)
@@ -84,8 +101,9 @@ local function worker(args)
current_number_of_reviews = rawlen(reviews)
if current_number_of_reviews > previous_number_of_reviews then
+ widget:set_unseen_review(true)
naughty.notify{
- icon = os.getenv("HOME") ..'/.config/awesome/awesome-wm-widgets/gerrit-widget/Gerrit_icon.svg',
+ icon = os.getenv("HOME") ..'/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg',
title = 'New Incoming Review',
text = reviews[1].project .. '\n' .. get_name_by_id(reviews[1].owner._account_id) .. reviews[1].subject ..'\n',
run = function() spawn.with_shell("google-chrome https://" .. host .. '/' .. reviews[1]._number) end
@@ -93,7 +111,7 @@ local function worker(args)
end
previous_number_of_reviews = current_number_of_reviews
- widget.text = current_number_of_reviews
+ widget:set_text(current_number_of_reviews)
count = #rows
for i=0, count do rows[i]=nil end
@@ -151,6 +169,7 @@ local function worker(args)
gerrit_widget:buttons(
awful.util.table.join(
awful.button({}, 1, function()
+ gerrit_widget:set_unseen_review(false)
awful.placement.top_right(popup, { margins = { top = 25, right = 10}, parent = awful.screen.focused() })
popup.visible = not popup.visible
end)
diff --git a/gerrit-widget/Gerrit_icon.svg b/gerrit-widget/gerrit_icon.svg
index 4ac5652..4ac5652 100644
--- a/gerrit-widget/Gerrit_icon.svg
+++ b/gerrit-widget/gerrit_icon.svg