Switching from dunst to qtile's notifications in the status bar.

This commit is contained in:
Bartek Stalewski 2022-10-18 17:13:21 +02:00
parent 0f49c1f23b
commit b45a8b3c70
5 changed files with 17 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
**/autostart.sh
**/btop.log
**/.netrwhist
**/__pycache__

View File

@ -28,7 +28,7 @@ set_input() {
set_bt_profile() {
bt_sink=$(pactl list cards | awk -F'"' '/device.name.*bluez/ {print $2}')
[ -z "${bt_sink}" ] &&
{ dunstify -u critical "🎧 no headphones connected"; exit; }
{ notify-send -t 1000 "ﳌ no headphones connected"; exit; }
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | dmenu -c -l 5 -i)
case "$profile_chosen" in
back) show_current ;;
@ -47,7 +47,7 @@ show_current() {
chosen=$(printf "Output: $def_snk\\nInput: $def_src" | dmenu -c -l 2)
if [ "$1" = "no_switch" ]; then
case "$chosen" in
*) dunstify -u critical "🔊 no device to switch" ;;
*) notify-send -t 1000 -t 1000 "婢 no device to switch" ;;
esac
else
case "$chosen" in

View File

@ -40,8 +40,6 @@ onescreen() {
postrun() {
feh --no-fehbg --bg-scale ~/.local/share/wallpaper.jpg
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
#kill -46 $(pidof dwmblocks)
}
# Get all possible displays
@ -52,7 +50,7 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
{ onescreen "$screens" "native"; postrun; dunstify -u critical "💻 no device to switch"; exit ;}
{ onescreen "$screens" "native"; postrun; notify-send -t 1000 ' no device to switch'; exit ;}
# Get user choice including both and manual selection:
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") &&

View File

@ -1,12 +1,13 @@
#!/bin/bash
icon='\uf028'
if [ $1 ]; then
case $1 in
inc) pactl set-sink-volume @DEFAULT_SINK@ +5%;;
dec) pactl set-sink-volume @DEFAULT_SINK@ -5%;;
esac
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
dunstify -h int:value:$volume -r 20 -t 800 "volume: $volume"
notify-send -t 1000 " volume: $volume"
else
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micmute="<span foreground='#ffffff' background='#770000'> \uf131 </span> " || micmute=""

View File

@ -1,3 +1,4 @@
import os
import psutil
import subprocess
from libqtile import bar, extension, hook, layout, widget
@ -5,6 +6,11 @@ from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad
from libqtile.dgroups import simple_key_binder
from libqtile.lazy import lazy
@hook.subscribe.startup_once
def autostart():
home = os.path.expanduser('~/.config/qtile/autostart.sh')
subprocess.Popen([home])
groups = [
Group("1", label="\uf292"),
Group("2", label="\uf738", matches=[Match(wm_class=["firefox"])]),
@ -122,6 +128,11 @@ screens = [
record_history=False,
),
widget.Spacer(),
widget.Notify(
default_timeout=5,
background="#e8b923",
foreground="#000000",
),
widget.GenPollText(
update_interval=1,
func=lambda: subprocess.check_output("sb-mail").decode(),