Toggle notification counter badge

This commit is contained in:
HaselLoyance
2022-04-09 01:00:19 -05:00
parent 98e2815e81
commit 8cb5db7c93
3 changed files with 57 additions and 1 deletions

View File

@@ -5835,6 +5835,51 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="show_notification_badge_row">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="show_notification_badge_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkSwitch" id="show_notification_badge_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<layout>
<property name="row">0</property>
<property name="column">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="show_notification_badge_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Show notification counter badge</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
<layout>
<property name="row">0</property>
<property name="column">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">

View File

@@ -1421,8 +1421,14 @@ var Panel = GObject.registerClass({
}
_initProgressManager() {
if(!this.progressManager && (Me.settings.get_boolean('progress-show-bar') || Me.settings.get_boolean('progress-show-count')))
const progressVisible = Me.settings.get_boolean('progress-show-bar');
const countVisible = Me.settings.get_boolean('progress-show-count');
const pm = this.progressManager;
if(!pm && (progressVisible || countVisible))
this.progressManager = new Progress.ProgressManager();
else if (pm)
Object.keys(pm._entriesByDBusName).forEach((k) => pm._entriesByDBusName[k].setCountVisible(countVisible));
}
});

View File

@@ -1592,6 +1592,11 @@ const Preferences = class {
'sensitive',
Gio.SettingsBindFlags.DEFAULT | Gio.SettingsBindFlags.INVERT_BOOLEAN);
this._settings.bind('progress-show-count',
this._builder.get_object('show_notification_badge_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._builder.get_object('group_apps_label_font_color_colorbutton').connect('color-set', (button) => {
let rgba = button.get_rgba();
let css = rgba.to_string();