mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-25 00:38:23 -05:00
dunst: 1.6.0 config, now works natively on Wayland
This commit is contained in:
parent
452b6aa9e8
commit
ae689b3c15
@ -21,8 +21,9 @@
|
|||||||
- `setup/` directory contains installers for additional packages.
|
- `setup/` directory contains installers for additional packages.
|
||||||
- Stuff I use:
|
- Stuff I use:
|
||||||
- **Text editor:** [Emacs](http://www.gnu.org/software/emacs/) + [Neovim](https://github.com/neovim/neovim)
|
- **Text editor:** [Emacs](http://www.gnu.org/software/emacs/) + [Neovim](https://github.com/neovim/neovim)
|
||||||
- **Fonts:** [Sarasa Gothic](https://github.com/be5invis/Sarasa-Gothic), [Iosevka Nerd Font](https://github.com/ryanoasis/nerd-fonts)
|
- **Fonts:** [Sarasa Gothic](https://github.com/be5invis/Sarasa-Gothic), [Iosevka Nerd Font](https://github.com/ryanoasis/nerd-fonts), [Iosevka](https://github.com/be5invis/Iosevka)
|
||||||
- **Backlight control:** [light](https://github.com/haikarainen/light) / [brightnessctl](https://github.com/Hummer12007/brightnessctl)
|
- **Backlight control:** [light](https://github.com/haikarainen/light) / [brightnessctl](https://github.com/Hummer12007/brightnessctl)
|
||||||
|
- **Notification daemon:** [mako](https://github.com/emersion/mako) / [dunst](https://github.com/dunst-project/dunst)
|
||||||
- **Clipboard manager:** [greenclip](https://github.com/erebe/greenclip) / [clipman](https://github.com/yory8/clipman)
|
- **Clipboard manager:** [greenclip](https://github.com/erebe/greenclip) / [clipman](https://github.com/yory8/clipman)
|
||||||
- **Mixer:** [pulsemixer](https://github.com/GeorgeFilipkin/pulsemixer)
|
- **Mixer:** [pulsemixer](https://github.com/GeorgeFilipkin/pulsemixer)
|
||||||
- **mpris:** [mpDris2](https://github.com/eonpatapon/mpDris2), [mpv-mpris](https://github.com/hoyon/mpv-mpris), [playerctl](https://github.com/altdesktop/playerctl)
|
- **mpris:** [mpDris2](https://github.com/eonpatapon/mpDris2), [mpv-mpris](https://github.com/hoyon/mpv-mpris), [playerctl](https://github.com/altdesktop/playerctl)
|
||||||
|
@ -43,7 +43,13 @@ case ${server} in
|
|||||||
wayland)
|
wayland)
|
||||||
cp -rfv ./home/.config/foot/ ~/.config/foot/
|
cp -rfv ./home/.config/foot/ ~/.config/foot/
|
||||||
cp -rfv ./home/.config/hikari/ ~/.config/hikari/
|
cp -rfv ./home/.config/hikari/ ~/.config/hikari/
|
||||||
|
# Dunst is Wayland native too, since 1.6.0
|
||||||
|
if command -v dunst >/dev/null
|
||||||
|
then
|
||||||
|
cp -rfv ./home/.config/dunst/ ~/.config/dunst/
|
||||||
|
else
|
||||||
cp -rfv ./home/.config/mako/ ~/.config/mako/
|
cp -rfv ./home/.config/mako/ ~/.config/mako/
|
||||||
|
fi
|
||||||
cp -rfv ./home/.config/nwg-launchers/ ~/.config/nwg-launchers/
|
cp -rfv ./home/.config/nwg-launchers/ ~/.config/nwg-launchers/
|
||||||
cp -rfv ./home/.config/river/ ~/.config/river/
|
cp -rfv ./home/.config/river/ ~/.config/river/
|
||||||
cp -rfv ./home/.config/sway/ ~/.config/sway/
|
cp -rfv ./home/.config/sway/ ~/.config/sway/
|
||||||
|
@ -304,15 +304,12 @@
|
|||||||
(desktop-environment-screenlock-command "~/.local/bin/X11/i3lock.sh"))
|
(desktop-environment-screenlock-command "~/.local/bin/X11/i3lock.sh"))
|
||||||
|
|
||||||
;; Control dunst
|
;; Control dunst
|
||||||
(defun disable-desktop-notifications ()
|
(defun close-desktop-notifications ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_PAUSE\""))
|
(start-process-shell-command "dunstctl" nil "dunstctl close-all"))
|
||||||
(defun enable-desktop-notifications ()
|
|
||||||
(interactive)
|
|
||||||
(start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_RESUME\""))
|
|
||||||
(defun toggle-desktop-notifications ()
|
(defun toggle-desktop-notifications ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_TOGGLE\""))
|
(start-process-shell-command "dunstctl" nil "dunstctl set-paused toggle"))
|
||||||
|
|
||||||
;; Clipboard managing with greenclip
|
;; Clipboard managing with greenclip
|
||||||
(defun ivy-greenclip ()
|
(defun ivy-greenclip ()
|
||||||
|
@ -29,7 +29,24 @@
|
|||||||
# the top and down respectively.
|
# the top and down respectively.
|
||||||
# The width can be negative. In this case the actual width is the
|
# The width can be negative. In this case the actual width is the
|
||||||
# screen width minus the width defined in within the geometry option.
|
# screen width minus the width defined in within the geometry option.
|
||||||
geometry = "0x0-5+30"
|
geometry = "0x5-5+30"
|
||||||
|
|
||||||
|
# Turn on the progess bar
|
||||||
|
progress_bar = true
|
||||||
|
|
||||||
|
# Set the progress bar height. This includes the frame, so make sure
|
||||||
|
# it's at least twice as big as the frame width.
|
||||||
|
progress_bar_height = 10
|
||||||
|
|
||||||
|
# Set the frame width of the progress bar
|
||||||
|
progress_bar_frame_width = 1
|
||||||
|
|
||||||
|
# Set the minimum width for the progress bar
|
||||||
|
progress_bar_min_width = 150
|
||||||
|
|
||||||
|
# Set the maximum width for the progress bar
|
||||||
|
progress_bar_max_width = 300
|
||||||
|
|
||||||
|
|
||||||
# Show how many messages are currently hidden (because of geometry).
|
# Show how many messages are currently hidden (because of geometry).
|
||||||
indicate_hidden = yes
|
indicate_hidden = yes
|
||||||
@ -41,7 +58,7 @@
|
|||||||
# The transparency of the window. Range: [0; 100].
|
# The transparency of the window. Range: [0; 100].
|
||||||
# This option will only work if a compositing window manager is
|
# This option will only work if a compositing window manager is
|
||||||
# present (e.g. xcompmgr, compiz, etc.).
|
# present (e.g. xcompmgr, compiz, etc.).
|
||||||
transparency = 5
|
transparency = 0
|
||||||
|
|
||||||
# The height of the entire notification. If the height is smaller
|
# The height of the entire notification. If the height is smaller
|
||||||
# than the font height and padding combined, it will be raised
|
# than the font height and padding combined, it will be raised
|
||||||
@ -59,6 +76,9 @@
|
|||||||
# Horizontal padding.
|
# Horizontal padding.
|
||||||
horizontal_padding = 8
|
horizontal_padding = 8
|
||||||
|
|
||||||
|
# Padding between text and icon.
|
||||||
|
text_icon_padding = 2
|
||||||
|
|
||||||
# Defines width in pixels of frame around the notification window.
|
# Defines width in pixels of frame around the notification window.
|
||||||
# Set to 0 to disable.
|
# Set to 0 to disable.
|
||||||
frame_width = 2
|
frame_width = 2
|
||||||
@ -102,7 +122,7 @@
|
|||||||
# <u>underline</u>
|
# <u>underline</u>
|
||||||
#
|
#
|
||||||
# For a complete reference see
|
# For a complete reference see
|
||||||
# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
|
# <https://developer.gnome.org/pango/stable/pango-Markup.html>.
|
||||||
#
|
#
|
||||||
# strip: This setting is provided for compatibility with some broken
|
# strip: This setting is provided for compatibility with some broken
|
||||||
# clients that send markup even though it's not enabled on the
|
# clients that send markup even though it's not enabled on the
|
||||||
@ -134,6 +154,10 @@
|
|||||||
# Possible values are "left", "center" and "right".
|
# Possible values are "left", "center" and "right".
|
||||||
alignment = center
|
alignment = center
|
||||||
|
|
||||||
|
# Vertical alignment of message text and icon.
|
||||||
|
# Possible values are "top", "center" and "bottom".
|
||||||
|
vertical_alignment = center
|
||||||
|
|
||||||
# Show age of message if message is older than show_age_threshold
|
# Show age of message if message is older than show_age_threshold
|
||||||
# seconds.
|
# seconds.
|
||||||
# Set to -1 to disable.
|
# Set to -1 to disable.
|
||||||
@ -164,6 +188,11 @@
|
|||||||
# Align icons left/right/off
|
# Align icons left/right/off
|
||||||
icon_position = left
|
icon_position = left
|
||||||
|
|
||||||
|
# Scale small icons up to this size, set to 0 to disable. Helpful
|
||||||
|
# for e.g. small files or high-dpi screens. In case of conflict,
|
||||||
|
# max_icon_size takes precedence over this.
|
||||||
|
min_icon_size = 0
|
||||||
|
|
||||||
# Scale larger icons down to this size, set to 0 to disable
|
# Scale larger icons down to this size, set to 0 to disable
|
||||||
max_icon_size = 64
|
max_icon_size = 64
|
||||||
|
|
||||||
@ -177,7 +206,7 @@
|
|||||||
sticky_history = yes
|
sticky_history = yes
|
||||||
|
|
||||||
# Maximum amount of notifications kept in history
|
# Maximum amount of notifications kept in history
|
||||||
history_length = 7
|
history_length = 20
|
||||||
|
|
||||||
### Misc/Advanced ###
|
### Misc/Advanced ###
|
||||||
|
|
||||||
@ -217,6 +246,22 @@
|
|||||||
# notification height to avoid clipping text and/or icons.
|
# notification height to avoid clipping text and/or icons.
|
||||||
corner_radius = 10
|
corner_radius = 10
|
||||||
|
|
||||||
|
# Ignore the dbus closeNotification message.
|
||||||
|
# Useful to enforce the timeout set by dunst configuration. Without this
|
||||||
|
# parameter, an application may close the notification sent before the
|
||||||
|
# user defined timeout.
|
||||||
|
ignore_dbusclose = false
|
||||||
|
|
||||||
|
### Wayland ###
|
||||||
|
# These settings are Wayland-specific. They have no effect when using X11
|
||||||
|
|
||||||
|
# Uncomment this if you want to let notications appear under fullscreen
|
||||||
|
# applications (default: overlay)
|
||||||
|
# layer = top
|
||||||
|
|
||||||
|
# Set this to true to use X11 output on Wayland.
|
||||||
|
force_xwayland = false
|
||||||
|
|
||||||
### Legacy
|
### Legacy
|
||||||
|
|
||||||
# Use the Xinerama extension instead of RandR for multi-monitor support.
|
# Use the Xinerama extension instead of RandR for multi-monitor support.
|
||||||
@ -231,13 +276,15 @@
|
|||||||
|
|
||||||
### mouse
|
### mouse
|
||||||
|
|
||||||
# Defines action of mouse event
|
# Defines list of actions for each mouse event
|
||||||
# Possible values are:
|
# Possible values are:
|
||||||
# * none: Don't do anything.
|
# * none: Don't do anything.
|
||||||
# * do_action: If the notification has exactly one action, or one is marked as default,
|
# * do_action: If the notification has exactly one action, or one is marked as default,
|
||||||
# invoke it. If there are multiple and no default, open the context menu.
|
# invoke it. If there are multiple and no default, open the context menu.
|
||||||
# * close_current: Close current notification.
|
# * close_current: Close current notification.
|
||||||
# * close_all: Close all notifications.
|
# * close_all: Close all notifications.
|
||||||
|
# These values can be strung together for each mouse event, and
|
||||||
|
# will be executed in sequence.
|
||||||
mouse_left_click = do_action
|
mouse_left_click = do_action
|
||||||
mouse_middle_click = close_all
|
mouse_middle_click = close_all
|
||||||
mouse_right_click = close_current
|
mouse_right_click = close_current
|
||||||
@ -252,6 +299,10 @@
|
|||||||
# where there are multiple screens with very different dpi values.
|
# where there are multiple screens with very different dpi values.
|
||||||
per_monitor_dpi = false
|
per_monitor_dpi = false
|
||||||
|
|
||||||
|
# The internal keyboard shortcut support in dunst is now considered deprecated
|
||||||
|
# and should be replaced by dunstctl calls. You can use the configuration of your
|
||||||
|
# WM or DE to bind these to shortcuts of your choice.
|
||||||
|
# Check the dunstctl manual page for more info.
|
||||||
[shortcuts]
|
[shortcuts]
|
||||||
|
|
||||||
# Shortcuts are specified as [modifier+][modifier+]...key
|
# Shortcuts are specified as [modifier+][modifier+]...key
|
||||||
@ -259,20 +310,21 @@
|
|||||||
# "mod3" and "mod4" (windows-key).
|
# "mod3" and "mod4" (windows-key).
|
||||||
# Xev might be helpful to find names for keys.
|
# Xev might be helpful to find names for keys.
|
||||||
|
|
||||||
# Close notification.
|
# Close notification. Equivalent dunstctl command:
|
||||||
close = ctrl+space
|
# dunstctl close
|
||||||
|
# close = ctrl+space
|
||||||
|
|
||||||
# Close all notifications.
|
# Close all notifications. Equivalent dunstctl command:
|
||||||
close_all = ctrl+shift+space
|
# dunstctl close-all
|
||||||
|
# close_all = ctrl+shift+space
|
||||||
|
|
||||||
# Redisplay last message(s).
|
# Redisplay last message(s). Equivalent dunstctl command:
|
||||||
# On the US keyboard layout "grave" is normally above TAB and left
|
# dunstctl history-pop
|
||||||
# of "1". Make sure this key actually exists on your keyboard layout,
|
# history = ctrl+grave
|
||||||
# e.g. check output of 'xmodmap -pke'
|
|
||||||
history = ctrl+grave
|
|
||||||
|
|
||||||
# Context menu.
|
# Context menu. Equivalent dunstctl command:
|
||||||
context = ctrl+shift+period
|
# dunstctl context
|
||||||
|
# context = ctrl+shift+period
|
||||||
|
|
||||||
[urgency_low]
|
[urgency_low]
|
||||||
# IMPORTANT: colors have to be defined in quotation marks.
|
# IMPORTANT: colors have to be defined in quotation marks.
|
||||||
|
@ -9,7 +9,7 @@ gsettings set org.gnome.desktop.interface cursor-size '24'
|
|||||||
# Autostart
|
# Autostart
|
||||||
pipewire &
|
pipewire &
|
||||||
mpd &
|
mpd &
|
||||||
mako -c ~/.config/mako/config &
|
start_notify &
|
||||||
wl-paste -t text --watch clipman store &
|
wl-paste -t text --watch clipman store &
|
||||||
waybar -c ~/.config/waybar/config-generic -s ~/.config/waybar/style-generic.css &
|
waybar -c ~/.config/waybar/config-generic -s ~/.config/waybar/style-generic.css &
|
||||||
mpDris2 &
|
mpDris2 &
|
||||||
|
@ -8,7 +8,7 @@ riverctl spawn 'wlr-randr --output DP-2 --mode 1920x1080@60.000000Hz --pos -1920
|
|||||||
|
|
||||||
riverctl spawn 'pipewire'
|
riverctl spawn 'pipewire'
|
||||||
riverctl spawn 'mpd'
|
riverctl spawn 'mpd'
|
||||||
riverctl spawn 'mako -c ~/.config/mako/config'
|
riverctl spawn 'start_notify'
|
||||||
riverctl spawn 'wl-paste -t text --watch clipman store'
|
riverctl spawn 'wl-paste -t text --watch clipman store'
|
||||||
riverctl spawn 'waybar'
|
riverctl spawn 'waybar'
|
||||||
riverctl spawn 'swayidle -w before-sleep swaylock'
|
riverctl spawn 'swayidle -w before-sleep swaylock'
|
||||||
@ -68,7 +68,7 @@ riverctl map normal $mod+Mod1 C spawn clipboard --clear
|
|||||||
riverctl map normal $mod C spawn clipman clear --tool wofi
|
riverctl map normal $mod C spawn clipman clear --tool wofi
|
||||||
|
|
||||||
# Dismiss notifications
|
# Dismiss notifications
|
||||||
riverctl map normal $mod+Mod1 N spawn makoctl dismiss --all
|
riverctl map normal $mod+Mod1 N spawn dismiss_notify
|
||||||
|
|
||||||
# Emacs
|
# Emacs
|
||||||
riverctl map normal $mod+Mod1 E spawn emacsclient -c -a emacs
|
riverctl map normal $mod+Mod1 E spawn emacsclient -c -a emacs
|
||||||
|
@ -80,7 +80,7 @@ input * xkb_numlock enable
|
|||||||
#
|
#
|
||||||
exec pipewire
|
exec pipewire
|
||||||
exec mpd
|
exec mpd
|
||||||
exec mako -c ~/.config/mako/config
|
exec start_notify
|
||||||
exec wl-paste -t text --watch clipman store
|
exec wl-paste -t text --watch clipman store
|
||||||
exec swayidle -w \
|
exec swayidle -w \
|
||||||
timeout 300 'swaylock' \
|
timeout 300 'swaylock' \
|
||||||
@ -205,7 +205,7 @@ bindsym Print exec screenshot --region
|
|||||||
bindsym $mod+Print exec screenshot --full
|
bindsym $mod+Print exec screenshot --full
|
||||||
|
|
||||||
# Dismiss notifications
|
# Dismiss notifications
|
||||||
bindsym $mod+Mod1+n exec makoctl dismiss --all
|
bindsym $mod+Mod1+n exec dismiss_notify
|
||||||
|
|
||||||
# Emacs
|
# Emacs
|
||||||
bindsym $mod+Mod1+e exec emacsclient -c -a emacs
|
bindsym $mod+Mod1+e exec emacsclient -c -a emacs
|
||||||
|
@ -98,7 +98,7 @@ modifier = <super> <alt>
|
|||||||
autostart_wf_shell = false
|
autostart_wf_shell = false
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications = mako -c ~/.config/mako/config
|
notifications = start_notify
|
||||||
|
|
||||||
# The bar
|
# The bar
|
||||||
bar = waybar -c ~/.config/waybar/config-generic -s ~/.config/waybar/style-generic.css
|
bar = waybar -c ~/.config/waybar/config-generic -s ~/.config/waybar/style-generic.css
|
||||||
|
3
home/.local/bin/Wayland/dismiss_notify
Executable file
3
home/.local/bin/Wayland/dismiss_notify
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
makoctl dismiss --all 2>/dev/null || dunstctl close-all
|
8
home/.local/bin/Wayland/start_notify
Executable file
8
home/.local/bin/Wayland/start_notify
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if command -v mako >/dev/null
|
||||||
|
then
|
||||||
|
mako -c ~/.config/mako/config &
|
||||||
|
else
|
||||||
|
dunst &
|
||||||
|
fi
|
@ -1,25 +1,37 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -z "$WAYLAND_DISPLAY" ]; then
|
_notify_brightness() {
|
||||||
notification=dunst
|
if command -v mako >/dev/null
|
||||||
else
|
then
|
||||||
notification=mako
|
icon="$HOME/.config/mako/idea.png"
|
||||||
fi
|
else
|
||||||
|
icon="$HOME/.config/dunst/idea.png"
|
||||||
|
fi
|
||||||
|
notify-send -h string:x-canonical-private-synchronous:brightness "Brightness: $1%" -h int:value:"$1" -i "${icon}"
|
||||||
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
up)
|
up)
|
||||||
if command -v light >/dev/null
|
if command -v light >/dev/null
|
||||||
then
|
then
|
||||||
light -A 5 > /dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(light -G | cut -d '.' -f 1)%"
|
light -A 5 >/dev/null
|
||||||
|
brightness="$(light -G | cut -d '.' -f 1)"
|
||||||
|
_notify_brightness "$brightness"
|
||||||
else
|
else
|
||||||
brightnessctl set 5%+ >/dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')%"
|
brightnessctl set 5%+ >/dev/null
|
||||||
|
brightness="$(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')"
|
||||||
|
_notify_brightness "$brightness"
|
||||||
fi ;;
|
fi ;;
|
||||||
down)
|
down)
|
||||||
if command -v light >/dev/null
|
if command -v light >/dev/null
|
||||||
then
|
then
|
||||||
light -U 5 > /dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(light -G | cut -d '.' -f 1)%"
|
light -U 5 >/dev/null
|
||||||
|
brightness="$(light -G | cut -d '.' -f 1)"
|
||||||
|
_notify_brightness "$brightness"
|
||||||
else
|
else
|
||||||
brightnessctl set 5%- >/dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')%"
|
brightnessctl set 5%- >/dev/null
|
||||||
|
brightness="$(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')"
|
||||||
|
_notify_brightness "$brightness"
|
||||||
fi ;;
|
fi ;;
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
|
@ -4,7 +4,7 @@ DIR_COLORSCRIPTS="$HOME/.local/bin/colorscripts"
|
|||||||
list_colorscripts="$(/usr/bin/ls "${DIR_COLORSCRIPTS}" | cut -d ' ' -f 1 | nl)"
|
list_colorscripts="$(/usr/bin/ls "${DIR_COLORSCRIPTS}" | cut -d ' ' -f 1 | nl)"
|
||||||
length_colorscripts="$(/usr/bin/ls "${DIR_COLORSCRIPTS}" | wc -l)"
|
length_colorscripts="$(/usr/bin/ls "${DIR_COLORSCRIPTS}" | wc -l)"
|
||||||
|
|
||||||
function _random() {
|
_random() {
|
||||||
declare -i random_index=$RANDOM%$length_colorscripts
|
declare -i random_index=$RANDOM%$length_colorscripts
|
||||||
[[ $random_index -eq 0 ]] && random_index=1
|
[[ $random_index -eq 0 ]] && random_index=1
|
||||||
|
|
||||||
|
@ -1,57 +1,54 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -z "$WAYLAND_DISPLAY" ]
|
if command -v mako >/dev/null
|
||||||
then
|
then
|
||||||
notification=dunst
|
|
||||||
else
|
|
||||||
notification=mako
|
notification=mako
|
||||||
|
else
|
||||||
|
notification=dunst
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use pulseaudio backend first (pulsemixer)
|
|
||||||
if command -v pulsemixer >/dev/null
|
if command -v pulsemixer >/dev/null
|
||||||
then
|
then
|
||||||
_notify() {
|
_notify_volume() {
|
||||||
volume=$(pulsemixer --get-volume)
|
volume=$(pulsemixer --get-volume)
|
||||||
# I only have 2 channels :)
|
# 2 channels
|
||||||
left=$(echo "$volume" | cut -d' ' -f1)
|
left=$(echo "${volume}" | cut -d' ' -f1)
|
||||||
right=$(echo "$volume" | cut -d' ' -f2)
|
right=$(echo "${volume}" | cut -d' ' -f2)
|
||||||
average=$(((left+right)/2))
|
|
||||||
notify-send -i "$HOME/.config/${notification}/speaker.png" "Volume: $average%"
|
notify-send -h string:x-canonical-private-synchronous:audio -h int:value:"${left}" -i "$HOME/.config/${notification}/speaker.png" "Volume: L:${left}% / R:${right}%"
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
increase)
|
increase)
|
||||||
pulsemixer --change-volume +5 && _notify
|
pulsemixer --change-volume +5 && _notify_volume
|
||||||
;;
|
;;
|
||||||
decrease)
|
decrease)
|
||||||
pulsemixer --change-volume -5 && _notify
|
pulsemixer --change-volume -5 && _notify_volume
|
||||||
;;
|
;;
|
||||||
toggle)
|
toggle)
|
||||||
pulsemixer --toggle-mute
|
pulsemixer --toggle-mute
|
||||||
status=$(pulsemixer --get-mute)
|
status=$(pulsemixer --get-mute)
|
||||||
if [ "$status" -eq 1 ] || [ "$status" = "true" ]
|
if [ "${status}" -eq 1 ] || [ "${status}" = "true" ]
|
||||||
then
|
then
|
||||||
notify-send -i "$HOME/.config/${notification}/mute.png" "Sound muted"
|
notify-send -i "$HOME/.config/${notification}/mute.png" "Sound muted"
|
||||||
else
|
else
|
||||||
notify-send -i "$HOME/.config/${notification}/speaker.png" "Sound unmuted"
|
notify-send -i "$HOME/.config/${notification}/speaker.png" "Sound unmuted"
|
||||||
fi
|
fi ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# Then fallback to the ALSA one (alsamixer + amixer)
|
|
||||||
else
|
else
|
||||||
_notify_alsa() {
|
_notify_volume() {
|
||||||
volume=$(amixer get Master | sed -nre 's/.*\\[(.*%)\\].*/\\1/p')
|
volume=$(amixer get Master | sed -nre 's/.*\\[(.*%)\\].*/\\1/p')
|
||||||
notify-send -i "$HOME/.config/${notification}/speaker.png" "Volume: $volume"
|
notify-send -h string:x-canonical-private-synchronous:audio -h int:value:"${volume}" -i "$HOME/.config/${notification}/speaker.png" "Volume: ${volume}"
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
increase)
|
increase)
|
||||||
amixer set Master 5+ && _notify_alsa
|
amixer set Master 5+ && _notify_volume
|
||||||
;;
|
;;
|
||||||
decrease)
|
decrease)
|
||||||
amixer set Master 5- && _notify_alsa
|
amixer set Master 5- && _notify_volume
|
||||||
;;
|
;;
|
||||||
toggle)
|
toggle)
|
||||||
amixer set Master toggle
|
amixer set Master toggle
|
||||||
@ -60,8 +57,7 @@ else
|
|||||||
notify-send -i "$HOME/.config/${notification}/mute.png" "Sound muted"
|
notify-send -i "$HOME/.config/${notification}/mute.png" "Sound muted"
|
||||||
else
|
else
|
||||||
notify-send -i "$HOME/.config/${notification}/speaker.png" "Sound unmuted"
|
notify-send -i "$HOME/.config/${notification}/speaker.png" "Sound unmuted"
|
||||||
fi
|
fi ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user