From d6393f1f36e449d4a876728c1264ce8b81bfdf5e Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Sun, 31 Jul 2022 17:57:58 -0400 Subject: [PATCH] Volume Polybar Module - Add pulseaudio volume module --- README.org | 88 +++++++++++++++++++++++++++++++++++++++++++++- polybar/config.ini | 79 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 165 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index 716a028..4f73a9c 100644 --- a/README.org +++ b/README.org @@ -5609,6 +5609,11 @@ deadd-notification-center-foreground = ${self.background} deadd-notification-center-background = ${self.green} deadd-notification-center-underline = ${self.background} deadd-notification-center-overline = ${self.background} + +volume-foreground = ${self.background} +volume-background = ${self.red} +volume-underline = ${self.background} +volume-overline = ${self.background} #+END_SRC **** Sizes @@ -5782,7 +5787,7 @@ font-5 = "IPAPGothic:size=11;3" ; modules-left = cpu ram ; modules-center = xwindow xbacklight ; modules-right = ipc clock -modules-left = powermenu-left powermenu powermenu-right dwm media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right +modules-left = powermenu-left powermenu powermenu-right dwm volume-left volume volume-right media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right ; modules-center = modules-right = kernel-left kernel kernel-right cpu-left cpu cpu-right memory-left memory memory-right filesystem-left filesystem filesystem-right date-left date date-right time-left time time-right deadd-notification-center-left deadd-notification-center deadd-notification-center-right @@ -6717,6 +6722,87 @@ click-right = "/home/sravan/.scripts/deadd.sh --rofi" ; scroll-down = notify-send scroll down #+END_SRC +**** Pulseaudio + +#+BEGIN_SRC conf :tangle polybar/config.ini +[module/volume-left] +type = custom/text +content = "" +content-foreground = ${colors.volume-background} +content-underline = ${colors.volume-underline} +content-overline = ${colors.volume-overline} +content-padding = ${sizes.module-padding} +#+END_SRC + +#+BEGIN_SRC conf :tangle polybar/config.ini +[module/volume-right] +type = custom/text +content = "" +content-foreground = ${colors.volume-background} +content-underline = ${colors.volume-underline} +content-overline = ${colors.volume-overline} +content-padding = ${sizes.module-padding} +#+END_SRC + +#+BEGIN_SRC conf :tangle polybar/config.ini +[module/volume] +type = internal/pulseaudio + +; Sink to be used, if it exists (find using `pacmd list-sinks`, name field) +; If not, uses default sink +; sink = alsa_output.pci-0000_12_00.3.analog-stereo + +; Use PA_VOLUME_UI_MAX (~153%) if true, or PA_VOLUME_NORM (100%) if false +; Default: true +use-ui-max = true + +; Interval for volume increase/decrease (in percent points) +; Default: 5 +interval = 5 + +; Available tags: +; (default) +; +; +format-volume = +format-volume-padding = ${sizes.module-padding} +format-volume-foreground = ${colors.volume-foreground} +format-volume-background = ${colors.volume-background} +format-volume-underline = ${colors.volume-underline} +format-volume-overline = ${colors.volume-overline} + +; Available tags: +; (default) +; +; +format-muted = +format-muted-padding = ${sizes.module-padding} +format-muted-foreground = ${colors.volume-foreground} +format-muted-background = ${colors.volume-background} +format-muted-underline = ${colors.volume-underline} +format-muted-overline = ${colors.volume-overline} + +; Available tokens: +; %percentage% (default) +; %decibels% +;label-volume = %percentage%% + +; Available tokens: +; %percentage% (default) +; %decibels% +label-muted = ﱝ muted + +; Only applies if is used +ramp-volume-0 = 奄 +ramp-volume-1 = 奔 +ramp-volume-2 = 墳 + +; Right and Middle click +click-right = pavucontrol +; click-middle = +#+END_SRC + + *** Launch Script #+BEGIN_SRC shell :shebang #!/bin/bash :tangle polybar/launch.sh diff --git a/polybar/config.ini b/polybar/config.ini index 4e6c7af..b47906f 100644 --- a/polybar/config.ini +++ b/polybar/config.ini @@ -106,6 +106,11 @@ deadd-notification-center-background = ${self.green} deadd-notification-center-underline = ${self.background} deadd-notification-center-overline = ${self.background} +volume-foreground = ${self.background} +volume-background = ${self.red} +volume-underline = ${self.background} +volume-overline = ${self.background} + [sizes] bar-height = ${xrdb:polybar.bar-height:25} module-margin = ${xrdb:polybar.module-margin:0} @@ -255,7 +260,7 @@ font-5 = "IPAPGothic:size=11;3" ; modules-left = cpu ram ; modules-center = xwindow xbacklight ; modules-right = ipc clock -modules-left = powermenu-left powermenu powermenu-right dwm media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right +modules-left = powermenu-left powermenu powermenu-right dwm volume-left volume volume-right media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right ; modules-center = modules-right = kernel-left kernel kernel-right cpu-left cpu cpu-right memory-left memory memory-right filesystem-left filesystem filesystem-right date-left date date-right time-left time time-right deadd-notification-center-left deadd-notification-center deadd-notification-center-right @@ -1016,3 +1021,75 @@ click-right = "/home/sravan/.scripts/deadd.sh --rofi" ; "scroll-(up|down)" will be executed using "/bin/sh -c $COMMAND" ; scroll-up = notify-send scroll up ; scroll-down = notify-send scroll down + +[module/volume-left] +type = custom/text +content = "" +content-foreground = ${colors.volume-background} +content-underline = ${colors.volume-underline} +content-overline = ${colors.volume-overline} +content-padding = ${sizes.module-padding} + +[module/volume-right] +type = custom/text +content = "" +content-foreground = ${colors.volume-background} +content-underline = ${colors.volume-underline} +content-overline = ${colors.volume-overline} +content-padding = ${sizes.module-padding} + +[module/volume] +type = internal/pulseaudio + +; Sink to be used, if it exists (find using `pacmd list-sinks`, name field) +; If not, uses default sink +; sink = alsa_output.pci-0000_12_00.3.analog-stereo + +; Use PA_VOLUME_UI_MAX (~153%) if true, or PA_VOLUME_NORM (100%) if false +; Default: true +use-ui-max = true + +; Interval for volume increase/decrease (in percent points) +; Default: 5 +interval = 5 + +; Available tags: +; (default) +; +; +format-volume = +format-volume-padding = ${sizes.module-padding} +format-volume-foreground = ${colors.volume-foreground} +format-volume-background = ${colors.volume-background} +format-volume-underline = ${colors.volume-underline} +format-volume-overline = ${colors.volume-overline} + +; Available tags: +; (default) +; +; +format-muted = +format-muted-padding = ${sizes.module-padding} +format-muted-foreground = ${colors.volume-foreground} +format-muted-background = ${colors.volume-background} +format-muted-underline = ${colors.volume-underline} +format-muted-overline = ${colors.volume-overline} + +; Available tokens: +; %percentage% (default) +; %decibels% +;label-volume = %percentage%% + +; Available tokens: +; %percentage% (default) +; %decibels% +label-muted = ﱝ muted + +; Only applies if is used +ramp-volume-0 = 奄 +ramp-volume-1 = 奔 +ramp-volume-2 = 墳 + +; Right and Middle click +click-right = pavucontrol +; click-middle =