aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2024-09-08 12:18:34 -0400
committerRyan Kavanagh <rak@rak.ac>2024-09-08 12:18:34 -0400
commit174a841d7e4ec0fd31c98422bc49ebe45071ff65 (patch)
tree007cf977bedb2924645009031822378ea02ca828 /bin
parentmake default neomutt printer pdf (diff)
parentfix thread sorting neomutt (diff)
Merge remote-tracking branch 'refs/remotes/origin/master'
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x]bin/executable_mutt_oauth2.py13
-rw-r--r--bin/executable_swaybg-random13
2 files changed, 9 insertions, 17 deletions
diff --git a/bin/executable_mutt_oauth2.py b/bin/executable_mutt_oauth2.py
index b32fc11..559811f 100755..100644
--- a/bin/executable_mutt_oauth2.py
+++ b/bin/executable_mutt_oauth2.py
@@ -39,13 +39,13 @@ import shlex
import socket
import http.server
import subprocess
+import readline
# The token file must be encrypted because it contains multi-use bearer tokens
# whose usage does not require additional verification. Specify whichever
# encryption and decryption pipes you prefer. They should read from standard
-# input and write to standard output. The example values here invoke GPG,
-# although won't work until an appropriate identity appears in the first line.
-ENCRYPTION_PIPE = ['gpg', '--encrypt', '--recipient', 'YOUR_GPG_IDENTITY']
+# input and write to standard output. The example values here invoke GPG.
+ENCRYPTION_PIPE = ['gpg', '--encrypt', '--default-recipient-self']
DECRYPTION_PIPE = ['gpg', '--decrypt']
registrations = {
@@ -93,7 +93,7 @@ ap.add_argument('--decryption-pipe', type=shlex.split, default=DECRYPTION_PIPE,
help='decryption command (string), reads from stdin and writes '
'to stdout, default: "{}"'.format(
" ".join(DECRYPTION_PIPE)))
-ap.add_argument('--encryption-pipe', type=shlex.split,
+ap.add_argument('--encryption-pipe', type=shlex.split, default=ENCRYPTION_PIPE,
help='encryption command (string), reads from stdin and writes '
'to stdout, suggested: "{}"'.format(
" ".join(ENCRYPTION_PIPE)))
@@ -140,6 +140,8 @@ if args.debug:
if not token:
if not args.authorize:
sys.exit('You must run script with "--authorize" at least once.')
+ if not ENCRYPTION_PIPE:
+ sys.exit("You need to provide a suitable --encryption-pipe setting")
print('', )
token['registration'] = args.provider or input(
'Available app and endpoint registrations: {regs}\nOAuth2 registration: '.format(
@@ -241,7 +243,7 @@ if args.authorize:
if 'code' in querydict:
authcode = querydict['code'][0]
self.do_HEAD()
- self.wfile.write(b'<html><head><title>Authorizaton result</title></head>')
+ self.wfile.write(b'<html><head><title>Authorization result</title></head>')
self.wfile.write(b'<body><p>Authorization redirect completed. You may '
b'close this window.</p></body></html>')
with http.server.HTTPServer(('127.0.0.1', listen_port), MyHandler) as httpd:
@@ -259,6 +261,7 @@ if args.authorize:
'code': authcode,
'client_secret': token['client_secret'],
'code_verifier': verifier})
+ print('Exchanging the authorization code for an access token')
try:
response = urllib.request.urlopen(registration['token_endpoint'],
urllib.parse.urlencode(p).encode())
diff --git a/bin/executable_swaybg-random b/bin/executable_swaybg-random
index 6184e33..ba4baa1 100644
--- a/bin/executable_swaybg-random
+++ b/bin/executable_swaybg-random
@@ -1,15 +1,4 @@
#!/bin/sh
# Usage: swaybg-random directory
-DIR=$1
-PIDFILE=$XDG_RUNTIME_DIR/swaybg.pid
-
-if test -z "$DIR"; then
- echo "Usage: swaybg-random dir"
- exit 1
-fi
-
-swaybg -i $(find $DIR/. -type f | shuf -n1) -m fill -o \* &
-NEWPID=$!
-pkill -F $PIDFILE
-echo $NEWPID > $PIDFILE
+exec swaybg -i "$(find ~/bg/. -type f | shuf -n1)" -m fill