Added control-center layer config option (#263)
This commit is contained in:
@@ -48,8 +48,8 @@ namespace SwayNotificationCenter {
|
|||||||
|
|
||||||
GtkLayerShell.set_exclusive_zone (this, -1);
|
GtkLayerShell.set_exclusive_zone (this, -1);
|
||||||
|
|
||||||
GtkLayerShell.Layer layer = GtkLayerShell.Layer.TOP;
|
GtkLayerShell.Layer layer;
|
||||||
switch (ConfigModel.instance.layer) {
|
switch (ConfigModel.instance.control_center_layer) {
|
||||||
case Layer.BACKGROUND:
|
case Layer.BACKGROUND:
|
||||||
layer = GtkLayerShell.Layer.BACKGROUND;
|
layer = GtkLayerShell.Layer.BACKGROUND;
|
||||||
break;
|
break;
|
||||||
@@ -59,6 +59,7 @@ namespace SwayNotificationCenter {
|
|||||||
case Layer.TOP:
|
case Layer.TOP:
|
||||||
layer = GtkLayerShell.Layer.TOP;
|
layer = GtkLayerShell.Layer.TOP;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
case Layer.OVERLAY:
|
case Layer.OVERLAY:
|
||||||
layer = GtkLayerShell.Layer.OVERLAY;
|
layer = GtkLayerShell.Layer.OVERLAY;
|
||||||
break;
|
break;
|
||||||
|
@@ -2,7 +2,8 @@
|
|||||||
"$schema": @JSONPATH@,
|
"$schema": @JSONPATH@,
|
||||||
"positionX": "right",
|
"positionX": "right",
|
||||||
"positionY": "top",
|
"positionY": "top",
|
||||||
"layer": "top",
|
"layer": "overlay",
|
||||||
|
"control-center-layer": "top",
|
||||||
"layer-shell": true,
|
"layer-shell": true,
|
||||||
"cssPriority": "application",
|
"cssPriority": "application",
|
||||||
"control-center-margin-top": 0,
|
"control-center-margin-top": 0,
|
||||||
|
@@ -27,14 +27,13 @@ namespace SwayNotificationCenter {
|
|||||||
|
|
||||||
public string parse () {
|
public string parse () {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
default:
|
|
||||||
return "top";
|
|
||||||
case BACKGROUND:
|
case BACKGROUND:
|
||||||
return "background";
|
return "background";
|
||||||
case BOTTOM:
|
case BOTTOM:
|
||||||
return "bottom";
|
return "bottom";
|
||||||
case TOP:
|
case TOP:
|
||||||
return "top";
|
return "top";
|
||||||
|
default:
|
||||||
case OVERLAY:
|
case OVERLAY:
|
||||||
return "overlay";
|
return "overlay";
|
||||||
}
|
}
|
||||||
@@ -346,9 +345,9 @@ namespace SwayNotificationCenter {
|
|||||||
get; set; default = PositionY.TOP;
|
get; set; default = PositionY.TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Layer of control center */
|
/** Layer of notification window */
|
||||||
public Layer layer {
|
public Layer layer {
|
||||||
get; set; default = Layer.TOP;
|
get; set; default = Layer.OVERLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -483,6 +482,11 @@ namespace SwayNotificationCenter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Layer of Control Center window */
|
||||||
|
public Layer control_center_layer {
|
||||||
|
get; set; default = Layer.TOP;
|
||||||
|
}
|
||||||
|
|
||||||
/** Categories settings */
|
/** Categories settings */
|
||||||
public OrderedHashTable<Category> categories_settings {
|
public OrderedHashTable<Category> categories_settings {
|
||||||
get;
|
get;
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
},
|
},
|
||||||
"layer": {
|
"layer": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Layer of control center window",
|
"description": "Layer of notification window",
|
||||||
"default": "top",
|
"default": "overlay",
|
||||||
"enum": ["background", "bottom", "top", "overlay"]
|
"enum": ["background", "bottom", "top", "overlay"]
|
||||||
},
|
},
|
||||||
"layer-shell": {
|
"layer-shell": {
|
||||||
@@ -69,6 +69,12 @@
|
|||||||
"description": "The margin (in pixels) at the left of the notification center. 0 to disable",
|
"description": "The margin (in pixels) at the left of the notification center. 0 to disable",
|
||||||
"default": 0
|
"default": 0
|
||||||
},
|
},
|
||||||
|
"control-center-layer": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Layer of control center window",
|
||||||
|
"default": "none",
|
||||||
|
"enum": ["background", "bottom", "top", "overlay", "none"]
|
||||||
|
},
|
||||||
"notification-2fa-action": {
|
"notification-2fa-action": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "If each notification should display a 'COPY \"1234\"' action",
|
"description": "If each notification should display a 'COPY \"1234\"' action",
|
||||||
|
@@ -270,8 +270,8 @@ namespace SwayNotificationCenter {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set layer
|
// Set layer
|
||||||
GtkLayerShell.Layer layer = GtkLayerShell.Layer.TOP;
|
GtkLayerShell.Layer layer;
|
||||||
switch (ConfigModel.instance.layer) {
|
switch (ConfigModel.instance.control_center_layer) {
|
||||||
case Layer.BACKGROUND:
|
case Layer.BACKGROUND:
|
||||||
layer = GtkLayerShell.Layer.BACKGROUND;
|
layer = GtkLayerShell.Layer.BACKGROUND;
|
||||||
break;
|
break;
|
||||||
@@ -281,6 +281,7 @@ namespace SwayNotificationCenter {
|
|||||||
case Layer.TOP:
|
case Layer.TOP:
|
||||||
layer = GtkLayerShell.Layer.TOP;
|
layer = GtkLayerShell.Layer.TOP;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
case Layer.OVERLAY:
|
case Layer.OVERLAY:
|
||||||
layer = GtkLayerShell.Layer.OVERLAY;
|
layer = GtkLayerShell.Layer.OVERLAY;
|
||||||
break;
|
break;
|
||||||
|
@@ -53,7 +53,6 @@ namespace SwayNotificationCenter {
|
|||||||
}
|
}
|
||||||
GtkLayerShell.init_for_window (this);
|
GtkLayerShell.init_for_window (this);
|
||||||
GtkLayerShell.set_namespace (this, "swaync-notification-window");
|
GtkLayerShell.set_namespace (this, "swaync-notification-window");
|
||||||
GtkLayerShell.set_layer (this, GtkLayerShell.Layer.OVERLAY);
|
|
||||||
}
|
}
|
||||||
this.set_anchor ();
|
this.set_anchor ();
|
||||||
|
|
||||||
@@ -68,56 +67,68 @@ namespace SwayNotificationCenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void set_anchor () {
|
private void set_anchor () {
|
||||||
switch (ConfigModel.instance.positionX) {
|
if (swaync_daemon.use_layer_shell) {
|
||||||
case PositionX.LEFT:
|
GtkLayerShell.Layer layer;
|
||||||
if (!swaync_daemon.use_layer_shell) break;
|
switch (ConfigModel.instance.layer) {
|
||||||
GtkLayerShell.set_anchor (
|
case Layer.BACKGROUND:
|
||||||
this, GtkLayerShell.Edge.RIGHT, false);
|
layer = GtkLayerShell.Layer.BACKGROUND;
|
||||||
GtkLayerShell.set_anchor (
|
break;
|
||||||
this, GtkLayerShell.Edge.LEFT, true);
|
case Layer.BOTTOM:
|
||||||
break;
|
layer = GtkLayerShell.Layer.BOTTOM;
|
||||||
case PositionX.CENTER:
|
break;
|
||||||
if (!swaync_daemon.use_layer_shell) break;
|
case Layer.TOP:
|
||||||
GtkLayerShell.set_anchor (
|
layer = GtkLayerShell.Layer.TOP;
|
||||||
this, GtkLayerShell.Edge.RIGHT, false);
|
break;
|
||||||
GtkLayerShell.set_anchor (
|
default:
|
||||||
this, GtkLayerShell.Edge.LEFT, false);
|
case Layer.OVERLAY:
|
||||||
break;
|
layer = GtkLayerShell.Layer.OVERLAY;
|
||||||
default:
|
break;
|
||||||
if (!swaync_daemon.use_layer_shell) break;
|
}
|
||||||
GtkLayerShell.set_anchor (
|
GtkLayerShell.set_layer (this, layer);
|
||||||
this, GtkLayerShell.Edge.LEFT, false);
|
|
||||||
GtkLayerShell.set_anchor (
|
switch (ConfigModel.instance.positionX) {
|
||||||
this, GtkLayerShell.Edge.RIGHT, true);
|
case PositionX.LEFT:
|
||||||
break;
|
GtkLayerShell.set_anchor (
|
||||||
}
|
this, GtkLayerShell.Edge.RIGHT, false);
|
||||||
switch (ConfigModel.instance.positionY) {
|
GtkLayerShell.set_anchor (
|
||||||
default:
|
this, GtkLayerShell.Edge.LEFT, true);
|
||||||
case PositionY.TOP:
|
break;
|
||||||
list_reverse = false;
|
case PositionX.CENTER:
|
||||||
if (!swaync_daemon.use_layer_shell) break;
|
GtkLayerShell.set_anchor (
|
||||||
GtkLayerShell.set_anchor (
|
this, GtkLayerShell.Edge.RIGHT, false);
|
||||||
this, GtkLayerShell.Edge.BOTTOM, false);
|
GtkLayerShell.set_anchor (
|
||||||
GtkLayerShell.set_anchor (
|
this, GtkLayerShell.Edge.LEFT, false);
|
||||||
this, GtkLayerShell.Edge.TOP, true);
|
break;
|
||||||
break;
|
default:
|
||||||
case PositionY.CENTER:
|
GtkLayerShell.set_anchor (
|
||||||
list_reverse = false;
|
this, GtkLayerShell.Edge.LEFT, false);
|
||||||
if (!swaync_daemon.use_layer_shell) break;
|
GtkLayerShell.set_anchor (
|
||||||
GtkLayerShell.set_anchor (
|
this, GtkLayerShell.Edge.RIGHT, true);
|
||||||
this, GtkLayerShell.Edge.BOTTOM, false);
|
break;
|
||||||
GtkLayerShell.set_anchor (
|
}
|
||||||
this, GtkLayerShell.Edge.TOP, false);
|
switch (ConfigModel.instance.positionY) {
|
||||||
break;
|
default:
|
||||||
case PositionY.BOTTOM:
|
case PositionY.TOP:
|
||||||
list_reverse = true;
|
GtkLayerShell.set_anchor (
|
||||||
if (!swaync_daemon.use_layer_shell) break;
|
this, GtkLayerShell.Edge.BOTTOM, false);
|
||||||
GtkLayerShell.set_anchor (
|
GtkLayerShell.set_anchor (
|
||||||
this, GtkLayerShell.Edge.TOP, false);
|
this, GtkLayerShell.Edge.TOP, true);
|
||||||
GtkLayerShell.set_anchor (
|
break;
|
||||||
this, GtkLayerShell.Edge.BOTTOM, true);
|
case PositionY.CENTER:
|
||||||
break;
|
GtkLayerShell.set_anchor (
|
||||||
|
this, GtkLayerShell.Edge.BOTTOM, false);
|
||||||
|
GtkLayerShell.set_anchor (
|
||||||
|
this, GtkLayerShell.Edge.TOP, false);
|
||||||
|
break;
|
||||||
|
case PositionY.BOTTOM:
|
||||||
|
GtkLayerShell.set_anchor (
|
||||||
|
this, GtkLayerShell.Edge.TOP, false);
|
||||||
|
GtkLayerShell.set_anchor (
|
||||||
|
this, GtkLayerShell.Edge.BOTTOM, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
list_reverse = ConfigModel.instance.positionY == PositionY.BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void size_alloc () {
|
private void size_alloc () {
|
||||||
|
Reference in New Issue
Block a user