Skip to content

Commit

Permalink
Close control center when clearing all notifications (#53)
Browse files Browse the repository at this point in the history
* Close control center when clearing all notifications

* make hide on clear configurable, disabled by default
  • Loading branch information
Lucaber authored Jan 8, 2022
1 parent c345804 commit 37142fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ To reload the config, you'll need to run `swaync-client --reload-config`
- `image-visibility`: `always`, `when-available` or `never`. Notification image visiblilty
- `transition-time`: uint (Any positive number, 0 to disable). The notification animation duration
- `notification-window-width`: uint (Any positive number). Width of the notification in pixels
- `hide-on-clear`: bool. Hides the control center after pressing "Clear All"

The main CSS style file is located in `/etc/xdg/swaync/style.css`. Copy it over to your `.config/swaync/` folder to customize without needing root access.

Expand Down
3 changes: 2 additions & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"notification-window-width": 500,
"keyboard-shortcuts": true,
"image-visibility": "always",
"transition-time": 200
"transition-time": 200,
"hide-on-clear": false
}
5 changes: 5 additions & 0 deletions src/configModel/configModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ namespace SwayNotificatonCenter {
*/
public int notification_window_width { get; set; default = 500; }

/*
* Hides the control center after clearing all notifications
*/
public bool hide_on_clear { get; set; default = false; }

/* Methods */

/**
Expand Down
4 changes: 4 additions & 0 deletions src/controlCenter/controlCenter.vala
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ namespace SwayNotificatonCenter {
} catch (Error e) {
stderr.printf (e.message + "\n");
}

if (ConfigModel.instance.hide_on_clear) {
this.set_visibility (false);
}
}

private void navigate_list (uint i) {
Expand Down

0 comments on commit 37142fc

Please sign in to comment.