Skip to content
Open
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
34 changes: 31 additions & 3 deletions metadata/dock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,20 @@
<default>true</default>
</option>
<option name="autohide_duration" type="int">
<_short>Autohide duration</_short>
<_short>Autohide animation duration</_short>
<_long>Time (in milliseconds) the dock takes to expand and retract</_long>
<default>300</default>
</option>
<option name="autohide_show_delay" type="int">
<_short>Autohide show delay</_short>
<_long>Amount of time (in milliseconds) the cursor needs to be in the zone before showing.</_long>
<default>300</default>
</option>
<option name="autohide_hide_delay" type="int">
<_short>Autohide hide delay</_short>
<_long>Amount of time (in milliseconds) the cursor needs to be out of the zone before hiding.</_long>
<default>500</default>
</option>
<option name="position" type="string">
<_short>Position</_short>
<default>bottom</default>
Expand All @@ -26,11 +37,28 @@
<value>bottom</value>
<_name>Bottom</_name>
</desc>
<desc>
<value>left</value>
<_name>Left</_name>
</desc>
<desc>
<value>right</value>
<_name>Right</_name>
</desc>
</option>
<option name="dock_height" type="int">
<_short>Dock height</_short>
<option name="minimal_height" type="int">
<_short>Minimal height</_short>
<default>100</default>
</option>
<option name="minimal_width" type="int">
<_short>Minimal width</_short>
<default>100</default>
</option>
<option name="full_span" type="bool">
<_short>Anchor to edges</_short>
<_long>Wether the dock should extend all the way to the left and right; or top and bottom depending on orientation.</_long>
<default>false</default>
</option>
<option name="icon_height" type="int">
<_short>Dock icons height</_short>
<default>72</default>
Expand Down
54 changes: 46 additions & 8 deletions metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,62 @@
<default></default>
</option>
<option name="widgets_left" type="string">
<_short>Widgets Left</_short>
<_short>Widgets Left/Top</_short>
<_long>Widgets placed in the left zone of the bar, or top if the bar is vertical.</_long>
<default>menu spacing4 launchers window-list</default>
</option>
<option name="widgets_center" type="string">
<_short>Widgets Center</_short>
<default>none</default>
</option>
<option name="widgets_right" type="string">
<_short>Widgets Right</_short>
<_short>Widgets Right/Bottom</_short>
<_long>Widgets placed in the right zone of the bar, or bottom if the bar is vertical.</_long>
<default>volume network battery clock</default>
</option>
<option name="minimal_height" type="int">
<_short>Minimal Height</_short>
<default>32</default>
<default>42</default>
<_long>Minimum height the panel takes.</_long>
</option>
<option name="minimal_width" type="int">
<_short>Minimal Width</_short>
<_long>Minimum width the panel takes.</_long>
<default>42</default>
</option>
<option name="full_span" type="bool">
<_short>Anchor to edges</_short>
<_long>Wether the pannel should extend all the way to the left and right; or top and bottom depending on orientation.</_long>
<default>true</default>
</option>
<option name="force_center" type="bool">
<_short>Force center by widgets</_short>
<_long>If on, the widgets on the left and right of the panel always take the same amount of space and the widgets in center are forced in the middle of the screen.
This will lead to unused space on the side that has the least space taken up by the widgets.</_long>
<default>false</default>
</option>
<option name="autohide" type="bool">
<_short>Autohide</_short>
<default>false</default>
</option>
<option name="autohide_duration" type="int">
<_short>Autohide Duration</_short>
<_short>Autohide animation duration</_short>
<_long>Time (in milliseconds) the panel takes to expand and retract</_long>
<default>300</default>
</option>
<option name="outputs" type="string">
<_short>Outputs on which to show a panel instance</_short>
<_long>A comma separated list of output names on which to show panel instances. Set to * wildcard for all outputs.</_long>
<default>*</default>
<option name="autohide_show_delay" type="int">
<_short>Autohide show delay</_short>
<_long>Amount of time (in milliseconds) the cursor needs to be in the zone before showing.</_long>
<default>300</default>
</option>
<option name="autohide_hide_delay" type="int">
<_short>Autohide hide delay</_short>
<_long>Amount of time (in milliseconds) the cursor needs to be out of the zone before hiding.</_long>
<default>500</default>
</option>
<option name="position" type="string">
<_short>Panel Position</_short>
Expand All @@ -49,6 +78,14 @@
<value>bottom</value>
<_name>Bottom</_name>
</desc>
<desc>
<value>left</value>
<_name>Left</_name>
</desc>
<desc>
<value>right</value>
<_name>Right</_name>
</desc>
</option>
<option name="edge_offset" type="int">
<_short>Edge offset</_short>
Expand Down Expand Up @@ -85,10 +122,11 @@
<option name="launchers_spacing" type="int">
<_short>Launchers Spacing</_short>
<default>4</default>
<min>0</min>
</option>
<option name="launchers_size" type="int">
<_short>Launchers Icon Size</_short>
<default>42</default>
<default>0</default>
<min>0</min>
</option>
</group>
Expand Down Expand Up @@ -191,7 +229,7 @@
</option>
<option name="menu_icon_size" type="int">
<_short>Menu Icon Size</_short>
<default>42</default>
<default>0</default>
<min>0</min>
</option>
<option name="menu_min_category_width" type="int">
Expand Down Expand Up @@ -497,8 +535,8 @@ Set to -1 to only run it by clicking the button.
</desc>
<default>row</default>
</option>
<option name="workspace_switcher_target_height" type="double">
<_short>Target height for workspace switcher widget in pixels</_short>
<option name="workspace_switcher_target_size" type="double">
<_short>Target size for workspace switcher widget in pixels</_short>
<default>0</default>
</option>
<option name="workspace_switcher_render_views" type="bool">
Expand Down
55 changes: 36 additions & 19 deletions src/dock/dock.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#include <gtkmm/window.h>
#include <gdkmm/frameclock.h>
#include <glibmm/main.h>
#include <gtkmm.h>
#include <glibmm.h>
#include <gdk/wayland/gdkwayland.h>

#include <gtk-utils.hpp>
#include <wf-shell-app.hpp>
#include <gtk4-layer-shell.h>
#include <wf-autohide-window.hpp>

#include "dock.hpp"
#include "wf-shell-app.hpp"
#include "wf-autohide-window.hpp"
#include "../util/gtk-utils.hpp"
#include <css-config.hpp>


class WfDock::impl
{
Expand All @@ -22,7 +17,7 @@ class WfDock::impl
Gtk::Box box;

WfOption<std::string> css_path{"dock/css_path"};
WfOption<int> dock_height{"dock/dock_height"};
WfOption<std::string> position{"dock/position"};

public:
impl(WayfireOutput *output)
Expand All @@ -32,18 +27,15 @@ class WfDock::impl
new WayfireAutohidingWindow(output, "dock"));
window->set_auto_exclusive_zone(false);
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);
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.add_css_class("out-box");
box.add_css_class("box");
window->set_child(out_box);
out_box.add_css_class("out_box");

window->add_css_class("wf-dock");
box.add_css_class("box");

out_box.set_halign(Gtk::Align::CENTER);
window->add_css_class("wf-dock");
window->set_child(out_box);

if ((std::string)css_path != "")
{
Expand All @@ -64,6 +56,31 @@ class WfDock::impl
set_clickable_region();
return true;
});

auto update_position = [=] ()
{
if (position.value() == "bottom")
{
// this is not great, but we lack better options without doing a
// layout with boxes in boxes (ugly) or some sort of custom layout manager
box.set_orientation(Gtk::Orientation::HORIZONTAL);
box.set_direction(Gtk::TextDirection::LTR);
} else if (position.value() == "left")
{
box.set_orientation(Gtk::Orientation::VERTICAL);
box.set_direction(Gtk::TextDirection::LTR);
} else if (position.value() == "right")
{
box.set_orientation(Gtk::Orientation::VERTICAL);
box.set_direction(Gtk::TextDirection::RTL);
} else // top
{
box.set_orientation(Gtk::Orientation::HORIZONTAL);
box.set_direction(Gtk::TextDirection::LTR);
}
};
position.set_callback(update_position);
update_position();
}

void add_child(Gtk::Widget& widget)
Expand All @@ -82,7 +99,7 @@ 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();
Expand Down
3 changes: 1 addition & 2 deletions src/dock/dock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ 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();
std::string get_application_name() override;
Expand Down
Loading