+/*** Default sink controls ***/
+
+static void update_default_sink(void)
+{
+ const char *def = pulse_default_sink_name ? : "?";
+ if (!strcmp(def, "ursarium"))
+ {
+ noct_set_button(8, 1);
+ noct_set_button(9, 0);
+ }
+ else if (!strcmp(def, "catarium"))
+ {
+ noct_set_button(8, 0);
+ noct_set_button(9, 1);
+ }
+ else
+ {
+ noct_set_button(8, 0);
+ noct_set_button(9, 0);
+ }
+}
+
+static void update_default_sink_from_button(int button, int on)
+{
+ if (!on)
+ return;
+
+ const char *def = pulse_default_sink_name ? : "?";
+ const char *switch_to = NULL;
+ if (button == 8)
+ {
+ if (!strcmp(def, "ursarium"))
+ switch_to = "burrow";
+ else
+ switch_to = "ursarium";
+ }
+ else if (button == 9)
+ {
+ if (!strcmp(def, "catarium"))
+ switch_to = "burrow";
+ else
+ switch_to = "catarium";
+ }
+
+ if (!switch_to)
+ return;
+
+ DBG("Switching default sink to %s", switch_to);
+ pulse_server_set_default_sink(switch_to);
+}
+