From e52f0e4bc37c98ab2f838de8316581b80ec3725a Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 11 May 2022 20:55:42 +0200 Subject: [PATCH] Revert "xss-dimmer: play a sound to notice dimmer when not looking at the screen" This reverts commit 398ef9263b8a0005cc506bd6f22a343e66078bdb. pygame intercepts SIGTERM. Maybe we could use Gstreamer instead. No time for that, let just remove this feature for now. --- bin/xss-dimmer | 23 +---------------------- dotfiles/systemd/xss-dimmer@.service | 3 +-- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/bin/xss-dimmer b/bin/xss-dimmer index 4f68952..c105514 100755 --- a/bin/xss-dimmer +++ b/bin/xss-dimmer @@ -17,17 +17,10 @@ import argparse import threading import time import math -import os from Xlib import display, X from Xlib.error import BadWindow from Xlib.protocol.event import MapNotify -try: - os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "hide" - import pygame -except ImportError: - pygame = None - def on_xevent(source, condition, xdisplay, locker): while xdisplay.pending_events(): @@ -96,17 +89,7 @@ def on_refresh(window, options, start): elapsed = time.monotonic() - start if elapsed < options.delay: next_step = min(options.step, options.delay - elapsed) - GLib.timeout_add(next_step * 1000, on_refresh, window, options, start) - - -def on_sound_ticker(options, sound, start): - elapsed = time.monotonic() - start - if elapsed < options.delay: - if sound is None: - pygame.mixer.init() - sound = pygame.mixer.Sound(options.sound) - sound.play() - GLib.timeout_add(1000, on_sound_ticker, options, sound, now) + GLib.timeout_add(options.step * 1000, on_refresh, window, options, start) # See: https://easings.net/ @@ -161,7 +144,6 @@ if __name__ == "__main__": choices=easing_functions.keys(), help="easing function for opacity", ) - add("--sound", help="play a sound for each second elapsed while dimmer running") options = parser.parse_args() background = None @@ -210,8 +192,5 @@ if __name__ == "__main__": ) xdisplay.pending_events() # otherwise, socket is inactive - if options.sound and pygame: - GLib.timeout_add(5000, on_sound_ticker, options, None, now) - # Main loop Gtk.main() diff --git a/dotfiles/systemd/xss-dimmer@.service b/dotfiles/systemd/xss-dimmer@.service index a3de649..59d2b44 100644 --- a/dotfiles/systemd/xss-dimmer@.service +++ b/dotfiles/systemd/xss-dimmer@.service @@ -3,5 +3,4 @@ Description=Screen dimmer [Service] ExecStart=%h/.config/i3/bin/xss-dimmer --delay=%i \ - --background=%t/i3/current-wallpaper.png \ - --sound=/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga + --background=%t/i3/current-wallpaper.png