
Gnome 3.20의 잠금 화면에 알림 보내기 메시지의 내용을 표시하는 방법을 찾고 있습니다. 일반적으로 이는 설정 > 알림에서 구성되지만 "알림-전송"은 언급되지 않고 설치된 앱만 언급됩니다.
dconf를 가지고 노는 것, 특히 under org.gnome.desktop.notifications application-children ['org-gnome-software', 'firefox', 'org-gnome-pomodoro', 'gnome-tweak-tool', 'evolution', 'ca-desrt-dconf-editor']
도 별로 도움이 되지 않았습니다.
내 알림 전송 스크립트는 30분마다 다른 파일에서 가져온 확인 메시지를 표시합니다.
#!/bin/bash
while : ; do
notify-send -i /usr/share/icons/gnome/scalable/emotes/face-smile-big-symbolic.svg --hint int:transient:1 "$(sort -R ~/Sonstiges/Affirmationen/Affirmationen.txt | head -n 1)"
sleep 30m # Zeit in Minuten
done
이것을 달성하는 방법에 대한 아이디어가 있습니까?
답변1
Chris Williams(chrisawi)에게 감사드립니다.그놈 IRC 채널다음 해결책을 찾았습니다.
다음 콘텐츠로 notifier
호출 되는 스크립트를 만듭니다 ./.local/bin/
#!/usr/bin/python3
# License: MIT
# Author: Chris Williams
APP_ID = "com.example.Notifier"
import sys
from gi.repository import GLib, GObject, Gio
class Notifier(Gio.Application):
def __init__(self):
Gio.Application.__init__(self, application_id=APP_ID, flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
self.set_option_context_parameter_string ("ID TITLE [MESSAGE...]")
self.add_main_option("icon", ord('i'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, "Icon name or file", None)
#self.add_main_option("quit", ord('q'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Quit", None)
self.add_main_option(GLib.OPTION_REMAINING, 0, GLib.OptionFlags.NONE, GLib.OptionArg.STRING_ARRAY, "", None)
def do_command_line(self, cl):
Gio.Application.do_command_line(self, cl)
opts = cl.get_options_dict().end().unpack()
#if opts.get("quit"):
# self.quit()
args = opts.get(GLib.OPTION_REMAINING, [])
if len(args) >= 2:
notification = Gio.Notification()
notification.set_title(args[1])
if len(args) >= 3:
notification.set_body(" ".join(args[2:]))
icon_str = opts.get("icon")
if icon_str:
try:
icon = Gio.Icon.new_for_string(icon_str)
except GLib.Error as e:
if not e.matches(Gio.io_error_quark(), Gio.IOErrorEnum.INVALID_ARGUMENT):
raise
else:
notification.set_icon(icon)
self.send_notification(args[0], notification)
else:
print ("not enough arguments")
return 0
if __name__ == '__main__':
app = Notifier()
app.run(sys.argv)
원래 알림 전송 스크립트에서 이를 언급하세요. 이 스크립트도 다음 위치에 있습니다 /.local/bin/
.
#!/bin/bash
while : ; do
notifier -i emote-love-symbolic idxyz "$(sort -R ~/Sonstiges/Affirmationen/Affirmationen.txt | head -n 1)"
sleep 30m # time in minutes
done
또한 시작 시 이 스크립트를 실행하려면 .desktop
에서 /.local/share/applications/
또는 에서 파일을 생성해야 합니다 . /.config/autostart/
내 /affirmationen.desktop
내부는 /.config/autostart/
다음과 같습니다.
[Desktop Entry]
Name=Affirmationen
Exec=affirmationen
Icon=emote-love-symbolic
Type=Application
StartupNotify=true
Hidden=false
NoDisplay=false
Terminal=false
X-GNOME-UsesNotifications=true
X-GNOME-Autostart-enabled=true
즐기다!