diff options
| author | Pavel Makhov <pmakhov@theoctavegroup.com> | 2019-12-17 16:27:30 -0500 | 
|---|---|---|
| committer | Pavel Makhov <pmakhov@theoctavegroup.com> | 2019-12-17 16:27:30 -0500 | 
| commit | a1f93fa8bd836f106acb3decbd1d21a9877e08f9 (patch) | |
| tree | dc0ea8a89230c52e23dd75c7d37ef4cb4e824e1a /jira-widget | |
| parent | 2a1fb6011857f12d3bfc4a67b73f427f047a788f (diff) | |
tiny refactoring
Diffstat (limited to 'jira-widget')
| -rw-r--r-- | jira-widget/jira.lua | 28 | 
1 files changed, 12 insertions, 16 deletions
diff --git a/jira-widget/jira.lua b/jira-widget/jira.lua index 158db7c..d0b364b 100644 --- a/jira-widget/jira.lua +++ b/jira-widget/jira.lua @@ -43,14 +43,12 @@ local function worker(args)      }      local popup = awful.popup{ -        visible = true,          ontop = true,          visible = false,          shape = gears.shape.rounded_rect,          border_width = 1,          border_color = beautiful.bg_focus,          maximum_width = 400, -        preferred_positions = top,          offset = { y = 5 },          widget = {}      } @@ -86,6 +84,12 @@ local function worker(args)          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)          for i = 0, #rows do rows[i]=nil end @@ -149,11 +153,7 @@ local function worker(args)              row:buttons(                      awful.util.table.join(                              awful.button({}, 1, function() -                                spawn.with_shell("google-chrome " .. host .. '/browse/' .. issue.key) -                                popup.visible = false -                            end), -                            awful.button({}, 3, function() -                                spawn.with_shell("echo 'git-review -d " .. issue._number .."' | xclip -selection clipboard") +                                spawn.with_shell("xdg-open " .. host .. '/browse/' .. issue.key)                                  popup.visible = false                              end)                      ) @@ -171,15 +171,11 @@ local function worker(args)                          if popup.visible then                              popup.visible = not popup.visible                          else -                            --local geo = mouse.current_widget_geometry -                            --if theme.calendar_placement == 'center' then -                            --    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}) -                            --else -                            --    popup:move_next_to(geo) -                            --end - -                            popup:move_next_to(mouse.current_widget_geometry) +                            local geo = mouse.current_widget_geometry +                            local x = geo.x + (geo.width / 2) - (popup:geometry().width / 2) +                            popup:move_next_to({x = x, y = geo.y + 22, width = 0, height = geo.height}) + +                            -- popup:move_next_to(mouse.current_widget_geometry)                          end                      end)              )  | 
