awesome-wm-widgets/bitbucket-widget
pingarelho 5e8d065baf 'e.g.' instead of 'e.g' 2023-09-20 23:09:25 +01:00
..
README.md 'e.g.' instead of 'e.g' 2023-09-20 23:09:25 +01:00
bitbucket-icon-gradient-blue.svg Bitbucket widget 2020-01-29 21:13:06 -05:00
bitbucket.lua Revert "[bitbucket] hide popup on right click" 2020-12-26 14:54:45 -05:00
check.svg [bitbucket] add more information to the widget 2020-10-14 21:06:43 -04:00
clipboard.svg [bitbucket] add more information to the widget 2020-10-14 21:06:43 -04:00
copy.svg [bitbucket] add more information to the widget 2020-10-14 21:06:43 -04:00
git-pull-request.svg [bitbucket] add more information to the widget 2020-10-14 21:06:43 -04:00
message-circle.svg [bitbucket] add more information to the widget 2020-10-14 21:06:43 -04:00
test_bitbucket_api.sh refactor bitbucket widget 2020-02-01 14:04:31 -05:00
user.svg [bitbucket] add more information to the widget 2020-10-14 21:06:43 -04:00

README.md

Bitbucket widget

The widget shows the number of pull requests assigned to the user and when clicked shows them in the list with some additional information. When item in the list is clicked - it opens the pull request in the browser.

How it works

Widget uses cURL to query Bitbucket's REST API. In order to be authenticated, widget uses a netrc feature of the cURL, which is basically allows storing basic auth credentials in a .netrc file in home folder.

Bitbucket allows using App Passwords (available in the account settings) - simply generate one for the widget and use it as password in .netrc file.

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/bitbucket-widget/bitbucket-icon-gradient-blue.svg Path to the icon
host Required e.g. http://api.bitbucket.org
uuid Required e.g. {123e4567-e89b-12d3-a456-426614174000}
workspace Required Workspace ID
repo_slug Required Repository slug
timeout 60 How often in seconds the widget refreshes

Note:

  • host most likely should start with api.
  • to get your UUID you may call curl -s -n 'https://api.bitbucket.org/2.0/user'

Installation

Create a .netrc file in you home directory with following content:

machine api.bitbucket.org
login mikey@tmnt.com
password cowabunga

Then change file's permissions to 600 (so only you can read/write it):

chmod 600 ~/.netrc

And test if it works by calling the API:

curl -s -n 'https://api.bitbucket.org/2.0/repositories/'

Also, to properly setup required parameters you can use test_bitbucket_api.sh script - it uses the same curl call as widget.

Then clone/download repo and use widget in rc.lua:

local bitbucket_widget = require("awesome-wm-widgets.bitbucket-widget.bitbucket")
...
s.mytasklist, -- Middle widget
	{ -- Right widgets
    	layout = wibox.layout.fixed.horizontal,
		...
		-- default
		bitbucket_widget({
		    host = 'https://api.bitbucket.org',
            uuid = '{123e4567-e89b-12d3-a456-426614174000}',
            workspace = 'workspace',
            repo_slug = 'slug'

		}}),
		...