This commit is contained in:
2024-06-12 13:49:42 +02:00
commit b8e15ff09c
390 changed files with 37206 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Jessey White-Cinis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,32 @@
# dunst
Creates a do-not-disturb button for muting [dunst](https://dunst-project.org/) notifications.
![](dunst.gif)
# Dependencies
- [dunst](https://dunst-project.org/)
- [Font Awesome](https://fontawesome.com) for the [bell](https://fontawesome.com/icons/bell?style=solid) and [bell-slash](https://fontawesome.com/icons/bell-slash?style=solid) icons
# Usage
Clicking the bell icon will toggle dunst notifications from being displayed.
This is accomplished using the `dunstctl` command.
# Config
```INI
[dunst]
command=$SCRIPT_DIR/dunst
interval=once
format=json
markup=pango
#min_width=50
#align=center
```

40
.config/i3blocks/dunst/dunst Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""
A do-not-disturb button for muting Dunst notifications in i3 using i3blocks
Mute is handled using the `dunstctl` command.
"""
__author__ = "Jessey White-Cinis <j@cin.is>"
__copyright__ = "Copyright (c) 2019 Jessey White-Cinis"
__license__ = "MIT"
__version__ = "1.1.0"
import os
import subprocess as sp
import json
def mute_toggle():
'''Toggle dunst notifications'''
sp.run(["dunstctl", "set-paused", "toggle"], check=True)
def clicked():
'''Returns True if the button was clicked'''
button = os.environ.get("BLOCK_BUTTON", None)
return bool(button)
def muted():
'''Returns True if Dunst is muted'''
output = sp.check_output(('dunstctl', 'is-paused'))
return u'true' == output.strip().decode("UTF-8")
if clicked():
# toggle button click to turn mute on and off
mute_toggle()
if muted():
RTN = {"full_text":"<span font='Font Awesome 5 Free Solid' color='#BE616E'>\uf1f6</span>"}
else:
RTN = {"full_text":"<span font='Font Awesome 5 Free Solid' color='#A4B98E'>\uf0f3</span>"}
print(json.dumps(RTN))

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,9 @@
[dunst]
command=$SCRIPT_DIR/dunst
markup=pango
interval=once
format=json
#min_width=50
#align=center
#DUNST_MUTE=off