awesome-wm-widgets/gerrit-widget
Pavel Makhov 998f6ad7da Small improvements in jira widget 2019-11-23 21:57:26 -05:00
..
README.md Small improvements in jira widget 2019-11-23 21:57:26 -05:00
gerrit.lua fix but with missing avatar 2019-11-08 14:30:47 -05:00
gerrit_icon.svg added icon 2019-10-01 21:49:58 -04:00
gerrit_widget.png Add screenshots to gerrit widget 2019-11-23 21:54:52 -05:00
new_review.png Add screenshots to gerrit widget 2019-11-23 21:54:52 -05:00
popup.png Add screenshots to gerrit widget 2019-11-23 21:54:52 -05:00

README.md

Gerrit widget

It shows number of currently assigned reviews in Gerrit to the user (by default) :

gerrit_widget

when clicked it shows reviews in a list, if an item of a list is clicked, the review will be opened in the default browser:

popup

Also, if a new review is assigned to the user, there will be a pop-up:

new_review

Customization

It is possible to customize widget by providing a table with all or some of the following config parameters:

Name Default Description
icon /.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg Path to the icon
host Required Ex https://gerrit.tmnt.com
query is:reviewer AND status:open AND NOT is:wip Query to retrieve reviews

Prerequisite

  • curl - is used to communicate with gerrit's REST API
  • setup netrc which is used to store username and password in order to call API's endpoints.

Installation

  1. This widget relies on Gerrit REST API, so you need to have a permission to access it. You also need to setup netrc, as widget uses curl to communicate with API and you have to be authenticated. To test if you have access to API and netrc setup is correct run following command, you should have a json response:

     curl  -s --request GET --netrc https://gerrit-host.com/a/changes/\?q\=status:open+AND+NOT+is:wip+AND+is:reviewer | tail -n +2
    

    Note: tail -n +2 is needed to skip first line of the response, as gerrit returns some characters there in order to prevent XSS hacks.

  2. Download json parser for lua from github.com/rxi/json.lua and place it under ~/.config/awesome/ (don't forget to star a repo):

    wget -P ~/.config/awesome/ https://raw.githubusercontent.com/rxi/json.lua/master/json.lua
    
  3. Clone this repo (if not cloned yet) under ~/.config/awesome/:

    git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/
    
  4. Require widget at the top of the rc.lua:

    local gerrit_widget = require("awesome-wm-widgets.gerrit-widget.gerrit")
    
  5. Add widget to the tasklist:

    s.mytasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,
            ...
            --default
            gerrit_widget({host = 'https://gerrit.tmnt.com'}),
            --customized
            gerrit_widget({
                host = 'https://gerrit.tmnt.com',
                query = 'is:reviewer AND is:wip'
            })
            ...