VPN status check
This commit is contained in:
		
							parent
							
								
									8f5ac5b948
								
							
						
					
					
						commit
						13994fa458
					
				
							
								
								
									
										25
									
								
								bin/vpn_status.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								bin/vpn_status.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# checks mullvad status for monitoring in polybar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CONNECTED=$(printf '%s%s' '%{F#0F0}' $(echo -e '\Uf0318')) # green
 | 
				
			||||||
 | 
					DISCONNECTED=$(printf '%s%s' '%{F#F00}' $(echo -e '\Uf0319')) # red
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# check that its installed
 | 
				
			||||||
 | 
					if ! command -v mullvad &>/dev/null ; then
 | 
				
			||||||
 | 
					    echo "Seafile not downloaded to device!">&2
 | 
				
			||||||
 | 
					    echo "$DISCONNECTED"
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# getting vpn status
 | 
				
			||||||
 | 
					VPN_DISCONNECTED=$(mullvad status | grep Disconnected)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ -n "$VPN_DISCONNECTED" ]] ; then
 | 
				
			||||||
 | 
					    # vpn is disconnected
 | 
				
			||||||
 | 
					    echo "$DISCONNECTED"
 | 
				
			||||||
 | 
					    exit 0
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# connected
 | 
				
			||||||
 | 
					echo "$CONNECTED"
 | 
				
			||||||
@ -6,7 +6,7 @@ foreground = #DDD
 | 
				
			|||||||
primary = #F0C674
 | 
					primary = #F0C674
 | 
				
			||||||
secondary = #8ABEB7
 | 
					secondary = #8ABEB7
 | 
				
			||||||
disabled = #707880
 | 
					disabled = #707880
 | 
				
			||||||
alert = #A54242
 | 
					alert = #A54242S
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[section/base-bar]
 | 
					[section/base-bar]
 | 
				
			||||||
; base bar settings
 | 
					; base bar settings
 | 
				
			||||||
@ -38,7 +38,7 @@ font-0 = Hack Nerd Font:size=10;2
 | 
				
			|||||||
height = 14pt
 | 
					height = 14pt
 | 
				
			||||||
; modules
 | 
					; modules
 | 
				
			||||||
modules-left = xworkspaces weather-thinkpad
 | 
					modules-left = xworkspaces weather-thinkpad
 | 
				
			||||||
modules-right = battery pulseaudio memory cpu wlan uptime seafile calendar-sync bg-selector date-tp powermenu
 | 
					modules-right = battery pulseaudio memory cpu wlan vpn uptime seafile calendar-sync bg-selector date-tp powermenu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[bar/desktop-bar]
 | 
					[bar/desktop-bar]
 | 
				
			||||||
; desktop bar config
 | 
					; desktop bar config
 | 
				
			||||||
@ -49,7 +49,7 @@ height = 24pt
 | 
				
			|||||||
modules-left = xworkspaces focus-fast spotify spotify-len
 | 
					modules-left = xworkspaces focus-fast spotify spotify-len
 | 
				
			||||||
;modules-left = xworkspaces spotify spotify-len
 | 
					;modules-left = xworkspaces spotify spotify-len
 | 
				
			||||||
modules-center = weather-desktop
 | 
					modules-center = weather-desktop
 | 
				
			||||||
modules-right = pulseaudio memory cpu temperature eth dev-bat packages seafile calendar-sync bg-selector quotes date powermenu
 | 
					modules-right = pulseaudio memory cpu temperature eth vpn dev-bat packages seafile calendar-sync bg-selector quotes date powermenu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[bar/work-bar]
 | 
					[bar/work-bar]
 | 
				
			||||||
; desktop bar config
 | 
					; desktop bar config
 | 
				
			||||||
@ -303,5 +303,11 @@ type = custom/script
 | 
				
			|||||||
interval = 600
 | 
					interval = 600
 | 
				
			||||||
exec = printf "%s %s\n" `echo -e '\ueb29'`  `pacman -Qu | wc -l`
 | 
					exec = printf "%s %s\n" `echo -e '\ueb29'`  `pacman -Qu | wc -l`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[module/vpn]
 | 
				
			||||||
 | 
					; custom vpn script
 | 
				
			||||||
 | 
					type = custom/script
 | 
				
			||||||
 | 
					exec = vpn_status.sh
 | 
				
			||||||
 | 
					interval = 30
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[settings]
 | 
					[settings]
 | 
				
			||||||
screenchange-reload = true
 | 
					screenchange-reload = true
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,7 @@
 | 
				
			|||||||
    ~/.local/bin/markdown-preview.sh: bin/markdown-preview.sh
 | 
					    ~/.local/bin/markdown-preview.sh: bin/markdown-preview.sh
 | 
				
			||||||
    ~/.local/bin/docker_check: bin/docker_check
 | 
					    ~/.local/bin/docker_check: bin/docker_check
 | 
				
			||||||
    ~/.local/bin/seafile_check: bin/seafile_check
 | 
					    ~/.local/bin/seafile_check: bin/seafile_check
 | 
				
			||||||
 | 
					    ~/.local/bin/vpn_status.sh: bin/vpn_status.sh
 | 
				
			||||||
    ~/.local/bin/watertracker: src/watertracker/watertracker
 | 
					    ~/.local/bin/watertracker: src/watertracker/watertracker
 | 
				
			||||||
    ~/.local/bin/device_battery.sh: src/device-battery/device_battery.sh
 | 
					    ~/.local/bin/device_battery.sh: src/device-battery/device_battery.sh
 | 
				
			||||||
    ~/.local/bin/weather: src/weather/weather
 | 
					    ~/.local/bin/weather: src/weather/weather
 | 
				
			||||||
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user