Update notify.sh
This commit is contained in:
		
							parent
							
								
									d78a61fe61
								
							
						
					
					
						commit
						4f45a4dd53
					
				
					 1 changed files with 8 additions and 6 deletions
				
			
		|  | @ -2,8 +2,10 @@ | ||||||
| # Show system status in notification, or your own message | # Show system status in notification, or your own message | ||||||
| # Syntaxis: notify [-vb] [-t <timeout>] [-p <value>] [<title> <message>] | # Syntaxis: notify [-vb] [-t <timeout>] [-p <value>] [<title> <message>] | ||||||
| 
 | 
 | ||||||
| # Requirements:  | # Requirements/dependencies:  | ||||||
|  | # - amixer | ||||||
| # - brightnessctl | # - brightnessctl | ||||||
|  | # - libnotify (notify-send) | ||||||
| 
 | 
 | ||||||
| panic () { | panic () { | ||||||
|     >&2 echo "Syntaxis: notify [-vb] [-t <timeout>] [-p <value>] [<title> <message>]" |     >&2 echo "Syntaxis: notify [-vb] [-t <timeout>] [-p <value>] [<title> <message>]" | ||||||
|  | @ -20,15 +22,15 @@ while getopts ":bvt:p:" options; do | ||||||
| 			;; | 			;; | ||||||
| 		v) | 		v) | ||||||
|             # Get volume (don't use pamixer because that is way slower) |             # Get volume (don't use pamixer because that is way slower) | ||||||
|             value=$( pactl get-sink-volume @DEFAULT_SINK@ \ |             value=$( amixer sget 'Master' \ | ||||||
|                 | cut -d '/' -f2 \ |                 | grep -o '\[[0-9]*%\]' \ | ||||||
|                 | grep -o '[0-9]*%' \ |                 | tr -d '][%' \ | ||||||
|                 | tr -d '%' ) | 	        | head -n1 ) | ||||||
|             title="Volume: ${value}%" |             title="Volume: ${value}%" | ||||||
|             category='sysinfo' |             category='sysinfo' | ||||||
| 
 | 
 | ||||||
|             # If audio disabled, set value to zero. |             # If audio disabled, set value to zero. | ||||||
|             if [ "$( pactl get-sink-mute @DEFAULT_SINK@ )" == "Mute: yes" ] ; then  | 	    if [ "$( amixer sget 'Master' | grep -o '\[\(on\|off\)\]' | head -n1 )" == "[off]" ] ; then  | ||||||
|                 title="Volume: ${value}% (Disabled)" |                 title="Volume: ${value}% (Disabled)" | ||||||
|                 value=0 |                 value=0 | ||||||
|             fi |             fi | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue