From 22b481863150b0b7c15c3c40458c5643cda1b210 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:07:36 +0000 Subject: [PATCH 01/10] desktop client setup --- README_commandline.md | 23 ++++++-- epicyon.py | 3 +- ...op-notifications => install-desktop-client | 52 +++++++++++-------- 3 files changed, 51 insertions(+), 27 deletions(-) rename install-desktop-notifications => install-desktop-client (57%) diff --git a/README_commandline.md b/README_commandline.md index f92a10708..42a4dce76 100644 --- a/README_commandline.md +++ b/README_commandline.md @@ -411,17 +411,30 @@ python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --notify your You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive. -## Desktop notifications +## Desktop client -You can get desktop notifications either by running the screen reader as shown above, or if you only want notifications and not spoken messages then you can run the client as follows, without the *screenreader* option: +You can install the desktop client with: ``` bash -python3 epicyon.py --notify yournickname@yourdomain +./install-desktop-client +``` + +and run it with: + +``` bash +~/epicyon-client +``` + + +You can run a desktop client as follows: + +``` bash +python3 epicyon.py --client yournickname@yourdomain ``` You can also use the **--password** option if needed. -The notifications client also provides a number of basic commands, which may be more convenient than the web interface for some purposes: +The desktop client also provides a number of commands, which may be more convenient than the web interface for some purposes: ``` bash quit Exit from the notification client @@ -445,4 +458,4 @@ read [post number] Read a post from a timeline open [post number] Open web links within a timeline post ``` -If you have a GPG key configured on your local system and are sending a direct message to someone who has a PGP key (the exported key, not just the key ID) set as a tag on their profile then it will try to encrypt the message automatically. So under some conditions end-to-end encryption is possible, such that the instance server only sees ciphertext. Conversely, for arriving direct messages if they are PGP encrypted then the notification client will try to obtain the relevant public key and decrypt. +If you have a GPG key configured on your local system and are sending a direct message to someone who has a PGP key (the exported key, not just the key ID) set as a tag on their profile then it will try to encrypt the message automatically. So under some conditions end-to-end encryption is possible, such that the instance server only sees ciphertext. Conversely, for arriving direct messages if they are PGP encrypted then the desktop client will try to obtain the relevant public key and decrypt. diff --git a/epicyon.py b/epicyon.py index 0d9f61284..bc828851a 100644 --- a/epicyon.py +++ b/epicyon.py @@ -454,7 +454,8 @@ parser.add_argument('--level', dest='skillLevelPercent', type=int, parser.add_argument('--status', '--availability', dest='availability', type=str, default=None, help='Set an availability status') -parser.add_argument('--notifications', '--notify', dest='notifications', +parser.add_argument('--notifications', '--notify', '--client', + dest='notifications', type=str, default=None, help='Notify posts as they arrive at your ' + 'inbox. --notifications [handle]') diff --git a/install-desktop-notifications b/install-desktop-client similarity index 57% rename from install-desktop-notifications rename to install-desktop-client index d6664e141..a9b6a3b1f 100755 --- a/install-desktop-notifications +++ b/install-desktop-client @@ -15,7 +15,7 @@ if [ ! -f /usr/bin/zenity ]; then fi fi -HANDLE=$(zenity --entry --width=400 --title "Epicyon Desktop Notifications" --text "Fediverse handle (name@domain): ") +HANDLE=$(zenity --entry --width=400 --title "Epicyon Desktop Client" --text "Fediverse handle (name@domain): ") if [ ! "$HANDLE" ]; then zenity --warning --width=400 --text "No fediverse handle was given" exit 1 @@ -24,11 +24,11 @@ if [[ "$HANDLE" != *'@'* ]]; then zenity --warning --width=400 --text "Fediverse handle must be in the form username@domain" exit 2 fi -PASSWORD=$(zenity --width=400 --password --title "Epicyon Desktop Notifications") -if [ ! "$PASSWORD" ]; then - zenity --warning --width=400 --text "No password was given" - exit 3 -fi +# PASSWORD=$(zenity --width=400 --password --title "Epicyon Desktop Client") +# if [ ! "$PASSWORD" ]; then +# zenity --warning --width=400 --text "No password was given" +# exit 3 +# fi if [ ! -f /usr/bin/git ]; then if [ -f /usr/bin/apt ]; then @@ -87,19 +87,29 @@ if [ ! -d ${HOME}/.gnupg ]; then gpg --quick-generate-key "${HANDLE}" ed25519 cert fi -{ echo '[Unit]'; - echo 'Description=Epicyon Desktop Notifications'; - echo ''; - echo '[Service]'; - echo "WorkingDirectory=${HOME}/.epicyon"; - echo "ExecStart=/usr/bin/python3 epicyon.py --noKeyPress --notifyType $notificationType --notify $HANDLE --password \"$PASSWORD\""; - echo 'Type=oneshot'; - echo 'RemainAfterExit=yes'; - echo ''; - echo '[Install]'; - echo 'WantedBy=default.target'; } > "${HOME}/.config/systemd/user/epicyon-notifications.service" -systemctl --user enable epicyon-notifications.service -systemctl --user daemon-reload -systemctl --user restart epicyon-notifications.service & +#{ echo '[Unit]'; +# echo 'Description=Epicyon Desktop Notifications'; +# echo ''; +# echo '[Service]'; +# echo "WorkingDirectory=${HOME}/.epicyon"; +# echo "ExecStart=/usr/bin/python3 epicyon.py --noKeyPress --notifyType $notificationType --notify $HANDLE --password \"$PASSWORD\""; +# echo 'Type=oneshot'; +# echo 'RemainAfterExit=yes'; +# echo ''; +# echo '[Install]'; +# echo 'WantedBy=default.target'; } > "${HOME}/.config/systemd/user/epicyon-notifications.service" +#systemctl --user daemon-reload +#systemctl --user stop epicyon-notifications.service & +#systemctl --user disable epicyon-notifications.service -zenity --info --width=400 --text "Epicyon notifications are now enabled" +{ echo '#!/bin/bash'; + echo 'cd ~/.epicyon'; + echo "PASSWORD=\$(zenity --width=400 --password --title \"Epicyon Desktop Client\")"; + echo "if [ ! \"\$PASSWORD\" ]; then"; + echo " zenity --warning --width=400 --text \"No password was given\""; + echo ' exit 3'; + echo 'fi'; + echo "python3 epicyon.py --client ${HANDLE} --password \"\$PASSWORD\""; } > ~/epicyon-client +chmod +x ~/epicyon-client + +zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client" From 9e0da09cf046e8a1aab11f6f26c49bee122fa931 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:11:54 +0000 Subject: [PATCH 02/10] Rename option to client --- README_commandline.md | 2 +- epicyon.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README_commandline.md b/README_commandline.md index 42a4dce76..73f9e46c9 100644 --- a/README_commandline.md +++ b/README_commandline.md @@ -406,7 +406,7 @@ python3 epicyon.py --speaker yournickname@yourdomain Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed: ``` bash -python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --notify yournickname@yourdomain +python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --client yournickname@yourdomain ``` You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive. diff --git a/epicyon.py b/epicyon.py index bc828851a..216657792 100644 --- a/epicyon.py +++ b/epicyon.py @@ -454,11 +454,9 @@ parser.add_argument('--level', dest='skillLevelPercent', type=int, parser.add_argument('--status', '--availability', dest='availability', type=str, default=None, help='Set an availability status') -parser.add_argument('--notifications', '--notify', '--client', - dest='notifications', +parser.add_argument('--client', dest='client', type=str, default=None, - help='Notify posts as they arrive at your ' + - 'inbox. --notifications [handle]') + help='Run desktop client') parser.add_argument('--block', dest='block', type=str, default=None, help='Block a particular address') parser.add_argument('--unblock', dest='unblock', type=str, default=None, @@ -1833,7 +1831,7 @@ if args.availability: time.sleep(1) sys.exit() -if args.notifications: +if args.client: # Announce posts as they arrive in your inbox using text-to-speech if args.notifications.startswith('@'): args.notifications = args.notifications[1:] From 4ecee6b829f4a373c1c93114b2d7fc5bf482b393 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:14:03 +0000 Subject: [PATCH 03/10] Rename option to desktop --- epicyon.py | 4 ++-- install-desktop-client | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epicyon.py b/epicyon.py index 216657792..5861e4940 100644 --- a/epicyon.py +++ b/epicyon.py @@ -454,7 +454,7 @@ parser.add_argument('--level', dest='skillLevelPercent', type=int, parser.add_argument('--status', '--availability', dest='availability', type=str, default=None, help='Set an availability status') -parser.add_argument('--client', dest='client', +parser.add_argument('--desktop', dest='desktop', type=str, default=None, help='Run desktop client') parser.add_argument('--block', dest='block', type=str, default=None, @@ -1831,7 +1831,7 @@ if args.availability: time.sleep(1) sys.exit() -if args.client: +if args.desktop: # Announce posts as they arrive in your inbox using text-to-speech if args.notifications.startswith('@'): args.notifications = args.notifications[1:] diff --git a/install-desktop-client b/install-desktop-client index a9b6a3b1f..9381486ed 100755 --- a/install-desktop-client +++ b/install-desktop-client @@ -109,7 +109,7 @@ fi echo " zenity --warning --width=400 --text \"No password was given\""; echo ' exit 3'; echo 'fi'; - echo "python3 epicyon.py --client ${HANDLE} --password \"\$PASSWORD\""; } > ~/epicyon-client + echo "python3 epicyon.py --desktop ${HANDLE} --password \"\$PASSWORD\""; } > ~/epicyon-client chmod +x ~/epicyon-client zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client" From b02c6c9de1f537fb2e0306e6f3df39240bd315a3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:15:49 +0000 Subject: [PATCH 04/10] Rename variable --- epicyon.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/epicyon.py b/epicyon.py index 5861e4940..567c5372b 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1833,13 +1833,13 @@ if args.availability: if args.desktop: # Announce posts as they arrive in your inbox using text-to-speech - if args.notifications.startswith('@'): - args.notifications = args.notifications[1:] - if '@' not in args.notifications: + if args.desktop.startswith('@'): + args.desktop = args.desktop[1:] + if '@' not in args.desktop: print('Specify the handle to notify: nickname@domain') sys.exit() - nickname = args.notifications.split('@')[0] - domain = args.notifications.split('@')[1] + nickname = args.desktop.split('@')[0] + domain = args.desktop.split('@')[1] if not nickname: print('Specify a nickname with the --nickname option') From 6df9396e830f03985dd5e888651e93d7b77465f0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:18:44 +0000 Subject: [PATCH 05/10] Optionally use parameter as password --- install-desktop-client | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install-desktop-client b/install-desktop-client index 9381486ed..5e78834b0 100755 --- a/install-desktop-client +++ b/install-desktop-client @@ -104,11 +104,15 @@ fi { echo '#!/bin/bash'; echo 'cd ~/.epicyon'; - echo "PASSWORD=\$(zenity --width=400 --password --title \"Epicyon Desktop Client\")"; - echo "if [ ! \"\$PASSWORD\" ]; then"; - echo " zenity --warning --width=400 --text \"No password was given\""; - echo ' exit 3'; - echo 'fi'; + echo "if [ \"\$1\" ]; then"; + echo " PASSWORD=\"\$1\""; + echo 'else'; + echo " PASSWORD=\$(zenity --width=400 --password --title \"Epicyon Desktop Client\")"; + echo " if [ ! \"\$PASSWORD\" ]; then"; + echo " zenity --warning --width=400 --text \"No password was given\""; + echo ' exit 3'; + echo ' fi'; + echo 'fi'; echo "python3 epicyon.py --desktop ${HANDLE} --password \"\$PASSWORD\""; } > ~/epicyon-client chmod +x ~/epicyon-client From 55d4144c92fdab7337c38985015335f937734ccf Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:23:31 +0000 Subject: [PATCH 06/10] Make tts versions of the epicyon client command --- install-desktop-client | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/install-desktop-client b/install-desktop-client index 5e78834b0..a896d6af3 100755 --- a/install-desktop-client +++ b/install-desktop-client @@ -116,4 +116,14 @@ fi echo "python3 epicyon.py --desktop ${HANDLE} --password \"\$PASSWORD\""; } > ~/epicyon-client chmod +x ~/epicyon-client +# TTS version +cp ~/epicyon-client ~/epicyon-client-tts +chmod +x ~/epicyon-client-tts +sed -i 's|epicyon.py|epicyon.py --screenreader espeak|g' ~/epicyon-client-tts + +# TTS version +cp ~/epicyon-client ~/epicyon-client-pico +chmod +x ~/epicyon-client-pico +sed -i 's|epicyon.py|epicyon.py --screenreader picospeaker|g' ~/epicyon-client-pico + zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client" From 34efc15f55b6ac4b062e365a8050a80283209308 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:32:19 +0000 Subject: [PATCH 07/10] Update documentation for new option name --- README_commandline.md | 17 ++++++++++------- install-desktop-client | 7 ++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README_commandline.md b/README_commandline.md index 73f9e46c9..9b41c423d 100644 --- a/README_commandline.md +++ b/README_commandline.md @@ -400,13 +400,13 @@ It is possible to use text-to-speech to read your inbox as posts arrive. This ca On Debian based systems you will need to have the **python3-espeak** package installed. ``` bash -python3 epicyon.py --speaker yournickname@yourdomain +python3 epicyon.py --notifyShowNewPosts --screenreader espeak --desktop yournickname@yourdomain ``` Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed: ``` bash -python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --client yournickname@yourdomain +python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --desktop yournickname@yourdomain ``` You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive. @@ -425,16 +425,19 @@ and run it with: ~/epicyon-client ``` - -You can run a desktop client as follows: +To run it with text-to-speech via espeak: ``` bash -python3 epicyon.py --client yournickname@yourdomain +~/epicyon-client-tts ``` -You can also use the **--password** option if needed. +or if you have picospeaker installed: -The desktop client also provides a number of commands, which may be more convenient than the web interface for some purposes: +``` bash +~/epicyon-client-pico +``` + +The desktop client has a few commands, which may be more convenient than the web interface for some purposes: ``` bash quit Exit from the notification client diff --git a/install-desktop-client b/install-desktop-client index a896d6af3..33931a932 100755 --- a/install-desktop-client +++ b/install-desktop-client @@ -121,9 +121,14 @@ cp ~/epicyon-client ~/epicyon-client-tts chmod +x ~/epicyon-client-tts sed -i 's|epicyon.py|epicyon.py --screenreader espeak|g' ~/epicyon-client-tts -# TTS version +# TTS version with picospeaker cp ~/epicyon-client ~/epicyon-client-pico chmod +x ~/epicyon-client-pico sed -i 's|epicyon.py|epicyon.py --screenreader picospeaker|g' ~/epicyon-client-pico +# TTS stream +cp ~/epicyon-client ~/epicyon-client-pico +chmod +x ~/epicyon-client-pico +sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader espeak|g' ~/epicyon-client-stream + zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client" From 545f633ab19e3a80495c216b5c849be41e8ba102 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:33:19 +0000 Subject: [PATCH 08/10] Stream --- install-desktop-client | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-desktop-client b/install-desktop-client index 33931a932..cf15c158c 100755 --- a/install-desktop-client +++ b/install-desktop-client @@ -127,8 +127,8 @@ chmod +x ~/epicyon-client-pico sed -i 's|epicyon.py|epicyon.py --screenreader picospeaker|g' ~/epicyon-client-pico # TTS stream -cp ~/epicyon-client ~/epicyon-client-pico -chmod +x ~/epicyon-client-pico +cp ~/epicyon-client ~/epicyon-client-stream +chmod +x ~/epicyon-client-stream sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader espeak|g' ~/epicyon-client-stream zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client" From 186203336ccdbc5f3deafb8b1267f7d6d426fdb6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:37:29 +0000 Subject: [PATCH 09/10] Describe stream command --- README_commandline.md | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/README_commandline.md b/README_commandline.md index 9b41c423d..fc18865c6 100644 --- a/README_commandline.md +++ b/README_commandline.md @@ -393,24 +393,6 @@ To remove a shared item: python3 epicyon.py --undoItemName "spanner" --nickname [yournick] --domain [yourdomain] --password [c2s password] ``` -## Speaking your inbox - -It is possible to use text-to-speech to read your inbox as posts arrive. This can be useful if you are not looking at a screen but want to stay ambiently informed of what's happening. - -On Debian based systems you will need to have the **python3-espeak** package installed. - -``` bash -python3 epicyon.py --notifyShowNewPosts --screenreader espeak --desktop yournickname@yourdomain -``` - -Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed: - -``` bash -python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --desktop yournickname@yourdomain -``` - -You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive. - ## Desktop client You can install the desktop client with: @@ -462,3 +444,27 @@ open [post number] Open web links within a timeline post ``` If you have a GPG key configured on your local system and are sending a direct message to someone who has a PGP key (the exported key, not just the key ID) set as a tag on their profile then it will try to encrypt the message automatically. So under some conditions end-to-end encryption is possible, such that the instance server only sees ciphertext. Conversely, for arriving direct messages if they are PGP encrypted then the desktop client will try to obtain the relevant public key and decrypt. + +## Speaking your inbox + +It is possible to use text-to-speech to read your inbox as posts arrive. This can be useful if you are not looking at a screen but want to stay ambiently informed of what's happening. + +On Debian based systems you will need to have the **python3-espeak** package installed. + +``` bash +python3 epicyon.py --notifyShowNewPosts --screenreader espeak --desktop yournickname@yourdomain +``` + +or a quicker version, if you have installed the desktop client as described above. + +``` bash +~/epicyon-client-stream +``` + +Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed: + +``` bash +python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --desktop yournickname@yourdomain +``` + +You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive. From 7cda8ecebfa11c34d938ce61777e790658db6ad3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 16 Mar 2021 22:42:40 +0000 Subject: [PATCH 10/10] Capitals --- README_commandline.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README_commandline.md b/README_commandline.md index fc18865c6..6a43c40c1 100644 --- a/README_commandline.md +++ b/README_commandline.md @@ -413,7 +413,7 @@ To run it with text-to-speech via espeak: ~/epicyon-client-tts ``` -or if you have picospeaker installed: +Or if you have picospeaker installed: ``` bash ~/epicyon-client-pico @@ -455,7 +455,7 @@ On Debian based systems you will need to have the **python3-espeak** package ins python3 epicyon.py --notifyShowNewPosts --screenreader espeak --desktop yournickname@yourdomain ``` -or a quicker version, if you have installed the desktop client as described above. +Or a quicker version, if you have installed the desktop client as described above. ``` bash ~/epicyon-client-stream