Skip to content

☎️ Interface with HFP capable Bluetooth devices from inside Emacs

License

Notifications You must be signed in to change notification settings

27justin/ephone.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

ephone.el

Control the telephony stack of your smartphone from inside Emacs via ofono and Bluetooth.

Features

  • Hangup calls & and dial phone-numbers.
  • Answer incoming calls.
  • Hooks for various actions.
  • tel: Org-links
  • Supports multiple phones.
  • Supports multiple HCI Bluetooth controllers.

Demo

demo.mp4

Installation

INFO: Please make sure you have both D-BUS and ofonod installed and running before following along.

You can install ephone.el through git:

git clone https://github.com/27justin/ephone.el ~/.emacs.d/site-lisp/ephone.el

Then add the path to your load-path and (require) the package.

(add-to-list 'load-path "~/.emacs.d/site-lisp/ephone.el")
(setq ephone-periodic-scan t)
(setq ephone-scan-interval "3 min")
(setq ephone-periodic-scan-break-after-found t)
(require 'ephone)
(ephone--attach-dbus-hooks)

NOTE: About ephone-periodic-scan / ephone-scan-interval.

ephone.el queries the ofono D-Bus once during ephone--attach-dbus-hooks, given this, ephone.el won’t properly attach to any device you connect **after** loading the plugin.

To circumvent this, you can either manually run M-x ephone/scan RET after connecting your phone, or facilitate the given variables.

When ephone-periodic-scan is t, ephone.el sets up a timer running every ephone-scan-interval (default 3 min), this timer will automatically call ephone/scan for you to make sure your phone keeps / gets connected to the Emacs hooks.

Additionally you may also set ephone-periodic-scan-break-after-found to t, with this ephone.el will also automatically remove it’s perodic-scan timer after attaching to one device.

After which you can re-evaluate your config, or restart Emacs.

Usage

ephone.el’s interactive functions are prefixed with ephone/.

Here an overview of said functions.

(ephone/dial "<number>")
(ephone/dial-last-number)
(ephone/hangup) ;; Also used to reject incoming calls.
(ephone/answer)
(ephone/scan)   ;; Re-fetch & attach devices from ofono

Some other non-interactive functions you might want to use.

(ephone/get-phone-number) ;; Returns the Phone-number of the active call as a string,
                          ;; or nil

Hooks

ephone.el provides the following hooks

ephone-call-hook   ;; Runs when a call is either started or received.
ephone-hangup-hook ;; Runs when a call is ended.

Examples

Open a Capture-Buffer on incoming calls

A prominent use-case may be clocking out of the current org-task and starting a capture buffer whenever a call is received, or started.

(add-to-list 'org-capture-templates ("p" "Call" entry
    (file+headline "~/org/TASKS.org" "Calls")
    "* %T %(ephone/get-phone-number)\n    %?"
    :clock-resume t :clock-in t))
(defun capture-received-call ()
    (org-capture nil "p"))
(add-hook ephone-call-hook #'capture-received-call)

Store HTML tel: inside org and immediately call them

Another fairly useful feature are tel: org-links, with similar semantics to the href Attribute on HTML <a>-tags for those familiar. Running C-c C-o / org-open-at-point on these links will run ephone/dial with the given number.

About

☎️ Interface with HFP capable Bluetooth devices from inside Emacs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published