mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon into main
commit
fe51662f87
|
|
@ -393,35 +393,33 @@ To remove a shared item:
|
||||||
python3 epicyon.py --undoItemName "spanner" --nickname [yournick] --domain [yourdomain] --password [c2s password]
|
python3 epicyon.py --undoItemName "spanner" --nickname [yournick] --domain [yourdomain] --password [c2s password]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Speaking your inbox
|
## Desktop client
|
||||||
|
|
||||||
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.
|
You can install the desktop client with:
|
||||||
|
|
||||||
On Debian based systems you will need to have the **python3-espeak** package installed.
|
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
python3 epicyon.py --speaker yournickname@yourdomain
|
./install-desktop-client
|
||||||
```
|
```
|
||||||
|
|
||||||
Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed:
|
and run it with:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --notify yournickname@yourdomain
|
~/epicyon-client
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
To run it with text-to-speech via espeak:
|
||||||
|
|
||||||
## Desktop notifications
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
python3 epicyon.py --notify yournickname@yourdomain
|
~/epicyon-client-tts
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use the **--password** option if needed.
|
Or if you have picospeaker installed:
|
||||||
|
|
||||||
The notifications client also provides a number of basic 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
|
``` bash
|
||||||
quit Exit from the notification client
|
quit Exit from the notification client
|
||||||
|
|
@ -445,4 +443,28 @@ read [post number] Read a post from a timeline
|
||||||
open [post number] Open web links within a timeline post
|
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.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
|
||||||
17
epicyon.py
17
epicyon.py
|
|
@ -454,10 +454,9 @@ parser.add_argument('--level', dest='skillLevelPercent', type=int,
|
||||||
parser.add_argument('--status', '--availability', dest='availability',
|
parser.add_argument('--status', '--availability', dest='availability',
|
||||||
type=str, default=None,
|
type=str, default=None,
|
||||||
help='Set an availability status')
|
help='Set an availability status')
|
||||||
parser.add_argument('--notifications', '--notify', dest='notifications',
|
parser.add_argument('--desktop', dest='desktop',
|
||||||
type=str, default=None,
|
type=str, default=None,
|
||||||
help='Notify posts as they arrive at your ' +
|
help='Run desktop client')
|
||||||
'inbox. --notifications [handle]')
|
|
||||||
parser.add_argument('--block', dest='block', type=str, default=None,
|
parser.add_argument('--block', dest='block', type=str, default=None,
|
||||||
help='Block a particular address')
|
help='Block a particular address')
|
||||||
parser.add_argument('--unblock', dest='unblock', type=str, default=None,
|
parser.add_argument('--unblock', dest='unblock', type=str, default=None,
|
||||||
|
|
@ -1832,15 +1831,15 @@ if args.availability:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if args.notifications:
|
if args.desktop:
|
||||||
# Announce posts as they arrive in your inbox using text-to-speech
|
# Announce posts as they arrive in your inbox using text-to-speech
|
||||||
if args.notifications.startswith('@'):
|
if args.desktop.startswith('@'):
|
||||||
args.notifications = args.notifications[1:]
|
args.desktop = args.desktop[1:]
|
||||||
if '@' not in args.notifications:
|
if '@' not in args.desktop:
|
||||||
print('Specify the handle to notify: nickname@domain')
|
print('Specify the handle to notify: nickname@domain')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
nickname = args.notifications.split('@')[0]
|
nickname = args.desktop.split('@')[0]
|
||||||
domain = args.notifications.split('@')[1]
|
domain = args.desktop.split('@')[1]
|
||||||
|
|
||||||
if not nickname:
|
if not nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
currUser="$USER"
|
||||||
|
|
||||||
|
if [ ! -d "${HOME}/.config/systemd/user" ]; then
|
||||||
|
mkdir -p "${HOME}/.config/systemd/user"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /usr/bin/zenity ]; then
|
||||||
|
if [ -f /usr/bin/apt ]; then
|
||||||
|
sudo apt -y install zenity
|
||||||
|
fi
|
||||||
|
if [ -f /usr/bin/pacman ]; then
|
||||||
|
sudo pacman -S --noconfirm zenity
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
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 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
|
||||||
|
sudo apt -y install git
|
||||||
|
fi
|
||||||
|
if [ -f /usr/bin/pacman ]; then
|
||||||
|
sudo pacman -S --noconfirm git
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /usr/bin/gpg ]; then
|
||||||
|
if [ -f /usr/bin/apt ]; then
|
||||||
|
sudo apt -y install gnupg
|
||||||
|
fi
|
||||||
|
if [ -f /usr/bin/pacman ]; then
|
||||||
|
sudo pacman -S --noconfirm gnupg
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /usr/bin/python3 ]; then
|
||||||
|
if [ -f /usr/bin/apt ]; then
|
||||||
|
sudo apt -y install python3
|
||||||
|
fi
|
||||||
|
if [ -f /usr/bin/pacman ]; then
|
||||||
|
sudo pacman -S --noconfirm python
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d ${HOME}/.epicyon ]; then
|
||||||
|
git clone https://gitlab.com/bashrc2/epicyon ${HOME}/.epicyon
|
||||||
|
else
|
||||||
|
cd ${HOME}/.epicyon || exit 1
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
|
if [ ! -d ${HOME}/.epicyon ]; then
|
||||||
|
zenity --warning --width=400 --text "Unable to clone Epicyon repo"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
chown -R "${currUser}":"${currUser}" ${HOME}/.epicyon
|
||||||
|
|
||||||
|
notificationType=
|
||||||
|
if [ -f /usr/bin/notify-send ]; then
|
||||||
|
notificationType='notify-send'
|
||||||
|
else
|
||||||
|
if [ -f /usr/bin/zenity ]; then
|
||||||
|
notificationType='zenity'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ ! "$notificationType" ]]; then
|
||||||
|
zenity --warning --width=400 --text "No desktop notification command was found."
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d ${HOME}/.gnupg ]; then
|
||||||
|
echo 'Generating GPG key'
|
||||||
|
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 daemon-reload
|
||||||
|
#systemctl --user stop epicyon-notifications.service &
|
||||||
|
#systemctl --user disable epicyon-notifications.service
|
||||||
|
|
||||||
|
{ echo '#!/bin/bash';
|
||||||
|
echo 'cd ~/.epicyon';
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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 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-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"
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
currUser="$USER"
|
|
||||||
|
|
||||||
if [ ! -d "${HOME}/.config/systemd/user" ]; then
|
|
||||||
mkdir -p "${HOME}/.config/systemd/user"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f /usr/bin/zenity ]; then
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
|
||||||
sudo apt -y install zenity
|
|
||||||
fi
|
|
||||||
if [ -f /usr/bin/pacman ]; then
|
|
||||||
sudo pacman -S --noconfirm zenity
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
HANDLE=$(zenity --entry --width=400 --title "Epicyon Desktop Notifications" --text "Fediverse handle (name@domain): ")
|
|
||||||
if [ ! "$HANDLE" ]; then
|
|
||||||
zenity --warning --width=400 --text "No fediverse handle was given"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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
|
|
||||||
|
|
||||||
if [ ! -f /usr/bin/git ]; then
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
|
||||||
sudo apt -y install git
|
|
||||||
fi
|
|
||||||
if [ -f /usr/bin/pacman ]; then
|
|
||||||
sudo pacman -S --noconfirm git
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f /usr/bin/gpg ]; then
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
|
||||||
sudo apt -y install gnupg
|
|
||||||
fi
|
|
||||||
if [ -f /usr/bin/pacman ]; then
|
|
||||||
sudo pacman -S --noconfirm gnupg
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f /usr/bin/python3 ]; then
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
|
||||||
sudo apt -y install python3
|
|
||||||
fi
|
|
||||||
if [ -f /usr/bin/pacman ]; then
|
|
||||||
sudo pacman -S --noconfirm python
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d ${HOME}/.epicyon ]; then
|
|
||||||
git clone https://gitlab.com/bashrc2/epicyon ${HOME}/.epicyon
|
|
||||||
else
|
|
||||||
cd ${HOME}/.epicyon || exit 1
|
|
||||||
git pull
|
|
||||||
fi
|
|
||||||
if [ ! -d ${HOME}/.epicyon ]; then
|
|
||||||
zenity --warning --width=400 --text "Unable to clone Epicyon repo"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
chown -R "${currUser}":"${currUser}" ${HOME}/.epicyon
|
|
||||||
|
|
||||||
notificationType=
|
|
||||||
if [ -f /usr/bin/notify-send ]; then
|
|
||||||
notificationType='notify-send'
|
|
||||||
else
|
|
||||||
if [ -f /usr/bin/zenity ]; then
|
|
||||||
notificationType='zenity'
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ ! "$notificationType" ]]; then
|
|
||||||
zenity --warning --width=400 --text "No desktop notification command was found."
|
|
||||||
exit 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d ${HOME}/.gnupg ]; then
|
|
||||||
echo 'Generating GPG key'
|
|
||||||
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 &
|
|
||||||
|
|
||||||
zenity --info --width=400 --text "Epicyon notifications are now enabled"
|
|
||||||
Loading…
Reference in New Issue