add volume notification and changing sound effect
This commit is contained in:
		
							parent
							
								
									f7d596a488
								
							
						
					
					
						commit
						9eed8fb9c1
					
				
					 3 changed files with 39 additions and 42 deletions
				
			
		| 
						 | 
				
			
			@ -27,7 +27,7 @@ in {
 | 
			
		|||
          # foreground-color = mkLiteral color.txt;
 | 
			
		||||
          text-color = mkLiteral color.txt;
 | 
			
		||||
          # background-color = mkLiteral color.bg;
 | 
			
		||||
          background-color= mkLiteral  "transparent";
 | 
			
		||||
          background-color = mkLiteral "transparent";
 | 
			
		||||
          # width = 512;
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -54,21 +54,20 @@ in {
 | 
			
		|||
        # };
 | 
			
		||||
        "#element" = {
 | 
			
		||||
          # text-color = mkLiteral "#252525";
 | 
			
		||||
          background-color= mkLiteral "transparent";
 | 
			
		||||
          background-color = mkLiteral "transparent";
 | 
			
		||||
          padding = mkLiteral "3px 10px";
 | 
			
		||||
        };
 | 
			
		||||
        "#element selected" = {
 | 
			
		||||
          # text-color = mkLiteral "#252525";
 | 
			
		||||
          background-color = mkLiteral accent.color;
 | 
			
		||||
        };
 | 
			
		||||
        element-icon=  {
 | 
			
		||||
            # background-color= inherit;
 | 
			
		||||
            # text-color=       inherit;
 | 
			
		||||
            margin-right = mkLiteral "20px";
 | 
			
		||||
            size = 24;
 | 
			
		||||
        element-icon = {
 | 
			
		||||
          # background-color= inherit;
 | 
			
		||||
          # text-color=       inherit;
 | 
			
		||||
          margin-right = mkLiteral "20px";
 | 
			
		||||
          size = 24;
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,26 +38,26 @@ min() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
# Pulse{{{
 | 
			
		||||
get_vol_pulse() {
 | 
			
		||||
get_vol_system() {
 | 
			
		||||
    pamixer --get-volume
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
is_muted_pulse() {
 | 
			
		||||
is_muted_system() {
 | 
			
		||||
    pamixer --get-mute >/dev/null
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
change_vol_pulse() {
 | 
			
		||||
change_vol_system() {
 | 
			
		||||
    pamixer "-$1" "$(min 120 $2)"
 | 
			
		||||
    round_vol
 | 
			
		||||
    pamixer --set-volume "${newvol}"
 | 
			
		||||
    if 
 | 
			
		||||
    if
 | 
			
		||||
        test -n "$VOLUME_CHANGE_SOUND"
 | 
			
		||||
    then
 | 
			
		||||
        paplay "$VOLUME_CHANGE_SOUND"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
toggle_mute_pulse() {
 | 
			
		||||
toggle_mute_system() {
 | 
			
		||||
    pactl set-sink-mute @DEFAULT_SINK@ toggle
 | 
			
		||||
}
 | 
			
		||||
#}}}
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +95,7 @@ usage() {
 | 
			
		|||
 | 
			
		||||
    exit "$1"
 | 
			
		||||
}
 | 
			
		||||
TARGET=pulse
 | 
			
		||||
TARGET=system
 | 
			
		||||
 | 
			
		||||
while [ $# -gt 0 ]; do
 | 
			
		||||
    case $1 in
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,13 +104,24 @@ in {
 | 
			
		|||
            { class = "WebCord"; }
 | 
			
		||||
          ];
 | 
			
		||||
        };
 | 
			
		||||
        modes = let return_mode = lib.mapAttrs (k: v: "${v}; mode default");
 | 
			
		||||
        modes = let
 | 
			
		||||
          locked_binds =
 | 
			
		||||
            lib.mapAttrs' (k: v: lib.nameValuePair "--locked ${k}" v);
 | 
			
		||||
          code_binds =
 | 
			
		||||
            lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v);
 | 
			
		||||
          return_mode = lib.mapAttrs (k: v: "${v}; mode default");
 | 
			
		||||
        in {
 | 
			
		||||
          audio = {
 | 
			
		||||
            ${key.tabL} = "volumes decrease";
 | 
			
		||||
          } // return_mode {
 | 
			
		||||
          audio = code_binds (locked_binds {
 | 
			
		||||
            ${key.tabR} = "exec volumesh -i 10";
 | 
			
		||||
            ${key.tabL} = "exec volumesh -d 10";
 | 
			
		||||
            ${key.right} = "exec mpc next";
 | 
			
		||||
            ${key.left} = "exec mpc prev";
 | 
			
		||||
            ${key.up} = "exec volumesh --mpd -i 10";
 | 
			
		||||
            ${key.down} = "exec volumesh --mpd -d 10";
 | 
			
		||||
          }) // return_mode {
 | 
			
		||||
            "space" = "exec mpc toggle";
 | 
			
		||||
            "escape" = "";
 | 
			
		||||
            "q" = "";
 | 
			
		||||
            "s" = "exec ${pulse_sink}/bin/pulse_sink";
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -365,25 +376,24 @@ in {
 | 
			
		|||
      margin = "15";
 | 
			
		||||
      layer = "overlay";
 | 
			
		||||
 | 
			
		||||
      font = "${font.interface} ${toString font.size.small}";
 | 
			
		||||
      textColor = color.txt;
 | 
			
		||||
 | 
			
		||||
      backgroundColor = color.bg;
 | 
			
		||||
      borderColor = accent.color;
 | 
			
		||||
      progressColor = "over ${accent.color}88";
 | 
			
		||||
 | 
			
		||||
      defaultTimeout = 10000;
 | 
			
		||||
 | 
			
		||||
      extraConfig = ''
 | 
			
		||||
        [app-name=volumesh]
 | 
			
		||||
        default-timeout=5000
 | 
			
		||||
        group-by=app-name
 | 
			
		||||
        format=<b>%s</b>\n%b
 | 
			
		||||
      '';
 | 
			
		||||
 | 
			
		||||
      # # {{@@ header() @@}}
 | 
			
		||||
      # # text
 | 
			
		||||
      # font={{@@ font.interface @@}} {{@@ font.size.small @@}}
 | 
			
		||||
      # text-color={{@@ color.txt @@}}
 | 
			
		||||
 | 
			
		||||
      # # colors
 | 
			
		||||
      # background-color={{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}
 | 
			
		||||
      # border-color={{@@ accent_color @@}}
 | 
			
		||||
      # progress-color=over {{@@ accent_color @@}}88
 | 
			
		||||
 | 
			
		||||
      # # decoration
 | 
			
		||||
      # border-size=2
 | 
			
		||||
      # padding=5
 | 
			
		||||
      # margin=15
 | 
			
		||||
 | 
			
		||||
      # # features
 | 
			
		||||
      # icons=1
 | 
			
		||||
| 
						 | 
				
			
			@ -394,18 +404,6 @@ in {
 | 
			
		|||
      # # position
 | 
			
		||||
      # layer=overlay
 | 
			
		||||
 | 
			
		||||
      # [app-name=volumesh]
 | 
			
		||||
      # default-timeout=5000
 | 
			
		||||
      # group-by=app-name
 | 
			
		||||
      # format=<b>%s</b>\n%b
 | 
			
		||||
 | 
			
		||||
      # [app-name=dotdrop]
 | 
			
		||||
      # default-timeout=5000
 | 
			
		||||
      # group-by=app-name
 | 
			
		||||
      # format=<b>%s</b>\n%b
 | 
			
		||||
 | 
			
		||||
      # # vim: ft=ini
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue