From ef93c0ccd720b833c8cdc234b980e312e65fe440 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Sun, 30 Oct 2022 01:22:54 +0200 Subject: [PATCH] added pre-commit --- .pre-commit-config.yaml | 19 +++++++++++++++++++ roles/wofi/files/powermenu.sh | 28 ---------------------------- roles/wofi/tasks/main.yml | 6 +++--- 3 files changed, 22 insertions(+), 31 deletions(-) create mode 100644 .pre-commit-config.yaml delete mode 100755 roles/wofi/files/powermenu.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c6435ec --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-yaml + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] +- repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.7.2.1 + hooks: + - id: shellcheck +- repo: local + hooks: + - id: ansible-syntax-check + name: Ansible syntax check + entry: "ansible-playbook --syntax-check install.yml" + pass_filenames: no + types_or: [yaml, jinja] + language: system diff --git a/roles/wofi/files/powermenu.sh b/roles/wofi/files/powermenu.sh deleted file mode 100755 index e5e6d72..0000000 --- a/roles/wofi/files/powermenu.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -action=$(echo -e "suspend\nlock\nlogout\nshutdown\nreboot" | wofi -d -p "power:" -L 5) - -if [[ "$action" == "lock" ]] -then - swaylock-fancy -fi - -if [[ "$action" == "suspend" ]] -then - swaylock-fancy && systemctl suspend && echo '*/reconnect' >~/.weechat/weechat_fifo -fi - -if [[ "$action" == "logout" ]] -then - swaymsg exit -fi - -if [[ "$action" == "shutdown" ]] -then - shutdown now -fi - -if [[ "$action" == "reboot" ]] -then - reboot -fi diff --git a/roles/wofi/tasks/main.yml b/roles/wofi/tasks/main.yml index 2493105..20182c6 100644 --- a/roles/wofi/tasks/main.yml +++ b/roles/wofi/tasks/main.yml @@ -15,7 +15,7 @@ dest: ~/.config/wofi/ - name: copy wofi powermenu - copy: - src: powermenu.sh - dest: ~/.config/wofi/ + template: + src: powermenu.sh.j2 + dest: ~/.config/wofi/powermenu.sh mode: 0755