about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-11-06 15:16:16 +0000
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-11-06 15:16:16 +0000
commit772ab4ac8643d22adcc2dbd8adb19fedf98791b7 (patch)
treedbe374dd9a09b923ae717a54ca06489e789e6c4e
parentRemoved geolocate depend (diff)
downloaddwm-772ab4ac8643d22adcc2dbd8adb19fedf98791b7.tar.gz
dwm-772ab4ac8643d22adcc2dbd8adb19fedf98791b7.tar.bz2
dwm-772ab4ac8643d22adcc2dbd8adb19fedf98791b7.zip
Remove scripts
-rwxr-xr-xscripts/dwm-status278
1 files changed, 0 insertions, 278 deletions
diff --git a/scripts/dwm-status b/scripts/dwm-status
deleted file mode 100755
index 68a680b..0000000
--- a/scripts/dwm-status
+++ /dev/null
@@ -1,278 +0,0 @@
-#!/bin/sh
-
-# This script sets the statusbar with the xsetroot command at the end. Have it
-# started by ~/.xinitrc or ~/.xprofile.
-
-# Set the deliminter character.
-delim="|"
-
-internet=false
-counter=0
-updates_aur=0
-
-checkinternet() {
-	echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1
-
-	if [ $? -eq 0 ]; then
-		internet=true
-	else
-		internet=false
-	fi
-}
-
-weather(){
-	if [ "$internet" = true ]; then
-		CURRENTLOCATION=$(
-		curl -s http://ip-api.com/json | \
-        	jq '.lat, .lon' | \
-        	while read -r LATITUDE; do
-                	read -r LONGITUDE
-                	echo "${LATITUDE}:${LONGITUDE}" | tr -d '"'
-        	done
-		)
-		LANG="en"
-		UNITS="Metric"
-		API_KEY="756edce7e9d4c385ef9499a53492678c"
-
-		LOCATION_FORMATTED_2=$(echo $CURRENTLOCATION | cut -d ':' -f2)
-		LOCATION_FORMATTED_1=$(echo $CURRENTLOCATION | cut -d ':' -f1)
-
-		OUTPUT=$(curl -s "http://api.openweathermap.org/data/2.5/weather?lat=$LOCATION_FORMATTED_1&lon=$LOCATION_FORMATTED_2&lang=$LANG&appid=$API_KEY&units=$UNITS")
-		STATUS=$(echo $OUTPUT | jq '.weather' | tr '[' ' ' | tr ']' ' ' | jq '.main' | sed 's/"//g')
-		TEMP=$(echo $OUTPUT | jq '.main' | jq '.temp' | xargs printf "%.*f\n" 0)
-
-		case $STATUS in
-			"Clear" )
-				echo "";;
-			"Clouds" )	
-				echo "摒";;
-			"Rain" )
-				echo "歹";;
-			"Thunderstorm" )
-				echo "朗";;
-			"Snow" )
-				echo "流";;
-			"Mist" )
-				echo "敖";;
-			* )
-				echo "摒";;
-		esac
-
-		echo "$STATUS, "
-		echo "$TEMP°C"
-		echo "$delim"
-	fi
-}
-
-setaurupdates(){
-	if [ "$internet" = true ]; then
-		if (( $counter % 30 == 0 )); then
-  		if ! updates_aur=$(yay -Qum --devel 2> /dev/null | wc -l); then
-    		updates_aur=0
-  		fi
-		fi
-	fi
-}
-
-updates() {
-
-	if [ "$internet" = true ]; then
-
-  	if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
-    	updates_arch=0
-    fi
-
-    updates=$(("$updates_arch" + "$updates_aur"))
-
-    if [ "$updates" -gt 0 ]; then
-    	echo " Updates: $updates"
-    else
-      echo " Updates: 0"
-    fi
-
-    echo $delim
-  fi
-}
-
-todo() {
-	command -v t >/dev/null 2>&1 &&
-        echo ": $(t --task-dir ~/.todo --list tasks | wc -l)" &&
-        echo "$delim"
-}
-
-mail() {
-	command -v neomutt >/dev/null 2>&1 &&
-        du -a ~/Mail/INBOX/new/* 2>/dev/null | wc -l | sed 's/^/: /' &&
-        echo "$delim"
-}
-
-tor() {
-
-	icon_enabled="ﴣ"
-	icon_disabled=""
-	status=$(systemctl is-active tor.service)
-
-	if [ "$status" == "active" ]
-	then
-	    echo "$icon_enabled $delim"
-	else
-	    echo "$icon_disabled"
-	fi
-}
-
-network() {
-
-	if grep -q wlan* "/proc/net/wireless"; then
-
-		# Wifi quality percentage
-		percentage=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70)}'| xargs)
-		case $percentage in
-			100|9[0-9]|8[0-9]|7[0-9])		  echo "" ;;
-			6[0-9]|5[0-9]|4[0-9]|3[0-9])	echo "" ;;
-			2[0-9]|1[0-9]|[0-9])	        echo "" ;;
-		esac
-
-		echo $delim
-	fi
-	
-	if [ -d /sys/class/net/eth? ]; then
-		if [ "$(cat /sys/class/net/eth?/carrier)" == "1" ]; then
-			echo "" # 
-			echo "$delim"
-		fi
-	fi
-
-	if [ "$internet" = true ]; then
-  	echo ""
-		echo $delim
-	else
-    :
-	fi
-}
-
-bluetooth() {
-
-	status=$(systemctl is-active bluetooth.service)
-
-	if [ "$status" == "active" ]
-	then
-	    echo ""
-	    echo "$delim"
-	else
-	    :
-	    #echo ""
-	fi
-}
-
-volume(){
-	# Get the volume of ALSA's master volume output.  Show an icon if or
-	# not muted.
-	active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
-	curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
-	volume=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ')
-	if [ "${curStatus}" = 'yes' ]
-	then
-			echo " $volume%"
-	else
-			echo " $volume%"
-	fi
-
-	echo "$delim"
-}
-
-temperature(){
-	CPU_T=$(cat /sys/devices/platform/coretemp.0/hwmon/hwmon?/temp2_input)
-	CPU_TEMP=$(expr $CPU_T / 1000)
-
-	if [ "$CPU_TEMP" -ge 70 ]; then
-		echo "🔥  $CPU_TEMP°C"
-	elif [ "$CPU_TEMP" -le 10 ]; then
-		echo "  $CPU_TEMP°C"
-	else
-		echo " $CPU_TEMP°C"
-	fi
-	echo "$delim"
-}
-
-battery(){
-	if [ -d /sys/class/power_supply/BAT? ]; then
-
-		ac_adapter=$(cat /sys/class/power_supply/BAT?/status)
-		if [ "$ac_adapter" == "Charging" ]; then
-			echo ""
-		fi
-
-		# Will show all batteries with approximate icon for remaining power.
-		for x in /sys/class/power_supply/BAT?/capacity;
-		do
-			case "$(cat $x)" in
-				100)            echo ""            ;;
-				9[0-9])	        echo " $(cat $x)%" ;;
-				8[0-9]|7[0-9])	echo " $(cat $x)%" ;;
-				6[0-9]|5[0-9])	echo " $(cat $x)%" ;;
-				4[0-9]|3[0-9])	echo " $(cat $x)%" ;;
-				2[0-9]|1[0-9])	if [ "$ac_adapter" == "Charging" ]; then
-													echo " $(cat $x)%"
-												else
-													echo "   $(cat $x)%"
-												fi ;;
-				[0-9])	        if [ "$ac_adapter" == "Charging" ]; then
-													echo " $(cat $x)%"
-												else
-													echo "   $(cat $x)%"
-												fi ;;
-			esac
-			done && echo "$delim"
-	fi
-}
-
-# Here is the (big) function that outputs the appearance of the statusbar. It
-# can really be broken down into many submodules which I've commented and
-# explained.
-status() { \
-
-	tor
-
-	weather
-
-	updates
-
-	todo
-
-	mail
-
-	volume
-
-	bluetooth
-
-	network
-
-	temperature
-
-	battery
-
-	# Date and time. FORMAT CORRECT NO PM
-	echo " $(date '+%d-%m-%y (%a) |  %H:%M')"
-	}
-
-while :; do
-	# So all that big status function was just a command that quicking gets
-	# what we want to be the statusbar. This xsetroot command is what sets
-	# it. Note that the tr command replaces newlines with spaces. This is
-	# to prevent some weird issues that cause significant slowing of
-	# everything in dwm. Note entirely sure of the cause, but again, the tr
-	# command easily avoids it.
-
-  checkinternet
-
-  setaurupdates
-
-	xsetroot -name "$(status | tr '\n' ' ')"
-
-	((counter++))
-
-	# Sleep for a minute after changing the status bar before updating it
-	# again. Note that the `refbar` "refreshes" the statusbar by killing
-	# this command. Feel free to change the time interval if you want.
-	sleep 1s
-done