refactor(Settings): move switchDelay to general settings
This commit is contained in:
parent
488d620b3b
commit
ea8f3881fe
8 changed files with 23 additions and 28 deletions
|
|
@ -151,6 +151,7 @@ This section contains options used when in server mode it will begin with `[serv
|
|||
| gridWidth | int | Width of the server's intenal grid used for the computer layout (default: 5) |
|
||||
| heartbeat | int | The server will expect each client to send a message no less than every `N` milliseconds. If no message arrives from a client within `3N` seconds the server forces that client to disconnect. If deskflow fails to detect clients disconnecting while the server is sleeping or vice versa, try using this option. |
|
||||
| protocol | `barrier` or `synergy` | The protocol to use when saying hello to clients. Can be set to barrier or synergy. If not set barrier is used as the default |
|
||||
| switchDelay | int | Deskflow won't switch computers when the mouse reaches edge of a computer unless it stays on the edge for `N` milliseconds. This helps prevent unintentional switching when working near an edge. (default: 250)|
|
||||
| xdpRestoreToken | UUID | Restore token provided by XDG portals |
|
||||
|
||||
### InternalConfig
|
||||
|
|
@ -277,7 +278,6 @@ switchCornerArray\3\switchCorner=false
|
|||
switchCornerArray\4\switchCorner=false
|
||||
switchCornerArray\size=4
|
||||
switchCornerSize=0
|
||||
switchDelay=250
|
||||
switchDoubleTap=250
|
||||
win32KeepForeground=false
|
||||
```
|
||||
|
|
@ -390,7 +390,7 @@ Note that links do not have to be symmetrical; for instance, here the edge betwe
|
|||
|
||||
```
|
||||
section: options
|
||||
switchDelay = 500
|
||||
name = value
|
||||
end
|
||||
```
|
||||
|
||||
|
|
@ -400,7 +400,6 @@ end
|
|||
|:--------|:-----------:|:-----------|
|
||||
|switchCorners | none top-left top-right bottom-left bottom-right left right top bottom all | Deskflow won't switch computers when the mouse reaches the edge of the computer if it's in a listed corner. The size of all corners is given by the `switchCornerSize` option. The first name in the list is one of the above names and defines the initial set of corners. Subsequent names are prefixed with + or - to add the corner to or remove the corner from the set, respectively. For example: `all -left +top-left` starts will all corners, removes the left corners (top and bottom) then adds the top-left back in, resulting in the top-left, bottom-left and bottom-right corners.|
|
||||
|switchCornerSize | integer (N) | Sets the size of all corners in pixels. The cursor must be within `N` pixels of the corner to be considered to be in the corner.|
|
||||
|switchDelay | integer| Deskflow won't switch computers when the mouse reaches edge of a computer unless it stays on the edge for `N` milliseconds. This helps prevent unintentional switching when working near an edge.|
|
||||
|switchDoubleTap| integer(N) | Deskflow won't switch computers when the mouse reaches the edge of a computer unless it's moved away from the edge and then back to the edge within `N` milliseconds. With the option you have to quickly tap the edge twice to switch. This helps prevent unintentional switching when working near the edge.|
|
||||
|screenSaverSync| `true` or `false`| ''Note: Removed in v1.14.1'' If set to ''false'' then Deskflow won't synchronize screen savers. Client screen savers will start according to their individual configurations. The server screen saver won't start if there is input, even if that input is directed toward a client computer.|
|
||||
|relativeMouseMoves| `true` or `false`| If set to ''true'' then secondary computers move the mouse using relative rather than absolute mouse moves when and only when the cursor is locked to the computer (by ''Scroll Lock'' or a configured hot key). This is intended to make Deskflow work better with certain games. If set to ''false'' or not set then all mouse moves are absolute.|
|
||||
|
|
@ -410,9 +409,6 @@ end
|
|||
|keystroke(key) | actions | Binds the ''key'' combination key to the given ''actions''. ''key'' is an optional list of modifiers (''shift'', ''control'', ''alt'', ''meta'' or ''super'') optionally followed by a character or a key name, all separated by + (plus signs). You must have either modifiers or a character/key name or both. See below for `valid key names` and `actions`. Keyboard hot keys are handled while the cursor any computer. Separate actions can be assigned to press and release.|
|
||||
|mousebutton(button) | actions| Binds the modifier and mouse button combination ''button'' to the given ''actions''. ''button'' is an optional list of modifiers (''shift'', ''control'', ''alt'', ''meta'' or ''super'') followed by a button number. The primary button (the left button for right handed users) is button 1, the middle button is 2, etc. Actions can be found below. Mouse button actions are not handled while the cursor is on the server. You cannot use these to perform an action while on the server. Separate actions can be assigned to press and release.|
|
||||
|
||||
|
||||
You can use both the ''switchDelay'' and ''switchDoubleTap'' options at the same time. Deskflow will switch when either requirement is satisfied.
|
||||
|
||||
##### Actions
|
||||
|
||||
Actions are two lists of individual actions separated by commas. The two lists are separated by a '';'' (semicolon). Either list can be empty and if the second list is empty then the semicolon is optional. The first list lists actions to take when the condition becomes true (e.g. the hot key or mouse button is pressed) and the second lists actions to take when the condition becomes false (e.g. the hot key or button is released). The condition becoming true is called activation and becoming false is called deactivation. Allowed individual actions are:
|
||||
|
|
|
|||
|
|
@ -219,6 +219,9 @@ QVariant Settings::defaultValue(const QString &key)
|
|||
if (key == Server::Heartbeat)
|
||||
return 5000;
|
||||
|
||||
if (key == Server::SwitchDelay)
|
||||
return 250;
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public:
|
|||
inline static const auto GridWidth = QStringLiteral("server/gridWidth");
|
||||
inline static const auto Heartbeat = QStringLiteral("server/heartbeat");
|
||||
inline static const auto Protocol = QStringLiteral("server/protocol");
|
||||
inline static const auto SwitchDelay = QStringLiteral("server/switchDelay");
|
||||
inline static const auto XdpRestoreToken = QStringLiteral("server/xdpRestoreToken");
|
||||
};
|
||||
|
||||
|
|
@ -256,6 +257,7 @@ private:
|
|||
, Settings::Server::GridWidth
|
||||
, Settings::Server::Heartbeat
|
||||
, Settings::Server::Protocol
|
||||
, Settings::Server::SwitchDelay
|
||||
, Settings::Server::XdpRestoreToken
|
||||
};
|
||||
|
||||
|
|
@ -311,6 +313,7 @@ private:
|
|||
, QStringLiteral("internalConfig/protocol")
|
||||
, QStringLiteral("internalConfig/numColumns")
|
||||
, QStringLiteral("internalConfig/numRows")
|
||||
, QStringLiteral("internalConfig/switchDelay")
|
||||
};
|
||||
// clang-format on
|
||||
};
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ bool ServerConfig::operator==(const ServerConfig &sc) const
|
|||
return m_Screens == sc.m_Screens && //
|
||||
m_RelativeMouseMoves == sc.m_RelativeMouseMoves && //
|
||||
m_Win32KeepForeground == sc.m_Win32KeepForeground && //
|
||||
m_SwitchDelay == sc.m_SwitchDelay && //
|
||||
m_SwitchDoubleTap == sc.m_SwitchDoubleTap && //
|
||||
m_SwitchCornerSize == sc.m_SwitchCornerSize && //
|
||||
m_SwitchCorners == sc.m_SwitchCorners && //
|
||||
|
|
@ -97,7 +96,6 @@ void ServerConfig::commit()
|
|||
|
||||
settings().setValue("relativeMouseMoves", relativeMouseMoves());
|
||||
settings().setValue("win32KeepForeground", win32KeepForeground());
|
||||
settings().setValue("switchDelay", switchDelay());
|
||||
settings().setValue("switchDoubleTap", switchDoubleTap());
|
||||
settings().setValue("switchCornerSize", switchCornerSize());
|
||||
settings().setValue("defaultLockToScreenState", defaultLockToScreenState());
|
||||
|
|
@ -144,7 +142,6 @@ void ServerConfig::recall()
|
|||
|
||||
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
|
||||
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
|
||||
setSwitchDelay(settings().value("switchDelay", 250).toInt());
|
||||
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
|
||||
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
|
||||
setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool());
|
||||
|
|
@ -248,10 +245,6 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
|||
outStream << "\t"
|
||||
<< "clipboardSharingSize = " << config.clipboardSharingSize() << Qt::endl;
|
||||
|
||||
if (Settings::value(Settings::Server::EnableSwitchDelay).toBool())
|
||||
outStream << "\t"
|
||||
<< "switchDelay = " << config.switchDelay() << Qt::endl;
|
||||
|
||||
if (Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool())
|
||||
outStream << "\t"
|
||||
<< "switchDoubleTap = " << config.switchDoubleTap() << Qt::endl;
|
||||
|
|
|
|||
|
|
@ -48,10 +48,6 @@ public:
|
|||
{
|
||||
return m_Win32KeepForeground;
|
||||
}
|
||||
int switchDelay() const
|
||||
{
|
||||
return m_SwitchDelay;
|
||||
}
|
||||
int switchDoubleTap() const
|
||||
{
|
||||
return m_SwitchDoubleTap;
|
||||
|
|
@ -126,10 +122,6 @@ private:
|
|||
{
|
||||
m_Win32KeepForeground = on;
|
||||
}
|
||||
void setSwitchDelay(int val)
|
||||
{
|
||||
m_SwitchDelay = val;
|
||||
}
|
||||
void setSwitchDoubleTap(int val)
|
||||
{
|
||||
m_SwitchDoubleTap = val;
|
||||
|
|
@ -172,7 +164,6 @@ private:
|
|||
private:
|
||||
bool m_RelativeMouseMoves = false;
|
||||
bool m_Win32KeepForeground = false;
|
||||
int m_SwitchDelay = 0;
|
||||
int m_SwitchDoubleTap = 0;
|
||||
int m_SwitchCornerSize = 0;
|
||||
bool m_DefaultLockToScreenState = false;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ void ServerConfigDialog::accept()
|
|||
Settings::setValue(Settings::Server::EnableHeatbeat, m_enableHeartbeat);
|
||||
Settings::setValue(Settings::Server::Heartbeat, m_heartbeatRate);
|
||||
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
|
||||
Settings::setValue(Settings::Server::SwitchDelay, m_switchDelay);
|
||||
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
|
||||
|
||||
QDialog::accept();
|
||||
|
|
@ -312,7 +313,9 @@ void ServerConfigDialog::toggleSwitchDelay(bool enable)
|
|||
|
||||
void ServerConfigDialog::setSwitchDelay(int delay)
|
||||
{
|
||||
serverConfig().setSwitchDelay(delay);
|
||||
if (m_switchDelay == delay)
|
||||
return;
|
||||
m_switchDelay = delay;
|
||||
onChange();
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +355,7 @@ void ServerConfigDialog::toggleExternalConfig(bool checked)
|
|||
ui->tabWidget->setTabEnabled(1, !checked);
|
||||
ui->groupMisc->setEnabled(!checked);
|
||||
ui->groupCorners->setEnabled(!checked);
|
||||
ui->groupSwitch->setEnabled(!checked);
|
||||
ui->sbSwitchDoubleTap->setEnabled(!checked);
|
||||
serverConfig().setUseExternalConfig(checked);
|
||||
onChange();
|
||||
}
|
||||
|
|
@ -396,9 +399,11 @@ void ServerConfigDialog::loadFromConfig()
|
|||
|
||||
m_enableSwitchDelay = Settings::value(Settings::Server::EnableSwitchDelay).toBool();
|
||||
ui->cbSwitchDelay->setChecked(m_enableSwitchDelay);
|
||||
ui->sbSwitchDelay->setValue(serverConfig().switchDelay());
|
||||
ui->sbSwitchDelay->setEnabled(ui->cbSwitchDelay->isChecked());
|
||||
|
||||
m_switchDelay = Settings::value(Settings::Server::SwitchDelay).toInt();
|
||||
ui->sbSwitchDelay->setValue(m_switchDelay);
|
||||
|
||||
m_enableSwitchDoubleTap = Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool();
|
||||
ui->cbSwitchDoubleTap->setChecked(m_enableSwitchDoubleTap);
|
||||
ui->sbSwitchDoubleTap->setValue(serverConfig().switchDoubleTap());
|
||||
|
|
@ -523,6 +528,7 @@ void ServerConfigDialog::onChange()
|
|||
m_enableHeartbeat == Settings::value(Settings::Server::EnableHeatbeat).toBool() &&
|
||||
m_heartbeatRate == Settings::value(Settings::Server::Heartbeat).toInt() &&
|
||||
m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool() &&
|
||||
m_switchDelay == Settings::value(Settings::Server::SwitchDelay).toInt() &&
|
||||
m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool();
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)
|
||||
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ private:
|
|||
NetworkProtocol m_protocol;
|
||||
bool m_enableHeartbeat;
|
||||
int m_heartbeatRate;
|
||||
int m_switchDelay;
|
||||
bool m_enableSwitchDelay;
|
||||
bool m_enableSwitchDoubleTap;
|
||||
bool m_originalServerConfigIsExternal;
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
|||
bool handled = true;
|
||||
|
||||
// Skip old protocol name
|
||||
if (name == "protocol" || name == "heartbeat") {
|
||||
if (name == "protocol" || name == "heartbeat" || name == "switchDelay") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -652,8 +652,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
|||
addOption("", kOptionScreenSwitchCorners, s.parseCorners(value));
|
||||
} else if (name == "switchCornerSize") {
|
||||
addOption("", kOptionScreenSwitchCornerSize, s.parseInt(value));
|
||||
} else if (name == "switchDelay") {
|
||||
addOption("", kOptionScreenSwitchDelay, s.parseInt(value));
|
||||
} else if (name == "switchDoubleTap") {
|
||||
addOption("", kOptionScreenSwitchTwoTap, s.parseInt(value));
|
||||
} else if (name == "switchNeedsShift") {
|
||||
|
|
@ -726,6 +724,10 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
|||
addOption("", kOptionHeartbeat, Settings::value(Settings::Server::Heartbeat).toInt());
|
||||
}
|
||||
|
||||
if (Settings::value(Settings::Server::EnableSwitchDelay).toBool()) {
|
||||
addOption("", kOptionScreenSwitchDelay, Settings::value(Settings::Server::SwitchDelay).toInt());
|
||||
}
|
||||
|
||||
throw ServerConfigReadException(s, "unexpected end of options section");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue