Skip to content
Draft
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
21 changes: 20 additions & 1 deletion data/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,23 @@
.wf-panel .battery label,
.wf-panel .battery:hover label,
.wf-panel .window-button label,
.wf-panel .window-button image,
.wf-panel .window-button:hover label,
.wf-panel .tray-button,
.wf-panel .tray-button:hover,
.wf-panel .notification button {
padding-left: 5px;
}


.wf-panel .window-button.activated {
background-color: #8883;
}

.wf-panel .window-button:hover {
background-color: #8882;
}

.wf-panel .battery overlay label {
--bcol: rgb(from currentcolor calc(255 - r) calc(255 - g) calc(255 - b) );
text-shadow: 1px 1px 0 var(--bcol),
Expand Down Expand Up @@ -94,7 +104,7 @@ text-shadow: 1px 1px 0 var(--bcol),
background-color: #24283B;
padding: 5px;
margin: 5px;
border-radius: 3px;
border-radius: 3px;
color: #41A6B5;
}

Expand Down Expand Up @@ -132,6 +142,15 @@ text-shadow: 1px 1px 0 var(--bcol),
background-color: #00FFAA77;
border: 1px solid #222;
}

.wf-panel .wf-menu.selected {
background-color:#8883;
}

.wf-panel .wf-menu:hover {
background-color: #8882;
}

.excellent {
color: #00ff00;
}
Expand Down
8 changes: 4 additions & 4 deletions data/css/panel-window-list-zoom-hover.css
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/* Default size not-selected not-hovered */
.wf-panel .window-button.flat image {
.wf-panel .window-button image {
transition: 500ms linear;
-gtk-icon-transform: scale(1.0);
}

/* Double size not-selected hovered */
.wf-panel .window-button.flat:hover image {
.wf-panel .window-button:hover image {
transition: 100ms linear;
-gtk-icon-transform: scale(2.0);
}

/* +50% size selected not-hovered */
.wf-panel .window-button image {
.wf-panel .window-button.activated image {
transition: 100ms linear;
-gtk-icon-transform: scale(1.5);
}

/* Double size selected hovered */
.wf-panel .window-button:hover image {
.wf-panel .window-button.activated:hover image {
transition: 100ms linear;
-gtk-icon-transform: scale(2.0);
}
14 changes: 9 additions & 5 deletions metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@
<_name>Background</_name>
</desc>
</option>
<option name="force_show_popup" type="bool">
<_short>Force showing the popups</_short>
<_long>Show the popup over other windows, even if it and the panel would be hidden otherwise.</_long>
<default>true</default>
</option>
<option name="menus_change_motion" type="bool">
<_short>Change between open menu with mouse motion</_short>
<default>false</default>
</option>
<option name="background_color" type="string">
<_short>Background Color</_short>
<default>gtk_headerbar</default>
Expand Down Expand Up @@ -203,11 +212,6 @@
<default>42</default>
<min>0</min>
</option>
<option name="menu_force_show_popup" type="bool">
<_short>Force showing the menu popup</_short>
<_long>Show the menu popup over other windows, even if it and the panel would be hidden otherwise.</_long>
<default>true</default>
</option>
<option name="menu_min_category_width" type="int">
<_short>Menu Minimum Category Width</_short>
<default>200</default>
Expand Down
1 change: 0 additions & 1 deletion src/locker/plugin/volume.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include <memory>
#include <gtkmm/button.h>
#include <gtkmm/popover.h>
#include <gtkmm/scale.h>
#include <pulse/pulseaudio.h>

Expand Down
12 changes: 5 additions & 7 deletions src/panel/widgets/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@

void WayfireClock::init(Gtk::Box *container)
{
button = std::make_unique<WayfireMenuButton>("panel");
button = std::make_unique<WayfireMenuWidget>("panel", "clock");
button->add_css_class("clock");
button->set_child(label);
button->show();
button->append(label);
button->open_on(1);
label.set_justify(Gtk::Justification::CENTER);
label.show();

update_label();

calendar.show();
button->get_popover()->add_css_class("clock-popover");
button->get_children()[0]->add_css_class("flat");
button->get_popover()->set_child(calendar);
btn_sig = button->get_popover()->signal_show().connect(
button->set_popup_child(calendar);
btn_sig = button->signal_popup().connect(
sigc::mem_fun(*this, &WayfireClock::on_calendar_shown));

container->append(*button);
Expand Down
2 changes: 1 addition & 1 deletion src/panel/widgets/clock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class WayfireClock : public WayfireWidget
{
Gtk::Label label;
Gtk::Calendar calendar;
std::unique_ptr<WayfireMenuButton> button;
std::unique_ptr<WayfireMenuWidget> button;

sigc::connection timeout, btn_sig;
WfOption<std::string> format{"panel/clock_format"};
Expand Down
119 changes: 24 additions & 95 deletions src/panel/widgets/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "menu.hpp"
#include "gtk-utils.hpp"
#include "wf-autohide-window.hpp"
#include "wf-popover.hpp"

const std::string default_icon = "wayfire";

Expand Down Expand Up @@ -515,12 +516,6 @@ void WayfireMenu::on_popover_shown()
on_search_changed();
set_category("All");
flowbox.unselect_all();

if (force_show_popup.value())
{
Gtk::Window *window = dynamic_cast<Gtk::Window*>(button->get_root());
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY);
}
}

bool WayfireMenu::update_icon()
Expand All @@ -540,13 +535,7 @@ bool WayfireMenu::update_icon()

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

flowbox.set_selection_mode(Gtk::SelectionMode::SINGLE);
flowbox.set_activate_on_single_click(true);
Expand Down Expand Up @@ -613,8 +602,7 @@ void WayfireMenu::setup_popover_layout()
return true;
} else if (keyval == GDK_KEY_Escape)
{
button->get_popover()->hide();
fullscreen.hide();
button->popdown();
return true;
} else if ((keyval == GDK_KEY_Up) ||
(keyval == GDK_KEY_Down) ||
Expand Down Expand Up @@ -649,36 +637,6 @@ void WayfireMenu::setup_popover_layout()
}
}, false));
popover_layout_box.add_controller(typing_gesture);
signals.push_back(button->get_popover()->signal_closed().connect([=] ()
{
if (!force_show_popup.value())
{
return;
}

Gtk::Window *window = dynamic_cast<Gtk::Window*>(button->get_root());
WfOption<std::string> panel_layer{"panel/layer"};

if ((std::string)panel_layer == "overlay")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY);
}

if ((std::string)panel_layer == "top")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP);
}

if ((std::string)panel_layer == "bottom")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BOTTOM);
}

if ((std::string)panel_layer == "background")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BACKGROUND);
}
}));
}

void WayfireMenu::update_popover_layout()
Expand Down Expand Up @@ -857,8 +815,7 @@ WayfireLogoutUI::~WayfireLogoutUI()

void WayfireMenu::on_logout_click()
{
button->get_popover()->hide();
fullscreen.hide();
button->popdown();
if (!std::string(menu_logout_command).empty())
{
g_spawn_command_line_async(std::string(menu_logout_command).c_str(), NULL);
Expand Down Expand Up @@ -940,27 +897,15 @@ void WayfireMenu::init(Gtk::Box *container)
menu_show_categories.set_callback([=] () { update_popover_layout(); });
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 = std::make_unique<WayfireMenuWidget>("panel", "menu");
button->append(main_image);
button->add_css_class("menu-button");
button->add_css_class("flat");
button->get_popover()->add_css_class("menu-popover");
button->get_children()[0]->add_css_class("flat");
signals.push_back(button->get_popover()->signal_show().connect(
button->open_on(1); /* Open menu on left click */
signals.push_back(button->signal_popup().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 @@ -969,20 +914,7 @@ 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);
}
});
button->set_popup_child(popover_layout_box);

container->append(box);
box.append(*button);
Expand All @@ -999,6 +931,13 @@ void WayfireMenu::init(Gtk::Box *container)
}));
box.add_controller(click_gesture);

auto menu_fs_changed = [=]
{
button->set_fullscreen(menu_fullscreen.value());
};
menu_fullscreen.set_callback(menu_fs_changed);
menu_fs_changed();

logout_image.set_icon_size(Gtk::IconSize::LARGE);
logout_image.set_from_icon_name("system-shutdown");
logout_button.add_css_class("flat");
Expand All @@ -1018,7 +957,7 @@ void WayfireMenu::init(Gtk::Box *container)
update_popover_layout();
populate_menu_categories();
populate_menu_items("All");

app_info_monitor = g_app_info_monitor_get();
app_info_monitor_changed_handler_id =
g_signal_connect(app_info_monitor, "changed", G_CALLBACK(app_info_changed), this);

Expand Down Expand Up @@ -1046,27 +985,13 @@ void WayfireMenu::update_content_width()
void WayfireMenu::toggle_menu()
{
search_entry.set_text("");
if (menu_fullscreen)
{
if (fullscreen.is_visible())
{
fullscreen.hide();
} else
{
fullscreen.show();
on_popover_shown();
}

return;
}

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

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

void WayfireMenu::set_category(std::string in_category)
Expand All @@ -1090,7 +1015,11 @@ void WayfireMenu::select_first_flowbox_item()

WayfireMenu::~WayfireMenu()
{
g_signal_handler_disconnect(app_info_monitor, app_info_monitor_changed_handler_id);
if (app_info_monitor)
{
g_signal_handler_disconnect(app_info_monitor, app_info_monitor_changed_handler_id);
}

for (auto signal : signals)
{
signal.disconnect();
Expand Down
6 changes: 2 additions & 4 deletions src/panel/widgets/menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ 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<WayfireMenuWidget> button;
std::unique_ptr<WayfireLogoutUI> logout_ui;

GAppInfoMonitor *app_info_monitor = g_app_info_monitor_get();
GAppInfoMonitor *app_info_monitor = nullptr;
guint app_info_monitor_changed_handler_id;

void load_menu_item(AppInfo app_info);
Expand Down Expand Up @@ -175,7 +174,6 @@ class WayfireMenu : public WayfireWidget
WfOption<bool> fuzzy_search_enabled{"panel/menu_fuzzy_search"};
WfOption<std::string> panel_position{"panel/position"};
WfOption<std::string> menu_icon{"panel/menu_icon"};
WfOption<bool> force_show_popup{"panel/menu_force_show_popup"};
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"};
Expand Down
Loading
Loading