Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@
</group>
<group>
<_short>Menu</_short>
<option name="menu_fullscreen" type="bool">
<_short>Fullscreen Menu</_short>
<default>false</default>
</option>
<option name="menu_fuzzy_search" type="bool">
<_short>Use Fuzzy Search in Menu</_short>
<default>true</default>
Expand Down
68 changes: 60 additions & 8 deletions src/panel/widgets/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,13 @@ bool WayfireMenu::update_icon()

void WayfireMenu::setup_popover_layout()
{
button->get_popover()->set_child(popover_layout_box);
if (menu_fullscreen)
{
fullscreen.set_child(popover_layout_box);
} else
{
button->get_popover()->set_child(popover_layout_box);
}

flowbox.set_selection_mode(Gtk::SelectionMode::SINGLE);
flowbox.set_activate_on_single_click(true);
Expand All @@ -552,18 +558,21 @@ void WayfireMenu::setup_popover_layout()
flowbox.set_filter_func(sigc::mem_fun(*this, &WayfireMenu::on_filter));
flowbox.add_css_class("app-list");
flowbox.set_size_request(int(menu_min_content_width), int(menu_min_content_height));
flowbox.set_vexpand(true);

flowbox_container.append(flowbox);

scroll_pair.append(category_scrolled_window);
scroll_pair.append(app_scrolled_window);
scroll_pair.set_homogeneous(false);
scroll_pair.set_vexpand(true);

app_scrolled_window.set_min_content_width(int(menu_min_content_width));
app_scrolled_window.set_min_content_height(int(menu_min_content_height));
app_scrolled_window.set_child(flowbox_container);
app_scrolled_window.add_css_class("app-list-scroll");
app_scrolled_window.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
app_scrolled_window.set_vexpand(true);

category_box.add_css_class("category-list");
category_box.set_orientation(Gtk::Orientation::VERTICAL);
Expand All @@ -573,6 +582,7 @@ void WayfireMenu::setup_popover_layout()
category_scrolled_window.set_child(category_box);
category_scrolled_window.add_css_class("categtory-list-scroll");
category_scrolled_window.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
category_scrolled_window.set_vexpand(true);

search_entry.add_css_class("app-search");

Expand Down Expand Up @@ -603,6 +613,7 @@ void WayfireMenu::setup_popover_layout()
} else if (keyval == GDK_KEY_Escape)
{
button->get_popover()->hide();
fullscreen.hide();
} else
{
std::string input = gdk_keyval_name(keyval);
Expand All @@ -616,8 +627,7 @@ void WayfireMenu::setup_popover_layout()

return false;
}, false));
button->get_popover()->add_controller(typing_gesture);

popover_layout_box.add_controller(typing_gesture);
signals.push_back(button->get_popover()->signal_closed().connect([=] ()
{
if (!force_show_popup.value())
Expand Down Expand Up @@ -827,6 +837,7 @@ WayfireLogoutUI::~WayfireLogoutUI()
void WayfireMenu::on_logout_click()
{
button->get_popover()->hide();
fullscreen.hide();
if (!std::string(menu_logout_command).empty())
{
g_spawn_command_line_async(std::string(menu_logout_command).c_str(), NULL);
Expand Down Expand Up @@ -909,6 +920,7 @@ void WayfireMenu::init(Gtk::Box *container)
menu_list.set_callback([=] () { update_popover_layout(); });

button = std::make_unique<WayfireMenuButton>("panel");
fullscreen.add_css_class("menu-fullscreen");
button->set_child(main_image);
button->add_css_class("menu-button");
button->add_css_class("flat");
Expand All @@ -917,6 +929,17 @@ void WayfireMenu::init(Gtk::Box *container)
signals.push_back(button->get_popover()->signal_show().connect(
sigc::mem_fun(*this, &WayfireMenu::on_popover_shown)));

/* Prepare fullscreen layer */
gtk_layer_init_for_window(fullscreen.gobj());
gtk_layer_set_monitor(fullscreen.gobj(), output->monitor->gobj());
gtk_layer_set_namespace(fullscreen.gobj(), "panelmenu");
gtk_layer_set_anchor(fullscreen.gobj(), GTK_LAYER_SHELL_EDGE_TOP, true);
gtk_layer_set_anchor(fullscreen.gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, true);
gtk_layer_set_anchor(fullscreen.gobj(), GTK_LAYER_SHELL_EDGE_LEFT, true);
gtk_layer_set_anchor(fullscreen.gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, true);
gtk_layer_set_layer(fullscreen.gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY);
gtk_layer_set_keyboard_mode(fullscreen.gobj(), GTK_LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE);

if (!update_icon())
{
return;
Expand All @@ -925,11 +948,31 @@ void WayfireMenu::init(Gtk::Box *container)
signals.push_back(button->property_scale_factor().signal_changed().connect(
[=] () {update_icon(); }));

menu_fullscreen.set_callback([=] ()
{
fullscreen.hide();
button->set_active(false);
if (menu_fullscreen)
{
gtk_popover_set_child(button->get_popover()->gobj(), nullptr);
fullscreen.set_child(popover_layout_box);
} else
{
gtk_window_set_child(fullscreen.gobj(), nullptr);
button->get_popover()->set_child(popover_layout_box);
}
});

container->append(box);
box.append(*button);

auto click_gesture = Gtk::GestureClick::create();
click_gesture->set_propagation_phase(Gtk::PropagationPhase::CAPTURE);
signals.push_back(click_gesture->signal_pressed().connect([=] (int count, double x, double y)
{
click_gesture->set_state(Gtk::EventSequenceState::CLAIMED);
}));
signals.push_back(click_gesture->signal_released().connect([=] (int count, double x, double y)
{
toggle_menu();
}));
Expand Down Expand Up @@ -983,18 +1026,27 @@ void WayfireMenu::toggle_menu()
{
search_contents = "";
search_entry.set_text("");
if (button->get_active())
{
button->set_active(false);
} else
if (menu_fullscreen)
{
button->set_active(true);
if (fullscreen.is_visible())
{
fullscreen.hide();
} else
{
fullscreen.show();
on_popover_shown();
}

return;
}

button->set_active(!button->get_active());
}

void WayfireMenu::hide_menu()
{
button->set_active(false);
fullscreen.hide();
}

void WayfireMenu::set_category(std::string in_category)
Expand Down
2 changes: 2 additions & 0 deletions src/panel/widgets/menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class WayfireMenu : public WayfireWidget
Gtk::Button logout_button;
Gtk::Image logout_image;
Gtk::ScrolledWindow app_scrolled_window, category_scrolled_window;
Gtk::Window fullscreen;
std::unique_ptr<WayfireMenuButton> button;
std::unique_ptr<WayfireLogoutUI> logout_ui;

Expand Down Expand Up @@ -180,6 +181,7 @@ class WayfireMenu : public WayfireWidget
WfOption<int> menu_min_category_width{"panel/menu_min_category_width"};
WfOption<int> menu_min_content_height{"panel/menu_min_content_height"};
WfOption<bool> menu_show_categories{"panel/menu_show_categories"};
WfOption<bool> menu_fullscreen{"panel/menu_fullscreen"};
void setup_popover_layout();
void update_popover_layout();
void update_category_width();
Expand Down
Loading