Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gtklock for openSUSE:Factory checked in at 2023-05-07 18:54:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gtklock (Old) and /work/SRC/openSUSE:Factory/.gtklock.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gtklock" Sun May 7 18:54:34 2023 rev:3 rq:1085278 version:2.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/gtklock/gtklock.changes 2022-11-08 10:56:16.745956826 +0100 +++ /work/SRC/openSUSE:Factory/.gtklock.new.1533/gtklock.changes 2023-05-07 18:54:40.812157910 +0200 @@ -1,0 +2,8 @@ +Sun May 7 07:11:10 UTC 2023 - Michael Vetter <[email protected]> + +- Update to 2.1.0: + * Lock/Unlock commands + * Should build on FreeBSD + * Bunch of small fixes and improvements + +------------------------------------------------------------------- Old: ---- v2.0.1.tar.gz New: ---- v2.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gtklock.spec ++++++ --- /var/tmp/diff_new_pack.sHyiOS/_old 2023-05-07 18:54:42.172165498 +0200 +++ /var/tmp/diff_new_pack.sHyiOS/_new 2023-05-07 18:54:42.176165521 +0200 @@ -1,7 +1,7 @@ # # spec file for package gtklock # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: gtklock -Version: 2.0.1 +Version: 2.1.0 Release: 0 Summary: GTK-based lockscreen for Wayland License: GPL-3.0-only ++++++ v2.0.1.tar.gz -> v2.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/README.md new/gtklock-2.1.0/README.md --- old/gtklock-2.0.1/README.md 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/README.md 2023-05-06 15:44:22.000000000 +0200 @@ -7,11 +7,17 @@ It uses the wlr-layer-shell and wlr-input-inhibitor Wayland protocols. Works on sway and other wlroots-based compositors. -â¹ï¸ __For documentation, check out the [wiki](https://github.com/jovanlanik/gtklock/wiki).__ +â¹ï¸ __For documentation, check out the [man page](https://man.voidlinux.org/gtklock) and [wiki](https://github.com/jovanlanik/gtklock/wiki).__ Available on these repositories: [](https://repology.org/project/gtklock/versions) +### Installing gtklock +- Arch: `# yay -S gtklock` (using [Yay](https://github.com/Jguer/yay)) +- Gentoo: `# emerge --ask gui-apps/gtklock` (in [GURU repository](https://wiki.gentoo.org/wiki/Project:GURU)) +- Void: `# xbps-install gtklock` + +â¤ï¸ __Please submit an installation command for your distro!__ ## Building from source ``` $ make @@ -26,8 +32,8 @@ - gtk+3.0 - gtk-layer-shell ### Install dependencies -- Arch: `pacman -S gcc make pkgconf scdoc pam wayland gtk3 gtk-layer-shell` -- Fedora: `dnf install gcc make pkgconf scdoc pam-devel wayland-devel gtk3-devel gtk-layer-shell-devel` -- Void: `xbps-install gcc make pkgconf scdoc pam-devel wayland-devel gtk+3-devel gtk-layer-shell-devel` +- Arch: `# pacman -S gcc make pkgconf scdoc pam wayland gtk3 gtk-layer-shell` +- Fedora: `# dnf install gcc make pkgconf scdoc pam-devel wayland-devel gtk3-devel gtk-layer-shell-devel` +- Void: `# xbps-install gcc make pkgconf scdoc pam-devel wayland-devel gtk+3-devel gtk-layer-shell-devel` -â¤ï¸ __Please submit an installation command for your distro!__ +â¤ï¸ __Please submit an dependency installation command for your distro!__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/makefile new/gtklock-2.1.0/makefile --- old/gtklock-2.0.1/makefile 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/makefile 2023-05-06 15:44:22.000000000 +0200 @@ -5,16 +5,39 @@ NAME := gtklock MAJOR_VERSION := 2 -MINOR_VERSION := 0 +MINOR_VERSION := 1 MICRO_VERSION := 0 PREFIX = /usr/local +SYSCONFDIR = $(PREFIX)/etc + +ifeq '$(shell uname)' 'Linux' + SYSCONFDIR = /etc +endif + INSTALL = install -LIBS := pam wayland-client gtk+-wayland-3.0 gtk-layer-shell-0 gmodule-export-2.0 -CFLAGS += -std=c11 -Iinclude -DPREFIX=$(PREFIX) $(shell pkg-config --cflags $(LIBS)) +LIBS := wayland-client gtk+-wayland-3.0 gtk-layer-shell-0 gmodule-export-2.0 + +PAMFLAGS := $(shell pkg-config --cflags pam) +PAMLIBS := $(shell pkg-config --libs pam) +ifneq '$(.SHELLSTATUS)' '0' + PAMLIBS := -lpam +endif + +PKGFLAGS := $(shell pkg-config --cflags $(LIBS)) +ifneq '$(.SHELLSTATUS)' '0' + $(error pkg-config failed) +endif + +PKGLIBS := $(shell pkg-config --libs $(LIBS)) +ifneq '$(.SHELLSTATUS)' '0' + $(error pkg-config failed) +endif + +CFLAGS += -std=c11 -Iinclude -DPREFIX=$(PREFIX) $(PAMFLAGS) $(PKGFLAGS) CFLAGS += -DMAJOR_VERSION=$(MAJOR_VERSION) -DMINOR_VERSION=$(MINOR_VERSION) -DMICRO_VERSION=$(MICRO_VERSION) -LDLIBS += -Wl,--export-dynamic $(shell pkg-config --libs $(LIBS)) +LDLIBS += -Wl,--export-dynamic $(PAMLIBS) $(PKGLIBS) OBJ = wlr-input-inhibitor-unstable-v1-client-protocol.o OBJ += $(patsubst %.c, %.o, $(wildcard src/*.c)) @@ -37,8 +60,8 @@ $(INSTALL) $(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) install-data: - $(INSTALL) -d $(DESTDIR)/etc/pam.d - $(INSTALL) -m644 pam/$(NAME) $(DESTDIR)/etc/pam.d/$(NAME) + $(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)/pam.d + $(INSTALL) -m644 pam/$(NAME) $(DESTDIR)$(SYSCONFDIR)/pam.d/$(NAME) $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/man/man1 $(INSTALL) -m644 $(NAME).1 $(DESTDIR)$(PREFIX)/share/man/man1/$(NAME).1 @@ -46,7 +69,7 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(NAME) - rm -f $(DESTDIR)/etc/pam.d/$(NAME) + rm -f $(DESTDIR)$(SYSCONFDIR)/pam.d/$(NAME) rm -r $(DESTDIR)$(PREFIX)/share/man/man1/$(NAME).1 $(NAME): $(OBJ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/man/gtklock.1.scd new/gtklock-2.1.0/man/gtklock.1.scd --- old/gtklock-2.0.1/man/gtklock.1.scd 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/man/gtklock.1.scd 2023-05-06 15:44:22.000000000 +0200 @@ -60,6 +60,12 @@ *-S, --start-hidden* Start with input form hidden. +*-L, --lock-command* + Command to execute before locking. Command is executed asynchronously. + +*-U, --unlock-command* + Command to execute after unlocking. Command is executed asynchronously. + # EXAMPLE Example config: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/res/gtklock.ui new/gtklock-2.1.0/res/gtklock.ui --- old/gtklock-2.0.1/res/gtklock.ui 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/res/gtklock.ui 2023-05-06 15:44:22.000000000 +0200 @@ -12,13 +12,12 @@ <property name="name">clock-label</property> <property name="halign">center</property> <property name="margin-bottom">10</property> - <property name="label"></property> </object> </child> <child> <object class="GtkRevealer" id="body-revealer"> <property name="transition-type">none</property> - <property name="reveal-child">True</property> + <property name="reveal-child">1</property> <child> <object class="GtkGrid" id="body-grid"> <property name="row-spacing">5</property> @@ -37,9 +36,10 @@ <object class="GtkEntry" id="input-field"> <property name="name">input-field</property> <property name="width-request">380</property> - <property name="visibility">False</property> - <property name="caps-lock-warning">False</property> + <property name="visibility">0</property> + <property name="caps-lock-warning">0</property> <property name="input-purpose">password</property> + <property name="secondary-icon-name">view-reveal-symbolic</property> <signal name="icon-release" handler="window_pw_toggle_vis"/> <signal name="activate" handler="window_pw_check"/> </object> @@ -51,7 +51,7 @@ </child> <child> <object class="GtkBox" id="message-box"> - <property name="no-show-all">True</property> + <property name="no-show-all">1</property> </object> <packing> <property name="left-attach">1</property> @@ -66,21 +66,17 @@ <child> <object class="GtkLabel" id="warning-label"> <property name="name">warning-label</property> - <property name="label"></property> </object> </child> <child> <object class="GtkLabel" id="error-label"> <property name="name">error-label</property> - <property name="label"></property> </object> </child> <child> <object class="GtkButton" id="unlock-button"> <property name="name">unlock-button</property> <property name="label">Unlock</property> - <property name="can-focus">False</property> - <property name="receives-default">False</property> <style> <class name="suggested-action"/> </style> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/src/auth.c new/gtklock-2.1.0/src/auth.c --- old/gtklock-2.0.1/src/auth.c 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/src/auth.c 2023-05-06 15:44:22.000000000 +0200 @@ -99,7 +99,8 @@ int ret = pam_authenticate((pam_handle_t *)handle, 0); pam_status = ret; pam_status = pam_setcred((pam_handle_t *)handle, PAM_REFRESH_CRED); - if(pam_end(handle, pam_status) != PAM_SUCCESS) fprintf(stderr, "pam_end() failed"); + if(pam_end(handle, pam_status) != PAM_SUCCESS) + fprintf(stderr, "pam_end() failed"); if(ret == PAM_SUCCESS) exit(EXIT_SUCCESS); exit(EXIT_FAILURE); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/src/gtklock.c new/gtklock-2.1.0/src/gtklock.c --- old/gtklock-2.0.1/src/gtklock.c 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/src/gtklock.c 2023-05-06 15:44:22.000000000 +0200 @@ -45,13 +45,13 @@ static int gtklock_update_clocks_handler(gpointer data) { struct GtkLock *gtklock = (struct GtkLock *)data; gtklock_update_clocks(gtklock); - return TRUE; + return G_SOURCE_CONTINUE; } static int gtklock_idle_handler(gpointer data) { struct GtkLock *gtklock = (struct GtkLock *)data; gtklock_idle_hide(gtklock); - return TRUE; + return G_SOURCE_CONTINUE; } void gtklock_idle_hide(struct GtkLock *gtklock) { @@ -79,7 +79,7 @@ if(!gtklock->use_idle_hide) return; if(gtklock->idle_hide_source > 0) g_source_remove(gtklock->idle_hide_source); - gtklock->idle_hide_source = g_timeout_add_seconds(gtklock->idle_timeout, gtklock_idle_handler, gtklock); + gtklock->idle_hide_source = g_timeout_add_seconds(gtklock->idle_timeout, G_SOURCE_FUNC(gtklock_idle_handler), gtklock); } #if GLIB_CHECK_VERSION(2, 74, 0) @@ -99,10 +99,10 @@ } void gtklock_activate(struct GtkLock *gtklock) { - gtklock->draw_clock_source = g_timeout_add(1000, gtklock_update_clocks_handler, gtklock); + gtklock->draw_clock_source = g_timeout_add(1000, G_SOURCE_FUNC(gtklock_update_clocks_handler), gtklock); gtklock_update_clocks(gtklock); if(gtklock->use_idle_hide) gtklock->idle_hide_source = - g_timeout_add_seconds(gtklock->idle_timeout, gtklock_idle_handler, gtklock); + g_timeout_add_seconds(gtklock->idle_timeout, G_SOURCE_FUNC(gtklock_idle_handler), gtklock); if(gtklock->use_layer_shell) g_application_hold(G_APPLICATION(gtklock->app)); if(gtklock->use_input_inhibit) input_inhibitor_get(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/src/input-inhibitor.c new/gtklock-2.1.0/src/input-inhibitor.c --- old/gtklock-2.0.1/src/input-inhibitor.c 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/src/input-inhibitor.c 2023-05-06 15:44:22.000000000 +0200 @@ -1,5 +1,5 @@ // gtklock -// Copyright (c) 2022 William Wold, Jovan Lanik +// Copyright (c) 2022 Sophie Winter, Jovan Lanik // wlr-input-inhibitor @@ -63,7 +63,7 @@ MIT License -Copyright (c) 2020 William Wold +Copyright (c) 2020 Sophie Winter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/src/module.c new/gtklock-2.1.0/src/module.c --- old/gtklock-2.0.1/src/module.c 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/src/module.c 2023-05-06 15:44:22.000000000 +0200 @@ -54,8 +54,10 @@ gboolean has_major = g_module_symbol(module, "module_major_version", (gpointer *)&major); gboolean has_minor = g_module_symbol(module, "module_minor_version", (gpointer *)&minor); if(has_major && has_minor) { - if(*major != MAJOR_VERSION) report_error_and_exit("%s: module has mismatched major version (%u), is incompatible", name, *major); - else if(*minor != MINOR_VERSION) g_warning("%s: module has mismatched minor version (%u), may be incompatible", name, *minor); + if(*major != MAJOR_VERSION) + report_error_and_exit("%s: module has mismatched major version (%u), is incompatible", name, *major); + else if(*minor != MINOR_VERSION) + g_warning("%s: module has mismatched minor version (%u), may be incompatible", name, *minor); } else { const gchar *gtklock_version = "v" STR(MAJOR_VERSION) "." STR(MINOR_VERSION) "." STR(MICRO_VERSION); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtklock-2.0.1/src/source.c new/gtklock-2.1.0/src/source.c --- old/gtklock-2.0.1/src/source.c 2022-10-21 14:57:15.000000000 +0200 +++ new/gtklock-2.1.0/src/source.c 2023-05-06 15:44:22.000000000 +0200 @@ -1,11 +1,12 @@ // gtklock // Copyright (c) 2022 Kenny Levinsen, Jovan Lanik -#define _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L #include <assert.h> #include <signal.h> #include <sys/wait.h> +#include <glib-unix.h> #include <gtk/gtk.h> #include "util.h" @@ -43,13 +44,14 @@ static gint idle_timeout = 15; -static char *gtk_theme = NULL; - -static char *config_path = NULL; -static char *style_path = NULL; -static char **module_path = NULL; -static char *background_path = NULL; -static char *time_format = NULL; +static gchar *gtk_theme = NULL; +static gchar *config_path = NULL; +static gchar *style_path = NULL; +static gchar **module_path = NULL; +static gchar *background_path = NULL; +static gchar *time_format = NULL; +static gchar *lock_command = NULL; +static gchar *unlock_command = NULL; static GOptionEntry main_entries[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, "Show version", NULL }, @@ -67,6 +69,8 @@ { "idle-hide", 'H', 0, G_OPTION_ARG_NONE, &idle_hide, "Hide form when idle", NULL }, { "idle-timeout", 'T', 0, G_OPTION_ARG_INT, &idle_timeout, "Idle timeout in seconds", NULL }, { "start-hidden", 'S', 0, G_OPTION_ARG_NONE, &start_hidden, "Start with hidden form", NULL }, + { "lock-command", 'L', 0, G_OPTION_ARG_STRING, &lock_command, "Command to execute before locking", NULL }, + { "unlock-command", 'U', 0, G_OPTION_ARG_STRING, &unlock_command, "Command to execute after unlocking", NULL }, { NULL }, }; @@ -155,8 +159,8 @@ gtklock_shutdown(gtklock); } -static void attach_style(const char *format, ...) G_GNUC_PRINTF(1, 2); -static void attach_style(const char *format, ...) { +static void attach_style(const gchar *format, ...) G_GNUC_PRINTF(1, 2); +static void attach_style(const gchar *format, ...) { GtkCssProvider *provider = gtk_css_provider_new(); GError *err = NULL; va_list args; @@ -177,7 +181,7 @@ g_free(buff); } -static void attach_custom_style(const char *path) { +static void attach_custom_style(const gchar *path) { GtkCssProvider *provider = gtk_css_provider_new(); GError *err = NULL; @@ -199,10 +203,8 @@ else if(pid != 0) { int status; waitpid(pid, &status, 0); - if(WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS) { - g_usleep(G_USEC_PER_SEC); - exit(0); - } + if(WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS) + exit(EXIT_SUCCESS); report_error_and_exit("Failed to daemonize!\n"); } @@ -212,6 +214,21 @@ else if(pid != 0) exit(EXIT_SUCCESS); } +static void exec_command(const gchar *command) { + GError *err = NULL; + + g_spawn_command_line_async(command, &err); + if(err != NULL) { + g_warning("Executing `%s` failed: %s", command, err->message); + g_error_free(err); + } +} + +static gboolean signal_handler(gpointer data) { + g_application_quit(G_APPLICATION(gtklock->app)); + return G_SOURCE_REMOVE; +} + int main(int argc, char **argv) { GOptionContext *option_context = g_option_context_new("- GTK-based lockscreen for sway"); g_option_context_add_main_entries(option_context, main_entries, NULL); @@ -241,11 +258,6 @@ g_option_context_add_group(option_context, gtk_get_option_group(TRUE)); g_option_context_parse(option_context, &argc, &argv, NULL); - if(gtk_theme) { - GtkSettings *settings = gtk_settings_get_default(); - g_object_set(settings, "gtk-theme-name", gtk_theme, NULL); - } - GArray *modules = g_array_new(FALSE, TRUE, sizeof(GModule *)); if(module_path) { for(guint i = 0; module_path[i] != NULL; ++i) { @@ -274,6 +286,13 @@ if(!g_option_context_parse(option_context, &argc, &argv, &error)) report_error_and_exit("Option parsing failed: %s\n", error->message); + if(lock_command) exec_command(lock_command); + + if(gtk_theme) { + GtkSettings *settings = gtk_settings_get_default(); + g_object_set(settings, "gtk-theme-name", gtk_theme, NULL); + } + gtklock = create_gtklock(); gtklock->use_layer_shell = !no_layer_shell; gtklock->use_input_inhibit = !no_input_inhibit; @@ -320,9 +339,11 @@ g_signal_connect(gtklock->app, "activate", G_CALLBACK(activate), NULL); g_signal_connect(gtklock->app, "shutdown", G_CALLBACK(shutdown), NULL); + g_unix_signal_add(SIGTERM, G_SOURCE_FUNC(signal_handler), NULL); int status = g_application_run(G_APPLICATION(gtklock->app), argc, argv); gtklock_destroy(gtklock); + if(unlock_command) exec_command(unlock_command); return status; }
