mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Add a configuration entry to disable auto_back_and_forth on Sway workspaces
This commit is contained in:
parent
f2e9bb54f0
commit
7eb2a6b709
@ -20,7 +20,7 @@ class Workspaces : public AModule, public sigc::trackable {
|
|||||||
auto update() -> void;
|
auto update() -> void;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline const std::string workspace_switch_cmd_ = "workspace --no-auto-back-and-forth \"{}\"";
|
static inline const std::string workspace_switch_cmd_ = "workspace {} \"{}\"";
|
||||||
|
|
||||||
static int convertWorkspaceNameToNum(std::string name);
|
static int convertWorkspaceNameToNum(std::string name);
|
||||||
|
|
||||||
|
@ -66,12 +66,16 @@ Addressed by *sway/workspaces*
|
|||||||
Lists workspaces that should always be shown, even when non existent
|
Lists workspaces that should always be shown, even when non existent
|
||||||
|
|
||||||
*on-update*: ++
|
*on-update*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
Command to execute when the module is updated.
|
Command to execute when the module is updated.
|
||||||
|
|
||||||
*numeric-first*: ++
|
*numeric-first*: ++
|
||||||
typeof: bool ++
|
typeof: bool ++
|
||||||
Whether to put workspaces starting with numbers before workspaces that do not start with a number.
|
Whether to put workspaces starting with numbers before workspaces that do not start with a number.
|
||||||
|
|
||||||
|
*disable-auto-back-and-forth*: ++
|
||||||
|
typeof: bool ++
|
||||||
|
Whether to disable *workspace_auto_back_and_forth* when clicking on workspaces. If this is set to *true*, clicking on a workspace you are already on won't do anything, even if *workspace_auto_back_and_forth* is enabled in the Sway configuration.
|
||||||
|
|
||||||
# FORMAT REPLACEMENTS
|
# FORMAT REPLACEMENTS
|
||||||
|
|
||||||
|
@ -257,11 +257,19 @@ Gtk::Button &Workspaces::addButton(const Json::Value &node) {
|
|||||||
ipc_.sendCmd(
|
ipc_.sendCmd(
|
||||||
IPC_COMMAND,
|
IPC_COMMAND,
|
||||||
fmt::format(workspace_switch_cmd_ + "; move workspace to output \"{}\"; " + workspace_switch_cmd_,
|
fmt::format(workspace_switch_cmd_ + "; move workspace to output \"{}\"; " + workspace_switch_cmd_,
|
||||||
|
"--no-auto-back-and-forth",
|
||||||
node["name"].asString(),
|
node["name"].asString(),
|
||||||
node["target_output"].asString(),
|
node["target_output"].asString(),
|
||||||
|
"--no-auto-back-and-forth",
|
||||||
node["name"].asString()));
|
node["name"].asString()));
|
||||||
} else {
|
} else {
|
||||||
ipc_.sendCmd(IPC_COMMAND, fmt::format(workspace_switch_cmd_, node["name"].asString()));
|
ipc_.sendCmd(
|
||||||
|
IPC_COMMAND,
|
||||||
|
fmt::format("workspace {} \"{}\"",
|
||||||
|
config_["disable-auto-back-and-forth"].asBool()
|
||||||
|
? "--no-auto-back-and-forth"
|
||||||
|
: "",
|
||||||
|
node["name"].asString()));
|
||||||
}
|
}
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
spdlog::error("Workspaces: {}", e.what());
|
spdlog::error("Workspaces: {}", e.what());
|
||||||
@ -322,7 +330,9 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ipc_.sendCmd(IPC_COMMAND, fmt::format(workspace_switch_cmd_, name));
|
ipc_.sendCmd(
|
||||||
|
IPC_COMMAND,
|
||||||
|
fmt::format(workspace_switch_cmd_, "--no-auto-back-and-forth", name));
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
spdlog::error("Workspaces: {}", e.what());
|
spdlog::error("Workspaces: {}", e.what());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user