Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to change No Notifications text #485

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions man/swaync.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ config file to be able to detect config errors
default: true ++
description: Hides the control center when clicking on notification action

*text-empty* ++
type: string ++
default: "No Notifications" ++
description: Text that appears when there are no notifications to show

*fit-to-screen* ++
type: bool ++
default: true ++
Expand Down
1 change: 1 addition & 0 deletions src/config.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"transition-time": 200,
"hide-on-clear": false,
"hide-on-action": true,
"text-empty": "No Notifications",
"script-fail-notify": true,
"scripts": {
"example-script": {
Expand Down
3 changes: 3 additions & 0 deletions src/configModel/configModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ namespace SwayNotificationCenter {
/** Hides the control center when clicking on notification action */
public bool hide_on_action { get; set; default = true; }

/** Text that appears when there are no notifications to show */
public string text_empty { get; set; default = "No Notifications"; }

/** The controlcenters horizontal alignment. Supersedes `positionX` if not `NONE` */
public PositionX control_center_positionX { // vala-lint=naming-convention
get; set; default = PositionX.NONE;
Expand Down
5 changes: 5 additions & 0 deletions src/configSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@
"description": "Hides the control center when clicking on notification action",
"default": true
},
"text-empty": {
"type": "string",
"description": "Text that appears when there are no notifications to show",
"default": "No Notifications"
},
"script-fail-notify": {
"type": "boolean",
"description": "Sends a notification if a script fails to run",
Expand Down
2 changes: 1 addition & 1 deletion src/controlCenter/controlCenter.ui
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</packing>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="text_empty_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">No Notifications</property>
Expand Down
6 changes: 5 additions & 1 deletion src/controlCenter/controlCenter.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ namespace SwayNotificationCenter {
[GtkChild]
unowned Gtk.Box notifications_box;
[GtkChild]
unowned Gtk.Label text_empty_label;
[GtkChild]
unowned Gtk.Stack stack;
[GtkChild]
unowned Gtk.ScrolledWindow scrolled_window;
Expand Down Expand Up @@ -61,11 +63,13 @@ namespace SwayNotificationCenter {
list_box.get_style_context ().add_class ("control-center-list");
viewport.add (list_box);

text_empty_label.set_text (ConfigModel.instance.text_empty);

if (swaync_daemon.use_layer_shell) {
if (!GtkLayerShell.is_supported ()) {
stderr.printf ("GTKLAYERSHELL IS NOT SUPPORTED!\n");
stderr.printf ("Swaync only works on Wayland!\n");
stderr.printf ("If running waylans session, try running:\n");
stderr.printf ("If running wayland session, try running:\n");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! :)

stderr.printf ("\tGDK_BACKEND=wayland swaync\n");
Process.exit (1);
}
Expand Down
Loading