From 86840be8ee74274c734693ec5de136ddf79cd2e1 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 4 Apr 2021 16:01:24 +0100 Subject: [PATCH 1/5] Makes calling work Much of the code that interfaces with the modem was taken from SXMO. Calling now works for both incoming and outgoing calls --- bin/.bin/modem/checkCall | 152 ++++++++++++++++++++++++++++++++---- bin/.bin/modem/checkSMS | 2 +- bin/.bin/modem/common | 1 + bin/.bin/modem/dialer | 92 +++++++++++++++------- bin/.bin/modem/makeCall | 41 ++++++++++ bin/.bin/modem/monitorModem | 3 + 6 files changed, 244 insertions(+), 47 deletions(-) create mode 100755 bin/.bin/modem/makeCall diff --git a/bin/.bin/modem/checkCall b/bin/.bin/modem/checkCall index 3fe158ba..50ce0d1d 100755 --- a/bin/.bin/modem/checkCall +++ b/bin/.bin/modem/checkCall @@ -3,9 +3,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source "$DIR/common" +export DISPLAY=:0.0 usage(){ - echo "checkCall [options] [message|-]" + echo "checkCall [options]" echo "Options:" echo " -h|--help Display this help text" echo " -m|--modem Specify a modem" @@ -22,24 +23,122 @@ lookupnumberfromcallid() { tr -d ' ' } +# Stolen from sxmo +toggleflag() { + TOGGLEFLAG=$1 + shift + FLAGS="$*" + + echo -- "$FLAGS" | grep -- "$TOGGLEFLAG" >&2 && + NEWFLAGS="$(echo -- "$FLAGS" | sed "s/$TOGGLEFLAG//g")" || + NEWFLAGS="$(echo -- "$FLAGS $TOGGLEFLAG")" + + NEWFLAGS="$(echo -- "$NEWFLAGS" | sed "s/--//g; s/ / /g")" + + # shellcheck disable=SC2086 + megiaudioroute $NEWFLAGS + echo -- "$NEWFLAGS" +} + +# Stolen from sxmo +toggleflagset() { + FLAGS="$(toggleflag "$1" "$FLAGS")" +} + + lookupcontact(){ - echo "$1" | - # Remove the +44 and replace with 0 - sed 's/^\+44/0/' - # This will eventually work with abook but for now just return the number + local contact="$(contact-numbers "$1" | cut -d ' ' -f 1)" + if [ -n "$contact" ]; then + echo "$contact" + else + echo "$1" | + # Remove the +44 and replace with 0 + sed 's/^\+44/0/' + fi } -answer-call(){ - export DISPLAY=:0.0 +dtmf(){ + local id="$1" + svkbd-numbers & + local choice="$( ( + echo "Exit" + ) | rofi -dmenu -i -me-accept-entry '!MousePrimary' -p "Tones" -normal-window -font 'Iosevka 20' )" + if [ "$choice" = "Exit" ]; then + return + fi + echo "$choice" | grep -o '.' | while read -r tone; do + sleep 0.5 + mmcli -m "$modem" -o "$id" --send-dtmf="$tone" + done + pkill svkbd-numbers + +} + +ongoingCall(){ + local id="$1" + + # Stolen from sxmo + FLAGS=" " + toggleflagset "-e" + toggleflagset "-m" + toggleflagset "-2" + toggleflagset "-2" + toggleflagset "-2" + + notify-send "I get here" + + while : ; do + choice="$( ( + echo "Hang Up" + echo "DTMF Tones" + echo "Volume Up" + echo "Volume Down" + ) | trofi)" + + case "$choice" in + "Hang Up") rejectCall "$1"; break ;; + "DTMF Tones") dtmf "$1" ;; + "Volume"*) notify-send "Still need to implement" ;; + esac + + done +} + +answerCall(){ + + pkill mpv + sleep 0.2 + echo "answer call $1" > /dev/tty mmcli -m "$modem" -o "$1" --accept + + ongoingCall "$1" } -reject-call(){ +rejectCall(){ + pkill mpv + echo "reject call $1" > /dev/tty mmcli -m "$modem" -o "$1" --hangup + mmcli -m "$modem" --voice-delete-call="$1" + + mmcli -m "$modem" --voice-hangup-all + for CALLID in $( mmcli -m "$modem" --voice-list-calls | grep -oE "Call\/[0-9]+" | cut -d'/' -f2); do + echo mmcli -m "$modem" --voice-delete-call "$CALLID" > ~/.hangup.log + done + + # Not sure why but sometimes the modem changes + # To be sure, re-check the modem and delete all calls + local tmpmodem="$(mmcli -L | grep -oE 'Modem\/[0-9]+' | head -n 1 | cut -d'/' -f2)" + + mmcli -m "$tmpmodem" --voice-hangup-all + for CALLID in $( mmcli -m "$tmpmodem" --voice-list-calls | grep -oE "Call\/[0-9]+" | cut -d'/' -f2); do + echo mmcli -m "$tmpmodem" --voice-delete-call "$CALLID" > ~/.hangup.log + done + + alsactl --file "$ALSA_CONF_DIR/default_alsa_sound.conf" restore } -prompt-incoming(){ +promptIncoming(){ export DISPLAY=:0.0 local answer="" @@ -62,11 +161,21 @@ prompt-incoming(){ esac } +checkOutgoing(){ + export DISPLAY=:0.0 + if [ "$dryrun" = "true" ]; then + return + fi + notify-send "outgoing call" "$1" + mmcli -m "$modem" -o "$1" --start + + ongoingCall "$1" +} checkIncoming(){ export DISPLAY=:0.0 if [ "$dryrun" = "true" ]; then - prompt-incoming "+441234567890" + promptIncoming "+441234567890" return fi local id="$( mmcli -m "$modem" --voice-list-calls | @@ -81,11 +190,12 @@ checkIncoming(){ local action="" while mmcli -m "$modem" --voice-list-calls | grep -Eoq "$id"' incoming \(ringing-in\)' && [ -z "$action" ]; do - action="$(prompt-incoming "$contact")" + mpv "$HOME/.local/share/soundeffects/ringtone" --loop & + action="$(promptIncoming "$contact")" done case "$action" in - "accept") answer-call "$id"; break ;; - "reject") reject-call "$id"; break ;; + "accept") answerCall "$id"; ;; + "reject") rejectCall "$id"; ;; esac } @@ -95,6 +205,7 @@ checkFinished(){ grep -Eo '[0-9]+ incoming \(terminated\)' | grep -Eo '[0-9]+' )" local count="$(echo "$ids" | deleteEmptyLines | wc -l)" + echo "Finished Count: $count" [ "$count" -eq 0 ] && return @@ -103,13 +214,16 @@ checkFinished(){ local number="$(lookupnumberfromcallid "$id")" local contact="$(lookupcontact "$number")" + echo "I get here" + # If there is a rofi process with the title of "call-from-number", then # it hasn't been answerd yet. # Treat as a missed call - if ps aux | grep -E '\Wrofi' | grep -q "call-from-$number"; then + if ps aux | grep -E '\Wrofi' | grep -q "call-from-$contact"; then echo "Missed call from $contact" >> "$CALL_DIR/missed-calls" + pkill mpv mmcli -m "$modem" --voice-delete-call "$id" - ps aux | grep -E '\Wrofi' | grep "call-from-$number" | + ps aux | grep -E '\Wrofi' | grep "call-from-$contact" | awk '{print $2}' | xargs kill fi @@ -140,8 +254,12 @@ while [[ $1 = -?* ]]; do shift done -checkIncoming & -checkFinished & +if [ -n "$1" ]; then + checkOutgoing "$1" & +else + checkIncoming & + checkFinished & +fi diff --git a/bin/.bin/modem/checkSMS b/bin/.bin/modem/checkSMS index f64f7cba..dcb48cbf 100755 --- a/bin/.bin/modem/checkSMS +++ b/bin/.bin/modem/checkSMS @@ -72,4 +72,4 @@ echo "$ids" | while read -r id; do mmcli -m "$modem" --messaging-delete-sms="$id" done -notify-send "$count new messages" +echo "$count new messages" diff --git a/bin/.bin/modem/common b/bin/.bin/modem/common index 6ce437d3..ff1f8853 100644 --- a/bin/.bin/modem/common +++ b/bin/.bin/modem/common @@ -2,6 +2,7 @@ CALL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/Calls/" SMS_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/SMS/" +ALSA_CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/alsa/" die(){ echo "$@" > /dev/stderr diff --git a/bin/.bin/modem/dialer b/bin/.bin/modem/dialer index 85733ee1..8ac74611 100755 --- a/bin/.bin/modem/dialer +++ b/bin/.bin/modem/dialer @@ -1,33 +1,67 @@ #!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +source "$DIR/common" + export DISPLAY=:0.0 -prompt="" - -answer="" -reject="" - -options="1 -4 -7 -* - -2 -5 -8 -0 -$answer -3 -6 -9 -# -X" - -while true; do - #notify-send "$prompt" - input="$(echo "$options" | - rofi -dmenu -p "$prompt" -theme themes/dialer.rasi \ - -me-select-entry '' -me-accept-entry MousePrimary)" - [ "$input" = "X" ] && exit - #exit - prompt+="$input" +usage(){ + echo "dialer" + echo "Options:" + echo " -h|--help Display this help text" + echo " -m|--modem Specify a modem" + echo " -l|--letters Show letter keyboard rather than just numbers" + echo " --dry-run Don't actually call" +} + +altKeyboard(){ + notify-send "also here" + if [ "$keyboard" = "svkbd-numbers" ]; then + echo "svkbd-colemak" + else + echo "svkbd-numbers" + fi +} + +modem="$(mmcli -L | grep -oE 'Modem\/[0-9]+' | head -n 1 | cut -d'/' -f2)" +keyboard="svkbd-numbers" +dryrun="" + +# Read the options and set stuff +while [[ $1 = -?* ]]; do + case $1 in + -h|--help) usage; exit;; + -m|--modem) modem="$2"; shift ;; + -l|--letters) keyboard="svkbd-colemak"; shift ;; + --dry-run) dryrun="--dry-run" ;; + --) shift; break ;; + *) die "invalid option: '$1'." ;; + esac + shift +done + +while : ; do + + # Stop any running keyboards + pkill -9 'svkbd-*' + + # Open the keyboard that we are using + "$keyboard" & + + choice="$( ( + echo "Switch Keyboard" + echo "Exit" + contact-numbers + ) | rofi -dmenu -i -me-accept-entry '!MousePrimary' -p "Call" -normal-window -font 'Iosevka 20' )" + + case "$choice" in + "Switch Keyboard") keyboard="$(altKeyboard)" ;; + "Exit") break ;; + *) + num="$(echo "$choice" | cut -d ' ' -f 2)" + pkill -9 'svkbd-*' + makeCall -m "$modem" $dryrun "$num" + break ;; + esac + done diff --git a/bin/.bin/modem/makeCall b/bin/.bin/modem/makeCall new file mode 100755 index 00000000..14971da1 --- /dev/null +++ b/bin/.bin/modem/makeCall @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +source "$DIR/common" + +export DISPLAY=:0.0 + +usage(){ + echo "makeCall number" + echo "Options:" + echo " -h|--help Display this help text" + echo " -m|--modem Specify a modem" + echo " --dry-run Don't actually call" +} + +modem="$(mmcli -L | grep -oE 'Modem\/[0-9]+' | head -n 1 | cut -d'/' -f2)" + +# Read the options and set stuff +while [[ $1 = -?* ]]; do + case $1 in + -h|--help) usage; exit;; + -m|--modem) modem="$2"; shift ;; + --dry-run) dryrun="--dry-run" ;; + --) shift; break ;; + *) die "invalid option: '$1'." ;; + esac + shift +done + +number="$1" + +[ -z "$number" ] && die "No Number Specified" + +callID="$(mmcli -m "$modem" --voice-create-call "number=$number" | + grep -Eo 'Call\/[0-9]+' | head -n 1 | cut -d'/' -f2)" + + + +checkCall $dryrun "$callID" + + diff --git a/bin/.bin/modem/monitorModem b/bin/.bin/modem/monitorModem index b966d256..d2d06b35 100755 --- a/bin/.bin/modem/monitorModem +++ b/bin/.bin/modem/monitorModem @@ -5,6 +5,8 @@ # # Although the proccess for managing calls etc is a bit simpler IMO +export DISPLAY=:0.0 + # Monitor for incoming calls dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \ while read -r line; do @@ -14,6 +16,7 @@ dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',typ # Monitor for incoming texts dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \ while read -r line; do + notify-send "Added (SMS)" echo "$line" | grep -E "^signal" && checkSMS done & From e0cf58430b936a22d2b67b0146995e67a512f69d Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 4 Apr 2021 16:04:22 +0100 Subject: [PATCH 2/5] Many changes including introduction to menu system THe main addition here is the menu system that is used to contoll the phone. THere are also some small helper scripts for calls etc. --- bin/.bin/contact-numbers | 14 ++++++-- bin/.bin/dmenu/menu-phone | 21 +++++++++++ bin/.bin/dmenu/menu-st | 21 +++++++++++ bin/.bin/dmenu/menu-system | 37 +++++++++++++++++++ bin/.bin/dmenu/rofi-volume | 58 ++++++++++++++++++++++++++++++ bin/.bin/dmenu/spawn-phone-menu | 27 ++++++++++++++ bin/.bin/dmenu/trofi | 12 +++++++ bin/.bin/notifications/phoneStatus | 10 ++++++ bin/.bin/toggleKeyboard | 7 ++++ bin/.bin/volume | 1 + 10 files changed, 206 insertions(+), 2 deletions(-) create mode 100755 bin/.bin/dmenu/menu-phone create mode 100755 bin/.bin/dmenu/menu-st create mode 100755 bin/.bin/dmenu/menu-system create mode 100755 bin/.bin/dmenu/rofi-volume create mode 100755 bin/.bin/dmenu/spawn-phone-menu create mode 100755 bin/.bin/dmenu/trofi create mode 100755 bin/.bin/notifications/phoneStatus create mode 100755 bin/.bin/toggleKeyboard diff --git a/bin/.bin/contact-numbers b/bin/.bin/contact-numbers index 26812e2a..0a2497a0 100755 --- a/bin/.bin/contact-numbers +++ b/bin/.bin/contact-numbers @@ -2,6 +2,15 @@ addressbook="$HOME/.abook/addressbook" +filter(){ + if [ -n "$1" ]; then + local str="$(echo "$1" | tr -d ' ' | sed 's/^0/+44/')" + grep -i "$str" + else + cat - + fi +} + cat "$addressbook" | grep -E '(\[[0-9]+\]|^$|name|phone|mobile)' | awk -v RS="\n\n" -v ORS="\n" '{gsub("\n","\t",$0); print $0}' | @@ -9,8 +18,9 @@ cat "$addressbook" | name="$(echo "$line" | cut -d ' ' -f 2 | cut -d '=' -f 2)" echo "$line" | tr '\t' '\n' | grep -E '(phone|mobile)' | while read -r numLine; do - num="$(echo "$numLine" | cut -d '=' -f 2 | tr -d ' ' | sed 's/+44(0)/+44/')" + num="$(echo "$numLine" | cut -d '=' -f 2 | tr -d ' ' | + sed 's/+44(0)/+44/' | sed 's/^0/+44/')" numType="$(echo "$numLine" | cut -d '=' -f 1)" echo -e "$name\t$num\t$numType" done - done + done | filter "$*" diff --git a/bin/.bin/dmenu/menu-phone b/bin/.bin/dmenu/menu-phone new file mode 100755 index 00000000..d302b8e7 --- /dev/null +++ b/bin/.bin/dmenu/menu-phone @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +options="End All Calls +Check for Calls +Check for Texts +Dialer" + +while true ; do + choice="$(echo "$options" | trofi)" + case "$choice" in + "End All Calls") + modem="$(mmcli -L | grep -oE 'Modem\/[0-9]+' | head -n 1 | cut -d'/' -f2)" + mmcli -m "$modem" --voice-hangup-all + break ;; + "Check for Calls") checkCall ;; + "Check for Texts") checkSMS ;; + "Dialer") (dialer &); break ;; + "Back") break;; + esac +done + diff --git a/bin/.bin/dmenu/menu-st b/bin/.bin/dmenu/menu-st new file mode 100755 index 00000000..0b559b8a --- /dev/null +++ b/bin/.bin/dmenu/menu-st @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +options="Zoom In +Zoom Out +Paste +System Menu +Exit" + +choice="" +while : ; do + choice="$(echo "$options" | trofi)" + case "$choice" in + "Zoom In") sleep 0.3; xdotool key --clearmodifiers "ctrl+shift+j" ;; + "Zoom Out") sleep 0.3; xdotool key --clearmodifiers "ctrl+shift+k" ;; + "Paste") sleep 0.3; xdotool key --clearmodifiers "ctrl+shift+v" ;; + "System Menu") menu-system; break ;; + "Exit") sleep 0.3; xdotool key --clearmodifiers "Super_L+q"; break ;; + "") break ;; + esac +done + diff --git a/bin/.bin/dmenu/menu-system b/bin/.bin/dmenu/menu-system new file mode 100755 index 00000000..985cf2de --- /dev/null +++ b/bin/.bin/dmenu/menu-system @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +options="Terminal +Browser +Phone +Podcasts +Go To Workspace +Move To Workspace +Power Menu +Exit" + +chooseWorkspace(){ + seq 1 10 | trofi +} + +goToWorkspace(){ + xdotool key --clearmodifiers "Super_L+$(chooseWorkspace)" +} +moveToWorkspace(){ + xdotool key --clearmodifiers "Super_L+Shift+$(chooseWorkspace)" +} + +while true ; do + choice="$(echo "$options" | trofi)" + case "$choice" in + "Terminal") (folder-shell &); break ;; + "Browser") (firefox &); break ;; + "Podcasts") (gnome-podcasts &); break ;; + "Phone") spawn-phone-menu phone ; break ;; + "Go To Workspace") goToWorkspace ; break ;; + "Move To Workspace") moveToWorkspace ; break ;; + "Power Menu") (rofi-shutdown &); break ;; + "Exit") sleep 0.3; xdotool key --clearmodifiers "Super_L+q"; break ;; + "") break;; + esac +done + diff --git a/bin/.bin/dmenu/rofi-volume b/bin/.bin/dmenu/rofi-volume new file mode 100755 index 00000000..b54ddb90 --- /dev/null +++ b/bin/.bin/dmenu/rofi-volume @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +up="" +down="" +mute="ﱝ" + + +while : ; do + active="" + urgent="" + + + if type -p pulseaudio-ctl 2> /dev/null; then + volume="$(pulseaudio-ctl full-status | cut -d ' ' -f1)" + speakerStatus="$(pulseaudio-ctl full-status | cut -d ' ' -f2 | + sed 's/no/on/g')" + else + volume="$(amixer -D default sget Master | grep -o '\[.*\%' | + head -n 1 | tr -d '[%')" + speakerStatus="$(amixer -D default sget Master | grep -o '\[\(on\|off\)' | + head -n 1 | tr -d '[')" + fi + + if [ "$speakerStatus" = "off" ]; then + volume="Muted" + urgent="-u 2" + else + active="-a 2" + fi + + choice="$(echo -e "$up\n$down\n$mute" | + rofi -dmenu -theme 'themes/volume.rasi' -p "$volume" $urgent $active)" + case "$choice" in + "$up") + if type -p pulseaudio-ctl 2> /dev/null; then + pulseaudio-ctl up + else + amixer -q -D default sset Master 5%+ unmute + fi + ;; + "$down") + if type -p pulseaudio-ctl 2> /dev/null; then + pulseaudio-ctl down + else + amixer -q -D default sset Master 5%- unmute + fi + ;; + "$mute") + if type -p pulseaudio-ctl 2> /dev/null; then + pulseaudio-ctl mute + else + amixer -q -D default sset Master toggle + fi + ;; + "") break + esac + +done diff --git a/bin/.bin/dmenu/spawn-phone-menu b/bin/.bin/dmenu/spawn-phone-menu new file mode 100755 index 00000000..6ded8b21 --- /dev/null +++ b/bin/.bin/dmenu/spawn-phone-menu @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# This script creates menus for applications running on my phone + +error(){ + echo "$@" > /dev/stderr + exit 1 +} + +windowFocus="$(xdotool getwindowfocus)" +if [ -n "$1" ]; then + menu="menu-$1" +else + class="$(xprop -id "$windowFocus" | grep "WM_CLASS" | cut -d '"' -f 2)" + case "$class" in + "xterm-256color") menu="menu-st" ;; + *) menu="menu-$class" ;; + esac +fi + + +type "$menu" > /dev/null 2>&1 || menu="menu-system" + +"$menu" + + + diff --git a/bin/.bin/dmenu/trofi b/bin/.bin/dmenu/trofi new file mode 100755 index 00000000..04ffa097 --- /dev/null +++ b/bin/.bin/dmenu/trofi @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# THis is a simple wrapper around rofi which makes it nicer to use with touch screens + + +input="$(cat -)" + +lines="$(echo "$input" | wc -l )" + +[ "$lines" -gt 15 ] && lines=15 + +echo "$input" | rofi -dmenu -me-accept-entry '!MousePrimary' -theme "themes/touch-dmenu.rasi" -lines "$lines" diff --git a/bin/.bin/notifications/phoneStatus b/bin/.bin/notifications/phoneStatus new file mode 100755 index 00000000..1dc8d2ec --- /dev/null +++ b/bin/.bin/notifications/phoneStatus @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +battery="$(cat /sys/class/power_supply/axp20x-battery/capacity)" +batteryStatus="$(cat /sys/class/power_supply/axp20x-battery/status)" +[ "$batteryStatus" = "Charging" ] && batteryIcon="🔌" || batteryIcon="🔋" + +time="$(date "+%H:%M")" + +notify-send "$(hostname)" "$batteryIcon ${battery}%\nTime $time" + diff --git a/bin/.bin/toggleKeyboard b/bin/.bin/toggleKeyboard new file mode 100755 index 00000000..009a783f --- /dev/null +++ b/bin/.bin/toggleKeyboard @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if pidof svkbd-colemak || pidof svkbd-numbers; then + pkill "svkbd-*" +else + svkbd-colemak & disown +fi diff --git a/bin/.bin/volume b/bin/.bin/volume index 57e35039..d8eb5b4c 100755 --- a/bin/.bin/volume +++ b/bin/.bin/volume @@ -43,6 +43,7 @@ case "$1" in else amixer -q -D default sset Master toggle fi + ;; esac if type -p pulseaudio-ctl 2> /dev/null; then From c15b2a86450943a4f97a98a2966f9e21424ca5fb Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 4 Apr 2021 16:06:00 +0100 Subject: [PATCH 3/5] Changes to rofi config for menu system --- rofi/.config/rofi/themes/launchpad.rasi | 2 +- rofi/.config/rofi/themes/touch-dmenu.rasi | 18 ++++ rofi/.config/rofi/themes/volume.rasi | 107 ++++++++++++++++++++++ 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 rofi/.config/rofi/themes/touch-dmenu.rasi create mode 100644 rofi/.config/rofi/themes/volume.rasi diff --git a/rofi/.config/rofi/themes/launchpad.rasi b/rofi/.config/rofi/themes/launchpad.rasi index 77d6ab83..61e1fa48 100644 --- a/rofi/.config/rofi/themes/launchpad.rasi +++ b/rofi/.config/rofi/themes/launchpad.rasi @@ -69,7 +69,7 @@ inputbar { listview { background-color: @background-alt; - columns: 7; + columns: 3; lines: 4; spacing: 2%; cycle: false; diff --git a/rofi/.config/rofi/themes/touch-dmenu.rasi b/rofi/.config/rofi/themes/touch-dmenu.rasi new file mode 100644 index 00000000..c492b042 --- /dev/null +++ b/rofi/.config/rofi/themes/touch-dmenu.rasi @@ -0,0 +1,18 @@ + +configuration { + font: "iosevka 30"; + disable-history: false; + fullscreen: false; + hide-scrollbar: true; + sidebar-mode: false; +} + +@import "gruvbox-dark.rasi" + +window { + width: 90%; +} + +mainbox { + children: [ listview ]; +} diff --git a/rofi/.config/rofi/themes/volume.rasi b/rofi/.config/rofi/themes/volume.rasi new file mode 100644 index 00000000..4b497f2a --- /dev/null +++ b/rofi/.config/rofi/themes/volume.rasi @@ -0,0 +1,107 @@ +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: 500px; + location: east; + x-offset: -15px; + y-offset: 0px; +} + +listview { + lines: 3; + margin: 8px; + spacing: 8px; + cycle: true; + dynamic: true; + layout: vertical; +} + +mainbox { + background-color: @background; + children: [ inputbar, listview ]; +} + +prompt{ + text-align: center; + background-color: red; + position: center; + + horizontal-align: 0.5; +} + +inputbar { + children: [ prompt ]; + spacing: 0px; + background-color: @background; + text-color: @foreground; + expand: false; + horizontal-align: 0.5; + border: 0px; + border-radius: 0px; + border-color: @accent; + margin: 0px 0px 0px 0px; + padding: 0px; + position: center; + text-align: center; +} + +element { + background-color: @background-light; + text-color: @foreground; + orientation: vertical; + border-radius: 12px; +} + +element-text { + font: "iosevka 25"; + expand: true; + horizontal-align: 0.5; + vertical-align: 0; + margin: 10px 10px 33px 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; +} + From e03e97f832fa0ca16ec7acb3f11c33e64fa12287 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 4 Apr 2021 16:11:26 +0100 Subject: [PATCH 4/5] Sets wallpaper if ~/Pictures/wallpaper exists --- x/.xinitrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/.xinitrc b/x/.xinitrc index 570eb7c7..b513ed38 100644 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -33,6 +33,7 @@ xinput --list | grep -Ei 'ErgoDox EZ\s+id' | grep -oE 'id=[0-9]+' | type -p compton > /dev/null && exec /usr/bin/compton --config "$HOME/.config/picom/picom.conf" & #setbackground & #/usr/bin/nitrogen --restore & +[ -e $HOME/Pictures/wallpaper ] && type -p feh > /dev/null && feh --bg-fill $HOME/Pictures/wallpaper /usr/bin/systemctl --user start background.service [ -f /usr/lib/kdeconnectd ] && /usr/lib/kdeconnectd & [ -f /usr/bin/pactl ] && /usr/bin/pactl load-module module-switch-on-connect & @@ -45,6 +46,8 @@ if hostname | grep -q phone; then xrandr --output DSI-1 --mode 720x1440 --dpi 192 fi +dunst & + #greenclip daemon & #exec xrdb .Xresources #xbindkeys From 967e73f80668de39e109daca4aa5dae3684601fe Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 4 Apr 2021 16:16:02 +0100 Subject: [PATCH 5/5] Adds systemd scripts for hardware access and modem --- .gitignore | 1 + systemd/.config/systemd/user/monitorModem.service | 9 +++++++++ .../etc/systemd/system/pinephone-hardware-access.service | 9 +++++++++ 3 files changed, 19 insertions(+) create mode 100644 systemd/.config/systemd/user/monitorModem.service create mode 100644 systemd/ROOT/etc/systemd/system/pinephone-hardware-access.service diff --git a/.gitignore b/.gitignore index 4bf02c9d..48bd772d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ mutt/accounts/* /qutebrowser/.config/qutebrowser/autoconfig.yml /bin/.bin/pappy /systemd/.config/systemd/user/timers.target.wants/ +/systemd/.config/systemd/user/default.target.wants/ nvim/.config/nvim/.netrwhist remind/.local/share/remind/work.rem diff --git a/systemd/.config/systemd/user/monitorModem.service b/systemd/.config/systemd/user/monitorModem.service new file mode 100644 index 00000000..7f15d6f2 --- /dev/null +++ b/systemd/.config/systemd/user/monitorModem.service @@ -0,0 +1,9 @@ +[Unit] +Description=Monitor Modem + +[Service] +Environment="PATH=/usr/bin:/usr/local/bin:/home/jonathan/.bin:/home/jonathan/.bin/modem:/home/jonathan/.bin/dmenu" +ExecStart=/home/jonathan/.bin/modem/monitorModem + +[Install] +WantedBy=default.target diff --git a/systemd/ROOT/etc/systemd/system/pinephone-hardware-access.service b/systemd/ROOT/etc/systemd/system/pinephone-hardware-access.service new file mode 100644 index 00000000..52d47b88 --- /dev/null +++ b/systemd/ROOT/etc/systemd/system/pinephone-hardware-access.service @@ -0,0 +1,9 @@ +[Unit] +Description=Enable user access to pinephone hardware kernel interface + +[Service] +Type=oneshot +ExecStart=/bin/bash -c 'for i in /sys/module/8723cs/parameters/rtw_scan_interval_thr /sys/devices/platform/backlight/backlight/backlight/brightness /sys/power/state /sys/devices/platform/soc/1f00000.rtc/power/wakeup /sys/power/mem_sleep /sys/bus/usb/drivers/usb/unbind /sys/bus/usb/drivers/usb/bind /sys/class/leds/red:indicator/brightness /sys/class/leds/blue:indicator/brightness /sys/class/leds/green:indicator/brightness /sys/class/leds/white:flash/brightness /dev/rtc0 /sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp221-pek/power/wakeup /sys/class/wakeup/*; do [ -e "$i" ] && chmod a+rw "$i" >> /tmp/log 2>&1; done' + +[Install] +WantedBy=multi-user.target