Add GNOME notification on finished
This commit is contained in:
parent
250d81824e
commit
ae7ff3210c
1 changed files with 10 additions and 1 deletions
|
@ -4,7 +4,8 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
gi.require_version('Gtk', '4.0')
|
gi.require_version('Gtk', '4.0')
|
||||||
gi.require_version('Adw', '1')
|
gi.require_version('Adw', '1')
|
||||||
from gi.repository import Gtk, Adw, Gio, Gdk, GLib
|
gi.require_version('Notify', '0.7')
|
||||||
|
from gi.repository import Gtk, Adw, Gio, Gdk, GLib, Notify
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from recoder.config import load_config, save_config
|
from recoder.config import load_config, save_config
|
||||||
|
@ -63,6 +64,8 @@ class RecoderWindow(Adw.ApplicationWindow):
|
||||||
self.vbox.append(self.progress)
|
self.vbox.append(self.progress)
|
||||||
self.progress.set_hexpand(True)
|
self.progress.set_hexpand(True)
|
||||||
|
|
||||||
|
Notify.init("Recoder")
|
||||||
|
|
||||||
def _setup_css(self):
|
def _setup_css(self):
|
||||||
css = b"""
|
css = b"""
|
||||||
textview.drop-highlight {
|
textview.drop-highlight {
|
||||||
|
@ -156,6 +159,12 @@ class RecoderWindow(Adw.ApplicationWindow):
|
||||||
self.progress.set_show_text(True)
|
self.progress.set_show_text(True)
|
||||||
self.progress.set_text("Transcoding Complete!")
|
self.progress.set_text("Transcoding Complete!")
|
||||||
self.play_complete_sound()
|
self.play_complete_sound()
|
||||||
|
notification = Notify.Notification.new(
|
||||||
|
"Recoder",
|
||||||
|
"Transcoding finished!",
|
||||||
|
"net.jeena.Recoder"
|
||||||
|
)
|
||||||
|
notification.show()
|
||||||
|
|
||||||
def play_complete_sound(self):
|
def play_complete_sound(self):
|
||||||
if shutil.which("canberra-gtk-play"):
|
if shutil.which("canberra-gtk-play"):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue