mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-08 17:24:21 +02:00
thunderbird: ensure thunderbird is started in the background
This commit is contained in:
parent
fa4bbc3f92
commit
a9f7026b83
1 changed files with 6 additions and 4 deletions
|
@ -24,7 +24,7 @@ parser.add_argument("folder", metavar="FOLDER", help="folder to monitor", nargs=
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def process(path):
|
def notify_new_messages(path):
|
||||||
new_watermark = None
|
new_watermark = None
|
||||||
watermark = watermarks.get(path)
|
watermark = watermarks.get(path)
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -107,19 +107,21 @@ for folder in options.folder:
|
||||||
folder = os.path.join(os.path.expanduser(options.root), *folder)
|
folder = os.path.join(os.path.expanduser(options.root), *folder)
|
||||||
print(f"Watch {folder}...", flush=True)
|
print(f"Watch {folder}...", flush=True)
|
||||||
# Take a not of the last message in the folder
|
# Take a not of the last message in the folder
|
||||||
process(folder)
|
notify_new_messages(folder)
|
||||||
# Monitor it for change
|
# Monitor it for change
|
||||||
gfile = Gio.File.new_for_path(folder)
|
gfile = Gio.File.new_for_path(folder)
|
||||||
monitor = gfile.monitor_file(Gio.FileMonitorFlags.NONE, None)
|
monitor = gfile.monitor_file(Gio.FileMonitorFlags.NONE, None)
|
||||||
monitor.connect(
|
monitor.connect(
|
||||||
"changed",
|
"changed",
|
||||||
lambda m, f1, f2, event: event == Gio.FileMonitorEvent.CHANGES_DONE_HINT
|
lambda m, f1, f2, event: event == Gio.FileMonitorEvent.CHANGES_DONE_HINT
|
||||||
and process(folder),
|
and notify_new_messages(folder),
|
||||||
)
|
)
|
||||||
monitors.append(monitor)
|
monitors.append(monitor)
|
||||||
|
|
||||||
# Reply to notification actions
|
# Reply to notification actions
|
||||||
notify.ActionInvoked.connect(
|
notify.ActionInvoked.connect(
|
||||||
lambda _, mid: subprocess.call(["thunderbird", f"mid:{mid}"])
|
lambda _, mid: subprocess.call(
|
||||||
|
["systemd-run", "--user", "thunderbird", f"mid:{mid}"]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
GLib.MainLoop().run()
|
GLib.MainLoop().run()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue