Hello community, here is the log from the commit of package swayidle for openSUSE:Factory checked in at 2020-01-23 15:55:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/swayidle (Old) and /work/SRC/openSUSE:Factory/.swayidle.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "swayidle" Thu Jan 23 15:55:02 2020 rev:6 rq:766521 version:1.6 Changes: -------- --- /work/SRC/openSUSE:Factory/swayidle/swayidle.changes 2019-12-23 22:48:45.934096924 +0100 +++ /work/SRC/openSUSE:Factory/.swayidle.new.26092/swayidle.changes 2020-01-23 15:55:13.159104811 +0100 @@ -1,0 +2,12 @@ +Thu Jan 23 08:51:39 UTC 2020 - Michael Vetter <[email protected]> + +- Update to 1.6: + * Add logind SetIdleHint event + * completion: use pkg-config to get install location for bash/fish + * fish-completion: use the correct fallback directory + * Update bash and fish completions with option -w + * Update zsh completions +- Add swayidle-version.patch + See https://github.com/swaywm/swayidle/pull/53 + +------------------------------------------------------------------- Old: ---- 1.5.tar.gz New: ---- 1.6.tar.gz swayidle-version.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ swayidle.spec ++++++ --- /var/tmp/diff_new_pack.2ZO33D/_old 2020-01-23 15:55:13.775105143 +0100 +++ /var/tmp/diff_new_pack.2ZO33D/_new 2020-01-23 15:55:13.775105143 +0100 @@ -1,7 +1,7 @@ # # spec file for package swayidle # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +17,15 @@ Name: swayidle -Version: 1.5 +Version: 1.6 Release: 0 Summary: Idle management daemon for Wayland License: MIT Group: System/GUI/Other URL: https://github.com/swaywm/swayidle Source0: https://github.com/swaywm/swayidle/archive/%{version}.tar.gz +# https://github.com/swaywm/swayidle/pull/53 +Patch0: swayidle-version.patch BuildRequires: meson >= 0.48.0 BuildRequires: pkgconfig BuildRequires: scdoc @@ -67,6 +69,7 @@ %prep %setup -q +%patch0 -p1 %build export CFLAGS="%{optflags} -I/usr/include/wayland" @@ -85,7 +88,7 @@ %files fish-completion %dir %{_datadir}/fish/ -%{_datadir}/fish/completions/ +%{_datadir}/fish/vendor_completions.d/ %files zsh-completion %{_datadir}/zsh/site-functions/ ++++++ 1.5.tar.gz -> 1.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.5/completions/bash/swayidle new/swayidle-1.6/completions/bash/swayidle --- old/swayidle-1.5/completions/bash/swayidle 2019-07-11 16:18:46.000000000 +0200 +++ new/swayidle-1.6/completions/bash/swayidle 2020-01-22 17:20:22.000000000 +0100 @@ -15,6 +15,7 @@ short=( -h -d + -w ) if [ "$prev" = timeout ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.5/completions/fish/swayidle.fish new/swayidle-1.6/completions/fish/swayidle.fish --- old/swayidle-1.5/completions/fish/swayidle.fish 2019-07-11 16:18:46.000000000 +0200 +++ new/swayidle-1.6/completions/fish/swayidle.fish 2020-01-22 17:20:22.000000000 +0100 @@ -1,3 +1,4 @@ # swayidle complete -c swayidle -s h --description 'show help' complete -c swayidle -s d --description 'debug' +complete -c swayidle -s w --description 'wait for command to finish' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.5/completions/zsh/_swayidle new/swayidle-1.6/completions/zsh/_swayidle --- old/swayidle-1.5/completions/zsh/_swayidle 2019-07-11 16:18:46.000000000 +0200 +++ new/swayidle-1.6/completions/zsh/_swayidle 2020-01-22 17:20:22.000000000 +0100 @@ -8,10 +8,11 @@ local resume=('resume:Execute command when there is activity again') if (($#words <= 2)); then + _describe -t "events" 'swayidle' events _arguments -C \ '(-h --help)'{-h,--help}'[Show help message and quit]' \ - '(-d)'-d'[Enable debug output]' - _describe -t "events" 'swayidle' events + '(-d)'-d'[Enable debug output]' \ + '(-w)'-w'[Wait for command to finish executing before continuing]' elif [[ "$words[-3]" == before-sleep || "$words[-3]" == resume ]]; then _describe -t "events" 'swayidle' events diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.5/main.c new/swayidle-1.6/main.c --- old/swayidle-1.5/main.c 2019-07-11 16:18:46.000000000 +0200 +++ new/swayidle-1.6/main.c 2020-01-22 17:20:22.000000000 +0100 @@ -35,6 +35,7 @@ char *after_resume_cmd; char *logind_lock_cmd; char *logind_unlock_cmd; + bool logind_idlehint; bool wait; } state; @@ -44,6 +45,7 @@ struct org_kde_kwin_idle_timeout *idle_timer; char *idle_cmd; char *resume_cmd; + bool idlehint; }; enum log_importance { @@ -149,6 +151,22 @@ sd_bus_message_unref(msg); } +static void set_idle_hint(bool hint) { + swayidle_log(LOG_DEBUG, "SetIdleHint %d", hint); + sd_bus_message *msg = NULL; + sd_bus_error error = SD_BUS_ERROR_NULL; + int ret = sd_bus_call_method(bus, "org.freedesktop.login1", + session_name, "org.freedesktop.login1.Session", "SetIdleHint", + &error, &msg, "b", hint); + if (ret < 0) { + swayidle_log(LOG_ERROR, + "Failed to send SetIdleHint signal: %s", error.message); + } + + sd_bus_error_free(&error); + sd_bus_message_unref(msg); +} + static int prepare_for_sleep(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error) { /* "b" apparently reads into an int, not a bool */ @@ -165,6 +183,9 @@ if (state.after_resume_cmd) { cmd_exec(state.after_resume_cmd); } + if (state.logind_idlehint) { + set_idle_hint(false); + } return 0; } @@ -197,6 +218,9 @@ sd_bus_error *ret_error) { swayidle_log(LOG_DEBUG, "Unlock signal received"); + if (state.logind_idlehint) { + set_idle_hint(false); + } if (state.logind_unlock_cmd) { cmd_exec(state.logind_unlock_cmd); } @@ -345,6 +369,11 @@ static void handle_idle(void *data, struct org_kde_kwin_idle_timeout *timer) { struct swayidle_timeout_cmd *cmd = data; swayidle_log(LOG_DEBUG, "idle state"); +#if HAVE_SYSTEMD || HAVE_ELOGIND + if (cmd->idlehint) { + set_idle_hint(true); + } else +#endif if (cmd->idle_cmd) { cmd_exec(cmd->idle_cmd); } @@ -356,6 +385,11 @@ if (cmd->registered_timeout != cmd->timeout) { register_timeout(cmd, cmd->timeout); } +#if HAVE_SYSTEMD || HAVE_ELOGIND + if (cmd->idlehint) { + set_idle_hint(false); + } else +#endif if (cmd->resume_cmd) { cmd_exec(cmd->resume_cmd); } @@ -376,23 +410,19 @@ return strdup(argv[0]); } -static int parse_timeout(int argc, char **argv) { - if (argc < 3) { - swayidle_log(LOG_ERROR, "Too few parameters to timeout command. " - "Usage: timeout <seconds> <command>"); - exit(-1); - } +static struct swayidle_timeout_cmd *build_timeout_cmd(int argc, char **argv) { errno = 0; char *endptr; int seconds = strtoul(argv[1], &endptr, 10); if (errno != 0 || *endptr != '\0') { - swayidle_log(LOG_ERROR, "Invalid timeout parameter '%s', it should be a " - "numeric value representing seconds", optarg); + swayidle_log(LOG_ERROR, "Invalid %s parameter '%s', it should be a " + "numeric value representing seconds", argv[0], argv[1]); exit(-1); } struct swayidle_timeout_cmd *cmd = calloc(1, sizeof(struct swayidle_timeout_cmd)); + cmd->idlehint = false; if (seconds > 0) { cmd->timeout = seconds * 1000; @@ -400,6 +430,18 @@ cmd->timeout = -1; } + return cmd; +} + +static int parse_timeout(int argc, char **argv) { + if (argc < 3) { + swayidle_log(LOG_ERROR, "Too few parameters to timeout command. " + "Usage: timeout <seconds> <command>"); + exit(-1); + } + + struct swayidle_timeout_cmd *cmd = build_timeout_cmd(argc, argv); + swayidle_log(LOG_DEBUG, "Register idle timeout at %d ms", cmd->timeout); swayidle_log(LOG_DEBUG, "Setup idle"); cmd->idle_cmd = parse_command(argc - 2, &argv[2]); @@ -416,8 +458,8 @@ static int parse_sleep(int argc, char **argv) { #if !HAVE_SYSTEMD && !HAVE_ELOGIND - swayidle_log(LOG_ERROR, "before-sleep not supported: swayidle was compiled " - "with neither systemd nor elogind support."); + swayidle_log(LOG_ERROR, "%s not supported: swayidle was compiled " + "with neither systemd nor elogind support.", "before-sleep"); exit(-1); #endif if (argc < 2) { @@ -436,8 +478,8 @@ static int parse_resume(int argc, char **argv) { #if !HAVE_SYSTEMD && !HAVE_ELOGIND - swayidle_log(LOG_ERROR, "after-resume not supported: swayidle was compiled " - "with neither systemd nor elogind support."); + swayidle_log(LOG_ERROR, "%s not supported: swayidle was compiled " + "with neither systemd nor elogind support.", "after-resume"); exit(-1); #endif if (argc < 2) { @@ -456,8 +498,8 @@ static int parse_lock(int argc, char **argv) { #if !HAVE_SYSTEMD && !HAVE_ELOGIND - swayidle_log(LOG_ERROR, "lock not supported: swayidle was compiled" - " with neither systemd nor elogind support."); + swayidle_log(LOG_ERROR, "%s not supported: swayidle was compiled" + " with neither systemd nor elogind support.", "lock"); exit(-1); #endif if (argc < 2) { @@ -476,8 +518,8 @@ static int parse_unlock(int argc, char **argv) { #if !HAVE_SYSTEMD && !HAVE_ELOGIND - swayidle_log(LOG_ERROR, "unlock not supported: swayidle was compiled" - " with neither systemd nor elogind support."); + swayidle_log(LOG_ERROR, "%s not supported: swayidle was compiled" + " with neither systemd nor elogind support.", "unlock"); exit(-1); #endif if (argc < 2) { @@ -494,6 +536,31 @@ return 2; } +static int parse_idlehint(int argc, char **argv) { +#if !HAVE_SYSTEMD && !HAVE_ELOGIND + swayidle_log(LOG_ERROR, "%s not supported: swayidle was compiled" + " with neither systemd nor elogind support.", "idlehint"); + exit(-1); +#endif + if (state.logind_idlehint) { + swayidle_log(LOG_ERROR, "Cannot add multiple idlehint events"); + exit(-1); + } + if (argc < 2) { + swayidle_log(LOG_ERROR, "Too few parameters to idlehint command. " + "Usage: idlehint <seconds>"); + exit(-1); + } + + struct swayidle_timeout_cmd *cmd = build_timeout_cmd(argc, argv); + cmd->idlehint = true; + + swayidle_log(LOG_DEBUG, "Register idlehint timeout at %d ms", cmd->timeout); + wl_list_insert(&state.timeout_cmds, &cmd->link); + state.logind_idlehint = true; + return 2; +} + static int parse_args(int argc, char *argv[]) { int c; while ((c = getopt(argc, argv, "hdw")) != -1) { @@ -535,6 +602,9 @@ } else if (!strcmp("unlock", argv[i])) { swayidle_log(LOG_DEBUG, "Got unlock"); i += parse_unlock(argc - i, &argv[i]); + } else if (!strcmp("idlehint", argv[i])) { + swayidle_log(LOG_DEBUG, "Got idlehint"); + i += parse_idlehint(argc - i, &argv[i]); } else { swayidle_log(LOG_ERROR, "Unsupported command '%s'", argv[i]); return 1; @@ -633,6 +703,9 @@ should_run = true; setup_unlock_listener(); } + if (state.logind_idlehint) { + set_idle_hint(false); + } #endif if (!should_run) { swayidle_log(LOG_INFO, "No command specified! Nothing to do, will exit"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.5/meson.build new/swayidle-1.6/meson.build --- old/swayidle-1.5/meson.build 2019-07-11 16:18:46.000000000 +0200 +++ new/swayidle-1.6/meson.build 2020-01-22 17:20:22.000000000 +0100 @@ -24,6 +24,8 @@ wayland_client = dependency('wayland-client') wayland_protos = dependency('wayland-protocols', version: '>=1.14') wayland_server = dependency('wayland-server') +bash_comp = dependency('bash-completion', required: false) +fish_comp = dependency('fish', required: false) logind = dependency('lib' + get_option('logind-provider'), required: get_option('logind')) scdoc = find_program('scdoc', required: get_option('man-pages')) @@ -127,7 +129,11 @@ bash_files = files( 'completions/bash/swayidle', ) - bash_install_dir = datadir + '/bash-completion/completions' + if bash_comp.found() + bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir') + else + bash_install_dir = datadir + '/bash-completion/completions' + endif install_data(bash_files, install_dir: bash_install_dir) endif @@ -136,7 +142,11 @@ fish_files = files( 'completions/fish/swayidle.fish', ) - fish_install_dir = datadir + '/fish/completions' + if fish_comp.found() + fish_install_dir = fish_comp.get_pkgconfig_variable('completionsdir') + else + fish_install_dir = datadir + '/fish/vendor_completions.d' + endif install_data(fish_files, install_dir: fish_install_dir) endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.5/swayidle.1.scd new/swayidle-1.6/swayidle.1.scd --- old/swayidle-1.5/swayidle.1.scd 2019-07-11 16:18:46.000000000 +0200 +++ new/swayidle-1.6/swayidle.1.scd 2020-01-22 17:20:22.000000000 +0100 @@ -58,6 +58,11 @@ If built with systemd support, executes _command_ when logind signals that the session should be unlocked +*idlehint* <timeout> + If built with systemd support, set IdleHint to indcate an idle logind/elogind + session after <timeout> seconds. Adding an idlehint event will also cause + swayidle to call SetIdleHint(false) when run, on resume, unlock, etc. + All commands are executed in a shell. # EXAMPLE ++++++ swayidle-version.patch ++++++ diff -urEbw swayidle-1.6/meson.build swayidle-1.6.new/meson.build --- swayidle-1.6/meson.build 2020-01-22 17:20:22.000000000 +0100 +++ swayidle-1.6.new/meson.build 2020-01-23 10:11:31.860055800 +0100 @@ -1,7 +1,7 @@ project( 'swayidle', 'c', - version: '1.5', + version: '1.6', license: 'MIT', meson_version: '>=0.48.0', default_options: [
