commit
bf51584525
9 changed files with 380 additions and 63 deletions
@ -0,0 +1,54 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
CALL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/Calls/" |
||||
SMS_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/SMS/" |
||||
|
||||
die(){ |
||||
echo "$@" > /dev/stderr |
||||
rm "$FILE" |
||||
exit 1 |
||||
} |
||||
|
||||
trimWhitespace(){ |
||||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' |
||||
} |
||||
|
||||
deleteEmptyLines(){ |
||||
sed '/^$/ d' |
||||
} |
||||
|
||||
# Iterate over options breaking -ab into -a -b when needed and --foo=bar into |
||||
# --foo bar |
||||
optstring=h |
||||
unset options |
||||
while (($#)); do |
||||
case $1 in |
||||
# If option is of type -ab |
||||
-[!-]?*) |
||||
# Loop over each character starting with the second |
||||
for ((i=1; i < ${#1}; i++)); do |
||||
c=${1:i:1} |
||||
|
||||
# Add current char to options |
||||
options+=("-$c") |
||||
|
||||
# If option takes a required argument, and it's not the last char make |
||||
# the rest of the string its argument |
||||
if [[ $optstring = *"$c:"* && ${1:i+1} ]]; then |
||||
options+=("${1:i+1}") |
||||
break |
||||
fi |
||||
done |
||||
;; |
||||
|
||||
# If option is of type --foo=bar |
||||
--?*=*) options+=("${1%%=*}" "${1#*=}") ;; |
||||
# add --endopts for -- |
||||
--) options+=(--endopts) ;; |
||||
# Otherwise, nothing special |
||||
*) options+=("$1") ;; |
||||
esac |
||||
shift |
||||
done |
||||
set -- "${options[@]}" |
||||
unset options |
@ -0,0 +1,38 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
||||
source "$DIR/common" |
||||
|
||||
usage(){ |
||||
echo "missedCalls" |
||||
echo "-a --all Print all (default)" |
||||
echo "-c --count Print count" |
||||
echo "-l --list Print list" |
||||
} |
||||
|
||||
toprint="all" |
||||
# Read the options and set stuff |
||||
while [[ $1 = -?* ]]; do |
||||
case $1 in |
||||
-a|--all) toprint="all" ;; |
||||
-c|--count) toprint="count" ;; |
||||
-l|--list) toprint="list" ;; |
||||
-h|--help) usage; exit;; |
||||
--) shift; break ;; |
||||
*) die "invalid option: '$1'." ;; |
||||
esac |
||||
shift |
||||
done |
||||
|
||||
[ -f "$CALL_DIR/missed-calls" ] || exit |
||||
|
||||
if [ "$toprint" = "count" ] || [ "$toprint" = "all" ]; then |
||||
count="$(cat "$CALL_DIR/missed-calls" | deleteEmptyLines | wc -l )" |
||||
echo "$count missed calls" |
||||
fi |
||||
|
||||
if [ "$toprint" = "list" ] || [ "$toprint" = "all" ]; then |
||||
cat "$CALL_DIR/missed-calls" |
||||
fi |
||||
|
@ -0,0 +1,29 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
# This was mostly taken from sxmo: |
||||
# https://git.sr.ht/~mil/sxmo-utils/tree/1.3.2/item/scripts/modem/sxmo_modemmonitor.sh#L181-205 |
||||
# |
||||
# Although the proccess for managing calls etc is a bit simpler IMO |
||||
|
||||
# Monitor for incoming calls |
||||
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \ |
||||
while read -r line; do |
||||
echo "$line" | grep -E "^signal" && checkCall |
||||
done & |
||||
|
||||
# Monitor for incoming texts |
||||
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \ |
||||
while read -r line; do |
||||
echo "$line" | grep -E "^signal" && checkSMS |
||||
done & |
||||
|
||||
# Monitor for finished calls |
||||
dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" | \ |
||||
while read -r line; do |
||||
echo "$line" | grep -E "^signal" && checkCall |
||||
done & |
||||
|
||||
wait |
||||
wait |
||||
wait |
||||
|
@ -0,0 +1,91 @@ |
||||
/* |
||||
* |
||||
* Author : Aditya Shakya |
||||
* Mail : adi1090x@gmail.com |
||||
* Github : @adi1090x |
||||
* Twitter : @adi1090x |
||||
* |
||||
*/ |
||||
|
||||
configuration { |
||||
disable-history: false; |
||||
fullscreen: false; |
||||
hide-scrollbar: true; |
||||
sidebar-mode: false; |
||||
} |
||||
|
||||
@import "gruvbox-dark.rasi" |
||||
|
||||
* { |
||||
background-color: @background; |
||||
text-color: @foreground; |
||||
} |
||||
|
||||
window { |
||||
transparency: "real"; |
||||
border-radius: 12px; |
||||
width: 100px; |
||||
location: east; |
||||
x-offset: -15px; |
||||
y-offset: -200px; |
||||
} |
||||
|
||||
listview { |
||||
lines: 4; |
||||
margin: 8px; |
||||
spacing: 8px; |
||||
cycle: true; |
||||
dynamic: true; |
||||
layout: vertical; |
||||
} |
||||
|
||||
mainbox { |
||||
background-color: @background; |
||||
children: [ listview ]; |
||||
} |
||||
|
||||
element { |
||||
background-color: @background-light; |
||||
text-color: @foreground; |
||||
orientation: vertical; |
||||
border-radius: 12px; |
||||
} |
||||
|
||||
element-text { |
||||
font: "iosevka 45"; |
||||
expand: true; |
||||
horizontal-align: 0.5; |
||||
vertical-align: 0; |
||||
margin: 0px 10px 63px 10px; |
||||
} |
||||
|
||||
element normal.urgent, |
||||
element alternate.urgent { |
||||
background-color: @urgent; |
||||
text-color: @foreground; |
||||
border-radius: 10px; |
||||
} |
||||
|
||||
element normal.active, |
||||
element alternate.active { |
||||
background-color: @background-alt; |
||||
text-color: @foreground; |
||||
} |
||||
|
||||
element selected { |
||||
background-color: @accent; |
||||
text-color: @background; |
||||
border: 0px; |
||||
border-radius: 10px; |
||||
border-color: @border; |
||||
} |
||||
|
||||
element selected.urgent { |
||||
background-color: @urgent; |
||||
text-color: @foreground; |
||||
} |
||||
|
||||
element selected.active { |
||||
background-color: @background-alt; |
||||
color: @foreground; |
||||
} |
Loading…
Reference in new issue