Skip to content

Commit 9b1440d

Browse files
committed
wm-actions: add method for home button in plamo
its just original toggle_showdesktop but its not a toggle, only hides clients Signed-off-by: Deepak Kumar <notwho53@gmail.com>
1 parent aba4382 commit 9b1440d

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

metadata/wm-actions.xml

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<_long>Show the desktop.</_long>
3535
<default>disabled</default>
3636
</option>
37+
<option name="plamo_showdesktop" type="activator">
38+
<_short>Plasmo Show Desktop</_short>
39+
<_long>Show the desktop.</_long>
40+
<default>disabled</default>
41+
</option>
3742
<option name="send_to_back" type="activator">
3843
<_short>Send to back</_short>
3944
<_long>Send the active view to behind all other views.</_long>

plugins/wm-actions/wm-actions.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,31 @@ class wayfire_wm_actions_output_t : public wf::per_output_plugin_instance_t
292292
return true;
293293
}
294294

295+
bool on_plamo_showdesktop()
296+
{
297+
showdesktop_active = !showdesktop_active;
298+
299+
if (showdesktop_active)
300+
{
301+
for (auto& view : output->wset()->get_views())
302+
{
303+
if (!view->minimized)
304+
{
305+
wf::get_core().default_wm->minimize_request(view, true);
306+
view->store_data(std::make_unique<wf::custom_data_t>(), "wm-actions-showdesktop");
307+
}
308+
}
309+
310+
output->connect(&view_set_output);
311+
output->connect(&workspace_changed);
312+
output->connect(&view_minimized);
313+
output->connect(&on_view_mapped);
314+
return true;
315+
}
316+
317+
return true;
318+
}
319+
295320
void do_send_to_back(wayfire_view view)
296321
{
297322
auto view_root = view->get_root_node();
@@ -397,6 +422,7 @@ class wayfire_wm_actions_t : public wf::plugin_interface_t,
397422
{
398423
wf::shared_data::ref_ptr_t<wf::ipc::method_repository_t> ipc_repo;
399424
wf::ipc_activator_t toggle_showdesktop{"wm-actions/toggle_showdesktop"};
425+
wf::ipc_activator_t plamo_showdesktop{"wm-actions/plamo_showdesktop"};
400426

401427
public:
402428
void init() override
@@ -408,6 +434,7 @@ class wayfire_wm_actions_t : public wf::plugin_interface_t,
408434
ipc_repo->register_method("wm-actions/set-sticky", ipc_set_sticky);
409435
ipc_repo->register_method("wm-actions/send-to-back", ipc_send_to_back);
410436
toggle_showdesktop.set_handler(on_toggle_showdesktop);
437+
plamo_showdesktop.set_handler(on_plamo_showdesktop);
411438
}
412439

413440
void fini() override
@@ -500,6 +527,11 @@ class wayfire_wm_actions_t : public wf::plugin_interface_t,
500527
{
501528
return this->output_instance[output]->on_toggle_showdesktop();
502529
};
530+
531+
wf::ipc_activator_t::handler_t on_plamo_showdesktop = [=] (wf::output_t *output, wayfire_view)
532+
{
533+
return this->output_instance[output]->on_plamo_showdesktop();
534+
};
503535
};
504536

505537
DECLARE_WAYFIRE_PLUGIN(wayfire_wm_actions_t);

0 commit comments

Comments
 (0)