Skip to content

Commit

Permalink
Revert "csd-media-keys: Show device description on volume OSD (#399)"
Browse files Browse the repository at this point in the history
This reverts commit 1dbe86a.

It should be obvious to the user which output device is active and
interacted with. We only have one set of media keys on the computer.
This also always show the device name, even when the computer only
has one.

This would be useful if we had multiple output devices and multiple
sets of media keys (like on a sound mixer for instance), but it's not
the case for most people.
  • Loading branch information
clefebvre committed Nov 29, 2024
1 parent 23580c3 commit 615a110
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions plugins/media-keys/csd-media-keys-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ cinnamon_proxy_complete (GObject *source,
static void
show_osd (CsdMediaKeysManager *manager,
const char *icon,
const char *label,
int level,
int outx,
int outy)
Expand All @@ -417,9 +416,6 @@ show_osd (CsdMediaKeysManager *manager,
if (icon)
g_variant_builder_add (&builder, "{sv}",
"icon", g_variant_new_string (icon));
if (label)
g_variant_builder_add (&builder, "{sv}",
"label", g_variant_new_string (label));
if (level >= 0)
g_variant_builder_add (&builder, "{sv}",
"level", g_variant_new_int32 (level));
Expand Down Expand Up @@ -646,7 +642,7 @@ do_eject_action (CsdMediaKeysManager *manager)
}

/* Show the dialogue */
show_osd (manager, "media-eject-symbolic", NULL, -1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
show_osd (manager, "media-eject-symbolic", -1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);

/* Clean up the drive selection and exit if no suitable
* drives are found */
Expand Down Expand Up @@ -700,7 +696,7 @@ do_touchpad_osd_action (CsdMediaKeysManager *manager, gboolean state)
{
show_osd (manager,
state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic",
NULL, -1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
-1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
}

static void
Expand Down Expand Up @@ -736,23 +732,11 @@ show_sound_osd (CsdMediaKeysManager *manager,
gboolean sound_changed,
gboolean quiet)
{
GvcMixerUIDevice *device;
const GvcMixerStreamPort *port;
const char *icon;

icon = get_icon_name_for_volume (muted, vol, is_mic);
port = gvc_mixer_stream_get_port (stream);
if (g_strcmp0 (gvc_mixer_stream_get_form_factor (stream), "internal") != 0 ||
(port != NULL &&
g_strcmp0 (port->port, "analog-output-speaker") != 0 &&
g_strcmp0 (port->port, "analog-output") != 0)) {
device = gvc_mixer_control_lookup_device_from_stream (manager->priv->volume, stream);
show_osd (manager, icon,
gvc_mixer_ui_device_get_description (device),
vol, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
} else {
show_osd (manager, icon, NULL, vol, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
}

show_osd (manager, icon, vol, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);

if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) {
gboolean enabled = g_settings_get_boolean (manager->priv->sound_settings, "volume-sound-enabled");
Expand Down Expand Up @@ -1249,7 +1233,7 @@ csd_media_player_key_pressed (CsdMediaKeysManager *manager,
if (!have_listeners) {
if (!mpris_controller_key (manager->priv->mpris_controller, key)) {
/* Popup a dialog with an (/) icon */
show_osd (manager, "action-unavailable-symbolic", NULL, -1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
show_osd (manager, "action-unavailable-symbolic", -1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
}
return TRUE;
}
Expand Down Expand Up @@ -1343,7 +1327,7 @@ do_video_rotate_lock_action (CsdMediaKeysManager *manager,
g_object_unref (settings);

show_osd (manager, locked ? "rotation-locked-symbolic"
: "rotation-allowed-symbolic", NULL, -1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
: "rotation-allowed-symbolic", -1, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
}

static void
Expand Down Expand Up @@ -1504,7 +1488,7 @@ update_screen_cb (GObject *source_object,

/* update the dialog with the new value */
g_variant_get (variant, "(uii)", &percentage, &outx, &outy);
show_osd (manager, "display-brightness-symbolic", NULL, percentage, outx, outy);
show_osd (manager, "display-brightness-symbolic", percentage, outx, outy);
g_variant_unref (variant);
}

Expand Down Expand Up @@ -1586,7 +1570,7 @@ update_keyboard_cb (GObject *source_object,

/* update the dialog with the new value */
g_variant_get (new_percentage, "(u)", &percentage);
show_osd (manager, "keyboard-brightness-symbolic", NULL, percentage, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
show_osd (manager, "keyboard-brightness-symbolic", percentage, OSD_ALL_OUTPUTS_X, OSD_ALL_OUTPUTS_Y);
g_variant_unref (new_percentage);
}

Expand Down

0 comments on commit 615a110

Please sign in to comment.