From 75894f50ff49b31e9024df3fe6ce97f09f6eb6ad Mon Sep 17 00:00:00 2001 From: christopher-l Date: Fri, 3 Dec 2021 13:40:13 +0100 Subject: [PATCH] Added option 'center' for 'positionX' in config (#30) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christopher Lübbemeier --- README.md | 2 +- src/configModel/configModel.vala | 2 +- src/controlCenter/controlCenter.vala | 8 ++++++++ src/notiWindow/notiWindow.vala | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b6f132..f9b34d7 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ to your `.config/swaync/` folder to customize without needing root access. To reload the config, you'll need to run `swaync-client --reload-config` -- `positionX`: `left` or `right` +- `positionX`: `left`, `right` or `center` - `positionY`: `top` or `bottom` - `timeout`: uint (Any positive number). The notification timeout for notifications with normal priority - `timeout-low`: uint (any positive number). The notification timeout for notifications with low priority diff --git a/src/configModel/configModel.vala b/src/configModel/configModel.vala index 0228582..335538c 100644 --- a/src/configModel/configModel.vala +++ b/src/configModel/configModel.vala @@ -1,6 +1,6 @@ namespace SwayNotificatonCenter { public enum PositionX { - RIGHT, LEFT; + RIGHT, LEFT, CENTER; public string parse () { EnumClass enumc = (EnumClass) typeof (PositionX).class_ref (); diff --git a/src/controlCenter/controlCenter.vala b/src/controlCenter/controlCenter.vala index 6edfaa9..9747106 100644 --- a/src/controlCenter/controlCenter.vala +++ b/src/controlCenter/controlCenter.vala @@ -227,6 +227,14 @@ namespace SwayNotificatonCenter { GtkLayerShell.Edge.LEFT, true); break; + case PositionX.CENTER: + GtkLayerShell.set_anchor (this, + GtkLayerShell.Edge.RIGHT, + false); + GtkLayerShell.set_anchor (this, + GtkLayerShell.Edge.LEFT, + false); + break; default: GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, diff --git a/src/notiWindow/notiWindow.vala b/src/notiWindow/notiWindow.vala index 7c1d0ba..bd11b2b 100644 --- a/src/notiWindow/notiWindow.vala +++ b/src/notiWindow/notiWindow.vala @@ -37,6 +37,12 @@ namespace SwayNotificatonCenter { GtkLayerShell.set_anchor ( this, GtkLayerShell.Edge.LEFT, true); break; + case PositionX.CENTER: + GtkLayerShell.set_anchor ( + this, GtkLayerShell.Edge.RIGHT, false); + GtkLayerShell.set_anchor ( + this, GtkLayerShell.Edge.LEFT, false); + break; default: GtkLayerShell.set_anchor ( this, GtkLayerShell.Edge.LEFT, false);