From 8cb8e431d3a54ca056dd3074ef286361a2dd9c87 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 12 Feb 2023 21:58:56 +0000 Subject: bin/Xsession: drop brightness_monitor It does not work as it needs a notification daemon to be running when the script is started, which is not true at that point in xsession. This will be handled in the window manager instead. --- bin/brightness_monitor | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100755 bin/brightness_monitor (limited to 'bin') diff --git a/bin/brightness_monitor b/bin/brightness_monitor deleted file mode 100755 index a8617e0..0000000 --- a/bin/brightness_monitor +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/python3 - -import notify2 -import os -import subprocess -import sys - -if len(sys.argv) < 2: - sys.stdout.write('Usage: %s /sys/...//\n') - sys.exit(0) - -path = sys.argv[1] - -with open(os.path.join(path, 'max_brightness'), 'r') as f: - brightness_max = float(f.read().strip()) - -notify2.init(os.path.basename(sys.argv[0])) - -notification = notify2.Notification('Brightness') - -inotify_cmd = ['inotifywait', '--monitor', '--event=close_write', - os.path.join(path, 'brightness')] - -child = subprocess.Popen(inotify_cmd, stdout = subprocess.PIPE, bufsize = 0) - -while True: - # wait for updates - child.stdout.read(4096) - if child.poll() is not None: - notification.message = 'inotify monitor has terminated' - notification.set_urgency(notify2.URGENCY_CRITICAL) - notification.show() - sys.stderr.write(notification.message + '\n') - break - - with open(os.path.join(path, 'brightness'), 'r') as f: - brightness = float(f.read().strip()) - - notification.message = '%d%%' % (100 * brightness / brightness_max) - notification.show() -- cgit v1.2.3