Remove broken desktop notifications

This commit is contained in:
daniele 2023-05-05 19:23:21 +02:00
parent fe2d66c24c
commit 631ffa85d3
Signed by: fuxino
GPG Key ID: 981A2B2A3BBF5514
3 changed files with 11 additions and 28 deletions

View File

@ -16,9 +16,8 @@ makedepends=('git'
'python-wheel') 'python-wheel')
depends=('python' depends=('python'
'rsync' 'rsync'
'python-dotenv' 'python-dotenv')
'python-dbus' optdepends=('python-systemd: use systemd log')
'python-systemd')
install=${pkgname}.install install=${pkgname}.install
source=(git+https://github.com/Fuxino/${pkgname}.git) source=(git+https://github.com/Fuxino/${pkgname}.git)
sha256sums=('SKIP') sha256sums=('SKIP')

View File

@ -4,7 +4,8 @@ A simple backup script
## Description ## Description
simple_backup is a Python script that allows you to backup your files. simple_backup is a Python script that allows you to backup your files.
Parameters like input files/directories, output directory etc. can be specified in a configuration file, or on the command line. Run: Parameters like input files/directories, output directory etc. can be specified in a configuration file, or on the command line.
Run:
```bash ```bash
simple_backup -h simple_backup -h
@ -35,3 +36,5 @@ python -m installer dist/*.whl
For Arch Linux, a PKGBUILD that automates this process is provided. For Arch Linux, a PKGBUILD that automates this process is provided.
After installing, copy simple_backup.conf (if you used the PKGBUILD on Arch, it will be in /etc/simple_backup/) to $HOME/.config/simple_backup and edit is as needed.

View File

@ -12,7 +12,6 @@ from timeit import default_timer
from subprocess import Popen, PIPE, STDOUT from subprocess import Popen, PIPE, STDOUT
from datetime import datetime from datetime import datetime
from tempfile import mkstemp from tempfile import mkstemp
import dbus
from dotenv import load_dotenv from dotenv import load_dotenv
try: try:
@ -236,10 +235,6 @@ class Backup:
if self._err_flag: if self._err_flag:
logger.warning('Some errors occurred (check log for details)') logger.warning('Some errors occurred (check log for details)')
return 1
return 0
def _parse_arguments(): def _parse_arguments():
parser = argparse.ArgumentParser(prog='simple_backup', parser = argparse.ArgumentParser(prog='simple_backup',
@ -304,21 +299,7 @@ def simple_backup():
backup = Backup(inputs, output, exclude, keep, backup_options) backup = Backup(inputs, output, exclude, keep, backup_options)
if backup.check_params(): if backup.check_params():
try: backup.run()
obj = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
obj = dbus.Interface(obj, "org.freedesktop.Notifications")
obj.Notify("simple_backup", 0, "", "Starting backup...", "", [], {"urgency": 1}, 10000)
except dbus.exceptions.DBusException:
obj = None
status = backup.run()
if obj is not None:
if status == 0:
obj.Notify("simple_backup", 0, "", "Backup finished.", "", [], {"urgency": 1}, 10000)
else:
obj.Notify("simple_backup", 0, "", "Backup finished. Some errors occurred.",
"", [], {"urgency": 1}, 10000)
return 0 return 0