Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add background_color to dock options #88

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
12 changes: 12 additions & 0 deletions metadata/dock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,17 @@
<_name>Bottom</_name>
</desc>
</option>
<option name="dock_height" type="int">
<_short>Dock height</_short>
<default>100</default>
</option>
<option name="icon_height" type="int">
<_short>Dock icons height</_short>
<default>72</default>
</option>
<option name="background_color" type="color">
<_short>Dock background color</_short>
<default>#222222AA</default>
</option>
</plugin>
</wf-shell>
8 changes: 6 additions & 2 deletions src/dock/dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "dock.hpp"
#include "../util/gtk-utils.hpp"
#include <wayfire/config/types.hpp>

class WfDock::impl
{
Expand All @@ -22,6 +23,8 @@ class WfDock::impl
Gtk::HBox box;

WfOption<std::string> css_path{"dock/css_path"};
WfOption<int> dock_height{"dock/dock_height"};
WfOption<wf::color_t> background_color{"dock/background_color"};

public:
impl(WayfireOutput *output)
Expand All @@ -30,7 +33,7 @@ class WfDock::impl
window = std::unique_ptr<WayfireAutohidingWindow> (
new WayfireAutohidingWindow(output, "dock"));

window->set_size_request(100, 100);
window->set_size_request(dock_height, dock_height);
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP);
window->increase_autohide();

Expand All @@ -49,7 +52,8 @@ class WfDock::impl
screen, css, GTK_STYLE_PROVIDER_PRIORITY_USER);
}
}

window->override_background_color
(Gdk::RGBA(wf::option_type::to_string<wf::color_t>(background_color)));
window->show_all();
_wl_surface = gdk_wayland_window_get_wl_surface(
window->get_window()->gobj());
Expand Down
9 changes: 6 additions & 3 deletions src/dock/toplevel-icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <iostream>
#include <sstream>
#include <cassert>
#include "wf-option-wrap.hpp"

namespace IconProvider
{
Expand All @@ -32,6 +33,7 @@ class WfToplevelIcon::impl
Gtk::Button button;
Gtk::Image image;
std::string app_id;
WfOption<int> icon_height{"dock/icon_height"};

public:
impl(zwlr_foreign_toplevel_handle_v1 *handle, wl_output *output)
Expand Down Expand Up @@ -89,9 +91,10 @@ class WfToplevelIcon::impl
void set_app_id(std::string app_id)
{
this->app_id = app_id;
IconProvider::set_image_from_icon(image, app_id,
72, button.get_scale_factor());

IconProvider::set_image_from_icon(image,
app_id,
icon_height,
button.get_scale_factor());
}

void send_rectangle_hint()
Expand Down