Skip to content

Commit 45fec7b

Browse files
committed
Revert "change layer for mode invisible to nullopt"
Previous commit should have a better workaround for Alexays#3211. This reverts commit b61ea62.
1 parent 7b23d58 commit 45fec7b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Diff for: include/bar.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct bar_margins {
4242
};
4343

4444
struct bar_mode {
45-
std::optional<bar_layer> layer;
45+
bar_layer layer;
4646
bool exclusive;
4747
bool passthrough;
4848
bool visible;

Diff for: src/bar.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const Bar::bar_mode_map Bar::PRESET_MODES = { //
4343
.visible = true}},
4444
{"invisible",
4545
{//
46-
.layer = std::nullopt,
46+
.layer = bar_layer::BOTTOM,
4747
.exclusive = false,
4848
.passthrough = true,
4949
.visible = false}},
@@ -59,7 +59,7 @@ const std::string Bar::MODE_INVISIBLE = "invisible";
5959
const std::string_view DEFAULT_BAR_ID = "bar-0";
6060

6161
/* Deserializer for enum bar_layer */
62-
void from_json(const Json::Value& j, std::optional<bar_layer>& l) {
62+
void from_json(const Json::Value& j, bar_layer& l) {
6363
if (j == "bottom") {
6464
l = bar_layer::BOTTOM;
6565
} else if (j == "top") {
@@ -317,13 +317,13 @@ void waybar::Bar::setMode(const std::string& mode) {
317317
void waybar::Bar::setMode(const struct bar_mode& mode) {
318318
auto* gtk_window = window.gobj();
319319

320-
if (mode.layer == bar_layer::BOTTOM) {
321-
gtk_layer_set_layer(gtk_window, GTK_LAYER_SHELL_LAYER_BOTTOM);
322-
} else if (mode.layer == bar_layer::TOP) {
323-
gtk_layer_set_layer(gtk_window, GTK_LAYER_SHELL_LAYER_TOP);
320+
auto layer = GTK_LAYER_SHELL_LAYER_BOTTOM;
321+
if (mode.layer == bar_layer::TOP) {
322+
layer = GTK_LAYER_SHELL_LAYER_TOP;
324323
} else if (mode.layer == bar_layer::OVERLAY) {
325-
gtk_layer_set_layer(gtk_window, GTK_LAYER_SHELL_LAYER_OVERLAY);
324+
layer = GTK_LAYER_SHELL_LAYER_OVERLAY;
326325
}
326+
gtk_layer_set_layer(gtk_window, layer);
327327

328328
if (mode.exclusive) {
329329
gtk_layer_auto_exclusive_zone_enable(gtk_window);

0 commit comments

Comments
 (0)