[Share Experiences] 跨平台共享使用鼠标和键盘【Barrier】安装记
Tofloor
poster avatar
weboob
deepin
2022-06-29 22:09
Author

相信有许多小伙伴有过同时使用几台机器的经历,有些可能还跨系统[WIN/MAC/Linux]。
以前使用的synergy,后来收费了,github有大神重写了一个开源版Barrier
目前源内版本不是最新的

barrier/未知 2.1.2+dfsg-1+rb2 amd64
Share mouse, keyboard and clipboard over the network

闲来无事就自己安装了最新版,小白一个,安装过程与君共勉。


Barrier 安装过程记录

安装遇到很多问题,现在记录自己正确的方式,其他问题可见参考文献

- 系统:Deepin 20.6
- Barrier:relaese2.4.0(2022-6-29)

一、准备工作( 源码 + 安装环境 )

github只提供MAC/WIN的安装文件,linux下只有源码

  1. 下载barrier源码
git clone https://github.com/debauchee/barrier.git
  1. 下载编译用到的补丁包(googletest + filesystem)
git clone https://github.com/google/googletest.git

将本下载中的googlemockgoogletest中的文件,分别放入barrier目录下的ext/gmockext/gtest下(注意是文件夹里面的文件,不是文件夹整个放进去)

参考文献1

git clone https://github.com/gulrak/filesystem.git

将下载的filesystem中的include文件夹放到barrier/ext/gulrak-filesystem下面

  1. 安装依赖库
sudo apt-get install libcurl4-openssl-dev libavahi-compat-libdnssd-dev libxtst-dev qtbase5-dev

参考文献2

文章中的git submodule update --init就是下载前文ext中放入的文件。我的网络有问题,直接github下载了。

二、编译安装

在barrier目录下执行:

$ bash clean_build.sh

成功后显示:

......
[ 98%] Building CXX object src/gui/CMakeFiles/barrier.dir/src/ZeroconfService.cpp.o
[ 99%] Building CXX object src/gui/CMakeFiles/barrier.dir/src/ZeroconfThread.cpp.o
[ 99%] Building CXX object src/gui/CMakeFiles/barrier.dir/barrier_autogen/PNK5WDWK6L/qrc_Barrier.cpp.o
[100%] Linking CXX executable ../../bin/barrier
[100%] Built target barrier
Build completed successfully

生成的文件在:

barrier/build/bin/barrier

双击运行就可以了

关于软件的使用配置,请搜索相关资料。

后记(配置自启动)

  1. 安装到系统目录:(相对路径基于前文git的barrier目录,请自行拼接绝对路径,或cd到此路径)
$ mkdir /opt/barrier
# copy 执行文件
$ sudo cp ./build/bin/* /opt/barrier/
# copy 图标文件
$ sudo cp ./res/barrier.png /opt/barrier/
  1. 创建启动文件[.desktop]并加入启动器中:

启动器本质是一个路径:/usr/share/applications/

# 使用源码提供的desktop文件
$ sudo cp ./res/barrier.desktop /usr/share/applications/
# 修改启动文件路径和icon路径
$ sudo vim /usr/share/applications/barrier.desktop

更改这两项为如下值:

Exec=/opt/barrier/barrier
Icon=/opt/barrier/barrier.png

[.desktop]选项说明:

基础配置:

  1. Name: desktop 文件最终显示的名称(一定要注意和 desktop 文件名的区别)。
  2. Type: 用于指定 desktop 文件的类型(包括 3 种类型:Application、Link、Directory)。
  3. Exec: 用于指定二进制可执行程序的完整路径。

可选配置:

  1. Icon: 指定应用程序图标的完整路径(可以省略后缀名)。支持 png 格式、svg 格式等,推荐尺寸128x128
  2. 其他参数Comment,Terminal,Categories,Keywords请自行查阅资料

这样你的启动菜单中就有了

20220629133537-2022-06-29-13-35-37.png
可以右键设置自启动,或加入autostart目录

# copy 启动文件到自动启动目录
$ sudo cp /usr/share/applications/barrier.desktop ~/.config/autostart/

参考文献3

Reply Favorite View the author
All Replies
babyfengfjx
Super Moderator
CQA
2022-06-29 22:28
#1

哇噻,好使不?

先收藏!

Reply View the author
weboob
deepin
2022-06-30 01:17
#2
babyfengfjx

哇噻,好使不?

先收藏!

必须好使,主要是网上的usb线缆太贵了,好几百啊。
我本子deepin,公司win,相互之间复制文本还是可以的。其他文件走samba(性能拉胯的树莓派)

Reply View the author
xuqi
deepin testing team
2022-08-19 19:43
#3

smirk

Reply View the author
weboob
deepin
2022-08-20 18:30
#4
xuqi

smirk

呔,来着何人,为何这般羞涩!!!😛

Reply View the author
MMHMM
Moderator
2023-01-16 01:08
#5

Debian GNU/Linux 10 (buster) 安装方法:

sudo apt-get install barrier
Reply View the author
KimmyL
deepin
2023-11-23 20:28
#6

笔记本装v23,台式机装win11,只能用笔记本做服务端

Reply View the author
weboob
deepin
2023-11-29 17:41
#7
KimmyL

笔记本装v23,台式机装win11,只能用笔记本做服务端

盲猜防火墙问题,只要网络通一般没问题,跟系统相关的我只能想到这个

Reply View the author