Skip to content

Instantly share code, notes, and snippets.

@premek
Created December 1, 2018 17:29
Show Gist options
  • Save premek/049e1f8236fa19983ecd78f06d6038a3 to your computer and use it in GitHub Desktop.
Save premek/049e1f8236fa19983ecd78f06d6038a3 to your computer and use it in GitHub Desktop.
A script to read SMSes via kdeconnect DBUS interface
#!/usr/bin/env bash
DEV=`dbus-send --print-reply --dest=org.kde.kdeconnectd /modules/kdeconnect/devices org.freedesktop.DBus.Introspectable.Introspect | sed -n 's/.*node name="\(.*\)".*/\1/p'`
DATE=`date +'%d-%m-%Y'`
SMS="`dbus-send --print-reply --dest=org.kde.kdeconnectd /modules/kdeconnect/devices/$DEV org.kde.kdeconnect.device.conversations.activeConversations | grep -A3 "Operace ze dne $DATE" | sed 's/.*string "\|"$//'`"
echo $SMS
CODE=`echo $SMS | sed -ne 's/.* \([0-9]\{5,\}\) .*/\1/gp'`
echo $CODE | xclip
echo copied: $CODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment