Skip to content

Commit

Permalink
Merge pull request vivien#467 from jolange/dunst
Browse files Browse the repository at this point in the history
dunst: use check_output
  • Loading branch information
jolange authored Oct 3, 2022
2 parents 76d63a2 + 9a54f38 commit aad4d45
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions dunst/dunst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ __license__ = "MIT"
__version__ = "1.1.0"

import os
import subprocess
import subprocess as sp
import json

def mute_toggle():
'''Toggle dunst notifications'''
subprocess.run(["dunstctl", "set-paused", "toggle"], check=True)
sp.run(["dunstctl", "set-paused", "toggle"], check=True)

def clicked():
'''Returns True if the button was clicked'''
Expand All @@ -25,9 +25,7 @@ def clicked():

def muted():
'''Returns True if Dunst is muted'''
cmd = ['dunstctl', 'is-paused']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
output = proc.communicate()[0]
output = sp.check_output(('dunstctl', 'is-paused'))
return u'true' == output.strip().decode("UTF-8")

if clicked():
Expand Down

0 comments on commit aad4d45

Please sign in to comment.