From 48ad841f56bb73da2734f571507ece7848615e61 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Wed, 3 Mar 2021 22:47:20 -0700 Subject: DELETE i3GAPS BLOCKS that I forgot, slightly changes to blog management tools --- .local/bin/blocks/dunst | 59 ------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100755 .local/bin/blocks/dunst (limited to '.local/bin/blocks/dunst') diff --git a/.local/bin/blocks/dunst b/.local/bin/blocks/dunst deleted file mode 100755 index 6f7ab0c..0000000 --- a/.local/bin/blocks/dunst +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/python -""" -A do-not-disturb button for muting Dunst notifications in i3 using i3blocks -Mute is handled by passing 'DUNST_COMMAND_PAUSE' and 'DUNST_COMMAND_RESUME' to -the notify-send script and the 'DUNST_MUTE' environment variable is set to keep -track of the toggle. -""" -import os -import subprocess -import json - - -def mute_on(): - '''Turns off dunst notifications''' - subprocess.run(["notify-send", "DUNST_COMMAND_PAUSE"], check=True) - return { - "full_text":"\uf1f6", - "DUNST_MUTE":"on" - } - - -def mute_off(): - '''Turns back on dunst notifications''' - subprocess.run(["notify-send", "DUNST_COMMAND_RESUME"], check=True) - return { - "full_text":"\uf0f3", - "DUNST_MUTE":"off" - } - - -def clicked(): - '''Returns True if the button was clicked''' - button = "BLOCK_BUTTON" in os.environ and os.environ["BLOCK_BUTTON"] - return bool(button) - - -def muted(): - '''Returns True if Dunst is muted''' - mute = "DUNST_MUTE" in os.environ and os.environ["DUNST_MUTE"] - return mute == 'on' - - -if clicked(): - # toggle button click to turn mute on and off - if muted(): - RTN = mute_off() - else: - RTN = mute_on() - - -else: - # Set default state using 'DUNST_MUTE' environment variable - if muted(): - RTN = mute_on() - else: - RTN = mute_off() - - -print(json.dumps(RTN)) -- cgit v1.2.3-54-g00ecf