statnot-config.py (1497B)
1 # Default time a notification is show, unless specified in notification 2 DEFAULT_NOTIFY_TIMEOUT = 5000 # milliseconds 3 4 # Maximum time a notification is allowed to show 5 MAX_NOTIFY_TIMEOUT = 5000 # milliseconds 6 7 # Maximum number of characters in a notification. 8 NOTIFICATION_MAX_LENGTH = 250 # number of characters 9 10 # Time between regular status updates 11 STATUS_UPDATE_INTERVAL = 999.0 # seconds 12 13 # Command to fetch status text from. We read from stdout. 14 # Each argument must be an element in the array 15 # os must be imported to use os.getenv 16 import os 17 STATUS_COMMAND = ['/bin/sh', '%s/.dwm/statnot/title.sh' % os.getenv('HOME')] 18 19 # Always show text from STATUS_COMMAND? If false, only show notifications 20 USE_STATUSTEXT=True 21 22 # Put incoming notifications in a queue, so each one is shown. 23 # If false, the most recent notification is shown directly. 24 QUEUE_NOTIFICATIONS=False 25 26 # update_text(text) is called when the status text should be updated 27 # If there is a pending notification to be formatted, it is appended as 28 # the final argument to the STATUS_COMMAND, e.g. as $1 in default shellscript 29 30 # dwm titlebar update 31 import subprocess 32 def update_text(text): 33 # Get first line 34 first_line = text.splitlines()[0].decode("utf-8") if text else '' 35 #subprocess.call(["xsetroot", "-name", "title:" + first_line]) 36 subprocess.call(["xsetroot", "-name", "title:" + first_line]) 37 if first_line != "": 38 with open("/tmp/notification-list", "a") as f: 39 f.write(first_line + "\n")