Go slowly all the way round the outside

This commit is contained in:
nik gaffney 2023-05-30 10:59:12 +02:00
parent f8a4ef0be0
commit 985b566065
Signed by: nik
GPG key ID: 989F5E6EDB478160
2 changed files with 53 additions and 14 deletions

30
.github/workflows/melpazoid-quiet.yml vendored Normal file
View file

@ -0,0 +1,30 @@
# melpazoid <https://github.com/riscy/melpazoid> build checks.
# for quiet package
name: melpazoid-quiet
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install
run: |
python -m pip install --upgrade pip
sudo apt-get install emacs && emacs --version
git clone https://github.com/riscy/melpazoid.git ~/melpazoid
pip install ~/melpazoid
- name: Run
env:
LOCAL_REPO: ${{ github.workspace }}
# RECIPE is your recipe as written for MELPA:
RECIPE: (quiet :repo "zzkt/quiet" :fetcher github)
# set this to false (or remove it) if the package isn't on MELPA:
EXIST_OK: true
run: echo $GITHUB_REF && make -C ~/melpazoid

View file

@ -45,20 +45,27 @@
;;; Code:
(defcustom quiet-disconnect "networksetup -setairportpower airport off"
(defcustom quiet-disconnect "networksetup -setairportpower airport off"
"Shell command to turn off network connection(s)."
:type 'string
:options '("networksetup -setairportpower airport off" "ifdown wlan0")
:type '(choice
(string :tag "macOS" "networksetup -setairportpower airport off")
(string :tag "GNU/Linux" "ifdown wlan0")
(string :tag "*BSD" "ifdown wlan0")
(string :tag "other" ""))
:group 'quiet)
(defcustom quiet-connect "networksetup -setairportpower airport on"
(defcustom quiet-connect "networksetup -setairportpower airport on"
"Shell command to turn on network connection(s)."
:type 'string
:options '("networksetup -setairportpower airport off" "ifup wlan0")
:group 'quiet)
:type '(choice
(string :tag "macOS" "networksetup -setairportpower airport on")
(string :tag "GNU/Linux" "ifup wlan0")
(string :tag "*BSD" "ifup wlan0")
(string :tag "other" ""))
:group 'quiet)
(defcustom quiet-timer 0
"Timer to reconnect network after a given time (in minutes). A value of 0 will leave the connection off."
(defcustom quiet-timer 0
"Timer to reconnect network after a given time (in minutes).
A value of 0 will leave the connection off."
:type 'integer
:group 'quiet)
@ -67,11 +74,11 @@
"Quieten network distractions for a while..."
(interactive)
(save-window-excursion
(message "disconnecting...")
(async-shell-command quiet-disconnect))
(message "disconnecting...")
(async-shell-command quiet-disconnect))
(if (not (= quiet-timer 0))
(progn
(run-at-time (* quiet-timer 60) nil 'quiet-reconnect))))
(run-at-time (* quiet-timer 60) nil 'quiet-reconnect))))
;; provide a 'disconnect' alias
(fset 'disconnect 'quiet)
@ -81,8 +88,10 @@
"Reconnect to networked distractions."
(interactive)
(save-window-excursion
(message "reconnecting after ~%d %s" quiet-timer (if (= quiet-timer 1) "minute" "minutes"))
(async-shell-command quiet-connect)))
(message "reconnecting after ~%d %s"
quiet-timer
(if (= quiet-timer 1) "minute" "minutes"))
(async-shell-command quiet-connect)))
(provide 'quiet)