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
*control-center-height* ++
type: integer ++
default: 500 ++
description: The control center height in pixels ++
This setting is ignored when _fit-to-screen_ is set to "true".
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.
*control-center-width* ++
type: integer ++
......
......@@ -581,19 +581,22 @@ namespace SwayNotificationCenter {
public bool relative_timestamps { get; set; default = true; }
/**
* Notification center's height, in pixels.
* Set `fit_to_screen` to true to ignore the height setting.
* 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.
*/
private const int CONTROL_CENTER_MINIMUM_HEIGHT = 300;
private const int CONTROL_CENTER_DEFAULT_HEIGHT = 300;
private int _control_center_height = CONTROL_CENTER_DEFAULT_HEIGHT;
private int _control_center_height = 500;
public int control_center_height {
get {
return _control_center_height;
}
set {
_control_center_height = value > CONTROL_CENTER_MINIMUM_HEIGHT
? value : CONTROL_CENTER_MINIMUM_HEIGHT;
if (value < 1) {
_control_center_height = -1;
return;
}
_control_center_height = value;
}
}
......
......@@ -159,9 +159,9 @@
},
"control-center-height": {
"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.",
"default": 600,
"minimum": 300
"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": 500,
"minimum": -1
},
"control-center-width": {
"type": "integer",
......
......@@ -324,6 +324,7 @@ namespace SwayNotificationCenter {
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, cover_screen);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, cover_screen);
} else {
// Fallback to conventional positioning
switch (pos_x) {
case PositionX.LEFT:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, true);
......
......@@ -70,6 +70,7 @@ namespace SwayNotificationCenter.Widgets {
set_vexpand (this.vertical_expand);
scrolled_window.set_propagate_natural_height (!this.vertical_expand);
stack.set_vhomogeneous (this.vertical_expand);
}
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