kdeconnect.el is a package that provides helper functions for the excellent KDE Connect package available for computers and Android devices. Now you can send files across devices or make your phone ring when you can’t find the darn thing, all without ever leaving Emacs!
New in 1.3.0: configuring devices has changed. See the Setup section for how to list (and now label!) your devices.
Install KDE Connect on your Android device(s) using F-Droid or the Google Play Store. Also install it on any computers you want. As of this writing, KDE Connect requires Linux, and is probably in your distro’s repos already. It does not require KDE. Pair your devices from these applications.
Install the Emacs package (available in MELPA) and add (require 'kdeconnect)
to your init.el
file.
You will need to add the IDs of any devices you wish to use.
If you don’t already know these, call M-x kdeconnect-list-devices
and check your *Messages*
buffer or use M-x kdeconnect-update-kdeconnect-devices
to fill the list with new devices.
Set kdeconnect-devices
in your init.el
to be the NAME and IDs of your device(s), like so:
(setq kdeconnect-devices '(("My cellphone" . "ef72819a8db1e193")
("My tablet" . "ff172817910b1bc5")
("My car" . "_2cd7dfcd_7260_22dd_6658_9aa2760b8275_")))
Before calling any functions that interact with a specific device, you must set the active device, even if you only have one device ID in kdeconnect-devices
.
There are two ways to do this.
You can set a default device by adding
(setq kdeconnect-active-device '("<name>" . "<device ID>"))
to your init.el
file.
When you load Emacs and call a function like kdeconnect-ping, that device will be the target.
If you do not set a default or wish to update your active device for the session, call M-x kdeconnect-select-active-device.
After selecting an active device, the following functions are available.
Function | Description |
---|---|
kdeconnect-update-kdeconnect-devices | Update the list stored in kdeconnect-devices with new devices |
kdeconnect-get-active-device | Display the active device |
kdeconnect-list-devices | Display all visible devices, even unavailable ones |
kdeconnect-ping | Send a notification to the active device |
kdeconnect-ping-msg | Send a notification with a custom message to the active device |
kdeconnect-refresh | Scan the network and refresh any available connections |
kdeconnect-ring | Make the active device ring (useful for finding it) |
kdeconnect-select-active-device | Select the active device from kdeconnect-devices |
kdeconnect-send-file | Send the selected file to the active device |
kdeconnect-send-text | Send text to the active device |
kdeconnect-send-text-region-or-prompt | Interactively send text from active region, or prompt |
kdeconnect-send-sms | Send an SMS to the specified destination |
If you’re not seeing any response from your desired device, make sure there is an active connection.
You can invoke M-x kdeconnect-refresh
to scan the network and refresh and available connections to your devices.
You can use M-x kdeconnect-list-devices
or open up KDE Connect to make sure that your desired devices are actually available.