mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-11-01 00:12:42 +01:00 
			
		
		
		
	feat: create new workspace on the wanted output
This commit is contained in:
		| @@ -68,6 +68,7 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) { | |||||||
|               if (output.asString() == bar_.output->name) { |               if (output.asString() == bar_.output->name) { | ||||||
|                 Json::Value v; |                 Json::Value v; | ||||||
|                 v["name"] = p_w_name; |                 v["name"] = p_w_name; | ||||||
|  |                 v["target_output"] = bar_.output->name; | ||||||
|                 workspaces_.emplace_back(std::move(v)); |                 workspaces_.emplace_back(std::move(v)); | ||||||
|                 break; |                 break; | ||||||
|               } |               } | ||||||
| @@ -202,9 +203,18 @@ Gtk::Button &Workspaces::addButton(const Json::Value &node) { | |||||||
|   auto &button = pair.first->second; |   auto &button = pair.first->second; | ||||||
|   box_.pack_start(button, false, false, 0); |   box_.pack_start(button, false, false, 0); | ||||||
|   button.set_relief(Gtk::RELIEF_NONE); |   button.set_relief(Gtk::RELIEF_NONE); | ||||||
|   button.signal_clicked().connect([this, pair] { |   button.signal_clicked().connect([this, node] { | ||||||
|     try { |     try { | ||||||
|       ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", pair.first->first)); |       if (node["target_output"].isString()) { | ||||||
|  |         ipc_.sendCmd( | ||||||
|  |             IPC_COMMAND, | ||||||
|  |             fmt::format("workspace \"{}\"; move workspace to output \"{}\"; workspace \"{}\"", | ||||||
|  |                         node["name"].asString(), | ||||||
|  |                         node["target_output"].asString(), | ||||||
|  |                         node["name"].asString())); | ||||||
|  |       } else { | ||||||
|  |         ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"")); | ||||||
|  |       } | ||||||
|     } catch (const std::exception &e) { |     } catch (const std::exception &e) { | ||||||
|       std::cerr << e.what() << std::endl; |       std::cerr << e.what() << std::endl; | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alex
					Alex