Commit 18bc4570 authored by Erik Reider's avatar Erik Reider

control-center-height is now able to be -1 to fit all widgets

parent cbfec455
...@@ -169,8 +169,11 @@ config file to be able to detect config errors ...@@ -169,8 +169,11 @@ config file to be able to detect config errors
*control-center-height* ++ *control-center-height* ++
type: integer ++ type: integer ++
default: 500 ++ default: 500 ++
description: The control center height in pixels ++ description: Height of the control center in pixels. ++
This setting is ignored when _fit-to-screen_ is set to "true". A value of -1 means that it will fit to the content. ++
Ignored when 'fit-to-screen' is set to 'true'. ++
Also limited to the height of the monitor, unless ++
'layer-shell-cover-screen' is set to false.
*control-center-width* ++ *control-center-width* ++
type: integer ++ type: integer ++
......
...@@ -581,19 +581,22 @@ namespace SwayNotificationCenter { ...@@ -581,19 +581,22 @@ namespace SwayNotificationCenter {
public bool relative_timestamps { get; set; default = true; } public bool relative_timestamps { get; set; default = true; }
/** /**
* Notification center's height, in pixels. * Height of the control center in pixels. A value of -1 means that it
* Set `fit_to_screen` to true to ignore the height setting. * will fit to the content. Ignored when 'fit-to-screen' is set to 'true'.
* Also limited to the height of the monitor, unless 'layer-shell-cover-screen'
* is set to false.
*/ */
private const int CONTROL_CENTER_MINIMUM_HEIGHT = 300; private int _control_center_height = 500;
private const int CONTROL_CENTER_DEFAULT_HEIGHT = 300;
private int _control_center_height = CONTROL_CENTER_DEFAULT_HEIGHT;
public int control_center_height { public int control_center_height {
get { get {
return _control_center_height; return _control_center_height;
} }
set { set {
_control_center_height = value > CONTROL_CENTER_MINIMUM_HEIGHT if (value < 1) {
? value : CONTROL_CENTER_MINIMUM_HEIGHT; _control_center_height = -1;
return;
}
_control_center_height = value;
} }
} }
......
...@@ -159,9 +159,9 @@ ...@@ -159,9 +159,9 @@
}, },
"control-center-height": { "control-center-height": {
"type": "integer", "type": "integer",
"description": "Height of the control center in pixels. Ignored when 'fit-to-screen' is set to 'true'. Also limited to the height of the monitor, unless 'layer-shell-cover-screen' is set to false.", "description": "Height of the control center in pixels. A value of -1 means that it will fit to the content. Ignored when 'fit-to-screen' is set to 'true'. Also limited to the height of the monitor, unless 'layer-shell-cover-screen' is set to false.",
"default": 600, "default": 500,
"minimum": 300 "minimum": -1
}, },
"control-center-width": { "control-center-width": {
"type": "integer", "type": "integer",
......
...@@ -324,6 +324,7 @@ namespace SwayNotificationCenter { ...@@ -324,6 +324,7 @@ namespace SwayNotificationCenter {
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, cover_screen); GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, cover_screen);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, cover_screen); GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, cover_screen);
} else { } else {
// Fallback to conventional positioning
switch (pos_x) { switch (pos_x) {
case PositionX.LEFT: case PositionX.LEFT:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, true); GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, true);
......
...@@ -70,6 +70,7 @@ namespace SwayNotificationCenter.Widgets { ...@@ -70,6 +70,7 @@ namespace SwayNotificationCenter.Widgets {
set_vexpand (this.vertical_expand); set_vexpand (this.vertical_expand);
scrolled_window.set_propagate_natural_height (!this.vertical_expand); scrolled_window.set_propagate_natural_height (!this.vertical_expand);
stack.set_vhomogeneous (this.vertical_expand);
} }
public uint notification_count () { public uint notification_count () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment