Adds missed calls list to phone menu
This commit is contained in:
		
							parent
							
								
									0e4dcd2790
								
							
						
					
					
						commit
						f1dd615869
					
				
					 3 changed files with 26 additions and 3 deletions
				
			
		|  | @ -1,9 +1,31 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
| 
 | 
 | ||||||
|  | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||||||
|  | source "$DIR/../modem/common" | ||||||
|  | 
 | ||||||
|  | viewMissedCalls(){ | ||||||
|  | 	local choice="$( ( | ||||||
|  | 	#cat "$CALL_DIR/missed-calls" | awk -F '\t' '{"date +%Y-%m-%d %H:%M:%S -d @" $1 |& getline $1; print $2 "<sub>" $1 "</sub>"}' | ||||||
|  | 	cat "$CALL_DIR/missed-calls" | awk -F '\t' '{"date  -d @" $1 "  \"+%Y-%m-%d %H:%M:%S\"" |& getline $1; print $2 "  <span size=\"xx-small\">" $1 "</span>"}' | ||||||
|  | 	echo "Clear" | ||||||
|  | 	)| trofi -markup-rows )" | ||||||
|  | 	case "$choice" in | ||||||
|  | 		"Clear") rm "$CALL_DIR/missed-calls" ;; | ||||||
|  | 		*) | ||||||
|  | 			local number="$(echo "$choice" | cut -d '	' -f 3)" | ||||||
|  | 			makeCall "$number" | ||||||
|  | 			;; | ||||||
|  | 	esac | ||||||
|  | } | ||||||
|  | 
 | ||||||
| options="End All Calls | options="End All Calls | ||||||
| Check for Calls | Check for Calls | ||||||
| Check for Texts | Check for Texts | ||||||
| Dialer" | $( [ -f "$CALL_DIR/missed-calls" ] && echo "Missed Calls" ) | ||||||
|  | Dialer | ||||||
|  | Back" | ||||||
|  | 
 | ||||||
|  | options="$(echo "$options" | sed '/^$/d')" | ||||||
| 
 | 
 | ||||||
| while true ; do | while true ; do | ||||||
| 	choice="$(echo "$options" | trofi)" | 	choice="$(echo "$options" | trofi)" | ||||||
|  | @ -14,6 +36,7 @@ while true ; do | ||||||
| 			break ;; | 			break ;; | ||||||
| 		"Check for Calls") checkCall ;; | 		"Check for Calls") checkCall ;; | ||||||
| 		"Check for Texts") checkSMS ;; | 		"Check for Texts") checkSMS ;; | ||||||
|  | 		"Missed Calls") viewMissedCalls; break ;; | ||||||
| 		"Dialer") (dialer &); break ;; | 		"Dialer") (dialer &); break ;; | ||||||
| 		"Back") break;; | 		"Back") break;; | ||||||
| 	esac | 	esac | ||||||
|  |  | ||||||
|  | @ -9,4 +9,4 @@ lines="$(echo "$input" | wc -l )" | ||||||
| 
 | 
 | ||||||
| [ "$lines" -gt 15 ] && lines=15 | [ "$lines" -gt 15 ] && lines=15 | ||||||
| 
 | 
 | ||||||
| echo "$input" | rofi -dmenu -me-accept-entry '!MousePrimary' -theme "themes/touch-dmenu.rasi" -lines "$lines" | echo "$input" | rofi -dmenu -me-accept-entry '!MousePrimary' -theme "themes/touch-dmenu.rasi" -lines "$lines" "$@" | ||||||
|  |  | ||||||
|  | @ -220,7 +220,7 @@ checkFinished(){ | ||||||
| 		# it hasn't been answerd yet. | 		# it hasn't been answerd yet. | ||||||
| 		# Treat as a missed call | 		# Treat as a missed call | ||||||
| 		if ps aux | grep -E '\Wrofi' | grep -q "call-from-$contact"; then | 		if ps aux | grep -E '\Wrofi' | grep -q "call-from-$contact"; then | ||||||
| 			echo "Missed call from $contact" >> "$CALL_DIR/missed-calls" | 			echo -e "$(date '+%s')\t$contact\t$number" >> "$CALL_DIR/missed-calls" | ||||||
| 			pkill mpv | 			pkill mpv | ||||||
| 			mmcli -m "$modem" --voice-delete-call "$id" | 			mmcli -m "$modem" --voice-delete-call "$id" | ||||||
| 			ps aux | grep -E '\Wrofi' | grep "call-from-$contact" | | 			ps aux | grep -E '\Wrofi' | grep "call-from-$contact" | | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue