diff -Nru caffeine-2.8.3/caffeinate caffeine-2.9.4/caffeinate --- caffeine-2.8.3/caffeinate 2015-01-15 22:08:39.000000000 +0000 +++ caffeine-2.9.4/caffeinate 2017-01-16 12:59:02.000000000 +0000 @@ -1,24 +1,67 @@ -#!/bin/sh -# (c) Reuben Thomas 4th January 2015 -# Released under the GPL version 3, or (at your option) any later version. - -if [ $# -lt 1 ]; then -cat <. + +import sys +import argparse +import signal +from subprocess import run + +import pkg_resources +from Xlib import display + +sys.tracebacklimit = None +PROGRAM_NAME = "caffeinate" +VERSION = pkg_resources.require("caffeine")[0].version + +def die(err): + sys.exit(PROGRAM_NAME + ': ' + err) + +# Handle command line arguments +parser = argparse.ArgumentParser(prog=PROGRAM_NAME, description='Inhibit desktop idleness for the duration of COMMAND') +parser.add_argument('COMMAND', help='command to run') +parser.add_argument('ARGUMENT', nargs='*', help='arguments to COMMAND', default=None) +parser.add_argument('-V', '--version', action='version', version=PROGRAM_NAME + ' ' + VERSION) +args = parser.parse_args() + +def make_unmapped_window(wm_name): + screen = display.Display().screen() + window = screen.root.create_window(0, 0, 1, 1, 0, screen.root_depth) + window.set_wm_name(wm_name) + window.set_wm_protocols([]) + return window + +# Create window to use with xdg-screensaver +window = make_unmapped_window("caffeinate") +wid = hex(window.id) + +# Catch signals, to do our best to ensure inhibition is removed +def signal_action(*args): + release() + sys.exit(1) + +def release(): + if run(['xdg-screensaver', 'resume', wid]).returncode != 0: + die("could not uninhibit desktop idleness") + +for sig in [signal.SIGINT, signal.SIGTERM, signal.SIGHUP]: + signal.signal(sig, signal_action) + +# Run command, bracketed by xdg-screensaver suspend/resume +if run(['xdg-screensaver', 'suspend', wid]).returncode != 0: + die("could not inhibit desktop idleness") +run([args.COMMAND] + args.ARGUMENT) +release() diff -Nru caffeine-2.8.3/caffeine caffeine-2.9.4/caffeine --- caffeine-2.8.3/caffeine 2015-01-20 01:02:11.000000000 +0000 +++ caffeine-2.9.4/caffeine 2017-01-16 12:59:02.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright © 2009-2014 The Caffeine Developers +# Copyright © 2009-2016 The Caffeine Developers # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,6 +22,8 @@ import sys import pkg_resources +import gi +gi.require_version('Gtk', '3.0') from gi.repository import GObject, Gtk, GLib from ewmh import EWMH @@ -57,7 +59,7 @@ if (self.screenSaverWindowID != None) != inhibit: if inhibit: self.screenSaverWindowID = hex(win.id) - call(['caffeine-screensaver', 'suspend', self.screenSaverWindowID]) + call(['xdg-screensaver', 'suspend', self.screenSaverWindowID]) logging.info(PROGRAM_NAME + " is inhibiting desktop idleness") else: self.release() @@ -67,7 +69,7 @@ def release(self): if self.screenSaverWindowID != None: - call(['caffeine-screensaver', 'resume', self.screenSaverWindowID]) + call(['xdg-screensaver', 'resume', self.screenSaverWindowID]) self.screenSaverWindowID = None logging.info(PROGRAM_NAME + " is no longer inhibiting desktop idleness") diff -Nru caffeine-2.8.3/caffeine-indicator caffeine-2.9.4/caffeine-indicator --- caffeine-2.8.3/caffeine-indicator 2015-01-20 01:04:57.000000000 +0000 +++ caffeine-2.9.4/caffeine-indicator 2017-01-16 12:59:02.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright © 2009-2014 The Caffeine Developers +# Copyright © 2009-2016 The Caffeine Developers # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,8 +27,10 @@ from subprocess import call import pkg_resources +import gi +gi.require_version('Gtk', '3.0') +gi.require_version('AppIndicator3', '0.1') from gi.repository import GLib, Gtk, GObject, AppIndicator3 - from Xlib import display PROGRAM_NAME = "caffeine-indicator" @@ -119,10 +121,17 @@ self.Caffeine.release() Gtk.main_quit() +def make_unmapped_window(wm_name): + screen = display.Display().screen() + window = screen.root.create_window(0, 0, 1, 1, 0, screen.root_depth) + window.set_wm_name(wm_name) + window.set_wm_protocols([]) + return window + class Caffeine(GObject.GObject): def __init__(self): GObject.GObject.__init__(self) - self.root = display.Display().screen().root + self.window = make_unmapped_window("Caffeine indicator") self.status_string = None self.screenSaverWindowID = None @@ -131,10 +140,10 @@ def toggle_activated(self): if self.screenSaverWindowID == None: - self.screenSaverWindowID = hex(self.root.id) + self.screenSaverWindowID = hex(self.window.id) self.status_string = _(PROGRAM_NAME + " is inhibiting desktop idleness") logging.info(self.status_string) - call(['caffeine-screensaver', 'suspend', self.screenSaverWindowID]) + call(['xdg-screensaver', 'suspend', self.screenSaverWindowID]) else: self.release() @@ -142,7 +151,7 @@ def release(self): if self.screenSaverWindowID != None: - call(['caffeine-screensaver', 'resume', self.screenSaverWindowID]) + call(['xdg-screensaver', 'resume', self.screenSaverWindowID]) self.screenSaverWindowID = None self.status_string = _(PROGRAM_NAME + " is inactive") logging.info(self.status_string) diff -Nru caffeine-2.8.3/caffeine-screensaver caffeine-2.9.4/caffeine-screensaver --- caffeine-2.8.3/caffeine-screensaver 2015-01-16 17:45:37.000000000 +0000 +++ caffeine-2.9.4/caffeine-screensaver 1970-01-01 00:00:00.000000000 +0000 @@ -1,952 +0,0 @@ -#!/bin/sh -#--------------------------------------------- -# xdg-screensaver patched for caffeine -# -# Utility script to control screensaver. -# -# Refer to the usage() function below for usage. -# -# Copyright 2006, Bryce Harrington -# -# LICENSE: -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -#--------------------------------------------- - -manualpage() -{ -cat << _MANUALPAGE -Name - -caffeine-screensaver - command line tool for controlling the screensaver - -Synopsis - -caffeine-screensaver suspend WindowID - -caffeine-screensaver resume WindowID - -caffeine-screensaver { activate | lock | reset | status } - -caffeine-screensaver { --help | --manual | --version } - -Description - -caffeine-screensaver provides commands to control the screensaver. - -caffeine-screensaver is for use inside a desktop session only. It is not recommended -to use caffeine-screensaver as root. - -Commands - -suspend WindowID - - Suspends the screensaver and monitor power management. WindowID must be the - X Window ID of an existing window of the calling application. The window - must remain in existance for the duration of the suspension. - - WindowID can be represented as either a decimal number or as a hexadecimal - number consisting of the prefix 0x followed by one or more hexadecimal - digits. - - The screensaver can be suspended in relation to multiple windows at the - same time. In that case screensaver operation is only restored once the - screensaver has been resumed in relation to each of the windows - -resume WindowID - Resume the screensaver and monitor power management after being suspended. - WindowID must be the same X Window ID that was passed to a previous call of - caffeine-screensaver suspend -activate - Turns the screensaver on immediately. This may result in the screen getting - locked, depending on existing system policies. -lock - Lock the screen immediately. -reset - Turns the screensaver off immediately. If the screen was locked the user - may be asked to authenticate first. -status - Prints enabled to stdout if the screensaver is enabled to turn on after a - period of inactivity and prints disabled if the screensaver is not enabled. - -Options - ---help - Show command synopsis. ---manual - Show this manualpage. ---version - Show the xdg-utils version information. - -Exit Codes - -An exit code of 0 indicates success while a non-zero exit code indicates -failure. The following failure codes can be returned: - -1 - Error in command line syntax. -3 - A required tool could not be found. -4 - The action failed. - -Examples - -caffeine-screensaver suspend 0x1c00007 - -Causes the screensaver to be disabled till caffeine-screensaver resume 0x1c00007 is -called. 0x1c00007 must be the X Window ID of an existing window. - -_MANUALPAGE -} - -usage() -{ -cat << _USAGE -caffeine-screensaver - command line tool for controlling the screensaver - -Synopsis - -caffeine-screensaver suspend WindowID - -caffeine-screensaver resume WindowID - -caffeine-screensaver { activate | lock | reset | status } - -caffeine-screensaver { --help | --manual | --version } - -_USAGE -} - -#@xdg-utils-common@ - -#---------------------------------------------------------------------------- -# Common utility functions included in all XDG wrapper scripts -#---------------------------------------------------------------------------- - -DEBUG() -{ - [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0; - [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0; - shift - echo "$@" >&2 -} - -#------------------------------------------------------------- -# Exit script on successfully completing the desired operation - -exit_success() -{ - if [ $# -gt 0 ]; then - echo "$@" - echo - fi - - exit 0 -} - - -#----------------------------------------- -# Exit script on malformed arguments, not enough arguments -# or missing required option. -# prints usage information - -exit_failure_syntax() -{ - if [ $# -gt 0 ]; then - echo "caffeine-screensaver: $@" >&2 - echo "Try 'caffeine-screensaver --help' for more information." >&2 - else - usage - echo "Use 'man caffeine-screensaver' or 'caffeine-screensaver --manual' for additional info." - fi - - exit 1 -} - -#------------------------------------------------------------- -# Exit script on missing file specified on command line - -exit_failure_file_missing() -{ - if [ $# -gt 0 ]; then - echo "caffeine-screensaver: $@" >&2 - fi - - exit 2 -} - -#------------------------------------------------------------- -# Exit script on failure to locate necessary tool applications - -exit_failure_operation_impossible() -{ - if [ $# -gt 0 ]; then - echo "caffeine-screensaver: $@" >&2 - fi - - exit 3 -} - -#------------------------------------------------------------- -# Exit script on failure returned by a tool application - -exit_failure_operation_failed() -{ - if [ $# -gt 0 ]; then - echo "caffeine-screensaver: $@" >&2 - fi - - exit 4 -} - -#------------------------------------------------------------ -# Exit script on insufficient permission to read a specified file - -exit_failure_file_permission_read() -{ - if [ $# -gt 0 ]; then - echo "caffeine-screensaver: $@" >&2 - fi - - exit 5 -} - -#------------------------------------------------------------ -# Exit script on insufficient permission to write a specified file - -exit_failure_file_permission_write() -{ - if [ $# -gt 0 ]; then - echo "caffeine-screensaver: $@" >&2 - fi - - exit 6 -} - -check_input_file() -{ - if [ ! -e "$1" ]; then - exit_failure_file_missing "file '$1' does not exist" - fi - if [ ! -r "$1" ]; then - exit_failure_file_permission_read "no permission to read file '$1'" - fi -} - -check_vendor_prefix() -{ - file_label="$2" - [ -n "$file_label" ] || file_label="filename" - file=`basename "$1"` - case "$file" in - [a-zA-Z]*-*) - return - ;; - esac - - echo "caffeine-screensaver: $file_label '$file' does not have a proper vendor prefix" >&2 - echo 'A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated' >&2 - echo 'with a dash ("-"). An example '"$file_label"' is '"'example-$file'" >&2 - echo "Use --novendor to override or 'caffeine-screensaver --manual' for additional info." >&2 - exit 1 -} - -check_output_file() -{ - # if the file exists, check if it is writeable - # if it does not exists, check if we are allowed to write on the directory - if [ -e "$1" ]; then - if [ ! -w "$1" ]; then - exit_failure_file_permission_write "no permission to write to file '$1'" - fi - else - DIR=`dirname "$1"` - if [ ! -w "$DIR" -o ! -x "$DIR" ]; then - exit_failure_file_permission_write "no permission to create file '$1'" - fi - fi -} - -#---------------------------------------- -# Checks for shared commands, e.g. --help - -check_common_commands() -{ - while [ $# -gt 0 ] ; do - parm="$1" - shift - - case "$parm" in - --help) - usage - echo "Use 'man caffeine-screensaver' or 'caffeine-screensaver --manual' for additional info." - exit_success - ;; - - --manual) - manualpage - exit_success - ;; - - --version) - echo "caffeine-screensaver 1.0.2" - exit_success - ;; - esac - done -} - -check_common_commands "$@" - -[ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; -if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then - # Be silent - xdg_redirect_output=" > /dev/null 2> /dev/null" -else - # All output to stderr - xdg_redirect_output=" >&2" -fi - -#-------------------------------------- -# Checks for known desktop environments -# set variable DE to the desktop environments name, lowercase - -detectDE() -{ - if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; - elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; - elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome; - elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce; - elif [ x"$DESKTOP_SESSION" = x"LXDE" ]; then DE=lxde; - else DE="" - fi -} - -#---------------------------------------------------------------------------- -# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 -# It also always returns 1 in KDE 3.4 and earlier -# Simply return 0 in such case - -kfmclient_fix_exit_code() -{ - version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep '^KDE'` - major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` - minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` - release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` - test "$major" -gt 3 && return $1 - test "$minor" -gt 5 && return $1 - test "$release" -gt 4 && return $1 - return 0 -} - -# Check if we can use "mv -T" -if mv -T ... ... 2>&1 | grep '\.\.\.' > /dev/null ; then - # We can securely move files in /tmp with mv -T - DEBUG 1 "mv -T available" - MV="mv -T" - screensaver_file="/tmp/caffeine-screensaver-$USER-"`echo $DISPLAY | sed 's/:/-/g'` -else - # No secure moves available, use home dir - DEBUG 1 "mv -T not available" - MV="mv" - screensaver_file="$HOME/.caffeine-screensaver-"`echo $(hostname)-$DISPLAY | sed 's/:/-/g'` -fi -lockfile_command=`which lockfile 2> /dev/null` - -lockfile() -{ - if [ -n "$lockfile_command" ] ; then - $lockfile_command -1 -l 10 -s 3 "$screensaver_file".lock - else - # Poor man's attempt at doing a lockfile - # Be careful not to facilitate a symlink attack - local try - try=0 - while ! ln -s "$screensaver_file".lock "$screensaver_file".lock 2> /dev/null; - do - sleep 1 - try=$(($try+1)) - if [ $try -eq 3 ] ; then - rm -f "$screensaver_file".lock || return # Can't remove lockfile - try=0 - fi - done - fi -} - -unlockfile() -{ - rm -f "$screensaver_file".lock -} - -perform_action() -{ - result=1 - - if [ "$1" = "resume" ] ; then - # Restore DPMS state - if [ -f "$screensaver_file.dpms" ]; then - rm "$screensaver_file.dpms" - # Re-enable DPMS - xset +dpms - fi - fi - if [ "$1" = "reset" ] ; then - if xset -q | grep 'DPMS is Enabled' > /dev/null 2> /dev/null; then - xset dpms force on - fi - fi - - case "$DE" in - kde) - if [ x"$KDE_SESSION_VERSION" = x"4" ]; then - screensaver_freedesktop "$1" "/ScreenSaver" - else - screensaver_kde "$1" - fi - ;; - - gnome) - screensaver_freedesktop "$1" "/org/freedesktop/ScreenSaver" - ;; - - gnome_screensaver) - screensaver_gnome_screensaver "$1" - ;; - - xscreensaver) - screensaver_xscreensaver "$1" - ;; - - xfce) - screensaver_xserver "$1" - ;; - - '') - screensaver_xserver "$1" - ;; - esac - - if [ "$1" = "suspend" ] ; then - # Save DPMS state - if xset -q | grep 'DPMS is Enabled' > /dev/null 2> /dev/null; then - test "${TMPDIR+set}" = set || TMPDIR=/tmp - tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` - $MV "$tmpfile" "$screensaver_file.dpms" - # Disable DPMS - xset -dpms - fi - fi - -} - -cleanup_suspend() -{ - lockfile - test "${TMPDIR+set}" = set || TMPDIR=/tmp - tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` - grep -v "$window_id:$xprop_pid\$" "$screensaver_file" > "$tmpfile" 2> /dev/null - $MV "$tmpfile" "$screensaver_file" - if [ ! -s "$screensaver_file" ] ; then - rm "$screensaver_file" - unlockfile - # $screensaver_file is empty, do resume - perform_action resume - else - unlockfile - fi -} - -do_resume() -{ - lockfile # Obtain lockfile - # Find the PID of the tracking process - xprop_pid=`grep "$window_id:" "$screensaver_file" 2> /dev/null | cut -d ':' -f 2` - unlockfile # Free lockfile - if [ -n "$xprop_pid" ] && ps -p "$xprop_pid" 2> /dev/null | grep xprop > /dev/null; then - # Kill the tracking process - kill -s TERM $xprop_pid - fi - cleanup_suspend -} - -XPROP=`which xprop 2> /dev/null` - -check_window_id() -{ - if [ -z "$XPROP" ]; then - DEBUG 3 "xprop not found" - return - fi - DEBUG 2 "Running $XPROP -id $window_id" - if $XPROP -id $window_id > /dev/null 2> /dev/null; then - DEBUG 3 Window $window_id exists - else - DEBUG 3 Window $window_id does not exist - exit_failure_operation_failed "Window $window_id does not exist" - fi -} - -track_window() -{ - if [ -z "$XPROP" ]; then - # Don't track window if we don't have xprop - return - fi - lockfile - - test "${TMPDIR+set}" = set || TMPDIR=/tmp - tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` - # Filter stale entries from the caffeine-screensaver status file - # Return if $window_id is being tracked already - ( - already_tracked=1 - IFS_save="$IFS" - IFS=":" - while read wid pid; do - if ps -p "$pid" 2> /dev/null | grep xprop > /dev/null; then - echo "$wid:$pid" - if [ $wid = $window_id ] ; then - already_tracked=0 - fi - fi - done - IFS="$IFS_save" - exit $already_tracked - ) < $screensaver_file > $tmpfile - already_tracked=$? - - if [ "$already_tracked" -eq "0" ] ; then - $MV "$tmpfile" "$screensaver_file" - # We are already tracking $window_id, don't do anything - unlockfile - return - fi - - # Start tracking $window_id - $XPROP -id $window_id -spy > /dev/null & - xprop_pid=$! - # Add window_id and xprop_pid to the xdg-screensaver status file - echo "$window_id:$xprop_pid" >> $tmpfile - $MV "$tmpfile" "$screensaver_file" - unlockfile - # Wait for xprop to edit, it means that the window disappeared - wait $xprop_pid - # Clean up the administration and resume the screensaver - cleanup_suspend -} - -screensaver_freedesktop() -{ - case "$1" in - suspend) - rm -f "$screensaver_file.pid" - caffeine-screensaver-freedesktop-helper & - echo $! > "$screensaver_file.pid" - result=$? - ;; - - resume) - if [ -f "$screensaver_file.pid" ] ; then - kill -HUP `cat "$screensaver_file.pid"` - rm -f "$screensaver_file.pid" - fi - result=$? - ;; - - activate|lock|reset) - echo "ERROR: Command '$1' is not implemented in the $DE environment" >&2 - ;; - - status) - result=0 - if [ -f "$screensaver_file" ] ; then - echo "disabled" - else - echo "enabled" - fi - ;; - - *) - echo "ERROR: Unknown command '$1'" >&2 - return 1 - ;; - esac -} - -screensaver_kde() -{ - case "$1" in - suspend) - dcop kdesktop KScreensaverIface enable false > /dev/null - result=$? - ;; - - resume) - dcop kdesktop KScreensaverIface configure > /dev/null - result=$? - ;; - - activate) - dcop kdesktop KScreensaverIface save > /dev/null - result=$? - ;; - - lock) - dcop kdesktop KScreensaverIface lock > /dev/null - result=$? - ;; - - reset) - # Turns the screensaver off right now - dcop kdesktop KScreensaverIface quit > /dev/null - result=$? - ;; - - status) - status=`dcop kdesktop KScreensaverIface isEnabled` - result=$? - if [ x"$status" = "xtrue" ]; then - echo "enabled" - elif [ x"$status" = "xfalse" ]; then - echo "disabled" - else - echo "ERROR: kdesktop KScreensaverIface isEnabled returned '$status'" >&2 - return 1 - fi - ;; - - *) - echo "ERROR: Unknown command '$1'" >&2 - return 1 - ;; - esac -} - -screensaver_xserver() -{ - case "$1" in - suspend) - xset s off > /dev/null - result=$? - ;; - - resume) - xset s default > /dev/null - result=$? - ;; - - activate) - xset s activate > /dev/null - result=$? - ;; - - reset) - xset s reset > /dev/null - result=$? - ;; - - status) - timeout=`xset q | sed '/^Screen Saver:/,/^[^ ]/ { s/.*timeout: *\([0-9]*\).*/\1/; t }; d'` - result=$? - if [ "$timeout" -gt 0 ]; then - echo "enabled" - elif [ "$timeout" -eq 0 ]; then - echo "disabled" - else - echo "ERROR: xset q did not report the screensaver timeout" >&2 - return 1 - fi - ;; - - *) - echo "ERROR: Unknown command '$1'" >&2 - return 1 - ;; - esac -} - -screensaver_xserver() -{ - case "$1" in - suspend) - xset s off > /dev/null - result=$? - ;; - - resume) - xset s default > /dev/null - result=$? - ;; - - activate) - xset s activate > /dev/null - result=$? - ;; - - reset) - xset s reset > /dev/null - result=$? - ;; - - status) - timeout=`xset q | sed '/^Screen Saver:/,/^[^ ]/ { s/.*timeout: *\([0-9]*\).*/\1/; t }; d'` - result=$? - if [ "$timeout" -gt 0 ]; then - echo "enabled" - elif [ "$timeout" -eq 0 ]; then - echo "disabled" - else - echo "ERROR: xset q did not report the screensaver timeout" >&2 - return 1 - fi - ;; - - *) - echo "ERROR: Unknown command '$1'" >&2 - return 1 - ;; - esac -} - -screensaver_suspend_loop() -{ - lockfile - test "${TMPDIR+set}" = set || TMPDIR=/tmp - tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` - # Filter stale entries from the caffeine-screensaver status file - cat "$screensaver_file" 2> /dev/null | ( - IFS_save="$IFS" - IFS=":" - while read wid pid; do - if ps -p "$pid" 2> /dev/null | grep xprop > /dev/null; then - echo "$wid:$pid" - fi - done - IFS="$IFS_save" - ) > $tmpfile - if [ -s "$tmpfile" ] ; then - # Suspend pending, don't do a thing - $MV "$tmpfile" "$screensaver_file" - unlockfile - return - fi - $MV "$tmpfile" "$screensaver_file" - unlockfile - (while [ -f "$screensaver_file" ]; do $*; sleep 50; done) > /dev/null 2> /dev/null & -} - -screensaver_gnome_screensaver() -{ -# DBUS interface for gnome-screensaver -# http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html - case "$1" in - suspend) - screensaver_suspend_loop \ - dbus-send --session \ - --dest=org.gnome.ScreenSaver \ - --type=method_call \ - /org/gnome/ScreenSaver \ - org.gnome.ScreenSaver.SimulateUserActivity \ - 2> /dev/null - result=$? - ;; - - resume) - # Automatic resume when $screensaver_file disappears - result=0 - ;; - - activate) - dbus-send --session \ - --dest=org.gnome.ScreenSaver \ - --type=method_call \ - /org/gnome/ScreenSaver \ - org.gnome.ScreenSaver.SetActive \ - boolean:true \ - 2> /dev/null - result=$? - ;; - - lock) - gnome-screensaver-command --lock > /dev/null 2> /dev/null - result=$? - ;; - - reset) - # Turns the screensaver off right now - dbus-send --session \ - --dest=org.gnome.ScreenSaver \ - --type=method_call \ - /org/gnome/ScreenSaver \ - org.gnome.ScreenSaver.SimulateUserActivity \ - 2> /dev/null - result=$? - ;; - - status) - status=`dbus-send --session \ - --dest=org.gnome.ScreenSaver \ - --type=method_call \ - --print-reply \ - --reply-timeout=2000 \ - /org/gnome/ScreenSaver \ - org.gnome.ScreenSaver.GetActive \ - | grep boolean | cut -d ' ' -f 5` - result=$? - if [ x"$status" = "xtrue" -o x"$status" = "xfalse" ]; then - echo "enabled" - elif [ x"$result" != "x0" ]; then - echo "ERROR: dbus org.gnome.ScreenSaver.GetActive returned '$status'" >&2 - return 1 - else - echo "disabled" - fi - ;; - - *) - echo "ERROR: Unknown command '$1" >&2 - return 1 - ;; - esac -} - -screensaver_xscreensaver() -{ - case "$1" in - suspend) - screensaver_suspend_loop xscreensaver-command -deactivate - result=0 - ;; - - resume) - # Automatic resume when $screensaver_file disappears - result=0 - ;; - - activate) - xscreensaver-command -activate > /dev/null 2> /dev/null - result=$? - ;; - - lock) - xscreensaver-command -lock > /dev/null 2> /dev/null - result=$? - ;; - - reset) - # Turns the screensaver off right now - xscreensaver-command -deactivate > /dev/null 2> /dev/null - result=$? - ;; - - status) - result=0 - if [ -f "$screensaver_file" ] ; then - echo "disabled" - else - echo "enabled" - fi - ;; - - *) - echo "ERROR: Unknown command '$1" >&2 - return 1 - ;; - esac -} - -[ x"$1" != x"" ] || exit_failure_syntax - -action= -window_id= - -case $1 in - suspend) - action="$1" - - shift - - if [ -z "$1" ] ; then - exit_failure_syntax "WindowID argument missing" - fi - - window_id="$1" - check_window_id - ;; - - resume) - action="$1" - - shift - - if [ -z "$1" ] ; then - exit_failure_syntax "WindowID argument missing" - fi - - window_id="$1" - check_window_id - ;; - - activate) - action="$1" - ;; - - lock) - action="$1" - ;; - - reset) - action="$1" - ;; - - status) - action="$1" - ;; - - *) - exit_failure_syntax "unknown command '$1'" - ;; -esac - -detectDE -# Consider "xscreensaver" a separate DE -xscreensaver-command -version 2> /dev/null | grep XScreenSaver > /dev/null && DE="xscreensaver" -# Consider "gnome-screensaver" a separate DE -gnome-screensaver-command -q > /dev/null 2>&1 && DE="gnome_screensaver" - -if [ "$action" = "resume" ] ; then - do_resume - exit_success -fi - -perform_action "$action" - -if [ "$action" = "suspend" ] ; then - # Start tracking $window_id and resume the screensaver once it disappears - ( track_window ) 2> /dev/null > /dev/null & -fi - -if [ $result -eq 0 ]; then - exit_success -else - exit_failure_operation_failed -fi diff -Nru caffeine-2.8.3/caffeine-screensaver-freedesktop-helper caffeine-2.9.4/caffeine-screensaver-freedesktop-helper --- caffeine-2.8.3/caffeine-screensaver-freedesktop-helper 2015-01-16 16:09:47.000000000 +0000 +++ caffeine-2.9.4/caffeine-screensaver-freedesktop-helper 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#!/usr/bin/perl -# Helper for caffeine-screensaver to inhibit desktop idleness using freedesktop.org DBus interface -# N.B. This script sleeps forever, so it must be killed to stop the inhibition - -use strict; -use warnings; - -use Net::DBus; - -my $bus = Net::DBus->session; -my $service = $bus->get_service("org.freedesktop.ScreenSaver"); -my $manager = $service->get_object("/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver"); -$manager->Inhibit("org.freedesktop.xdg-screensaver", "caffeine-screensaver suspend"); - -# Keep inhibiting until we're killed -sleep; diff -Nru caffeine-2.8.3/debian/caffeinate caffeine-2.9.4/debian/caffeinate --- caffeine-2.8.3/debian/caffeinate 1970-01-01 00:00:00.000000000 +0000 +++ caffeine-2.9.4/debian/caffeinate 2017-11-26 12:11:10.000000000 +0000 @@ -0,0 +1,32 @@ +# caffeinate(1) completion -*- shell-script -*- +# Adapted from bash-completion's ccache completion script +# License: GPL-V2+ + +_caffeinate() +{ + local cur prev words cword + _init_completion || return + + local i + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} != -* ]]; then + _command_offset $i + return + fi + done + + case "$prev" in + -h|--help|-V|--version) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi +} && +complete -F _caffeinate caffeinate + +# ex: ts=4 sw=4 et filetype=sh diff -Nru caffeine-2.8.3/debian/caffeine.bash-completion caffeine-2.9.4/debian/caffeine.bash-completion --- caffeine-2.8.3/debian/caffeine.bash-completion 1970-01-01 00:00:00.000000000 +0000 +++ caffeine-2.9.4/debian/caffeine.bash-completion 2017-11-26 12:11:21.000000000 +0000 @@ -0,0 +1 @@ +debian/caffeinate diff -Nru caffeine-2.8.3/debian/changelog caffeine-2.9.4/debian/changelog --- caffeine-2.8.3/debian/changelog 2016-02-16 14:43:53.000000000 +0000 +++ caffeine-2.9.4/debian/changelog 2017-11-26 12:22:29.000000000 +0000 @@ -1,12 +1,13 @@ -caffeine (2.8.3-3build1) xenial; urgency=medium +caffeine (2.9.4-1) unstable; urgency=medium - * No change rebuild to drop python3.4 support. + * New upstream version (Closes: #881742, #880280). + * Update the copyrights. - -- Dimitri John Ledkov Tue, 16 Feb 2016 14:43:53 +0000 + -- Andrew Shadura Sun, 26 Nov 2017 12:22:28 +0000 caffeine (2.8.3-3) unstable; urgency=medium - * Actually depend on python3-git (now really closes: #802908 and also + * Actually depend on python3-gi (now really closes: #802908 and also closes: #806714). -- Andrew Shadura Mon, 30 Nov 2015 17:17:57 +0100 diff -Nru caffeine-2.8.3/debian/control caffeine-2.9.4/debian/control --- caffeine-2.8.3/debian/control 2015-11-30 16:17:12.000000000 +0000 +++ caffeine-2.9.4/debian/control 2017-11-26 12:15:00.000000000 +0000 @@ -2,17 +2,29 @@ Section: misc Priority: optional Maintainer: Andrew Shadura -Build-Depends: debhelper (>= 9), dh-python, python3-all, python-setuptools, gettext -Standards-Version: 3.9.6 +Build-Depends: + bash-completion, + debhelper (>= 9), + dh-python, + gettext, + python-setuptools, + python3-all +Standards-Version: 4.0.0 Homepage: https://launchpad.net/caffeine Package: caffeine Architecture: all Depends: - ${misc:Depends}, ${python3:Depends}, ${perl:Depends}, - gir1.2-gtk-3.0, gir1.2-appindicator3-0.1, - python3-xlib, python3-pkg-resources, python3-gi, - libnet-dbus-perl + gir1.2-appindicator3-0.1, + gir1.2-gtk-3.0, + python3-ewmh, + python3-gi, + python3-pkg-resources, + python3-xlib, + xdg-utils (>= 1.1.1), + ${misc:Depends}, + ${perl:Depends}, + ${python3:Depends} Description: prevent the desktop becoming idle in full-screen mode Caffeine prevents the desktop from becoming idle when an application is running full-screen. A desktop indicator ‘caffeine-indicator’ diff -Nru caffeine-2.8.3/debian/copyright caffeine-2.9.4/debian/copyright --- caffeine-2.8.3/debian/copyright 2015-07-22 14:59:12.000000000 +0000 +++ caffeine-2.9.4/debian/copyright 2017-11-26 12:15:58.000000000 +0000 @@ -1,16 +1,16 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: caffeine Upstream-Contact: rrt@sc3d.org Source: https://launchpad.net/caffeine Files: debian/* Copyright: - 2013—2015 Reuben Thomas - 2015 Andrew Shadura + 2013—2017 Reuben Thomas + 2015—2017 Andrew Shadura License: GPL-3+ Files: * -Copyright: 2009-2013 Isaiah Heyer, Tommy Brunn, Brad Smith and Reuben Thomas +Copyright: 2009-2017 Isaiah Heyer, Tommy Brunn, Brad Smith and Reuben Thomas License: GPL-3+ License: GPL-3+ diff -Nru caffeine-2.8.3/debian/rules caffeine-2.9.4/debian/rules --- caffeine-2.8.3/debian/rules 2015-07-22 14:57:57.000000000 +0000 +++ caffeine-2.9.4/debian/rules 2017-11-26 12:14:15.000000000 +0000 @@ -3,4 +3,4 @@ export PYBUILD_NAME=caffeine %: - dh $@ --with python3 --buildsystem=pybuild + dh $@ --with python3,bash-completion --buildsystem=pybuild diff -Nru caffeine-2.8.3/ewmh.py caffeine-2.9.4/ewmh.py --- caffeine-2.8.3/ewmh.py 2014-12-22 23:03:17.000000000 +0000 +++ caffeine-2.9.4/ewmh.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,355 +0,0 @@ -"""This module intends to provide an implementation of Extended Window Manager Hints, based on -the Xlib modules for python. - -See the freedesktop.org `specification `_ for more information. -""" - -from Xlib import display, X, protocol, Xatom -import time - -class EWMH: - """This class provides the ability to get and set properties defined by the EWMH spec. - - Each property can be accessed in two ways. For example, to get the active window:: - - win = ewmh.getActiveWindow() - # or: win = ewmh.getProperty('_NET_ACTIVE_WINDOW') - - Similarly, to set the active window:: - - ewmh.setActiveWindow(myWindow) - # or: ewmh.setProperty('_NET_ACTIVE_WINDOW', myWindow) - - When a property is written, don't forget to really send the notification by flushing requests:: - - ewmh.display.flush() - - :param _display: the display to use. If not given, Xlib.display.Display() is used. - :param root: the root window to use. If not given, self.display.screen().root is used.""" - - NET_WM_WINDOW_TYPES = ( - '_NET_WM_WINDOW_TYPE_DESKTOP', '_NET_WM_WINDOW_TYPE_DOCK', '_NET_WM_WINDOW_TYPE_TOOLBAR', '_NET_WM_WINDOW_TYPE_MENU', - '_NET_WM_WINDOW_TYPE_UTILITY', '_NET_WM_WINDOW_TYPE_SPLASH', '_NET_WM_WINDOW_TYPE_DIALOG', '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU', - '_NET_WM_WINDOW_TYPE_POPUP_MENU', '_NET_WM_WINDOW_TYPE_NOTIFICATION', '_NET_WM_WINDOW_TYPE_COMBO', '_NET_WM_WINDOW_TYPE_DND', - '_NET_WM_WINDOW_TYPE_NORMAL') - """List of strings representing all known window types.""" - - NET_WM_ACTIONS = ( - '_NET_WM_ACTION_MOVE', '_NET_WM_ACTION_RESIZE', '_NET_WM_ACTION_MINIMIZE', '_NET_WM_ACTION_SHADE', - '_NET_WM_ACTION_STICK', '_NET_WM_ACTION_MAXIMIZE_HORZ', '_NET_WM_ACTION_MAXIMIZE_VERT', '_NET_WM_ACTION_FULLSCREEN', - '_NET_WM_ACTION_CHANGE_DESKTOP', '_NET_WM_ACTION_CLOSE', '_NET_WM_ACTION_ABOVE', '_NET_WM_ACTION_BELOW') - """List of strings representing all known window actions.""" - - NET_WM_STATES = ( - '_NET_WM_STATE_MODAL', '_NET_WM_STATE_STICKY', '_NET_WM_STATE_MAXIMIZED_VERT', '_NET_WM_STATE_MAXIMIZED_HORZ', - '_NET_WM_STATE_SHADED', '_NET_WM_STATE_SKIP_TASKBAR', '_NET_WM_STATE_SKIP_PAGER', '_NET_WM_STATE_HIDDEN', - '_NET_WM_STATE_FULLSCREEN','_NET_WM_STATE_ABOVE', '_NET_WM_STATE_BELOW', '_NET_WM_STATE_DEMANDS_ATTENTION') - """List of strings representing all known window states.""" - - def __init__(self, _display=None, root = None): - self.display = _display or display.Display() - self.root = root or self.display.screen().root - self.__getAttrs = { - '_NET_CLIENT_LIST': self.getClientList, - '_NET_CLIENT_LIST_STACKING': self.getClientListStacking, - '_NET_NUMBER_OF_DESKTOPS': self.getNumberOfDesktops, - '_NET_DESKTOP_GEOMETRY': self.getDesktopGeometry, - '_NET_DESKTOP_VIEWPORT': self.getDesktopViewPort, - '_NET_CURRENT_DESKTOP': self.getCurrentDesktop, - '_NET_ACTIVE_WINDOW': self.getActiveWindow, - '_NET_WORKAREA': self.getWorkArea, - '_NET_SHOWING_DESKTOP': self.getShowingDesktop, - '_NET_WM_NAME': self.getWmName, - '_NET_WM_VISIBLE_NAME': self.getWmVisibleName, - '_NET_WM_DESKTOP': self.getWmDesktop, - '_NET_WM_WINDOW_TYPE': self.getWmWindowType, - '_NET_WM_STATE': self.getWmState, - '_NET_WM_ALLOWED_ACTIONS': self.getWmAllowedActions, - '_NET_WM_PID': self.getWmPid, - } - self.__setAttrs = { - '_NET_NUMBER_OF_DESKTOPS': self.setNumberOfDesktops, - '_NET_DESKTOP_GEOMETRY': self.setDesktopGeometry, - '_NET_DESKTOP_VIEWPORT': self.setDesktopViewport, - '_NET_CURRENT_DESKTOP': self.setCurrentDesktop, - '_NET_ACTIVE_WINDOW': self.setActiveWindow, - '_NET_SHOWING_DESKTOP': self.setShowingDesktop, - '_NET_CLOSE_WINDOW': self.setCloseWindow, - '_NET_MOVERESIZE_WINDOW': self.setMoveResizeWindow, - '_NET_WM_NAME': self.setWmName, - '_NET_WM_VISIBLE_NAME': self.setWmVisibleName, - '_NET_WM_DESKTOP': self.setWmDesktop, - '_NET_WM_STATE': self.setWmState, - } - - # ------------------------ setters properties ------------------------ - - def setNumberOfDesktops(self, nb): - """Set the number of desktops (property _NET_NUMBER_OF_DESKTOPS). - - :param nb: the number of desired desktops""" - self._setProperty('_NET_NUMBER_OF_DESKTOPS', [nb]) - - def setDesktopGeometry(self, w, h): - """Set the desktop geometry (property _NET_DESKTOP_GEOMETRY) - - :param w: desktop width - :param h: desktop height""" - self._setProperty('_NET_DESKTOP_GEOMETRY', [w, h]) - - def setDesktopViewport(self, w, h): - """Set the viewport size of the current desktop (property _NET_DESKTOP_VIEWPORT) - - :param w: desktop width - :param h: desktop height""" - self._setProperty('_NET_DESKTOP_VIEWPORT', [w, h]) - - def setCurrentDesktop(self, i): - """Set the current desktop (property _NET_CURRENT_DESKTOP). - - :param i: the desired desktop number""" - self._setProperty('_NET_CURRENT_DESKTOP', [i, X.CurrentTime]) - - def setActiveWindow(self, win): - """Set the given window active (property _NET_ACTIVE_WINDOW) - - :param win: the window object""" - self._setProperty('_NET_ACTIVE_WINDOW', [1, X.CurrentTime, win.id], win) - - def setShowingDesktop(self, show): - """Set/unset the mode Showing desktop (property _NET_SHOWING_DESKTOP) - - :param show: 1 to set the desktop mode, else 0""" - self._setProperty('_NET_SHOWING_DESKTOP', [show]) - - def setCloseWindow(self, win): - """Colse the given window (property _NET_CLOSE_WINDOW) - - :param win: the window object""" - self._setProperty('_NET_CLOSE_WINDOW', [int(time.mktime(time.localtime())), 1], win) - - def setWmName(self, win, name): - """Set the property _NET_WM_NAME - - :param win: the window object - :param name: desired name""" - self._setProperty('_NET_WM_NAME', name, win) - - def setWmVisibleName(self, win, name): - """Set the property _NET_WM_VISIBLE_NAME - - :param win: the window object - :param name: desired visible name""" - self._setProperty('_NET_WM_VISIBLE_NAME', name, win) - - def setWmDesktop(self, win, i): - """Move the window to the desired desktop by changing the property _NET_WM_DESKTOP. - - :param win: the window object - :param i: desired desktop number""" - self._setProperty('_NET_WM_DESKTOP', [i, 1], win) - - def setMoveResizeWindow(self, win, gravity=0, x=None, y=None, w=None, h=None): - """Set the property _NET_MOVERESIZE_WINDOW to move or resize the given window. - Flags are automatically calculated if x, y, w or h are defined. - - :param win: the window object - :param gravity: gravity (one of the Xlib.X.*Gravity constant or 0) - :param x: int or None - :param y: int or None - :param w: int or None - :param h: int or None""" - gravity_flags = gravity | 0b0000100000000000 # indicate source (application) - if x is None: x = 0 - else: gravity_flags = gravity_flags | 0b0000010000000000 # indicate presence of x - if y is None: y = 0 - else: gravity_flags = gravity_flags | 0b0000001000000000 # indicate presence of y - if w is None: w = 0 - else: gravity_flags = gravity_flags | 0b0000000100000000 # indicate presence of w - if h is None: h = 0 - else: gravity_flags = gravity_flags | 0b0000000010000000 # indicate presence of h - self._setProperty('_NET_MOVERESIZE_WINDOW', [gravity_flags, x, y, w, h], win) - - def setWmState(self, win, action, state, state2=0): - """Set/unset one or two state(s) for the given window (property _NET_WM_STATE). - - :param win: the window object - :param action: 0 to remove, 1 to add or 2 to toggle state(s) - :param state: a state - :type state: int or str (see :attr:`NET_WM_STATES`) - :param state2: a state or 0 - :type state2: int or str (see :attr:`NET_WM_STATES`)""" - if type(state) != int: state = self.display.get_atom(state, 1) - if type(state2) != int: state2 = self.display.get_atom(state2, 1) - self._setProperty('_NET_WM_STATE', [action, state, state2, 1], win) - - # ------------------------ getters properties ------------------------ - - def getClientList(self): - """Get the list of windows maintained by the window manager for the property - _NET_CLIENT_LIST. - - :return: list of Window objects""" - return map(self._createWindow, self._getProperty('_NET_CLIENT_LIST')) - - def getClientListStacking(self): - """Get the list of windows maintained by the window manager for the property - _NET_CLIENT_LIST_STACKING. - - :return: list of Window objects""" - return map(self._createWindow, self._getProperty('_NET_CLIENT_LIST_STACKING')) - - def getNumberOfDesktops(self): - """Get the number of desktops (property _NET_NUMBER_OF_DESKTOPS). - - :return: int""" - return self._getProperty('_NET_NUMBER_OF_DESKTOPS')[0] - - def getDesktopGeometry(self): - """Get the desktop geometry (property _NET_DESKTOP_GEOMETRY) as an array - of two integers [width, height]. - - :return: [int, int]""" - return self._getProperty('_NET_DESKTOP_GEOMETRY') - - def getDesktopViewPort(self): - """Get the current viewports of each desktop as a list of [x, y] representing - the top left corner (property _NET_DESKTOP_VIEWPORT). - - :return: list of [int, int]""" - return self._getProperty('_NET_DESKTOP_VIEWPORT') - - def getCurrentDesktop(self): - """Get the current desktop number (property _NET_CURRENT_DESKTOP) - - :return: int""" - return self._getProperty('_NET_CURRENT_DESKTOP')[0] - - def getActiveWindow(self): - """Get the current active (toplevel) window or None (property _NET_ACTIVE_WINDOW) - - :return: Window object or None""" - active_window = self._getProperty('_NET_ACTIVE_WINDOW') - if active_window == None: - return None - return self._createWindow(active_window[0]) - - def getWorkArea(self): - """Get the work area for each desktop (property _NET_WORKAREA) as a list of [x, y, width, height] - - :return: a list of [int, int, int, int]""" - return self._getProperty('_NET_WORKAREA') - - def getShowingDesktop(self): - """Get the value of "showing the desktop" mode of the window manager (property _NET_SHOWING_DESKTOP). - 1 means the mode is activated, and 0 means deactivated. - - :return: int""" - return self._getProperty('_NET_SHOWING_DESKTOP')[0] - - def getWmName(self, win): - """Get the property _NET_WM_NAME for the given window as a string. - - :param win: the window object - :return: str""" - return self._getProperty('_NET_WM_NAME', win) - - def getWmVisibleName(self, win): - """Get the property _NET_WM_VISIBLE_NAME for the given window as a string. - - :param win: the window object - :return: str""" - return self._getProperty('_NET_WM_VISIBLE_NAME', win) - - def getWmDesktop(self, win): - """Get the current desktop number of the given window (property _NET_WM_DESKTOP). - - :param win: the window object - :return: int""" - return self._getProperty('_NET_WM_DESKTOP', win)[0] - - def getWmWindowType(self, win, str=False): - """Get the list of window types of the given window (property _NET_WM_WINDOW_TYPE). - - :param win: the window object - :param str: True to get a list of string types instead of int - :return: list of (int|str)""" - types = self._getProperty('_NET_WM_WINDOW_TYPE', win) - if not str: return types - return map(self._getAtomName, wtypes) - - def getWmState(self, win, str=False): - """Get the list of states of the given window (property _NET_WM_STATE). - - :param win: the window object - :param str: True to get a list of string states instead of int - :return: list of (int|str)""" - states = self._getProperty('_NET_WM_STATE', win) - if not str: return states - return map(self._getAtomName, states) - - def getWmAllowedActions(self, win, str=False): - """Get the list of allowed actions for the given window (property _NET_WM_ALLOWED_ACTIONS). - - :param win: the window object - :param str: True to get a list of string allowed actions instead of int - :return: list of (int|str)""" - wAllowedActions = self._getProperty('_NET_WM_ALLOWED_ACTIONS', win) - if not str: return wAllowedActions - return map(self._getAtomName, wAllowedActions) - - def getWmPid(self, win): - """Get the pid of the application associated to the given window (property _NET_WM_PID) - - :param win: the window object""" - return self._getProperty('_NET_WM_PID', win)[0] - - def _getProperty(self, _type, win=None): - if not win: win = self.root - atom = win.get_full_property(self.display.get_atom(_type), X.AnyPropertyType) - if atom: return atom.value - - def _setProperty(self, _type, data, win=None, mask=None): - """Send a ClientMessage event to the root window""" - if not win: win = self.root - if type(data) is str: - dataSize = 8 - else: - data = (data+[0]*(5-len(data)))[:5] - dataSize = 32 - - ev = protocol.event.ClientMessage(window=win, client_type=self.display.get_atom(_type), data=(dataSize, data)) - - if not mask: - mask = (X.SubstructureRedirectMask|X.SubstructureNotifyMask) - self.root.send_event(ev, event_mask=mask) - - def _getAtomName(self, atom): - try: return self.display.get_atom_name(atom) - except: return 'UNKNOWN' - - def _createWindow(self, wId): - if not wId: return None - return self.display.create_resource_object('window', wId) - - def getReadableProperties(self): - """Get all the readable properties' names""" - return self.__getAttrs.keys() - - def getProperty(self, prop, *args, **kwargs): - """Get the value of a property. See the corresponding method for the required arguments. - For example, for the property _NET_WM_STATE, look for :meth:`getWmState`""" - f = self.__getAttrs.get(prop) - if not f: raise KeyError('Unknow readable property: %s' % prop) - return f(self, *args, **kwargs) - - def getWritableProperties(self): - """Get all the writable properties names""" - return self.__setAttrs.keys() - - def setProperty(self, prop, *args, **kwargs): - """Set the value of a property by sending an event on the root window. See the corresponding method for - the required arguments. For example, for the property _NET_WM_STATE, look for :meth:`setWmState`""" - f = self.__setAttrs.get(prop) - if not f: raise KeyError('Unknow writable property: %s' % prop) - f(self, *args, **kwargs) diff -Nru caffeine-2.8.3/setup.py caffeine-2.9.4/setup.py --- caffeine-2.8.3/setup.py 2015-01-16 22:27:04.000000000 +0000 +++ caffeine-2.9.4/setup.py 2017-01-16 12:59:02.000000000 +0000 @@ -38,7 +38,6 @@ author="The Caffeine Developers", author_email="rrt@sc3d.org", url="https://launchpad.net/caffeine", - py_modules=["ewmh"], data_files=data_files, - scripts=["caffeine", "caffeinate", "caffeine-indicator", "caffeine-screensaver", "caffeine-screensaver-freedesktop-helper"] + scripts=["caffeine", "caffeinate", "caffeine-indicator"] ) diff -Nru caffeine-2.8.3/share/applications/caffeine-indicator.desktop caffeine-2.9.4/share/applications/caffeine-indicator.desktop --- caffeine-2.8.3/share/applications/caffeine-indicator.desktop 2015-01-14 22:36:10.000000000 +0000 +++ caffeine-2.9.4/share/applications/caffeine-indicator.desktop 2017-01-16 12:59:02.000000000 +0000 @@ -7,5 +7,5 @@ Type=Application Categories=Utility;TrayIcon; Keywords=Screensaver,Power,Saving,Blank -OnlyShowIn=GNOME;Unity; +OnlyShowIn=GNOME;KDE;LXDE;LXQt;MATE;Razor;ROX;TDE;Unity;XFCE;EDE;Cinnamon;Pantheon; StartupNotify=false Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/16x16/status/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/16x16/status/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/16x16/status/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/16x16/status/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/22x22/status/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/22x22/status/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/22x22/status/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/22x22/status/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/24x24/status/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/24x24/status/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/24x24/status/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/24x24/status/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/32x32/status/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/32x32/status/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/32x32/status/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/32x32/status/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/48x48/status/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/48x48/status/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/hicolor/48x48/status/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/hicolor/48x48/status/caffeine-cup-full.png differ diff -Nru caffeine-2.8.3/share/icons/hicolor/scalable/status/caffeine-cup-empty.svg caffeine-2.9.4/share/icons/hicolor/scalable/status/caffeine-cup-empty.svg --- caffeine-2.8.3/share/icons/hicolor/scalable/status/caffeine-cup-empty.svg 2015-01-05 21:27:15.000000000 +0000 +++ caffeine-2.9.4/share/icons/hicolor/scalable/status/caffeine-cup-empty.svg 2017-01-16 12:59:02.000000000 +0000 @@ -46,9 +46,9 @@ showgrid="false" showguides="false" inkscape:guide-bbox="true" - inkscape:zoom="2.8284271" - inkscape:cx="-34.921692" - inkscape:cy="-24.096221" + inkscape:zoom="5.6568542" + inkscape:cx="5.8904435" + inkscape:cy="11.472705" inkscape:window-x="0" inkscape:window-y="24" inkscape:window-maximized="1" @@ -139,12 +139,12 @@ sodipodi:type="inkscape:persp3d" /> + style="opacity:0.6;fill:#3a3935;fill-opacity:1;stroke:none" + d="m 1.03125,8.7382814 c 0,6.0624996 0.0625,11.4999996 8.4375,11.4999996 6.974045,0 8.117352,-3.694702 8.3125,-8.5 2.019425,-0.0018 3.1875,-0.06004 3.1875,-0.5625 l 0,-1.125 c 0,-0.6035306 -1.343015,-0.5624996 -3.125,-0.5624996 5.81e-4,-0.250971 0,-0.495767 0,-0.75 l -16.8125,0 z" + id="path4168" /> diff -Nru caffeine-2.8.3/share/icons/hicolor/scalable/status/caffeine-cup-full.svg caffeine-2.9.4/share/icons/hicolor/scalable/status/caffeine-cup-full.svg --- caffeine-2.8.3/share/icons/hicolor/scalable/status/caffeine-cup-full.svg 2015-01-05 21:27:15.000000000 +0000 +++ caffeine-2.9.4/share/icons/hicolor/scalable/status/caffeine-cup-full.svg 2017-01-16 12:59:02.000000000 +0000 @@ -16,7 +16,7 @@ id="svg2816" style="display:inline" inkscape:version="0.47 r22583" - sodipodi:docname="empty_cup.svg" + sodipodi:docname="full_cup.svg" inkscape:export-filename="/home/nevon/Desktop/ubuntu_mono_light/32x32/empty_cup.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> @@ -47,9 +47,9 @@ showgrid="false" showguides="false" inkscape:guide-bbox="true" - inkscape:zoom="2.8284271" - inkscape:cx="-34.921692" - inkscape:cy="-24.096221" + inkscape:zoom="2" + inkscape:cx="16.867797" + inkscape:cy="-19.11988" inkscape:window-x="0" inkscape:window-y="24" inkscape:window-maximized="1" @@ -150,28 +150,43 @@ sodipodi:type="inkscape:persp3d" /> + id="g4166" + transform="translate(-1,-0.99999963)"> - + id="path4168" + d="m 2.03125,9.738281 c 0,6.0625 0.0625,11.5 8.4375,11.5 6.974045,0 8.117352,-3.694702 8.3125,-8.5 2.019425,-0.0018 3.1875,-0.06004 3.1875,-0.5625 l 0,-1.125 c 0,-0.603531 -1.343015,-0.5625 -3.125,-0.5625 5.81e-4,-0.250971 0,-0.495767 0,-0.75 l -16.8125,0 z" + style="opacity:0.6;fill:#3a3935;fill-opacity:1;stroke:none" /> - - + style="fill:#eae3d0;fill-opacity:1;stroke:none" + d="m 2.69417,10.445387 c 0,3.808647 -0.622517,9.842719 7.752483,9.842719 6.974045,0 7.321857,-3.274857 7.517005,-8.080155 2.019425,-0.0018 3.364277,0.249317 3.364277,-0.253141 l 0.0221,-0.638864 c 0,-0.603531 -1.497695,-0.319432 -3.27968,-0.319432 5.81e-4,-0.250971 4e-6,-0.296894 4e-6,-0.551127 l -15.376189,0 z" + id="path4170" /> + + + + + + Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/16/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/16/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/16/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/16/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/22/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/22/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/22/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/22/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/24/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/24/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/24/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/24/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/32/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/32/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/32/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/32/caffeine-cup-full.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/48/caffeine-cup-empty.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/48/caffeine-cup-empty.png differ Binary files /tmp/tmpGRieha/myUdo1wF7o/caffeine-2.8.3/share/icons/ubuntu-mono-light/status/48/caffeine-cup-full.png and /tmp/tmpGRieha/b2kepwJ_0O/caffeine-2.9.4/share/icons/ubuntu-mono-light/status/48/caffeine-cup-full.png differ diff -Nru caffeine-2.8.3/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-empty.svg caffeine-2.9.4/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-empty.svg --- caffeine-2.8.3/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-empty.svg 1970-01-01 00:00:00.000000000 +0000 +++ caffeine-2.9.4/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-empty.svg 2017-01-16 12:59:02.000000000 +0000 @@ -0,0 +1,150 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru caffeine-2.8.3/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-full.svg caffeine-2.9.4/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-full.svg --- caffeine-2.8.3/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-full.svg 1970-01-01 00:00:00.000000000 +0000 +++ caffeine-2.9.4/share/icons/ubuntu-mono-light/status/scalable/caffeine-cup-full.svg 2017-01-16 12:59:02.000000000 +0000 @@ -0,0 +1,177 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru caffeine-2.8.3/translations/caffeine-indicator.pot caffeine-2.9.4/translations/caffeine-indicator.pot --- caffeine-2.8.3/translations/caffeine-indicator.pot 2015-01-20 01:08:22.000000000 +0000 +++ caffeine-2.9.4/translations/caffeine-indicator.pot 2017-01-16 13:06:22.000000000 +0000 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-01-20 01:08+0000\n" +"POT-Creation-Date: 2017-01-16 13:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,22 +17,22 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: caffeine-indicator:71 +#: caffeine-indicator:73 msgid "Activate" msgstr "" -#: caffeine-indicator:71 +#: caffeine-indicator:73 msgid "Deactivate" msgstr "" -#: caffeine-indicator:94 +#: caffeine-indicator:96 msgid "translator-credits" msgstr "" -#: caffeine-indicator:135 +#: caffeine-indicator:144 msgid " is inhibiting desktop idleness" msgstr "" -#: caffeine-indicator:147 +#: caffeine-indicator:156 msgid " is inactive" msgstr "" diff -Nru caffeine-2.8.3/VERSION caffeine-2.9.4/VERSION --- caffeine-2.8.3/VERSION 2015-01-20 01:06:46.000000000 +0000 +++ caffeine-2.9.4/VERSION 2017-01-16 13:04:41.000000000 +0000 @@ -1 +1 @@ -2.8.3 \ No newline at end of file +2.9.4 \ No newline at end of file