tiny refactoring

This commit is contained in:
Pavel Makhov 2019-12-17 16:27:30 -05:00
parent 2a1fb60118
commit a1f93fa8bd
3 changed files with 12 additions and 19 deletions

View File

@ -137,7 +137,6 @@ local function worker(args)
ontop = true, ontop = true,
visible = false, visible = false,
shape = gears.shape.rounded_rect, shape = gears.shape.rounded_rect,
preferred_positions = top,
offset = { y = 5 }, offset = { y = 5 },
border_width = 1, border_width = 1,
border_color = calendar_themes[theme].border, border_color = calendar_themes[theme].border,

View File

@ -45,14 +45,12 @@ local function worker(args)
} }
local popup = awful.popup{ local popup = awful.popup{
visible = true,
ontop = true, ontop = true,
visible = false, visible = false,
shape = gears.shape.rounded_rect, shape = gears.shape.rounded_rect,
border_width = 1, border_width = 1,
border_color = beautiful.bg_focus, border_color = beautiful.bg_focus,
maximum_width = 400, maximum_width = 400,
preferred_positions = top,
offset = { y = 5 }, offset = { y = 5 },
widget = {} widget = {}
} }
@ -84,7 +82,7 @@ local function worker(args)
} }
local function get_name_by_user_id(user_id) local function get_name_by_user_id(user_id)
if name_dict[user_id] == null then if name_dict[user_id] == nil then
name_dict[user_id] = {} name_dict[user_id] = {}
end end

View File

@ -43,14 +43,12 @@ local function worker(args)
} }
local popup = awful.popup{ local popup = awful.popup{
visible = true,
ontop = true, ontop = true,
visible = false, visible = false,
shape = gears.shape.rounded_rect, shape = gears.shape.rounded_rect,
border_width = 1, border_width = 1,
border_color = beautiful.bg_focus, border_color = beautiful.bg_focus,
maximum_width = 400, maximum_width = 400,
preferred_positions = top,
offset = { y = 5 }, offset = { y = 5 },
widget = {} widget = {}
} }
@ -86,6 +84,12 @@ local function worker(args)
current_number_of_reviews = rawlen(result.issues) current_number_of_reviews = rawlen(result.issues)
if current_number_of_reviews == 0 then
widget:set_visible(false)
return
end
widget:set_visible(true)
widget:set_text(current_number_of_reviews) widget:set_text(current_number_of_reviews)
for i = 0, #rows do rows[i]=nil end for i = 0, #rows do rows[i]=nil end
@ -149,11 +153,7 @@ local function worker(args)
row:buttons( row:buttons(
awful.util.table.join( awful.util.table.join(
awful.button({}, 1, function() awful.button({}, 1, function()
spawn.with_shell("google-chrome " .. host .. '/browse/' .. issue.key) spawn.with_shell("xdg-open " .. host .. '/browse/' .. issue.key)
popup.visible = false
end),
awful.button({}, 3, function()
spawn.with_shell("echo 'git-review -d " .. issue._number .."' | xclip -selection clipboard")
popup.visible = false popup.visible = false
end) end)
) )
@ -171,15 +171,11 @@ local function worker(args)
if popup.visible then if popup.visible then
popup.visible = not popup.visible popup.visible = not popup.visible
else else
--local geo = mouse.current_widget_geometry local geo = mouse.current_widget_geometry
--if theme.calendar_placement == 'center' then local x = geo.x + (geo.width / 2) - (popup:geometry().width / 2)
-- local x = geo.x + (geo.width / 2) - (popup:geometry().width / 2) -- align two widgets popup:move_next_to({x = x, y = geo.y + 22, width = 0, height = geo.height})
-- popup:move_next_to({x = x, y = geo.y + 22, width = 0, height = geo.height})
--else
-- popup:move_next_to(geo)
--end
popup:move_next_to(mouse.current_widget_geometry) -- popup:move_next_to(mouse.current_widget_geometry)
end end
end) end)
) )