update-notifier: update wayland support patch
This commit is contained in:
parent
40d46056ff
commit
857bdc6eea
6 changed files with 65 additions and 65 deletions
|
|
@ -0,0 +1,114 @@
|
|||
# Check updates with update-notifier instead of aptdaemon
|
||||
|
||||
diff -ru a/data/backend_helper.py b/data/backend_helper.py
|
||||
--- a/data/backend_helper.py 2023-04-30 21:20:07.986410268 -0400
|
||||
+++ b/data/backend_helper.py 2023-04-30 21:35:59.442841302 -0400
|
||||
@@ -58,35 +58,14 @@
|
||||
return _install_all_updates_synaptic()
|
||||
|
||||
|
||||
-# check updates
|
||||
-def _check_updates_aptdaemon():
|
||||
- from gi.repository import Gtk
|
||||
- from aptdaemon import client, enums
|
||||
- from aptdaemon.gtk3widgets import AptProgressDialog
|
||||
- client = client.AptClient()
|
||||
- trans = client.update_cache()
|
||||
- dia = AptProgressDialog(trans)
|
||||
- dia.connect("finished", Gtk.main_quit)
|
||||
- dia.run()
|
||||
- Gtk.main()
|
||||
- return trans.exit == enums.EXIT_SUCCESS
|
||||
-
|
||||
-
|
||||
-def _check_updates_gtk():
|
||||
- cmd = ["/usr/bin/synaptic-pkexec",
|
||||
- "--update-at-startup",
|
||||
- "--non-interactive",
|
||||
- "--hide-main-window",
|
||||
- ]
|
||||
- subprocess.call(cmd)
|
||||
-
|
||||
-
|
||||
def check_updates():
|
||||
- """ check for updates either with aptdaemon or synaptic """
|
||||
- if HAVE_APTDAEMON:
|
||||
- return _check_updates_aptdaemon()
|
||||
+ """ check and show updates using update-manager """
|
||||
+ if os.path.exists("/usr/bin/update-manager"):
|
||||
+ cmd = ["update-manager", "--no-check-screen"]
|
||||
+ res = subprocess.call(cmd)
|
||||
+ return (res == 0)
|
||||
else:
|
||||
- return _check_updates_gtk()
|
||||
+ logging.error("update-manager is not installed")
|
||||
|
||||
|
||||
# start packagemanager
|
||||
diff -ru a/data/backend_helper.py b/data/backend_helper.py
|
||||
--- a/data/backend_helper.py 2023-05-01 10:18:12.941023681 -0400
|
||||
+++ b/data/backend_helper.py 2023-05-01 10:27:12.724396819 -0400
|
||||
@@ -53,9 +53,10 @@
|
||||
def install_all_updates():
|
||||
""" install all updates either with synaptic or aptdaemon """
|
||||
if HAVE_APTDAEMON:
|
||||
- return _install_all_updates_aptdaemon()
|
||||
+ _install_all_updates_aptdaemon()
|
||||
else:
|
||||
- return _install_all_updates_synaptic()
|
||||
+ _install_all_updates_synaptic()
|
||||
+ return show_updates()
|
||||
|
||||
|
||||
def check_updates():
|
||||
diff -ru a/data/backend_helper.py b/data/backend_helper.py
|
||||
--- a/data/backend_helper.py 2023-05-04 20:33:23.000867005 -0400
|
||||
+++ b/data/backend_helper.py 2023-05-04 20:37:57.616904543 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
+import apt_pkg
|
||||
|
||||
HAVE_APTDAEMON = False
|
||||
try:
|
||||
@@ -69,6 +70,16 @@
|
||||
logging.error("update-manager is not installed")
|
||||
|
||||
|
||||
+def reminder_check():
|
||||
+ """ check and show updates using update-manager """
|
||||
+ if os.path.exists("/usr/bin/update-manager"):
|
||||
+ cmd = ["update-manager", "--check-dist-upgrades", "--no-focus-on-map"]
|
||||
+ res = subprocess.call(cmd)
|
||||
+ return (res == 0)
|
||||
+ else:
|
||||
+ logging.error("update-manager is not installed")
|
||||
+
|
||||
+
|
||||
# start packagemanager
|
||||
def start_packagemanager():
|
||||
if os.path.exists("/usr/bin/synaptic-pkexec"):
|
||||
@@ -127,6 +138,9 @@
|
||||
# check_updates - synaptic --reload/aptdaemon reload
|
||||
command = subparser.add_parser("check_updates")
|
||||
command.set_defaults(command="check_updates")
|
||||
+ # reminder_check
|
||||
+ command = subparser.add_parser("reminder_check")
|
||||
+ command.set_defaults(command="reminder_check")
|
||||
# start_pkgmanager
|
||||
command = subparser.add_parser("start_packagemanager")
|
||||
command.set_defaults(command="start_packagemanager")
|
||||
@@ -141,6 +155,12 @@
|
||||
else:
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
+ # we show a "do you want to check for updates" every 2 weeks, if auto-update is off
|
||||
+ if args.command == "reminder_check":
|
||||
+ apt_pkg.init()
|
||||
+ if apt_pkg.config.find_i("APT::Periodic::Update-Package-Lists") != 0:
|
||||
+ sys.exit(0)
|
||||
+
|
||||
func_name = args.command
|
||||
f_kwargs = {}
|
||||
f = globals()[func_name]
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
# Reduce the timeout to refresh the status of the tray icon
|
||||
|
||||
diff -ru a/src/update-notifier.c b/src/update-notifier.c
|
||||
--- a/src/update-notifier.c 2023-05-01 12:24:36.171054235 -0400
|
||||
+++ b/src/update-notifier.c 2023-05-01 13:54:27.833304128 -0400
|
||||
@@ -53,7 +53,7 @@
|
||||
gboolean update_timer_finished(gpointer data);
|
||||
|
||||
// the time when we check for fam events, in seconds
|
||||
-#define TIMEOUT_FAM 180
|
||||
+#define TIMEOUT_FAM 30
|
||||
|
||||
// the timeout (in sec) when a further activity from dpkg/apt
|
||||
// causes the applet to "ungray"
|
||||
@@ -398,10 +398,9 @@ monitor_init(UpgradeNotifier *un)
|
||||
|
||||
// monitor these dirs
|
||||
static const char *monitor_dirs[] = {
|
||||
- "/var/lib/apt/lists/", "/var/lib/apt/lists/partial/",
|
||||
- "/var/cache/apt/archives/", "/var/cache/apt/archives/partial/",
|
||||
+ "/var/lib/apt/lists/",
|
||||
+ "/var/cache/apt/archives/",
|
||||
HOOKS_DIR,
|
||||
- CRASHREPORT_DIR,
|
||||
DPKG_INFO_DIR,
|
||||
NULL};
|
||||
for(i=0;monitor_dirs[i] != NULL;i++) {
|
||||
@@ -422,7 +421,6 @@ monitor_init(UpgradeNotifier *un)
|
||||
"/var/lib/dpkg/status",
|
||||
"/var/lib/update-notifier/dpkg-run-stamp",
|
||||
"/var/lib/apt/periodic/update-success-stamp",
|
||||
- LIVEPATCH_FILE,
|
||||
REBOOT_FILE,
|
||||
NULL};
|
||||
for(i=0;monitor_files[i] != NULL;i++) {
|
||||
diff -ru a/src/update.c b/src/update.c
|
||||
--- a/src/update.c 2023-05-01 14:30:39.889778059 -0400
|
||||
+++ b/src/update.c 2023-05-01 18:05:21.754318730 -0400
|
||||
@@ -702,7 +702,8 @@
|
||||
|
||||
// show the notification with some delay. otherwise on a login
|
||||
// the origin of the window is 0,0 and that looks ugly
|
||||
- g_timeout_add_seconds(5, show_notification, ta);
|
||||
+ if (priv->num_upgrades != 0)
|
||||
+ g_timeout_add_seconds(5, show_notification, ta);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
diff -ru a/src/update.c b/src/update.c
|
||||
--- a/src/update.c 2023-05-01 14:30:39.889778059 -0400
|
||||
+++ b/src/update.c 2023-05-01 20:45:14.717390627 -0400
|
||||
@@ -251,7 +251,7 @@
|
||||
GTK_STOCK_DIALOG_INFO, 48,0,NULL);
|
||||
notify_notification_set_icon_from_pixbuf (n, pix);
|
||||
g_object_unref(pix);
|
||||
- notify_notification_set_timeout (n, 60*1000);
|
||||
+ notify_notification_set_timeout (n, 10*1000);
|
||||
notify_notification_show(n, NULL);
|
||||
// save the notification handle
|
||||
if (priv->active_notification)
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Actually show the indicator icon
|
||||
|
||||
diff --git a/src/update.c b/src/update.c
|
||||
index 588fa66..951a24f 100644
|
||||
--- a/src/update.c
|
||||
+++ b/src/update.c
|
||||
@@ -687,7 +687,6 @@ update_check (TrayApplet *ta)
|
||||
|
||||
g_child_watch_add (pid, launch_update_manager, NULL);
|
||||
}
|
||||
- return TRUE;
|
||||
|
||||
// if we are already visible, skip the rest
|
||||
if(tray_applet_ui_get_visible (ta))
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
diff --git a/src/update-notifier.c b/src/update-notifier.c
|
||||
index ea81f78f..4c678b2e 100644
|
||||
--- a/src/update-notifier.c
|
||||
+++ b/src/update-notifier.c
|
||||
@@ -163,6 +163,7 @@ void invoke(const gchar *cmd, const gchar *desktop, gboolean with_pkexec)
|
||||
|
||||
// normal launch
|
||||
context = gdk_display_get_app_launch_context (gdk_display_get_default ());
|
||||
+ #ifdef GDK_WINDOWING_X11
|
||||
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
|
||||
// fake window to get the current server time *urgh*
|
||||
if (!w) {
|
||||
@@ -172,8 +173,16 @@ void invoke(const gchar *cmd, const gchar *desktop, gboolean with_pkexec)
|
||||
|
||||
guint32 timestamp = gdk_x11_get_server_time (gtk_widget_get_window (w));
|
||||
gdk_app_launch_context_set_timestamp (context, timestamp);
|
||||
+ } else {
|
||||
+ guint32 timestamp = (guint32) (g_get_monotonic_time () / 1000);
|
||||
+ gdk_app_launch_context_set_timestamp (context, timestamp);
|
||||
}
|
||||
-
|
||||
+ #else
|
||||
+ {
|
||||
+ guint32 timestamp = (guint32) (g_get_monotonic_time () / 1000);
|
||||
+ gdk_app_launch_context_set_timestamp (context, timestamp);
|
||||
+ }
|
||||
+ #endif
|
||||
appinfo = g_app_info_create_from_commandline(cmd,
|
||||
cmd,
|
||||
G_APP_INFO_CREATE_NONE,
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
--- a/debian/control 2023-04-06 12:43:17.147156435 -0600
|
||||
+++ b/debian/control 2023-04-06 12:46:32.883071182 -0600
|
||||
@@ -34,11 +34,9 @@
|
||||
ubuntu-release-upgrader-gtk,
|
||||
gnome-shell <!s390x> | notification-daemon <!s390x>,
|
||||
policykit-1
|
||||
-Recommends: apport-gtk (>=2.8-0ubuntu3),
|
||||
- python3-aptdaemon.gtk3widgets | synaptic (>= 0.75.12),
|
||||
+Recommends: python3-aptdaemon.gtk3widgets | synaptic (>= 0.75.12),
|
||||
software-properties-gtk,
|
||||
- python3-aptdaemon,
|
||||
- whoopsie (>= 0.2.77)
|
||||
+ python3-aptdaemon
|
||||
Description: Daemon which notifies about package updates
|
||||
Puts an icon in the user's notification area when package updates are
|
||||
available.
|
||||
Loading…
Add table
Add a link
Reference in a new issue