mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-11-04 01:32:42 +01:00 
			
		
		
		
	sway/workspaces: make clicking on workspaces idempotent
Previously, clicking on the same workspace you were on would throw you to another workspace if `workspace_auto_back_and_forth yes` was specified in your sway config. This also fixes workspace output moving misbehaving and doing the same.
This commit is contained in:
		@@ -219,12 +219,12 @@ Gtk::Button &Workspaces::addButton(const Json::Value &node) {
 | 
			
		||||
      if (node["target_output"].isString()) {
 | 
			
		||||
        ipc_.sendCmd(
 | 
			
		||||
            IPC_COMMAND,
 | 
			
		||||
            fmt::format("workspace \"{}\"; move workspace to output \"{}\"; workspace \"{}\"",
 | 
			
		||||
            fmt::format(workspace_switch_cmd_ + "; move workspace to output \"{}\"; " + workspace_switch_cmd_,
 | 
			
		||||
                        node["name"].asString(),
 | 
			
		||||
                        node["target_output"].asString(),
 | 
			
		||||
                        node["name"].asString()));
 | 
			
		||||
      } else {
 | 
			
		||||
        ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", node["name"].asString()));
 | 
			
		||||
        ipc_.sendCmd(IPC_COMMAND, fmt::format(workspace_switch_cmd_, node["name"].asString()));
 | 
			
		||||
      }
 | 
			
		||||
    } catch (const std::exception &e) {
 | 
			
		||||
      spdlog::error("Workspaces: {}", e.what());
 | 
			
		||||
@@ -276,7 +276,7 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  try {
 | 
			
		||||
    ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", name));
 | 
			
		||||
    ipc_.sendCmd(IPC_COMMAND, fmt::format(workspace_switch_cmd_, name));
 | 
			
		||||
  } catch (const std::exception &e) {
 | 
			
		||||
    spdlog::error("Workspaces: {}", e.what());
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user