Unverified Commit 6ea41065 authored by Erik Reider's avatar Erik Reider Committed by GitHub

Add config option to auto expand the per volume controls (#657)

parent 5896170d
...@@ -679,6 +679,11 @@ config file to be able to detect config errors ...@@ -679,6 +679,11 @@ config file to be able to detect config errors
optional: true ++ optional: true ++
default: false ++ default: false ++
description: Show application name in per app control ++ description: Show application name in per app control ++
expand-per-app: ++
type: bool ++
optional: true ++
default: false ++
description: If the per app section should start expanded ++
empty-list-label: ++ empty-list-label: ++
type: string ++ type: string ++
optional: true ++ optional: true ++
......
...@@ -702,6 +702,11 @@ ...@@ -702,6 +702,11 @@
"default": false, "default": false,
"description": "Show application name in per app control" "description": "Show application name in per app control"
}, },
"expand-per-app": {
"type": "boolean",
"default": false,
"description": "If the per app section should start expanded"
},
"empty-list-label": { "empty-list-label": {
"type": "string", "type": "string",
"default": "No active sink input", "default": "No active sink input",
......
...@@ -30,9 +30,10 @@ namespace SwayNotificationCenter.Widgets { ...@@ -30,9 +30,10 @@ namespace SwayNotificationCenter.Widgets {
private PulseDevice ?default_sink = null; private PulseDevice ?default_sink = null;
private PulseDaemon client = new PulseDaemon (); private PulseDaemon client = new PulseDaemon ();
private bool show_per_app; private bool show_per_app = false;
private bool show_per_app_icon = true; private bool show_per_app_icon = true;
private bool show_per_app_label = false; private bool show_per_app_label = false;
private bool expand_per_app = false;
construct { construct {
this.client.change_default_device.connect (default_device_changed); this.client.change_default_device.connect (default_device_changed);
...@@ -76,6 +77,13 @@ namespace SwayNotificationCenter.Widgets { ...@@ -76,6 +77,13 @@ namespace SwayNotificationCenter.Widgets {
this.show_per_app_label = show_per_app_label; this.show_per_app_label = show_per_app_label;
} }
bool expand_per_app_found;
bool ?expand_per_app = get_prop<bool> (config, "expand-per-app",
out expand_per_app_found);
if (expand_per_app_found) {
this.expand_per_app = expand_per_app;
}
string ?el = get_prop<string> (config, "empty-list-label"); string ?el = get_prop<string> (config, "empty-list-label");
if (el != null) { if (el != null) {
empty_label = el; empty_label = el;
...@@ -155,6 +163,9 @@ namespace SwayNotificationCenter.Widgets { ...@@ -155,6 +163,9 @@ namespace SwayNotificationCenter.Widgets {
this.client.remove_active_sink.connect (active_sink_removed); this.client.remove_active_sink.connect (active_sink_removed);
reveal_button = new Gtk.ToggleButton (); reveal_button = new Gtk.ToggleButton ();
reveal_button.set_active (expand_per_app);
revealer.set_reveal_child (expand_per_app);
set_button_icon (); set_button_icon ();
reveal_button.toggled.connect (() => { reveal_button.toggled.connect (() => {
set_button_icon (); set_button_icon ();
...@@ -186,9 +197,9 @@ namespace SwayNotificationCenter.Widgets { ...@@ -186,9 +197,9 @@ namespace SwayNotificationCenter.Widgets {
this.client.start (); this.client.start ();
} else { } else {
this.client.close (); this.client.close ();
if (show_per_app) { }
reveal_button.set_active (false); if (show_per_app) {
} reveal_button.set_active (expand_per_app);
} }
} }
......
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