mirror of
https://github.com/bvanroll/_dotfiles.git
synced 2025-08-29 20:12:42 +00:00
init
This commit is contained in:
21
.config/i3blocks/dunst/LICENSE
Normal file
21
.config/i3blocks/dunst/LICENSE
Normal 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.
|
32
.config/i3blocks/dunst/README.md
Normal file
32
.config/i3blocks/dunst/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# dunst
|
||||
|
||||
Creates a do-not-disturb button for muting [dunst](https://dunst-project.org/) notifications.
|
||||
|
||||

|
||||
|
||||
|
||||
# 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
40
.config/i3blocks/dunst/dunst
Executable 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))
|
BIN
.config/i3blocks/dunst/dunst.gif
Normal file
BIN
.config/i3blocks/dunst/dunst.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
9
.config/i3blocks/dunst/i3blocks.conf
Normal file
9
.config/i3blocks/dunst/i3blocks.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
[dunst]
|
||||
command=$SCRIPT_DIR/dunst
|
||||
markup=pango
|
||||
interval=once
|
||||
format=json
|
||||
#min_width=50
|
||||
#align=center
|
||||
#DUNST_MUTE=off
|
||||
|
Reference in New Issue
Block a user