@@ -43,7 +43,7 @@ const Bar::bar_mode_map Bar::PRESET_MODES = { //
43
43
.visible = true }},
44
44
{" invisible" ,
45
45
{//
46
- .layer = std::nullopt ,
46
+ .layer = bar_layer::BOTTOM ,
47
47
.exclusive = false ,
48
48
.passthrough = true ,
49
49
.visible = false }},
@@ -59,7 +59,7 @@ const std::string Bar::MODE_INVISIBLE = "invisible";
59
59
const std::string_view DEFAULT_BAR_ID = " bar-0" ;
60
60
61
61
/* 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) {
63
63
if (j == " bottom" ) {
64
64
l = bar_layer::BOTTOM;
65
65
} else if (j == " top" ) {
@@ -317,13 +317,13 @@ void waybar::Bar::setMode(const std::string& mode) {
317
317
void waybar::Bar::setMode (const struct bar_mode & mode) {
318
318
auto * gtk_window = window.gobj ();
319
319
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;
324
323
} 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;
326
325
}
326
+ gtk_layer_set_layer (gtk_window, layer);
327
327
328
328
if (mode.exclusive ) {
329
329
gtk_layer_auto_exclusive_zone_enable (gtk_window);
0 commit comments