config: remove redundant options

parent 1291f4d5
......@@ -40,13 +40,6 @@ config file to be able to detect config errors
description: Wether or not the windows should be opened as layer-shell ++
surfaces. Note: Requires ximper-shell-notification-center restart to apply
*cssPriority* ++
type: string ++
default: application ++
values: application, user ++
description: Which GTK priority to use when loading the default and user ++
CSS files. Pick "user" to override *XDG_CONFIG_HOME/gtk-3.0/gtk.css*
*control-center-positionX* ++
type: string ++
default: right ++
......@@ -95,11 +88,6 @@ config file to be able to detect config errors
compositors exclusive zones. An example would be setting it to ++
*false* to cover your panel/dock.
*notification-2fa-action* ++
type: bool ++
default: true ++
description: If each notification should display a 'COPY \"1234\"' action
*timeout* ++
type: integer ++
default: 10 ++
......@@ -120,11 +108,6 @@ config file to be able to detect config errors
default: 500 ++
description: Width of the notification in pixels
*notification-window-height* ++
type: integer ++
default: -1 ++
description: Max height of the notification in pixels. -1 to use ++
the full amount of space given by the compositor.
*notification-window-preferred-output* ++
type: string ++
......@@ -135,21 +118,6 @@ config file to be able to detect config errors
(ex: "Acer Technologies XV272U V 503023B314202"). ++
If the output is not found, the currently focused one is picked.
*keyboard-shortcuts* ++
type: bool ++
default: true ++
description: If control center should use keyboard shortcuts
*notification-grouping* ++
type: bool ++
default: true ++
description: If notifications should be grouped by app name
*image-visibility* ++
type: string ++
default: always ++
values: always, when-available, never ++
description: An explanation about the purpose of this instance.
*transition-time* ++
type: integer ++
......@@ -167,11 +135,6 @@ config file to be able to detect config errors
description: Hides the control center when clicking on notification action
*fit-to-screen* ++
type: bool ++
default: true ++
description: Whether the control center should expand vertically to fill the screen
*relative-timestamps* ++
type: bool ++
default: true ++
......@@ -184,8 +147,7 @@ config file to be able to detect config errors
description: Height of the control center in pixels. ++
When 'control-center-dynamic-height' is true, ++
this acts as maximum height. ++
A value of -1 means that it will fit to the content. ++
Ignored when 'fit-to-screen' is set to 'true'.
A value of -1 means that it will fit to the content.
*control-center-dynamic-height* ++
type: bool ++
......@@ -208,51 +170,6 @@ config file to be able to detect config errors
(ex: "Acer Technologies XV272U V 503023B314202"). If the ++
output is not found, the currently focused one is picked.
*notification-action-filter* ++
type: object ++
visibility object properties: ++
*use-regex*++
type: bool ++
optional: true ++
default: false ++
description: Indicates if all the below fields should use ++
regex or not.++
*app-name*++
type: string ++
optional: true ++
description: The app-name.++
*desktop-entry*++
type: string ++
optional: true ++
description: The desktop-entry.++
*id-matcher*++
type: string ++
optional: true (needs at least one *matcher*) ++
description: Matches the actions identifier. Can be found by ++
reading the output of ximper-shell-notification-center when run with the ++
*G_MESSAGES_DEBUG=all* environment variable.++
*text-matcher*++
type: string ++
optional: true (needs at least one *matcher*) ++
description: Matches the actions text visible in the notification. ++
description: Hides matching action(s) of matching notifications. ++
If the notification doesn't include one of the properties, that ++
property will be ignored. If all properties match the given ++
notification, the matching actions will be hidden. ++
example:
```
{
"notification-action-filter": {
"hide-chromium-settings": {
"desktop-entry": "chromium-browser",
"use-regex": false,
"id-matcher": "settings",
"text-matcher": "Settings"
}
},
}
```
*notification-visibility* ++
type: object ++
visibility object properties: ++
......
......@@ -4,7 +4,6 @@
"positionY": "top",
"layer": "overlay",
"layer-shell": true,
"cssPriority": "user",
"control-center-width": 400,
"control-center-height": 740,
"control-center-dynamic-height": true,
......@@ -12,17 +11,12 @@
"control-center-margin-bottom": 8,
"control-center-margin-right": 8,
"control-center-margin-left": 0,
"notification-2fa-action": true,
"notification-inline-replies": false,
"notification-window-width": 400,
"notification-body-image-height": 160,
"notification-body-image-width": 200,
"timeout": 4,
"timeout-low": 2,
"timeout-critical": 6,
"fit-to-screen": false,
"keyboard-shortcuts": true,
"image-visibility": "when-available",
"transition-time": 200,
"hide-on-clear": false,
"hide-on-action": false,
......
......@@ -7,20 +7,6 @@ namespace XimperShellNotificationCenter {
TOP, BOTTOM, CENTER, NONE;
}
public enum ImageVisibility {
ALWAYS, WHEN_AVAILABLE, NEVER;
public string parse () {
switch (this) {
default:
return "always";
case WHEN_AVAILABLE:
return "when_available";
case NEVER:
return "never";
}
}
}
public enum Layer {
BACKGROUND, BOTTOM, TOP, OVERLAY;
......@@ -54,19 +40,6 @@ namespace XimperShellNotificationCenter {
}
}
public enum CssPriority {
APPLICATION, USER;
public int get_priority () {
switch (this) {
case APPLICATION:
return Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION;
default:
case USER:
return Gtk.STYLE_PROVIDER_PRIORITY_USER;
}
}
}
public class Category : Object {
public string ?sound { get; set; default = null; }
......@@ -461,10 +434,6 @@ namespace XimperShellNotificationCenter {
*/
public bool layer_shell_cover_screen { get; set; default = true; }
/** The CSS loading priority */
public CssPriority cssPriority { // vala-lint=naming-convention
get; set; default = CssPriority.USER;
}
/** The timeout for notifications with NORMAL priority */
private const int TIMEOUT_DEFAULT = 10;
......@@ -518,26 +487,15 @@ namespace XimperShellNotificationCenter {
* Specifies if the control center should use keyboard shortcuts
* and block keyboard input for other applications while open
*/
public bool keyboard_shortcuts { get; set; default = true; }
/**
* If notifications should be grouped by app name
*/
public bool notification_grouping { get; set; default = true; }
/** Specifies if the notification image should be shown or not */
public ImageVisibility image_visibility {
get;
set;
default = ImageVisibility.WHEN_AVAILABLE;
}
/**
* Notification window's width, in pixels.
*/
public int notification_window_width { get; set; default = 500; }
/** Max height of the notification in pixels */
public int notification_window_height { get; set; default = -1; }
/**
* The preferred output to open the notification window (popup notifications).
......@@ -623,12 +581,7 @@ namespace XimperShellNotificationCenter {
default = new OrderedHashTable<Category> ();
}
/** Filter Notification Actions */
public OrderedHashTable<ActionMatching> notification_action_filter {
get;
set;
default = new OrderedHashTable<ActionMatching> ();
}
/** Notification Status */
public OrderedHashTable<NotificationVisibility> notification_visibility {
......@@ -637,8 +590,6 @@ namespace XimperShellNotificationCenter {
default = new OrderedHashTable<NotificationVisibility> ();
}
/** Whether to expand the notification center across both edges of the screen */
public bool fit_to_screen { get; set; default = true; }
/**
* Display notification timestamp relative to now e.g. "26 minutes ago".
......@@ -701,16 +652,6 @@ namespace XimperShellNotificationCenter {
*/
public string control_center_preferred_output { get; set; default = ""; }
/**
* If each notification should display a 'COPY \"1234\"' action
*/
public bool notification_2fa_action { get; set; default = true; }
/**
* If notifications should display a text field to reply if the
* sender requests it.
*/
public bool notification_inline_replies { get; set; default = false; }
/**
* Notification icon size, in pixels.
......@@ -790,15 +731,6 @@ namespace XimperShellNotificationCenter {
out status);
value = result;
return status;
case "notification-action-filter" :
bool status;
OrderedHashTable<ActionMatching> result =
extract_hashtable<ActionMatching> (
property_name,
property_node,
out status);
value = result;
return status;
case "notification-visibility" :
bool status;
OrderedHashTable<NotificationVisibility> result =
......@@ -872,11 +804,6 @@ namespace XimperShellNotificationCenter {
var table = (OrderedHashTable<Category>) value;
node.set_object (serialize_hashtable<Category> (table));
break;
case "notification-action-filter" :
node = new Json.Node (Json.NodeType.OBJECT);
var table = (OrderedHashTable<ActionMatching>) value;
node.set_object (serialize_hashtable<ActionMatching> (table));
break;
case "notification-visibility":
node = new Json.Node (Json.NodeType.OBJECT);
var table = (OrderedHashTable<NotificationVisibility>) value;
......
......@@ -35,12 +35,6 @@
"description": "Whether or not the windows should cover the whole screen when layer-shell is used. May exceed the height of the monitor if the value is too large. Fixes animations in compositors like Hyprland.",
"default": true
},
"cssPriority": {
"type": "string",
"description": "Which GTK priority to use when loading the default and user CSS files. Pick \"user\" to override XDG_CONFIG_HOME/gtk-4.0/gtk.css",
"default": "highest",
"enum": ["application", "user"]
},
"positionY": {
"type": "string",
"description": "Vertical position of control center and notification window",
......@@ -90,16 +84,6 @@
"description": "Whether or not the control center should follow the compositors exclusive zones. An example would be setting it to \"false\" to cover your panel/dock.",
"default": true
},
"notification-2fa-action": {
"type": "boolean",
"description": "If each notification should display a 'COPY \"1234\"' action",
"default": true
},
"notification-inline-replies": {
"type": "boolean",
"description": "If notifications should display a text field to reply if the sender requests it. NOTE: Replying in popup notifications is only available if the compositor supports GTK Layer-Shell ON_DEMAND keyboard interactivity.",
"default": false
},
"notification-body-image-height": {
"type": "integer",
"description": "The notification body image height (in pixels)",
......@@ -132,20 +116,10 @@
"description": "Width of the notification in pixels",
"default": 500
},
"notification-window-height": {
"type": "integer",
"description": "Max height of the notification in pixels. -1 to use the full amount of space given by the compositor.",
"default": -1
},
"notification-window-preferred-output": {
"type": "string",
"description": "The preferred output to open the notification window (popup notifications). Can either be the monitor connector name (ex: \"DP-1\"), or the full name, manufacturer model serial (ex: \"Acer Technologies XV272U V 503023B314202\"). If the output is not found, the currently focused one is picked"
},
"fit-to-screen": {
"type": "boolean",
"description": "If the control center should expand to both edges of the screen",
"default": true
},
"relative-timestamps": {
"type": "boolean",
"description": "Display notification timestamps relative to now e.g. \"26 minutes ago\". If false, a local iso8601-formatted absolute timestamp is displayed.",
......@@ -172,22 +146,6 @@
"type": "string",
"description": "The preferred output to open the control center. Can either be the monitor connector name (ex: \"DP-1\"), or the full name, manufacturer model serial (ex: \"Acer Technologies XV272U V 503023B314202\"). If the output is not found, the currently focused one is picked"
},
"keyboard-shortcuts": {
"type": "boolean",
"description": "If control center should use keyboard shortcuts",
"default": true
},
"notification-grouping": {
"type": "boolean",
"description": "If notifications should be grouped by app name",
"default": true
},
"image-visibility": {
"type": "string",
"description": "The notification image visibility when no icon is available.",
"default": "when-available",
"enum": ["always", "when-available", "never"]
},
"transition-time": {
"type": "integer",
"description": "The notification animation duration. 0 to disable",
......@@ -203,47 +161,6 @@
"description": "Hides the control center when clicking on notification action",
"default": true
},
"notification-action-filter": {
"type": "object",
"description": "Hides matching action(s) of matching notifications. If the notification doesn't include one of the properties, that property will be ignored. If all properties match the given notification, the matching actions will be hidden.",
"minProperties": 1,
"additionalProperties": false,
"patternProperties": {
"^.{1,}$": {
"type": "object",
"description": "Your script object.",
"minProperties": 1,
"anyOf": [
{ "required": ["id-matcher"] },
{ "required": ["text-matcher"] }
],
"additionalProperties": false,
"properties": {
"use-regex": {
"type": "boolean",
"default": false,
"description": "Indicates if all the below fields should use regex or not."
},
"app-name": {
"type": "string",
"description": "The app-name."
},
"desktop-entry": {
"type": "string",
"description": "The desktop-entry."
},
"id-matcher": {
"type": "string",
"description": "Matches the action identifier. Can be found by reading the output of ximper-shell-notification-center when run with the `G_MESSAGES_DEBUG=all` environment variable."
},
"text-matcher": {
"type": "string",
"description": "Matches the actions text visible in the notification."
}
}
}
}
},
"notification-visibility": {
"type": "object",
"description": "Set the visibility of each incoming notification. If the notification doesn't include one of the properties, that property will be ignored. All properties (except for state) use regex. If all properties match the given notification, the notification will be follow the provided state. Only the first matching object will be used.",
......
......@@ -247,12 +247,8 @@ namespace XimperShellNotificationCenter {
// Set the exlusive zone
int exclusive_zone = ConfigModel.instance.control_center_exclusive_zone ? 0 : 100;
GtkLayerShell.set_exclusive_zone (this, exclusive_zone);
// Grabs the keyboard input until closed
bool keyboard_shortcuts = ConfigModel.instance.keyboard_shortcuts;
var mode = keyboard_shortcuts ?
GtkLayerShell.KeyboardMode.EXCLUSIVE :
GtkLayerShell.KeyboardMode.NONE;
GtkLayerShell.set_keyboard_mode (this, mode);
GtkLayerShell.set_keyboard_mode (this,
GtkLayerShell.KeyboardMode.EXCLUSIVE);
// Set layer
GtkLayerShell.set_layer (
......@@ -282,25 +278,38 @@ namespace XimperShellNotificationCenter {
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, true);
break;
}
if (ConfigModel.instance.fit_to_screen) {
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, true);
} else {
switch (pos_y) {
default:
case PositionY.TOP:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, false);
break;
case PositionY.CENTER:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, true);
break;
case PositionY.BOTTOM:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, false);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, true);
break;
}
switch (pos_y) {
default:
case PositionY.TOP:
GtkLayerShell.set_anchor (
this,
GtkLayerShell.Edge.TOP,
true);
GtkLayerShell.set_anchor (
this,
GtkLayerShell.Edge.BOTTOM,
false);
break;
case PositionY.CENTER:
GtkLayerShell.set_anchor (
this,
GtkLayerShell.Edge.TOP,
true);
GtkLayerShell.set_anchor (
this,
GtkLayerShell.Edge.BOTTOM,
true);
break;
case PositionY.BOTTOM:
GtkLayerShell.set_anchor (
this,
GtkLayerShell.Edge.TOP,
false);
GtkLayerShell.set_anchor (
this,
GtkLayerShell.Edge.BOTTOM,
true);
break;
}
}
......@@ -357,10 +366,6 @@ namespace XimperShellNotificationCenter {
}
break;
}
// Fit the ControlCenter to the monitor height
if (ConfigModel.instance.fit_to_screen) {
align_y = Gtk.Align.FILL;
}
// Set the ControlCenter alignment
window.set_halign (align_x);
window.set_valign (align_y);
......@@ -381,8 +386,7 @@ namespace XimperShellNotificationCenter {
box.set_size_request (cc_width, -1);
} else {
window.set_propagate_natural_height (
cc_height < 1
|| ConfigModel.instance.fit_to_screen);
cc_height < 1);
window.set_max_content_height (-1);
window.set_size_request (cc_width, cc_height);
box.set_size_request (cc_width, cc_height);
......
......@@ -267,8 +267,7 @@ namespace XimperShellNotificationCenter.Widgets {
if (param.name_id.length > 0) {
group = noti_groups_name.get (param.name_id);
}
if (group == null || group.dismissed
|| ConfigModel.instance.notification_grouping == false) {
if (group == null || group.dismissed) {
group = new NotificationGroup (param.name_id, param.display_name, viewport);
// Collapse other groups on expand
group.on_expand_change.connect ((expanded) => {
......
......@@ -90,7 +90,7 @@ namespace XimperShellNotificationCenter {
* with default GTK style properties
*/
public static bool load_css (string ?style_path) {
int css_priority = ConfigModel.instance.cssPriority.get_priority ();
int css_priority = Gtk.STYLE_PROVIDER_PRIORITY_USER;
// Load packaged CSS as backup
string system_css = get_style_path (null, true);
......
......@@ -357,32 +357,9 @@ namespace XimperShellNotificationCenter {
return;
}
// Find all the matching filters
List<unowned ActionMatching> valid_matchers = new List<unowned ActionMatching> ();
unowned OrderedHashTable<ActionMatching> filters =
ConfigModel.instance.notification_action_filter;
foreach (string key in filters.get_keys ()) {
unowned ActionMatching matcher = filters[key];
if (matcher.matches_notification (this)) {
valid_matchers.append (matcher);
}
}
for (int i = 0; i < actions.length; i += 2) {
Action action = new Action (actions[i], actions[i + 1]);
// Filtering
bool matches = false;
foreach (unowned ActionMatching matcher in valid_matchers) {
if (matcher.matches_action (action)) {
matches = true;
break;
}
}
if (matches) {
continue;
}
if (action.text != null && action.identifier != null) {
string id = action.identifier.down ();
switch (id) {
......
......@@ -417,9 +417,6 @@ namespace XimperShellNotificationCenter {
/** Returns the first code found, else null */
private string ?parse_body_codes () {
if (!ConfigModel.instance.notification_2fa_action) {
return null;
}
string body = this.body.get_text ().strip ();
if (body.length == 0) {
return null;
......@@ -521,10 +518,10 @@ namespace XimperShellNotificationCenter {
inline_reply_box.set_visible (false);
// Only show inline replies in popup notifications if the compositor
// supports ON_DEMAND layer shell keyboard interactivity
if (!ConfigModel.instance.notification_inline_replies
|| (ConfigModel.instance.layer_shell
if (ConfigModel.instance.layer_shell
&& !app.has_layer_on_demand
&& notification_type == NotificationType.FLOATING)) {
&& notification_type
== NotificationType.FLOATING) {
return;
}
if (param.inline_reply == null) {
......@@ -695,12 +692,6 @@ namespace XimperShellNotificationCenter {
app_icon_uri = param.app_icon;
}
var image_visibility = ConfigModel.instance.image_visibility;
if (image_visibility == ImageVisibility.NEVER) {
img.set_visible (false);
img_app_icon.set_visible (false);
return;
}
int notification_icon_size =
ConfigModel.instance.notification_icon_size.clamp (-1, int.MAX);
......@@ -757,9 +748,6 @@ namespace XimperShellNotificationCenter {
app_icon_exists);
} else if (app_icon_name != null) {
img.set_from_gicon (app_icon_name);
} else if (image_visibility == ImageVisibility.ALWAYS) {
// Default icon
img.set_from_icon_name ("image-missing");
} else {
img.set_visible (false);
}
......
......@@ -192,10 +192,8 @@ namespace XimperShellNotificationCenter {
break;
}
// -1 should set it to the content size unless it exceeds max_height
scrolled_window.set_min_content_height (-1);
scrolled_window.set_max_content_height (
int.max (ConfigModel.instance.notification_window_height, -1));
scrolled_window.set_max_content_height (-1);
scrolled_window.set_propagate_natural_height (true);
set_input_region ();
......
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