sway status update
This commit is contained in:
		
							parent
							
								
									a99ca359ce
								
							
						
					
					
						commit
						6858cdb490
					
				| @ -193,7 +193,7 @@ bar { | |||||||
| 
 | 
 | ||||||
|     # When the status_command prints a new line to stdout, swaybar updates. |     # When the status_command prints a new line to stdout, swaybar updates. | ||||||
|     # The default just shows the current date and time. |     # The default just shows the current date and time. | ||||||
|     status_command while ~/.config/sway/status.sh; do sleep 1; done |     status_command while ~/.config/sway/status.sh; do sleep 0.15; done | ||||||
|     font "Ubuntu Mono Regular 14" |     font "Ubuntu Mono Regular 14" | ||||||
|      |      | ||||||
|     status_padding 8 |     status_padding 8 | ||||||
|  | |||||||
| @ -1,9 +1,26 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| 
 | 
 | ||||||
|  | if [[ $(pactl get-sink-mute "@DEFAULT_SINK@") == *"yes" ]]; then | ||||||
|  |   volume="Mute" | ||||||
|  | else | ||||||
|  |   volume=$(pactl get-sink-volume "@DEFAULT_SINK@" | grep -Po '\d+%' | head -n 1) | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | mem=$(free --mega | tail -2 | awk '{print s+=$3}' | tail -1 | awk '{printf "%.2f GB", $1/1000}') | ||||||
|  | 
 | ||||||
|  | cpu=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {printf "%.2f%", usage}') | ||||||
|  | 
 | ||||||
| bat_level=$(cat /sys/class/power_supply/BAT*/capacity) | bat_level=$(cat /sys/class/power_supply/BAT*/capacity) | ||||||
| bat_state=$(cat /sys/class/power_supply/BAT*/status) | bat_state=$(cat /sys/class/power_supply/BAT*/status) | ||||||
| 
 | 
 | ||||||
| date=$(date +'%d.%m.%Y %H:%M:%S') | date=$(date +'%d.%m.%Y %H:%M:%S') | ||||||
| 
 | 
 | ||||||
| echo "$bat_level%" $bat_state "|" $date "" | status="Audio $volume | CPU $cpu | RAM $mem | $bat_level% $bat_state | $date" | ||||||
|  | 
 | ||||||
|  | wifi=$(nmcli -t -f name,type connection show --active | grep wireless | cut -d\: -f1) | ||||||
|  | if [[ -n $wifi ]]; then | ||||||
|  |   status="$wifi | $status" | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | echo $status | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ludwig Lehnert
						Ludwig Lehnert