diff --git a/metadata/dock.xml b/metadata/dock.xml index 3451c111..e8ad7aa1 100644 --- a/metadata/dock.xml +++ b/metadata/dock.xml @@ -12,9 +12,26 @@ true - <_short>Autohide duration + <_short>Autohide animation duration + <_long> + Time (in milliseconds) the panel takes to expand and retract + 300 + + <_short>Autohide show delay + <_long> + Amount of time (in milliseconds) the cursor needs to be in the zone before showing. + + 300 + + + <_short>Autohide hide delay + <_long> + Amount of time (in milliseconds) the cursor needs to be out of the zone before hiding. + + 500 + <_short>Position bottom @@ -26,11 +43,28 @@ bottom <_name>Bottom + + left + <_name>Left + + + right + <_name>Right + + + + <_short>Max icons per line + <_long>If greater than 0, the dock will have a maximum number of entries per line, after which a new line is created. + 0 <_short>Dock height 100 + + <_short>Dock width + 100 + <_short>Dock icons height 72 diff --git a/metadata/panel.xml b/metadata/panel.xml index bfe391f0..4299cca6 100644 --- a/metadata/panel.xml +++ b/metadata/panel.xml @@ -10,7 +10,10 @@ - <_short>Widgets Left + <_short>Widgets Left/Top + <_long> + Widgets placed in the left zone of the bar, or top if the bar is vertical. + menu spacing4 launchers window-list @@ -18,21 +21,65 @@ none - <_short>Widgets Right + <_short>Widgets Right/Bottom + <_long> + Widgets placed in the right zone of the bar, or bottom if the bar is vertical. + volume network battery clock <_short>Minimal Height + <_long> + Minimum height the panel takes. + 24 + + <_short>Minimal Width + <_long> + Minimum width the panel takes. + + 24 + + + <_short>Span whole side + <_long> + Wether the pannel should extend all the way to the left and right; or top and bottom depending on orientation. + + true + + + <_short>Force even spacing + <_long> + If on, the left and right of the panel always take the same amount of space and the panel is always centered on the middle of the screen. This will lead to unused space on the side that has the least space taken up by the widgets. + + false + <_short>Autohide false - <_short>Autohide Duration + <_short>Autohide animation duration + <_long> + Time (in milliseconds) the panel takes to expand and retract + + 300 + + + <_short>Autohide show delay + <_long> + Amount of time (in milliseconds) the cursor needs to be in the zone before showing. + 300 + + <_short>Autohide hide delay + <_long> + Amount of time (in milliseconds) the cursor needs to be out of the zone before hiding. + + 500 + <_short>Panel Position top @@ -44,6 +91,14 @@ bottom <_name>Bottom + + left + <_name>Left + + + right + <_name>Right + <_short>Edge offset diff --git a/src/dock/dock-app.cpp b/src/dock/dock-app.cpp index dc6e6d9b..6d0d7d22 100644 --- a/src/dock/dock-app.cpp +++ b/src/dock/dock-app.cpp @@ -44,14 +44,21 @@ class WfDockApp::impl zwlr_foreign_toplevel_manager_v1 *toplevel_manager = NULL; }; +void WfDockApp::on_config_reload() +{ + for (auto& d : priv->docks) + { + d.second->handle_config_reload(); + } +} + void WfDockApp::on_activate() { WayfireShellApp::on_activate(); new CssFromConfigInt("dock/icon_height", ".toplevel-icon {-gtk-icon-size:", "px;}"); IconProvider::load_custom_icons(); - /* At this point, wayland connection has been initialized, - * and hopefully outputs have been created */ + /* At this point, wayland connection has been initialized, and hopefully outputs have been created */ auto gdk_display = gdk_display_get_default(); auto display = gdk_wayland_display_get_wl_display(gdk_display); @@ -84,8 +91,8 @@ void WfDockApp::handle_new_output(WayfireOutput *output) void WfDockApp::handle_output_removed(WayfireOutput *output) { /* Send an artificial output leave. - * This is useful because in this way the toplevel can safely destroy - * its icons created on that particular output */ + * This is useful because in this way the toplevel can safely destroy its + * icons created on that particular output */ for (auto& toplvl : priv->toplevels) { toplvl.second->handle_output_leave(output->wo); diff --git a/src/dock/dock.cpp b/src/dock/dock.cpp index ba461c21..a1bc73ed 100644 --- a/src/dock/dock.cpp +++ b/src/dock/dock.cpp @@ -20,10 +20,23 @@ class WfDock::impl wl_surface *_wl_surface; Gtk::Box out_box; Gtk::Box box; + // for having multiple layers in the dock (max_per_line setting) + // flowbox doesn’t really cut it unfortunately. can’t center the inner widgets and can’t complete the + // down/right row first + // listbox neither, since it can’t even be oriented WfOption css_path{"dock/css_path"}; + WfOption dock_width{"dock/dock_width"}; WfOption dock_height{"dock/dock_height"}; + WfOption position{"dock/position"}; + WfOption entries_per_line{"dock/max_per_line"}; + + void (Gtk::Box::*ap_or_pre_pend)(Gtk::Widget&); // pointer to Gtk::Box::prepend or Gtk::Box::append, + // updated by update_layout + Gtk::Widget*(Gtk::Widget::*first_or_last_child)(); // similar, for get_first_child and get_last_child + bool reverse_iteration; + public: impl(WayfireOutput *output) { @@ -31,20 +44,22 @@ class WfDock::impl window = std::unique_ptr( new WayfireAutohidingWindow(output, "dock")); gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP); - gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, true); - gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, true); + out_box.get_style_context()->add_class("out-box"); + + gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_TOP, 0); + gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, 0); gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, 0); gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, 0); - out_box.append(box); - out_box.get_style_context()->add_class("out-box"); - box.get_style_context()->add_class("box"); + window->set_child(out_box); + window->set_default_size(dock_width, dock_height); + update_layout(); window->get_style_context()->add_class("wf-dock"); out_box.set_halign(Gtk::Align::CENTER); - if ((std::string)css_path != "") + if (css_path.value() != "") { auto css = load_css_from_path(css_path); if (css) @@ -57,6 +72,20 @@ class WfDock::impl window->present(); _wl_surface = gdk_wayland_surface_get_wl_surface( window->get_surface()->gobj()); + } + + void prepare_new_layer(Gtk::Box& box) + { + box.get_style_context()->add_class("box"); + box.set_homogeneous(true); + + if (position.value() == "left" or position.value() == "right") + { + box.set_orientation(Gtk::Orientation::VERTICAL); + } else + { + box.set_orientation(Gtk::Orientation::HORIZONTAL); + } box.add_tick_callback([=] (Glib::RefPtr fc) { @@ -65,14 +94,117 @@ class WfDock::impl }); } + void update_layout() + { + Gtk::Orientation orientation; + + // this sequence of checking gives a fallback to a horizontal layout if the value is invalid. + // goes with the WfAutohideWindow fallback to go at the top. + if (position.value() == "left" or position.value() == "right") + { + orientation = Gtk::Orientation::VERTICAL; + out_box.set_orientation(Gtk::Orientation::HORIZONTAL); + } else + { + orientation = Gtk::Orientation::HORIZONTAL; + out_box.set_orientation(Gtk::Orientation::VERTICAL); + } + + if (position.value() == "bottom" or position.value() == "right") + { + ap_or_pre_pend = &Gtk::Box::prepend; + first_or_last_child = &Gtk::Widget::get_first_child; + reverse_iteration = true; + } else + { + ap_or_pre_pend = &Gtk::Box::append; + first_or_last_child = &Gtk::Widget::get_last_child; + reverse_iteration = false; + } + + for (auto layer : out_box.get_children()) + { + ((Gtk::Box*)layer)->set_orientation(orientation); + } + } + void add_child(Gtk::Widget& widget) { - box.append(widget); + // create a box if the last one is full or there is none + if (((int)(out_box.get_children().size()) == 0) || + ((int)((out_box.*first_or_last_child)()->get_children().size()) == entries_per_line)) + { + Gtk::Box new_box; + prepare_new_layer(new_box); + (out_box.*ap_or_pre_pend)(new_box); + } + + Gtk::Box& last_child = *(Gtk::Box*)(out_box.*first_or_last_child)(); + + widget.set_halign(Gtk::Align::CENTER); + widget.set_valign(Gtk::Align::CENTER); + widget.get_style_context()->add_class("re-orient"); + + last_child.append(widget); } void rem_child(Gtk::Widget& widget) { - this->box.remove(widget); + Gtk::Box *prev_row = nullptr; + bool found = false; + + auto check_row = [&] (Gtk::Widget *row) + { + if (!found) + { + for (Gtk::Widget *item : row->get_children()) + { + if (&widget == item) + { + found = true; + ((Gtk::Box*)row)->remove(*item); + break; + } + } + + if (!found) + { + return; + } + } + + // move the first widget of every next line and append it to the previous line + if (prev_row != nullptr) + { + Gtk::Widget *to_move = ((Gtk::Box*)row)->get_last_child(); + prev_row->append(*to_move); + ((Gtk::Box*)row)->remove(*to_move); + } + + prev_row = ((Gtk::Box*)row); + }; + + auto children = out_box.get_children(); + + if (reverse_iteration) + { + for (auto it = children.rbegin(); it != children.rend(); ++it) + { + check_row(*it); + } + } else + { + for (auto it = children.begin(); it != children.end(); ++it) + { + check_row(*it); + } + } + + // if we emptied a row, delete it + if ((out_box.*first_or_last_child)()->get_children().size() == 0) + { + out_box.remove(*(out_box.*first_or_last_child)()); + } } wl_surface *get_wl_surface() @@ -81,11 +213,11 @@ class WfDock::impl } /* Sets the central section as clickable and transparent edges as click-through - * Gets called regularly to ensure css size changes all register */ + * Gets called regularly to ensure css size changes all register */ void set_clickable_region() { auto surface = window->get_surface(); - auto widget_bounds = box.compute_bounds(*window); + auto widget_bounds = out_box.compute_bounds(*window); auto rect = Cairo::RectangleInt{ (int)widget_bounds->get_x(), @@ -105,6 +237,11 @@ WfDock::WfDock(WayfireOutput *output) : {} WfDock::~WfDock() = default; +void WfDock::handle_config_reload() +{ + pimpl->update_layout(); +} + void WfDock::add_child(Gtk::Widget& w) { return pimpl->add_child(w); diff --git a/src/dock/dock.hpp b/src/dock/dock.hpp index 012c8e80..619b9ae6 100644 --- a/src/dock/dock.hpp +++ b/src/dock/dock.hpp @@ -14,6 +14,7 @@ class WfDock WfDock(WayfireOutput *output); ~WfDock(); + void handle_config_reload(); void add_child(Gtk::Widget& widget); void rem_child(Gtk::Widget& widget); @@ -34,11 +35,11 @@ class WfDockApp : public WayfireShellApp static WfDockApp& get(); - /* Starts the program. get() is valid afterward the first (and the only) - * call to run() */ + /* Starts the program. get() is valid afterward the first (and the only) call to run() */ static void create(int argc, char **argv); virtual ~WfDockApp(); + void on_config_reload() override; void on_activate() override; void handle_new_output(WayfireOutput *output) override; void handle_output_removed(WayfireOutput *output) override; diff --git a/src/panel/panel.cpp b/src/panel/panel.cpp index 34bdc513..6ff0d980 100644 --- a/src/panel/panel.cpp +++ b/src/panel/panel.cpp @@ -10,11 +10,13 @@ #include #include -#include #include + #include "panel.hpp" #include "wf-ipc.hpp" +#include "gtkmm/sizegroup.h" +#include "widget.hpp" #include "widgets/battery.hpp" #include "widgets/command-output.hpp" #include "widgets/language.hpp" @@ -39,6 +41,7 @@ class WayfirePanel::impl Gtk::CenterBox content_box; Gtk::Box left_box, center_box, right_box; + std::shared_ptr sides_size_group; using Widget = std::unique_ptr; using WidgetContainer = std::vector; @@ -49,43 +52,117 @@ class WayfirePanel::impl WfOption panel_layer{"panel/layer"}; std::function set_panel_layer = [=] () { - if ((std::string)panel_layer == "overlay") + if (panel_layer.value() == "overlay") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY); } - if ((std::string)panel_layer == "top") + if (panel_layer.value() == "top") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP); } - if ((std::string)panel_layer == "bottom") + if (panel_layer.value() == "bottom") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BOTTOM); } - if ((std::string)panel_layer == "background") + if (panel_layer.value() == "background") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BACKGROUND); } }; WfOption minimal_panel_height{"panel/minimal_height"}; + WfOption minimal_panel_width{"panel/minimal_width"}; + WfOption full_edge{"panel/span_full_edge"}; + WfOption force_center{"panel/force_center"}; + + WfOption panel_position{"panel/position"}; + + void set_boxes_orientation(Gtk::Orientation orientation) + { + content_box.set_orientation(orientation); + left_box.set_orientation(orientation); + center_box.set_orientation(orientation); + right_box.set_orientation(orientation); + } + + void update_orientation() + { + bool is_horizontal = !(panel_position.value() == "left" or panel_position.value() == + "right"); // not the most pretty, but if the value is top, down or something invalid, it works the + // same + + if (is_horizontal) + { + // if the panel is supposed to expand trough the whole edge, set anchors to stretch it + gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, full_edge); + gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, full_edge); + + gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, 0); + gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, 0); + + set_boxes_orientation(Gtk::Orientation::HORIZONTAL); + + if (force_center) + { + sides_size_group->set_mode(Gtk::SizeGroup::Mode::HORIZONTAL); + left_box.set_halign(Gtk::Align::END); + right_box.set_halign(Gtk::Align::START); + left_box.set_valign(Gtk::Align::CENTER); + right_box.set_valign(Gtk::Align::CENTER); + } else + { + sides_size_group->set_mode(Gtk::SizeGroup::Mode::NONE); + left_box.set_valign(Gtk::Align::START); + right_box.set_valign(Gtk::Align::END); + left_box.set_halign(Gtk::Align::CENTER); + right_box.set_halign(Gtk::Align::CENTER); + } + } else + { + gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_TOP, full_edge); + gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, full_edge); + + gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_TOP, 0); + gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, 0); + + set_boxes_orientation(Gtk::Orientation::VERTICAL); + sides_size_group->set_mode(Gtk::SizeGroup::Mode::VERTICAL); + + if (force_center) + { + sides_size_group->set_mode(Gtk::SizeGroup::Mode::VERTICAL); + left_box.set_valign(Gtk::Align::END); + right_box.set_valign(Gtk::Align::START); + left_box.set_halign(Gtk::Align::CENTER); + right_box.set_halign(Gtk::Align::CENTER); + } else + { + sides_size_group->set_mode(Gtk::SizeGroup::Mode::NONE); + left_box.set_halign(Gtk::Align::START); + right_box.set_halign(Gtk::Align::END); + left_box.set_valign(Gtk::Align::CENTER); + right_box.set_valign(Gtk::Align::CENTER); + } + } + } void create_window() { window = std::make_unique(output, "panel"); - window->set_default_size(0, minimal_panel_height); + window->set_default_size(minimal_panel_width, minimal_panel_height); + window->get_style_context()->add_class("wf-panel"); panel_layer.set_callback(set_panel_layer); set_panel_layer(); // initial setting - gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, true); - gtk_layer_set_anchor(window->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, true); - gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, 0); - gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, 0); + + update_orientation(); window->present(); + init_widgets(); init_layout(); } @@ -95,6 +172,7 @@ class WayfirePanel::impl left_box.get_style_context()->add_class("left"); right_box.get_style_context()->add_class("right"); center_box.get_style_context()->add_class("center"); + content_box.set_start_widget(left_box); if (!center_box.get_children().empty()) { @@ -104,10 +182,12 @@ class WayfirePanel::impl content_box.set_end_widget(right_box); content_box.set_hexpand(true); + content_box.set_vexpand(true); - left_box.set_halign(Gtk::Align::START); center_box.set_halign(Gtk::Align::CENTER); - right_box.set_halign(Gtk::Align::END); + + sides_size_group->add_widget(left_box); + sides_size_group->add_widget(right_box); window->set_child(content_box); } @@ -266,15 +346,15 @@ class WayfirePanel::impl { left_widgets_opt.set_callback([=] () { - reload_widgets((std::string)left_widgets_opt, left_widgets, left_box); + reload_widgets(left_widgets_opt.value(), left_widgets, left_box); }); right_widgets_opt.set_callback([=] () { - reload_widgets((std::string)right_widgets_opt, right_widgets, right_box); + reload_widgets(right_widgets_opt.value(), right_widgets, right_box); }); center_widgets_opt.set_callback([=] () { - reload_widgets((std::string)center_widgets_opt, center_widgets, center_box); + reload_widgets(center_widgets_opt.value(), center_widgets, center_box); if (center_box.get_children().empty()) { content_box.unset_center_widget(); @@ -284,14 +364,34 @@ class WayfirePanel::impl } }); - reload_widgets((std::string)left_widgets_opt, left_widgets, left_box); - reload_widgets((std::string)right_widgets_opt, right_widgets, right_box); - reload_widgets((std::string)center_widgets_opt, center_widgets, center_box); + reload_widgets(left_widgets_opt.value(), left_widgets, left_box); + reload_widgets(right_widgets_opt.value(), right_widgets, right_box); + reload_widgets(center_widgets_opt.value(), center_widgets, center_box); } public: impl(WayfireOutput *output) : output(output) { + sides_size_group = Gtk::SizeGroup::create(Gtk::SizeGroup::Mode::NONE); + + // Intentionally leaking feels bad. + new CssFromConfigInt("panel/launchers_size", ".menu-button,.launcher{-gtk-icon-size:", "px;}"); + new CssFromConfigInt("panel/launchers_spacing", ".launcher{padding: 0px ", "px;}"); + new CssFromConfigInt("panel/battery_icon_size", ".battery image{-gtk-icon-size:", "px;}"); + new CssFromConfigInt("panel/network_icon_size", ".network{-gtk-icon-size:", "px;}"); + new CssFromConfigInt("panel/volume_icon_size", ".volume{-gtk-icon-size:", "px;}"); + new CssFromConfigInt("panel/notifications_icon_size", ".notification-center{-gtk-icon-size:", "px;}"); + new CssFromConfigInt("panel/tray_icon_size", ".tray-button{-gtk-icon-size:", "px;}"); + new CssFromConfigString("panel/background_color", ".wf-panel{background-color:", ";}"); + new CssFromConfigBool("panel/battery_icon_invert", ".battery image{filter:invert(100%);}", ""); + new CssFromConfigBool("panel/network_icon_invert_color", ".network-icon{filter:invert(100%);}", ""); + + // People will probably need to update sizes to have a measure + // 16px, 1.1rem, 1em . + // So on + new CssFromConfigFont("panel/battery_font", ".battery {", "}"); + new CssFromConfigFont("panel/clock_font", ".clock {", "}"); + create_window(); } @@ -307,6 +407,8 @@ class WayfirePanel::impl void handle_config_reload() { + update_orientation(); + for (auto& w : left_widgets) { w->handle_config_reload(); diff --git a/src/panel/panel.hpp b/src/panel/panel.hpp index cae9903e..2e503095 100644 --- a/src/panel/panel.hpp +++ b/src/panel/panel.hpp @@ -28,8 +28,7 @@ class WayfirePanelApp : public WayfireShellApp WayfirePanel *panel_for_wl_output(wl_output *output); static WayfirePanelApp& get(); - /* Starts the program. get() is valid afterward the first (and the only) - * call to create() */ + /* Starts the program. get() is valid afterward the first (and the only) call to create() */ static void create(int argc, char **argv); ~WayfirePanelApp(); diff --git a/src/panel/widget.hpp b/src/panel/widget.hpp index 6f85c344..5ee637d9 100644 --- a/src/panel/widget.hpp +++ b/src/panel/widget.hpp @@ -8,8 +8,10 @@ #define DEFAULT_PANEL_HEIGHT "48" #define DEFAULT_ICON_SIZE 32 -#define PANEL_POSITION_BOTTOM "bottom" #define PANEL_POSITION_TOP "top" +#define PANEL_POSITION_BOTTOM "bottom" +#define PANEL_POSITION_LEFT "left" +#define PANEL_POSITION_RIGHT "right" class wayfire_config; class WayfireWidget diff --git a/src/panel/widgets/battery.cpp b/src/panel/widgets/battery.cpp index 090e1f23..2688fe4a 100644 --- a/src/panel/widgets/battery.cpp +++ b/src/panel/widgets/battery.cpp @@ -1,7 +1,6 @@ #include "battery.hpp" #include #include -#include #define UPOWER_NAME "org.freedesktop.UPower" #define DISPLAY_DEVICE "/org/freedesktop/UPower/devices/DisplayDevice" @@ -206,6 +205,24 @@ bool WayfireBatteryInfo::setup_dbus() return false; } +void WayfireBatteryInfo::update_layout() +{ + std::string panel_position = WfOption{"panel/position"}; + + if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + { + button_box.set_orientation(Gtk::Orientation::VERTICAL); + } else + { + button_box.set_orientation(Gtk::Orientation::HORIZONTAL); + } +} + +void WayfireBatteryInfo::handle_config_reload() +{ + update_layout(); +} + // TODO: simplify config loading void WayfireBatteryInfo::init(Gtk::Box *container) @@ -231,4 +248,6 @@ void WayfireBatteryInfo::init(Gtk::Box *container) button.set_child(button_box); button.property_scale_factor().signal_changed() .connect(sigc::mem_fun(*this, &WayfireBatteryInfo::update_icon)); + + update_layout(); } diff --git a/src/panel/widgets/battery.hpp b/src/panel/widgets/battery.hpp index a3366e19..bb26a785 100644 --- a/src/panel/widgets/battery.hpp +++ b/src/panel/widgets/battery.hpp @@ -38,6 +38,9 @@ class WayfireBatteryInfo : public WayfireWidget void update_details(); void update_state(); + void update_layout(); + void handle_config_reload(); + void on_properties_changed( const Gio::DBus::Proxy::MapChangedProperties& properties, const std::vector& invalidated); diff --git a/src/panel/widgets/launchers.cpp b/src/panel/widgets/launchers.cpp index 46da4d35..1f43230c 100644 --- a/src/panel/widgets/launchers.cpp +++ b/src/panel/widgets/launchers.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -44,7 +43,11 @@ bool WfLauncherButton::initialize(std::string name, std::string icon, std::strin return false; } + m_icon.set_halign(Gtk::Align::CENTER); + m_icon.set_valign(Gtk::Align::CENTER); + button.set_child(m_icon); + auto style = button.get_style_context(); style->add_class("flat"); style->add_class("launcher"); @@ -147,12 +150,32 @@ launcher_container WayfireLaunchers::get_launchers_from_config() void WayfireLaunchers::init(Gtk::Box *container) { box.get_style_context()->add_class("launchers"); + container->append(box); + + box.set_halign(Gtk::Align::CENTER); + box.set_valign(Gtk::Align::CENTER); + handle_config_reload(); } +void WayfireLaunchers::update_layout() +{ + std::string panel_position = WfOption{"panel/position"}; + + if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + { + box.set_orientation(Gtk::Orientation::VERTICAL); + } else + { + box.set_orientation(Gtk::Orientation::HORIZONTAL); + } +} + void WayfireLaunchers::handle_config_reload() { + update_layout(); + for (auto child : box.get_children()) { box.remove(*child); diff --git a/src/panel/widgets/launchers.hpp b/src/panel/widgets/launchers.hpp index 4f1fb696..3af311ab 100644 --- a/src/panel/widgets/launchers.hpp +++ b/src/panel/widgets/launchers.hpp @@ -34,6 +34,9 @@ class WayfireLaunchers : public WayfireWidget public: virtual void init(Gtk::Box *container); + + void update_layout(); + virtual void handle_config_reload(); virtual ~WayfireLaunchers() {} diff --git a/src/panel/widgets/menu.cpp b/src/panel/widgets/menu.cpp index 61cb6ad5..43cedd00 100644 --- a/src/panel/widgets/menu.cpp +++ b/src/panel/widgets/menu.cpp @@ -10,7 +10,6 @@ #include "menu.hpp" #include "gtk-utils.hpp" -#include "launchers.hpp" #include "wf-autohide-window.hpp" const std::string default_icon = "wayfire"; @@ -174,8 +173,7 @@ static bool fuzzy_match(Glib::ustring text, Glib::ustring pattern) ++j; } else { - /* Try to match current unmatched character in pattern with the next - * character in text */ + /* Try to match current unmatched character in pattern with the next character in text */ ++j; } } @@ -291,7 +289,7 @@ void WayfireMenu::load_menu_item(AppInfo app_info) loaded_apps.insert({name, exec}); /* Check if this has a 'OnlyShownIn' for a different desktop env - * If so, we throw it in a pile at the bottom just to be safe */ + * If so, we throw it in a pile at the bottom just to be safe */ if (!app_info->should_show()) { add_category_app("Hidden", app_info); @@ -596,30 +594,29 @@ void WayfireMenu::update_popover_layout() Gtk::Window *window = dynamic_cast(button->get_root()); WfOption panel_layer{"panel/layer"}; - if ((std::string)panel_layer == "overlay") + if (panel_layer.value() == "overlay") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY); } - if ((std::string)panel_layer == "top") + if (panel_layer.value() == "top") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP); } - if ((std::string)panel_layer == "bottom") + if (panel_layer.value() == "bottom") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BOTTOM); } - if ((std::string)panel_layer == "background") + if (panel_layer.value() == "background") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BACKGROUND); } }); } else { - /* Layout was already initialized, make sure to remove widgets before - * adding them again */ + /* Layout was already initialized, make sure to remove widgets before adding them again */ popover_layout_box.remove(search_entry); popover_layout_box.remove(scroll_pair); popover_layout_box.remove(separator); diff --git a/src/panel/widgets/network.cpp b/src/panel/widgets/network.cpp index 0ed71819..f2e4856c 100644 --- a/src/panel/widgets/network.cpp +++ b/src/panel/widgets/network.cpp @@ -390,9 +390,9 @@ bool WayfireNetworkInfo::setup_dbus() void WayfireNetworkInfo::on_click() { - if ((std::string)click_command_opt != "default") + if (click_command_opt.value() != "default") { - Glib::spawn_command_line_async((std::string)click_command_opt); + Glib::spawn_command_line_async(click_command_opt.value()); } else { info->spawn_control_center(nm_proxy); @@ -432,8 +432,23 @@ void WayfireNetworkInfo::init(Gtk::Box *container) handle_config_reload(); } +void WayfireNetworkInfo::update_layout() +{ + std::string panel_position = WfOption{"panel/position"}; + + if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + { + button_content.set_orientation(Gtk::Orientation::VERTICAL); + } else + { + button_content.set_orientation(Gtk::Orientation::HORIZONTAL); + } +} + void WayfireNetworkInfo::handle_config_reload() { + update_layout(); + if (status_opt.value() == NETWORK_STATUS_ICON) { if (status.get_parent()) diff --git a/src/panel/widgets/network.hpp b/src/panel/widgets/network.hpp index 1ef806ef..aad7836d 100644 --- a/src/panel/widgets/network.hpp +++ b/src/panel/widgets/network.hpp @@ -79,6 +79,9 @@ class WayfireNetworkInfo : public WayfireWidget void update_status(); void init(Gtk::Box *container); + + void update_layout(); + void handle_config_reload(); virtual ~WayfireNetworkInfo(); }; diff --git a/src/panel/widgets/separator.cpp b/src/panel/widgets/separator.cpp index 8f8636b9..1e3ea1e5 100644 --- a/src/panel/widgets/separator.cpp +++ b/src/panel/widgets/separator.cpp @@ -11,4 +11,24 @@ void WayfireSeparator::init(Gtk::Box *container) { separator.get_style_context()->add_class("separator"); container->append(separator); + + update_layout(); +} + +void WayfireSeparator::update_layout() +{ + std::string panel_position = WfOption{"panel/position"}; + + if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + { + separator.set_orientation(Gtk::Orientation::VERTICAL); + } else + { + separator.set_orientation(Gtk::Orientation::HORIZONTAL); + } +} + +void WayfireSeparator::handle_config_reload() +{ + update_layout(); } diff --git a/src/panel/widgets/separator.hpp b/src/panel/widgets/separator.hpp index 74b615bb..e9ca18e6 100644 --- a/src/panel/widgets/separator.hpp +++ b/src/panel/widgets/separator.hpp @@ -12,6 +12,10 @@ class WayfireSeparator : public WayfireWidget WayfireSeparator(int pixels); virtual void init(Gtk::Box *container); + + void update_layout(); + void handle_config_reload(); + virtual ~WayfireSeparator() {} }; diff --git a/src/panel/widgets/tray/tray.cpp b/src/panel/widgets/tray/tray.cpp index bf9a0c3a..1ec8ba21 100644 --- a/src/panel/widgets/tray/tray.cpp +++ b/src/panel/widgets/tray/tray.cpp @@ -1,10 +1,16 @@ #include "tray.hpp" +#include "gtkmm/enums.h" void WayfireStatusNotifier::init(Gtk::Box *container) { - icons_hbox.get_style_context()->add_class("tray"); - icons_hbox.set_spacing(5); - container->append(icons_hbox); + update_layout(); + icons_box.set_halign(Gtk::Align::FILL); + icons_box.set_valign(Gtk::Align::FILL); + icons_box.set_expand(true); + icons_box.set_homogeneous(true); + icons_box.get_style_context()->add_class("tray"); + icons_box.set_spacing(5); + container->append(icons_box); } void WayfireStatusNotifier::add_item(const Glib::ustring & service) @@ -15,7 +21,7 @@ void WayfireStatusNotifier::add_item(const Glib::ustring & service) } items.emplace(service, service); - icons_hbox.append(items.at(service)); + icons_box.append(items.at(service)); } void WayfireStatusNotifier::remove_item(const Glib::ustring & service) @@ -25,6 +31,24 @@ void WayfireStatusNotifier::remove_item(const Glib::ustring & service) return; } - icons_hbox.remove(items.at(service)); + icons_box.remove(items.at(service)); items.erase(service); } + +void WayfireStatusNotifier::update_layout() +{ + std::string panel_position = WfOption{"panel/position"}; + + if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + { + icons_box.set_orientation(Gtk::Orientation::VERTICAL); + } else + { + icons_box.set_orientation(Gtk::Orientation::HORIZONTAL); + } +} + +void WayfireStatusNotifier::handle_config_reload() +{ + update_layout(); +} diff --git a/src/panel/widgets/tray/tray.hpp b/src/panel/widgets/tray/tray.hpp index 0fbfb881..4001812c 100644 --- a/src/panel/widgets/tray/tray.hpp +++ b/src/panel/widgets/tray/tray.hpp @@ -11,9 +11,12 @@ class WayfireStatusNotifier : public WayfireWidget private: StatusNotifierHost host = StatusNotifierHost(this); - Gtk::Box icons_hbox; + Gtk::Box icons_box; std::map items; + void update_layout(); + void handle_config_reload(); + public: void init(Gtk::Box *container) override; diff --git a/src/panel/widgets/volume.cpp b/src/panel/widgets/volume.cpp index d6bd8034..c3922452 100644 --- a/src/panel/widgets/volume.cpp +++ b/src/panel/widgets/volume.cpp @@ -1,9 +1,6 @@ #include -#include #include #include "volume.hpp" -#include "launchers.hpp" -#include "gtk-utils.hpp" WayfireVolumeScale::WayfireVolumeScale() { @@ -195,8 +192,7 @@ void WayfireVolume::on_default_sink_changed() volume_scale.set_increments(max_norm * scroll_sensitivity, max_norm * scroll_sensitivity * 2); - /* Finally, update the displayed volume. However, do not show the - * popup */ + /* Finally, update the displayed volume. However, do not show the popup */ set_volume(gvc_mixer_stream_get_volume(gvc_stream), VOLUME_FLAG_NO_ACTION); } diff --git a/src/panel/widgets/volume.hpp b/src/panel/widgets/volume.hpp index 39d3dd25..eb69a874 100644 --- a/src/panel/widgets/volume.hpp +++ b/src/panel/widgets/volume.hpp @@ -2,16 +2,13 @@ #define WIDGETS_VOLUME_HPP #include "../widget.hpp" -#include "wf-popover.hpp" #include -#include #include #include "gvc-mixer-control.h" #include /** - * A custom scale which animates transitions when its value is - * changed programatically. + * A custom scale which animates transitions when its value is changed programatically. */ class WayfireVolumeScale : public Gtk::Scale { @@ -94,8 +91,7 @@ class WayfireVolume : public WayfireWidget void on_default_sink_changed(); /** - * Check whether the popover should be auto-hidden, and if yes, start - * a timer to hide it + * Check whether the popover should be auto-hidden, and if yes, start a timer to hide it */ void check_set_popover_timeout(); }; diff --git a/src/util/wf-autohide-window.cpp b/src/util/wf-autohide-window.cpp index 96155640..e3d1c5f7 100644 --- a/src/util/wf-autohide-window.cpp +++ b/src/util/wf-autohide-window.cpp @@ -10,15 +10,14 @@ #include #include -#define AUTOHIDE_SHOW_DELAY 300 -#define AUTOHIDE_HIDE_DELAY 500 - WayfireAutohidingWindow::WayfireAutohidingWindow(WayfireOutput *output, const std::string& section) : position{section + "/position"}, - y_position{WfOption{section + "/autohide_duration"}}, + autohide_animation{WfOption{section + "/autohide_duration"}}, edge_offset{section + "/edge_offset"}, - autohide_opt{section + "/autohide"} + autohide_opt{section + "/autohide"}, + autohide_show_delay{section + "/autohide_show_delay"}, + autohide_hide_delay{section + "/autohide_hide_delay"} { this->output = output; this->set_decorated(false); @@ -39,7 +38,7 @@ WayfireAutohidingWindow::WayfireAutohidingWindow(WayfireOutput *output, } this->input_inside_panel = true; - y_position.animate(0); + autohide_animation.animate(0); start_draw_timer(); }); pointer_gesture->signal_leave().connect([=] @@ -47,7 +46,7 @@ WayfireAutohidingWindow::WayfireAutohidingWindow(WayfireOutput *output, this->input_inside_panel = false; if (this->should_autohide()) { - this->schedule_hide(AUTOHIDE_HIDE_DELAY); + this->schedule_hide(autohide_hide_delay); } }); this->add_controller(pointer_gesture); @@ -111,6 +110,16 @@ static std::string check_position(std::string position) return WF_WINDOW_POSITION_BOTTOM; } + if (position == WF_WINDOW_POSITION_LEFT) + { + return WF_WINDOW_POSITION_LEFT; + } + + if (position == WF_WINDOW_POSITION_RIGHT) + { + return WF_WINDOW_POSITION_RIGHT; + } + std::cerr << "Bad position in config file, defaulting to top" << std::endl; return WF_WINDOW_POSITION_TOP; } @@ -128,6 +137,16 @@ static GtkLayerShellEdge get_anchor_edge(std::string position) return GTK_LAYER_SHELL_EDGE_BOTTOM; } + if (position == WF_WINDOW_POSITION_LEFT) + { + return GTK_LAYER_SHELL_EDGE_LEFT; + } + + if (position == WF_WINDOW_POSITION_RIGHT) + { + return GTK_LAYER_SHELL_EDGE_RIGHT; + } + assert(false); // not reached because check_position() } @@ -141,7 +160,7 @@ void WayfireAutohidingWindow::m_show_uncertain() { schedule_hide(0); return false; - }, AUTOHIDE_HIDE_DELAY); + }, autohide_hide_delay); } } @@ -150,6 +169,8 @@ void WayfireAutohidingWindow::update_position() /* Reset old anchors */ gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_TOP, false); gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, false); + gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, false); + gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, false); /* Set new anchor */ GtkLayerShellEdge anchor = get_anchor_edge(position); @@ -160,8 +181,17 @@ void WayfireAutohidingWindow::update_position() return; } + // need different measurements depending on position + if (anchor == GTK_LAYER_SHELL_EDGE_LEFT or anchor == GTK_LAYER_SHELL_EDGE_RIGHT) + { + get_allocated_height_or_width = &Gtk::Widget::get_allocated_width; + } else + { + get_allocated_height_or_width = &Gtk::Widget::get_allocated_height; + } + /* When the position changes, show an animation from the new edge. */ - y_position.animate(-this->get_allocated_height(), 0); + autohide_animation.animate(-(this->*get_allocated_height_or_width)(), 0); start_draw_timer(); m_show_uncertain(); setup_hotspot(); @@ -202,14 +232,26 @@ static zwf_hotspot_v2_listener hotspot_listener = { void WayfireAutohidingWindow::setup_hotspot() { /* No need to recreate hotspots if the height didn't change */ - if ((this->get_allocated_height() == last_hotspot_height) && (edge_offset == last_edge_offset)) + + auto position = check_position(this->position); + + int allocated; + if (position == WF_WINDOW_POSITION_LEFT or position == WF_WINDOW_POSITION_RIGHT) { - return; + allocated = this->get_allocated_width(); + } else + { + allocated = this->get_allocated_height(); } - this->last_hotspot_height = get_allocated_height(); - this->last_edge_offset = edge_offset; + if ((allocated == last_hotspot_size) && (edge_offset == last_edge_offset) && (position == last_position)) + { + return; + } + this->last_hotspot_size = allocated; + this->last_edge_offset = edge_offset; + this->last_position = position; if (this->edge_hotspot) { zwf_hotspot_v2_destroy(edge_hotspot); @@ -220,15 +262,26 @@ void WayfireAutohidingWindow::setup_hotspot() zwf_hotspot_v2_destroy(panel_hotspot); } - auto position = check_position(this->position); - uint32_t edge = (position == WF_WINDOW_POSITION_TOP) ? - ZWF_OUTPUT_V2_HOTSPOT_EDGE_TOP : ZWF_OUTPUT_V2_HOTSPOT_EDGE_BOTTOM; + uint32_t edge; + if (position == WF_WINDOW_POSITION_TOP) + { + edge = ZWF_OUTPUT_V2_HOTSPOT_EDGE_TOP; + } else if (position == WF_WINDOW_POSITION_BOTTOM) + { + edge = ZWF_OUTPUT_V2_HOTSPOT_EDGE_BOTTOM; + } else if (position == WF_WINDOW_POSITION_LEFT) + { + edge = ZWF_OUTPUT_V2_HOTSPOT_EDGE_LEFT; + } else if (position == WF_WINDOW_POSITION_RIGHT) + { + edge = ZWF_OUTPUT_V2_HOTSPOT_EDGE_RIGHT; + } this->edge_hotspot = zwf_output_v2_create_hotspot(output->output, - edge, edge_offset, AUTOHIDE_SHOW_DELAY); + edge, edge_offset, autohide_show_delay); this->panel_hotspot = zwf_output_v2_create_hotspot(output->output, - edge, this->get_allocated_height(), 0); // immediate + edge, allocated, 0); // immediate this->edge_callbacks = std::make_unique(); @@ -261,7 +314,7 @@ void WayfireAutohidingWindow::setup_hotspot() this->input_inside_panel = false; if (this->should_autohide()) { - this->schedule_hide(AUTOHIDE_HIDE_DELAY); + this->schedule_hide(autohide_hide_delay); } }; @@ -329,7 +382,7 @@ bool WayfireAutohidingWindow::should_autohide() const bool WayfireAutohidingWindow::m_do_hide() { - y_position.animate(-get_allocated_height()); + autohide_animation.animate(-(this->*get_allocated_height_or_width)()); start_draw_timer(); update_margin(); return false; // disconnect @@ -345,7 +398,7 @@ gboolean WayfireAutohidingWindow::update_animation(Glib::RefPtr update_margin(); // this->queue_draw(); // Once we've finished fading, stop this callback - return y_position.running() ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE; + return autohide_animation.running() ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE; } void WayfireAutohidingWindow::schedule_hide(int delay) @@ -366,7 +419,7 @@ void WayfireAutohidingWindow::schedule_hide(int delay) bool WayfireAutohidingWindow::m_do_show() { - y_position.animate(0); + autohide_animation.animate(0); start_draw_timer(); update_margin(); return false; // disconnect @@ -390,10 +443,10 @@ void WayfireAutohidingWindow::schedule_show(int delay) bool WayfireAutohidingWindow::update_margin() { - if (y_position.running()) + if (autohide_animation.running()) { gtk_layer_set_margin(this->gobj(), - get_anchor_edge(position), y_position); + get_anchor_edge(position), autohide_animation); // queue_draw does not work when the panel is hidden // so calling wl_surface_commit to make WM show the panel back if (get_surface()) @@ -460,7 +513,7 @@ void WayfireAutohidingWindow::unset_active_popover(WayfireMenuButton& button) if (should_autohide()) { - schedule_hide(AUTOHIDE_HIDE_DELAY); + schedule_hide(autohide_hide_delay); } } diff --git a/src/util/wf-autohide-window.hpp b/src/util/wf-autohide-window.hpp index 2324c6d0..360c2ae6 100644 --- a/src/util/wf-autohide-window.hpp +++ b/src/util/wf-autohide-window.hpp @@ -12,6 +12,8 @@ struct zwf_hotspot_v2; #define WF_WINDOW_POSITION_TOP "top" #define WF_WINDOW_POSITION_BOTTOM "bottom" +#define WF_WINDOW_POSITION_LEFT "left" +#define WF_WINDOW_POSITION_RIGHT "right" struct WayfireAutohidingWindowHotspotCallbacks; /** @@ -23,13 +25,13 @@ class WayfireAutohidingWindow : public Gtk::Window { public: /** - * WayfireAutohidingWindow's behavior can be modified with several config - * file options: - * + * WayfireAutohidingWindow's behavior can be modified with several config file options: * 1. section/position * 2. section/autohide_duration * 3. section/edge_offset * 4. section/autohide + * 5. section/autohide_show_delay + * 6. section/autohide_hide_delay */ WayfireAutohidingWindow(WayfireOutput *output, const std::string& section); WayfireAutohidingWindow(WayfireAutohidingWindow&&) = delete; @@ -47,8 +49,7 @@ class WayfireAutohidingWindow : public Gtk::Window /* Returns true if the window should autohide */ bool should_autohide() const; - /* Hide or show the panel after delay milliseconds, if nothing happens - * in the meantime */ + /* Hide or show the panel after delay milliseconds, if nothing happens in the meantime */ void schedule_hide(int delay); void schedule_show(int delay); @@ -60,8 +61,8 @@ class WayfireAutohidingWindow : public Gtk::Window /** * Set the currently active popover button. - * The lastly activated popover, if any, will be closed, in order to - * show this new one. + * The lastly activated popover, if any, will be closed, + * in order to show this new one. * * In addition, if the window has an active popover, it will grab the * keyboard input and deactivate the popover when the focus is lost. @@ -82,13 +83,17 @@ class WayfireAutohidingWindow : public Gtk::Window WfOption position; void update_position(); - wf::animation::simple_animation_t y_position; + wf::animation::simple_animation_t autohide_animation; + int (Gtk::Widget::*get_allocated_height_or_width)() const; bool update_margin(); WfOption edge_offset; int last_edge_offset = -1; WfOption autohide_opt; + WfOption autohide_show_delay; + WfOption autohide_hide_delay; + bool last_autohide_value = autohide_opt; void setup_autohide(); void update_autohide(); @@ -109,8 +114,9 @@ class WayfireAutohidingWindow : public Gtk::Window /** Show the window but hide if no pointer input */ void m_show_uncertain(); - int32_t last_hotspot_height = -1; - bool input_inside_panel = false; + std::string last_position = ""; + int32_t last_hotspot_size = -1; + bool input_inside_panel = false; zwf_hotspot_v2 *edge_hotspot = NULL; zwf_hotspot_v2 *panel_hotspot = NULL; std::unique_ptr edge_callbacks; diff --git a/src/util/wf-option-wrap.hpp b/src/util/wf-option-wrap.hpp index 562a189e..99130a3f 100644 --- a/src/util/wf-option-wrap.hpp +++ b/src/util/wf-option-wrap.hpp @@ -4,8 +4,7 @@ #include "wf-shell-app.hpp" /** - * An implementation of wf::base_option_wrapper_t for wf-shell-app based - * programs. + * An implementation of wf::base_option_wrapper_t for wf-shell-app based programs. */ template class WfOption : public wf::base_option_wrapper_t diff --git a/src/util/wf-popover.cpp b/src/util/wf-popover.cpp index a12c0ed7..e3a6e717 100644 --- a/src/util/wf-popover.cpp +++ b/src/util/wf-popover.cpp @@ -1,6 +1,6 @@ #include "wf-popover.hpp" +#include "gtkmm/enums.h" #include "wf-autohide-window.hpp" -#include WayfireMenuButton::WayfireMenuButton(const std::string& section) : panel_position{section + "/position"} @@ -10,8 +10,19 @@ WayfireMenuButton::WayfireMenuButton(const std::string& section) : auto cb = [=] () { - // set_direction((std::string)panel_position == "top" ? - // Gtk::Arrow::DOWN : Gtk::Arrow::UP); + if (panel_position.value() == "top") + { + set_direction(Gtk::ArrowType::DOWN); + } else if (panel_position.value() == "bottom") + { + set_direction(Gtk::ArrowType::UP); + } else if (panel_position.value() == "left") + { + set_direction(Gtk::ArrowType::RIGHT); + } else if (panel_position.value() == "right") + { + set_direction(Gtk::ArrowType::LEFT); + } this->unset_popover(); // m_popover.set_constrain_to(Gtk::POPOVER_CONSTRAINT_NONE); diff --git a/src/util/wf-shell-app.hpp b/src/util/wf-shell-app.hpp index c7036ba8..53e4d181 100644 --- a/src/util/wf-shell-app.hpp +++ b/src/util/wf-shell-app.hpp @@ -31,8 +31,7 @@ struct WayfireOutput /** * A basic shell application. * - * It is suitable for applications that need to show one or more windows - * per monitor. + * It is suitable for applications that need to show one or more windows per monitor. */ class WayfireShellApp { @@ -41,8 +40,7 @@ class WayfireShellApp std::vector> css_rules; protected: - /** This should be initialized by the subclass in each program which uses - * wf-shell-app */ + /** This should be initialized by the subclass in each program which uses wf-shell-app */ static std::unique_ptr instance; std::optional cmdline_config; std::optional cmdline_css; @@ -53,8 +51,7 @@ class WayfireShellApp virtual void add_output(GMonitor monitor); virtual void rem_output(GMonitor monitor); - /* The following functions can be overridden in the shell implementation to - * handle the events */ + /* The following functions can be overridden in the shell implementation to handle the events */ virtual void on_activate(); virtual bool parse_cfgfile(const Glib::ustring & option_name, const Glib::ustring & value, bool has_value); @@ -87,8 +84,7 @@ class WayfireShellApp /** * WayfireShellApp is a singleton class. - * Using this function, any part of the application can get access to the - * shell app. + * Using this function, any part of the application can get access to the shell app. */ static WayfireShellApp& get(); }; diff --git a/wf-shell.ini.example b/wf-shell.ini.example index 5ac56363..f5d1b892 100644 --- a/wf-shell.ini.example +++ b/wf-shell.ini.example @@ -30,9 +30,16 @@ minimal_height = 24 # automatically hide when pointer isn't over the panel autohide = false -# time in milliseconds to wait before hiding +# time in milliseconds the showing/hiding animation takes autohide_duration = 300 +# time in milliseconds to wait before showing +autohide_show_delay= 300 + +# time in milliseconds to wait before hiding +autohide_hide_delay = 500 + + # layer can be top, bottom, overlay or background layer = top