From de2e58da681999104cae2d4adaddc90c3a7bb8f8 Mon Sep 17 00:00:00 2001 From: Bruno Paz <184563+brpaz@users.noreply.github.com> Date: Wed, 15 Jun 2022 12:12:49 +0100 Subject: [PATCH] feat: small improvments --- .github/dependabot.yml | 13 +++++++++++++ .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++++--- .pre-commit-config.yaml | 20 ++++++++++---------- .releaserc.json | 12 ++++++++++++ Makefile | 21 +++++++++------------ README.md | 11 +++++++---- brotab_ulauncher/brotab.py | 2 +- brotab_ulauncher/extension.py | 6 +----- requirements.txt | 2 ++ 9 files changed, 84 insertions(+), 35 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .releaserc.json create mode 100644 requirements.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..429776a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# Dependabot configuration +# see: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates#configuration-options-for-dependabotyml +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + assignees: + - "@brpaz" + labels: + - "dependencies" + open-pull-requests-limit: 3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b195b0..7a1653e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,14 +1,24 @@ name: CI -on: [push] +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + branches: + - main + - master + pull_request: + branches: + - main + - master jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: 3.7 - name: Install dependencies @@ -17,3 +27,19 @@ jobs: pip install flake8 - name: Lint with flake8 run: make lint + + release: + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v3 + with: + extra_plugins: | + @semantic-release/changelog + @semantic-release/git + @semantic-release/github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 613afef..32c0bbb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ - repo: local hooks: - - id: yapf - name: yapf - entry: make format - language: system - types: [python] - - id: lint - name: flake8 - entry: make lint - language: system - types: [python] + - id: format + name: format + entry: make format + language: system + types: [python] + - id: lint + name: flake8 + entry: make lint + language: system + types: [python] diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..ab1babb --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,12 @@ +{ + "branches": [ + "master" + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github", + "@semantic-release/changelog", + "@semantic-release/git" + ] +} diff --git a/Makefile b/Makefile index 89a9bfd..7794a4b 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,15 @@ -EXT_NAME:=ulauncher-brotab +EXT_NAME:=com.github.com.brpaz.ulauncher-brotab EXT_DIR:=$(shell pwd) -.PHONY: help lint format link unlink deps dev setup -.DEFAULT_GOAL := help +.PHONY: help lint format link unlink deps dev +.DEFAULT_TARGET: help -setup: ## Setups the project - pre-commit install +help: ## Show help menu + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -lint: ## Run Lint - @flake8 --ignore=E402,F401 +lint: ## Run Pylint + @flake8 format: ## Format code using yapf @yapf --in-place --recursive . @@ -18,13 +18,10 @@ link: ## Symlink the project source directory with Ulauncher extensions dir. @ln -s ${EXT_DIR} ~/.local/share/ulauncher/extensions/${EXT_NAME} unlink: ## Unlink extension from Ulauncher - @rm -r ~/.local/share/ulauncher/extensions/${EXT_NAME} + @rm -rf ~/.local/share/ulauncher/extensions/${EXT_NAME} deps: ## Install Python Dependencies @pip3 install -r requirements.txt dev: ## Runs ulauncher on development mode - ulauncher -v --dev --no-extensions |& grep "${EXT_NAME}" - -help: ## Show help menu - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + ulauncher --no-extensions --dev -v |& grep "ulauncher-brotab" diff --git a/README.md b/README.md index 2fd6ad2..74865ca 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # Brotab Ulauncher Extension +> Control your browser tabs directly from Ulauncher with [Brotab](https://github.com/balta2ar/brotab). + [![Ulauncher Extension](https://img.shields.io/badge/Ulauncher-Extension-yellowgreen.svg?style=for-the-badge)](https://ext.ulauncher.io/) [![CI Status](https://img.shields.io/github/workflow/status/brpaz/ulauncher-brotab/CI?color=orange&label=actions&logo=github&logoColor=orange&style=for-the-badge)](https://github.com/brpaz/ulauncher-brotab) [![license](https://img.shields.io/github/license/brpaz/ulauncher-brotab.svg?style=for-the-badge)](LICENSE) -> Control your browser tabs directly from Ulauncher with [Brotab](https://github.com/balta2ar/brotab). + ## Demo @@ -22,12 +24,11 @@ You also need to have some Python packages installed on your system. You can do so, by running the following command: ```sh -pip install --user memoization==0.3.1 +pip install --user memoization==0.4.0 ``` In some systems, you might need to run `pip3` instead of `pip`. - ## Install Open ulauncher preferences window -> extensions -> add extension and paste the following url: @@ -60,7 +61,7 @@ The output will display something like this: 2020-11-15 10:24:16,869 | WARNING | ulauncher.api.server.ExtensionRunner: _run_process() | VERBOSE=1 ULAUNCHER_WS_API=ws://127.0.0.1:5054/ulauncher-brotab PYTHONPATH=/usr/lib/python3.8/site-packages /usr/bin/python3 /home/bruno/.local/share/ulauncher/extensions/ulauncher-brotab/main.py ``` -Open another terminal window and execute the command displayed, "starting at VERBOSE=1". This will activate the extension. +Open another terminal window and execute the command displayed, "starting at VERBOSE=1". This will activate the extension. To see your changes, CTRL+C the previous command and run it again to refresh. @@ -108,3 +109,5 @@ Or if you prefer a one time donation to the project, you can simple: Copyright © 2020 [Bruno Paz](https://github.com/brpaz). This project is [MIT](https://opensource.org/licenses/MIT) licensed. + +Tab icons created by Freepik - Flaticon diff --git a/brotab_ulauncher/brotab.py b/brotab_ulauncher/brotab.py index a5a345f..0ab1d5f 100644 --- a/brotab_ulauncher/brotab.py +++ b/brotab_ulauncher/brotab.py @@ -5,7 +5,7 @@ from brotab.inout import is_port_accepting_connections from brotab.inout import get_mediator_ports -from brotab.inout import in_temp_dir +from brotab import in_temp_dir from brotab.api import SingleMediatorAPI, MultipleMediatorsAPI FORMAT = '%(asctime)-15s %(levelname)-10s %(message)s' diff --git a/brotab_ulauncher/extension.py b/brotab_ulauncher/extension.py index 5191cc3..f78e1d9 100644 --- a/brotab_ulauncher/extension.py +++ b/brotab_ulauncher/extension.py @@ -2,11 +2,6 @@ Extension Class """ -import gi - -gi.require_version("Gtk", "3.0") - -from gi.repository import Gtk from ulauncher.api.client.Extension import Extension from ulauncher.api.shared.event import KeywordQueryEvent, ItemEnterEvent from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem @@ -22,6 +17,7 @@ class BrotabExtension(Extension): """ Main Extension Class """ + def __init__(self): """ Initializes the extension """ super(BrotabExtension, self).__init__() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7b8d248 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +brotab=~1.4.2 +memoization=~0.4.0