KDEConnect

From KDE UserBase Wiki
Revision as of 11:03, 23 June 2021 by Coioidea (talk | contribs) (Created page with "* 把你的手机当作电脑的遥控器")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

什么是 KDE Connect?

KDE Connect 是一个能够让你的各种设备交互通信的方案。 这里有一些 KDE Connect 能做的事:


  • 在电脑上接收手机通知并回复消息
  • 在手机端控制电脑播放音乐
  • 把你的手机当作电脑的遥控器
  • 从连接的设备在你的电脑上运行预定义的命令。更多细节请见命令示例。
  • 在电脑上查看你的手机的电量
  • 通过响铃来寻找手机
  • 在设备之间分享文件和链接
  • 在电脑上浏览你的手机
  • 用你的手机控制桌面音量
  • 从你的电脑上发短信

安装

你将会在你的发行版仓库中找到 KDE Connect 桌面组件的软件包。如果没有,你可以要求他们把它打包。

尽管普遍存在误解,你可以在所有的桌面环境中使用 KDE Connect 。由于大多数开发者都在使用Plasma,所以可能会出现某个功能在其他桌面环境下损坏或无法使用的情况。在这种情况下,请提交一份 错误报告 。有多种方法可以在非Plasma桌面上增强KDE Connect的体验。如果你是一个GNOME用户,你可能更喜欢 indicator-kdeconnect ,一个GNOME shell扩展。对于支持AppIndicator的桌面(Budgie、Cinnamon、LXDE、Pantheon、Unity)可以使用 indicator-kdeconnect

Android 版应用程序可以在 Google Play 应用商店 和开源应用商店 F-Droid 中找到。

2014年,尽管有一些针对 iOS 的 KDE Connect 客户端开发(见源代码),但由于我们的经验和各种技术和组织因素,最近不太可能有官方的 iOS 支持。

KDE Connect 也可以在 sailfish connect 上使用,我们正在努力使它搭载到其他基于Linux的手机上(Plasma Mobile, PostmarketOS等)。

查看 KDE Connect 下载页


概览

这是 KDEConnect 的文档页面。在这里你会看到社区页面 [1] ,它解释了什么是 KDEConnect 以及如何安装它。

KDE Connect 由两部分组成。桌面程序和手机应用程序。

设备配对

首先,你需要在你的电脑手机上打开 KDE Connect。现在你应该能在每个屏幕上看到你希望配对的设备名称。如果这无效,请确保这两台设备连接到了同一个网络,并且没有任何防火墙阻止这两台设备互相看到对方。参见故障排除部分。

现在你可以在任意一台设备上请求配对。另一台设备将显示一个提示,要求接受配对请求。点击确认就可以了! 你的设备现在已经配对了。

尽管典型的配置会是一台电脑和一部手机,但也可以用两台电脑来代替。

浏览器集成

Plasma Browser Integration makes KDE Connect even more powerful. It allows you to control content from e.g. Youtube or Netflix from your phone and send browser tabs to your phone. Despite the name, it can also be used on non-Plasma desktops.

改变设备名

你只能在一台设备上改变这台设备的名称。所以,如果你想改变你电脑的设备名,你必须使用桌面程序,如果你想改变你的手机或平板电脑的名称,你必须在 KDE Connect APP 中进行更改。一旦某个设备被重命名,它将自动与所有连接的设备同步。

通过 OpenVPN 运行 KDE Connect

There may be a variety of reasons for using KDE Connect with a VPN. Maybe you have left home and want to run a command, or maybe you’re on a public wifi network where your devices aren’t allowed to communicate and you want to use the remote control to give a presentation.

设置 OpenVPN

If you have your own server with a public-facing IP address, you can set up OpenVPN yourself. It is not the easiest piece of software to set up, but by following a setup tutorial such as this one, you should be able to manage: https://openvpn.net/howto.html

In order to allow UDP broadcast packets, which are what KDE Connect uses to automatically discover two devices, OpenVPN needs to be set up for bridging (TAP device). If you use a tun device, you can still manually connect by IP address.

If you want to rent a pre-configured OpenVPN service rather than set up your own, it should work, but the same considerations about the server settings need to be taken into account.

Once the server is running, you can use the official OpenVPN client to connect the desktop to the server. There is no official OpenVPN client for Android, but the OpenVPN for Android client works well: https://play.google.com/store/apps/details?id=de.blinkt.openvpn

Once both devices are connected, test that they are able to communicate over the VPN by trying to do a network ping between them.

配置 KDE Connect

如果 OpenVPN 实例已经设置好桥接(bridging),KDE Connect 应该能像在局域网中一样运行。

If you are using OpenVPN with a tun device, you will have to manually add your devices by IP. Then, once you connect to the VPN, KDE Connect should automatically detect your device and either connect or be ready for pairing!

可用插件

电量显示

"在你电脑电量旁显示手机电量"

启用它,KDE Connect组件将会在系统托盘显示你的手机电量

剪贴板

"在设备间分享剪贴板"

With this, you can simply copy text from your computer and it will be immediately available to paste on your phone, and vice-versa. This does not work with images though.

Inhibit Screensaver

"Inhibit the screensaver when the device is connected."

This makes sure that your screensaver will not run while your device is connected.

多媒体控制

"远程控制音乐和视频"

With this feature, you can control your music and videos remotely, with pause/play, previous/next, 5 s before/later. You can also change which media player to control, in addition to application and system volume.

在Android中使用KDE Connect的多媒体控制器
在Android中使用KDE Connect的多媒体控制器

Pause Media During Calls

"Pause music/videos during a phone call."

Pause music/videos during a call. This feature can be powerful when combined with Plasma Browser Integration. For example, when you are listening to some music on Peertube or Youtube, the video will be paused whenever you receive a call.

You can configure this option to pause only when you pick up your phone or directly when your phone starts to ring. You can also decide if you want to only pause the media player or/and mute the system sound.

发送 Ping

"发送和接受 ping."

This serves to test your connection to a given device. Once selected, a "Ping!" will appear as a notification on your receiving device.

On your desktop, you can send a ping through the KDE Connect settings or through the widget on the tray.

On your phone, you can send a ping through the upper right hamburger menu on the KDE Connect app.

在Android上给电脑发送ping
在Android上给电脑发送ping

接收应用通知

"在电脑上接收并同步手机通知"

This keeps you in touch with what happens on your phone! Any notifications you receive on your phone will be shown in your computer. Some notifications, such as those of Instant Messengers (IM) like Telegram can be replied on the fly through the computer notification itself.

Remote File System Browser

"Browse the remote device filesystem using SFTP."

This allows you to access your phone storage! When enabled, a device will appear in Dolphin with which you can navigate your external storage.

控制手机响铃

"通过响铃寻找手机"

This also serves to test your connection to a given device, and by ringing your phone remotely, you can quickly find its location!

Run Commands

"Execute console commands directly."

With KDE Connect, you can run predefined commands on your computer by pressing buttons on your phone! Instructions on how to add a command are shown in userbase. A set of useful commands can also be found here. Some sample commands, such as suspend and lock screen, are also available.

Send Notifications

"Broadcast this computer's notifications, so they can be shown on other devices."

This is pretty self-explanatory: notifications from your computer will show up on your phone.

You can configure if you want to send the notification description, the icons pertaining to the application and persistent or very important notifications. This keeps you in touch with what happens on your computer! Any notifications you receive on your computer will be shown in your phone.

Share and Receive

"Receive and send files, URLs or plain text easily."

This integrates your desktop and your browser so that you can right-click on files or links and send it immediately to your phone!

Files show the right-click option "Send to phone via KDEConnect" and will send the file directly, showing it among your notifications.

Links show the right-click option "Open on phone" and will automatically open your phone's default browser on the chosen website. Really handy!

When receiving files from your phone into your computer, they will go to your Downloads folder by default. If you wish, you can change that too.

Telephone Integration

"Show notifications for incoming calls."

Whenever you get a call on your phone, a notification telling you which number is calling appears. Paired with "Pause media during calls", you'll surely be able to answer readily and never lose a call!

Virtual Input

"Use your phone as a touchpad and keyboard."

With this enabled, by going to your phone app and selecting Remote input, a touch screen will immediately be available for you to control your computer mouse, similarly to a touchpad. One touch equals one click.

The keyboard icon in the upper right allows you to type on your phone and see the result on your computer too.

If you press the hamburger menu right by its side, you'll be able to send right and middle clicks.

Presentation control

It is possible to control presentations using the previous/next slide button. When the device is locked, you can use the volume up/down button to do that. You can also highlight something using the laserpointer. Just move your phone and the blue circle will follow! Using the hamburger menu, you can toggle fullscreen (F5) or quit the presentation (Esc).

Troubleshooting

I have two devices running KDE Connect on the same network, but they can't see each other

KDE Connect uses dynamic ports in the range 1714-1764 for UDP and TCP. So if you are behind a firewall, make sure to open this port range for both TCP and UDP. Otherwise, make sure your network is not blocking UDP broadcast packets.

ufw

If your firewall is ufw, you can open the necessary ports with:

sudo ufw allow 1714:1764/udp
sudo ufw allow 1714:1764/tcp
sudo ufw reload

firewalld

If your firewall is firewalld, you can open the necessary ports with:

sudo firewall-cmd --zone=public --permanent --add-port=1714-1764/tcp
sudo firewall-cmd --zone=public --permanent --add-port=1714-1764/udp
sudo systemctl restart firewalld.service

Firewall Configuration (firewall-config)

Open Firewall Configuration (firewall-config). In ZonesServices, check the kde-connect service.

Make sure you choose the "Permanent" Configuration: option in the drop-down menu at the top, otherwise rebooting will discard your settings changes.

iptables

If your firewall is iptables, you can open the necessary ports with:

sudo iptables -I INPUT -i <yourinterface> -p udp --dport 1714:1764 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -I INPUT -i <yourinterface> -p tcp --dport 1714:1764 -m state --state NEW,ESTABLISHED -j ACCEPT

sudo iptables -A OUTPUT -o <yourinterface> -p udp --sport 1714:1764 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -o <yourinterface> -p tcp --sport 1714:1764 -m state --state NEW,ESTABLISHED -j ACCEPT

KDE Connect crashes or restarts when trying to pair with another device

Sometimes, a corrupt config file may cause KDE Connect to crash when trying to pair with a device. In that case, deleting the config ~/.config/kdeconnect might help.

Can I run KDE Connect without a display server?

Yes, you can pass the command line argument `-platform offscreen` to the daemon (eg: `killall -9 kdeconnectd; /usr/lib/libexec/kdeconnectd -platform offscreen`)

GSConnect

GSConnect is an independent project which implements the KDE Connect protocol into GNOME and uses the same Android app. If you are running GSConnect, please visit that project's GitHub page first for support. If you and the GSConnect team determine the issue is the Android app or protocol, feel free to report those in the KDE Connect bug tracker.

列表中没有我遇到的问题 :(

如果你想提交并报告一个BUG,你可以在KDE bug tracker 报告。