ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

Synergy-core 如何用 deskflow-client 命令行参数连接服务器并设置 --invert-scroll 滚动方向

2026/9/12 11:58:36 拓冰建站 浏览量
Synergy-core 如何用 deskflow-client 命令行参数连接服务器并设置 --invert-scroll 滚动方向 Synergy-core 如何用 deskflow-client 命令行参数连接服务器并设置 --invert-scroll 滚动方向【免费下载链接】synergy-coreShare a single keyboard and mouse between multiple computers.项目地址: https://gitcode.com/GitHub_Trending/sy/synergy-coreSynergy-coreDeskflow 上游代码库中除了图形界面入口deskflow之外还有一个独立的客户端二进制deskflow-client可以在不经过 GUI 的情况下用命令行参数指定服务器地址、以独立客户端身份加入鼠标键盘共享网络。本文的任务是用deskflow-client的连接参数连上已运行的服务器并在客户端本机反转滚轮方向--invert-scroll。适用前提服务器上已有一台机器运行着 Deskflow 服务端客户端机器上已有所需平台的deskflow-client可执行文件预构建版本或自行编译产物。准备拿到 deskflow-client 二进制deskflow-client的目标名由构建配置固定为deskflow-client见 Definitions.cmake入口源码在 deskflow-client.cpp内部通过 ClientApp 完成参数解析与启动。如果手上没有预构建版本可以按 BUILD.md 从源码编译。该流程会安装构建依赖并执行 CMake 配置与编译属于本地构建操作只影响当前机器的构建环境# Linux / macOS / BSD 系安装依赖Windows 用 python scripts/install_deps.py ./scripts/install_deps.sh # 配置 cmake -B build # 编译 cmake --build build -j8编译完成后运行测试可选./build/bin/unittests、./build/bin/integtestsBUILD.md 给出的运行入口是./build/bin/deskflowGUI客户端二进制位于同一build/bin目录Linux 下会安装到bin见 CMakeLists.txt。客户端连接参数一览以下描述均取自 ClientApp.cpp 中--help输出的用法说明解析逻辑在 ArgParser.cpp参数文档中的说明server-address必选的位置参数服务器地址形式为[hostname][:port]端口缺省时使用默认端口24800定义于 protocol_types.h--invert-scrollinvert scroll direction on this computer在本机反转滚动方向--yscroll deltadefines the vertical scrolling delta, which is 120 by default定义垂直滚动增量默认 120--address address/-alocal network interface address本机使用的网络接口地址--sync-languageenable language synchronization启用语言同步--hostact as a host; invert server/client mode and listen instead of connecting反转服务端/客户端模式改为监听而非主动连接-n, --name name屏幕名。默认取本机主机名见 ArgParser.cpp需要与服务器配置文件中section: screens里声明的屏幕名对应服务器配置格式可参考 deskflow.conf.example-d, --debug level/-l, --log file调整日志级别 / 指定日志文件-f, --no-daemon不以后台守护进程方式运行默认会 daemon 化-h, --help/--version打印用法后正常退出 / 打印版本后退出平台相关选项Windows 下支持--exit-pause、--stop-on-desk-switchX11 构建下支持--display display、--no-xinitthreadsWayland 场景下客户端默认使用 libei见 ClientApp.cpp可用--no-libei关闭。主路径连接服务器并反转滚动方向最短命令是把服务器地址作为位置参数传入--invert-scroll加在同一命令行即可# server-address 替换为服务器机器的地址形式 [hostname][:port] deskflow-client server-address --invert-scroll排查阶段建议加-f前台运行避免 daemon 化后看不到日志和-l写日志文件--yscroll仅在需要覆盖默认滚动增量 120 时使用# server-address 替换为服务器地址log-file 替换为你希望写入的日志路径 deskflow-client -f -l log-file server-address --invert-scroll两个参数的作用与内部落点--invert-scroll将 ClientArgs.h 中m_clientScrollDirection从默认的SERVER置为INVERT_SERVERArgParser.cpp随后在创建客户端屏幕时传给平台屏幕实现ClientApp.cpp 的createScreen使本机滚动方向与服务器方向相反。--host与本任务相反它让客户端转为监听模式而不是主动连接除非明确要反转主从角色否则不要加。结果验证与报错判断命令行本身可以按以下方式核对deskflow-client --help应打印上面列出的用法文本并正常退出可用来核对当前构建支持哪些平台选项。忘记传服务器地址时ArgParser.cpp 会报错并退出deskflow-client: a server address or name is required。传了拼写错误或不支持的选项时报deskflow-client: unrecognized option option选项缺参数值时报deskflow-client: missing arguments for option。参数解析行为有单元测试佐证ClientArgsParsingTests.cpp 中parseClientArgs_setInvertScroll断言传入--invert-scroll后m_clientScrollDirection INVERT_SERVER。连接成功与否以客户端接入服务器后的实际表现为准help 文本对该参数的定义是invert scroll direction on this computer即客户端机器上的滚动方向相对服务器方向被反转滚动增量仍由--yscroll默认 120控制。已知限制Windows 下--daemon不受支持解析器会直接报错并提示改用服务方式安装the --daemon argument is not supported on windows. instead, install deskflow-client as a service (--service install)ArgParser.cpp。Linux 上--enable-drag-drop会被解析器显式忽略并记录ignoring --enable-drag-drop, not supported on linux.。--invert-scroll影响的是客户端本机滚动方向滚动增量、语言同步等仍是独立参数互不替代。图形界面上的滚动方向设置与此参数等价GUI 侧勾选 invert scroll direction 后CoreProcess.cpp 拼装启动参数时同样会追加--invert-scroll命令行路径可以视为其等价的手动操作。相关源码与文档用法与帮助文本src/lib/deskflow/ClientApp.cpp参数解析src/lib/deskflow/ArgParser.cpp客户端参数结构src/lib/deskflow/ClientArgs.h客户端入口src/apps/deskflow-client/deskflow-client.cpp服务器配置示例doc/deskflow.conf.example构建流程BUILD.md【免费下载链接】synergy-coreShare a single keyboard and mouse between multiple computers.项目地址: https://gitcode.com/GitHub_Trending/sy/synergy-core创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考