背景
家里有台破旧的笔记本,为了让它继续发光发热,打算安装Debian系统配置开发环境;十年前的笔记本改装后依然可以开发诸如PHP或python之类不需要编译的项目。笔者的工作本是mbp, 两台笔记本开发时总是来回切换鼠标键盘比较麻烦,因此需要通过mbp操作旧版笔记本。
synergy是一个跨平台软件,可以通过一套键鼠操作多个不同系统主机的软件;同类型的还有微软推出的无界
软件,不过该软件仅限Windows平台操作。
synergy分为收费版和开源版本,开源版本是命令行操作(无GUI),满足基本操作。
构建
下载源码
1
2
3
4
5git clone https://github.com/symless/synergy-core.git
cd synergy-core
git checkout v2.0.0-stable配置编译(MacOS)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21// 依赖qt, 如果没有安装可以brew install qt
// 查看qt安装目录
brew info qt
// 设置Cmake环境变量
export CMAKE_PREFIX_PATH="/usr/local/Cellar/qt/5.15.0/Frameworks/"
// 设置构建make文件目录
mkdir build && cd build
// 注意big sur版本的sdk版本是11.0.sdk
cmake -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES=x86_64 ..
// 编译
make
// make成功后生成三个二进制文件,其中synergy-core是核心文件,其他两个是旧版本程序
synergy-core
synergyc
synergys配置编译(Debian)
1
2
3
4
5
6
7
8git clone https://github.com/symless/synergy-core.git
cd synergy-core
git checkout v2.0.0-stable
mkdir build
// Debian8版本的cmake需要升级
cmake ..
makesynergy配置示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51// server.conf
// 配置参考: https://github.com/symless/synergy-core/wiki/Text-Config
# sample synergy configuration file
#
# comments begin with the # character and continue to the end of
# line. comments may appear anywhere the syntax permits.
# +----------+ +---------+ +---------+
# | mac-mini | | macbook | | windows |
# | | | | | |
# +----------+ +---------+ +---------+
section: screens
# three hosts named: mac-mini, macbook, and windows
# These are the nice names of the hosts to make it easy to write the config file
# The aliases section below contain the "actual" names of the hosts (their hostnames)
debian:
macbook:
windows:
end
section: links
# windows is to the right of macbook
# mac-mini is to the left of macbook
macbook:
right(0,100) = windows # the numbers in parentheses indicate the percentage of the screen's edge to be considered active for switching)
left = debian
# shift = shift (shift, alt, super, meta can be mapped to any of the others)
# macbook is to the right of mac-mini
debian:
right = macbook
# macbook is to the left of windows
windows:
left = macbook
end
section: aliases
# The "real" name of windows is John-Smiths-windows-3.local.
# If we wanted we could remove this alias and instead use John-Smiths-windows-3.local everywhere windows is above.
# Hopefully it should be easy to see why using an alias is nicer
macbook:
mbp
debian:
debian.local
end
section: options
switchDelay = 400 # 鼠标滑到边缘时,提留多久才能切换屏幕
clipboardSharing = true # 共享剪切板
end
运行
笔者采用mbp作为服务端控制Debian系统操作,需要注意的是mac环境运行软件需要设置给iterm配置权限(iterm终端执行synergy)
未配置权限报错:
1 | error failed to create quartz event tap |
mac环境权限配置: 系统偏好设置 -> 安全性与隐私 -> 辅助功能 -> iterm.app允许
- 服务端(mbp)
1
2// address参数代表服务端主机IP地址
sudo ./synergy-core --server --address 192.168.1.100 --no-daemon --name macbook --config ./server.conf - 客户端(Debian)
1
sudo ./synergy-core --client --no-daemon --name debian 192.168.1.100
操作
操作mbp的触摸板移动到屏幕外时会进入到Debian系统屏幕中,同一局域网中操作流畅,没有卡顿现象。
如果Debian为server端操作mbp时会导致鼠标移动到mbp屏幕时点击无效情况。
参考
1、[Synergy-core编译使用教程] https://segmentfault.com/a/1190000023512582
2、[synergy文档] https://github.com/symless/synergy-core/wiki/Compiling
3、[cmake官网] https://cmake.org/download/