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

Config page and a new description #1

Closed
wants to merge 3 commits into from
Closed

Conversation

Phen-Ro
Copy link

@Phen-Ro Phen-Ro commented Mar 19, 2024

Here's a few changes on top of yours for Plasma 6. I'm sending this to you and to denilsonsa, too, since there's not really a canonical owner anymore.

Enhance the config page to make the layout nicer, plus show examples of descriptions and examples of icons. Add the node nickname as a description option.

Enhance the config page to make the layout nicer, plus show examples of descriptions and examples of icons.  Add the node nickname as a description option.
@jkhunter
Copy link
Owner

Hi, I check your patch, but on my system now my headset and speaker icons were both replaced by audio-card-analog.

@Phen-Ro
Copy link
Author

Phen-Ro commented Mar 20, 2024

Ah bummer, okay. I've modified to code to just ignore any variation of audio-card-analog on the device's icon-name/icon_name property. Whatever is responsible for populating those defaults is too boring.

@gabeklavans
Copy link

Copying over from denilsonsa#5 (comment) since things seem to be more active here

Changing the value of the Description radio button doesn't do anything on my machine; it doesn't even signal a change for the Apply button to light up. I haven't dug into the code for that config, yet

@gabeklavans
Copy link

To update: running the plasmoid in its own containment with plasmoidviewer -a org.kde.plasma.audiodeviceswitcher-ng, the Description radio buttons work as expected.

Reinstalling the plasmoid by deleting the folder in my .local plasmoids folder and running plasmapkg2 -i ./package on this repo's main branch, now the Apply button lights up when I change the Description selection, but clicking Apply and/or OK doesn't actually change the labels on the plasmoid.

@jkhunter
Copy link
Owner

I still have issues with the new code for icons determination.

@Phen-Ro
Copy link
Author

Phen-Ro commented Mar 25, 2024

@gabeklavans Does your plasma config file update when you apply config changes? It's located at ~/.config/plasma-org.kde.plasma.desktop-appletsrc.

For example, mine has a section that looks like

[Containments][53][Applets][89]
immutability=1
plugin=org.kde.plasma.audiodeviceswitcher-ng

[Containments][53][Applets][89][Configuration][ConfigDialog]
DialogHeight=570
DialogWidth=760

[Containments][53][Applets][89][Configuration][General]
naming=nodeNickname
useVerticalLayout=true

@jkhunter Do you happen to know what your device's icon-name property is? It can be found with wpctl status then wpctl inspect 83 | grep icon or whatever the relevant node number is.

@gabeklavans
Copy link

@Phen-Ro So, I accidentally reset my global theme to the default breeze dark when messing around in settings... good news is now the description buttons work perfectly. May have been a bug in the migration script for OpenSUSE TW's branding. 🤷

@jkhunter
Copy link
Owner

jkhunter commented Mar 27, 2024

non of the wpctl numbers return any icon for me. I checked all of them.

I wrote a log function to get the data of the devices:
Devices 1: USB Headset

const data = {
formFactor:
deviceName: alsa_output.usb-0b0e_Jabra_Link_380_08C8C230B3FF-00.analog-stereo
portName: analog-output
deviceDescription: Jabra Link 380 Analog Stereo
portDescription: Analog Output
}

device.properties = {
alsa.card: 1
alsa.card_name: Jabra Link 380
alsa.class: generic
alsa.device: 0
alsa.driver_name: snd_usb_audio
alsa.id: USB Audio
alsa.long_card_name: Jabra Link 380 at usb-0000:00:14.0-3.1.1, full speed
alsa.name: USB Audio
alsa.resolution_bits: 16
alsa.subclass: generic-mix
alsa.subdevice: 0
alsa.subdevice_name: subdevice #0
device.access_mode: mmap+timer
device.api: alsa
device.buffering.buffer_size: 352800
device.buffering.fragment_size: 176400
device.bus: usb
device.bus_path: pci-0000:00:14.0-usb-0:3.1.1:1.0
device.class: sound
device.description: Jabra Link 380 Analog Stereo
device.icon_name: audio-card-usb
device.product.id: 24c8
device.product.name: Jabra Link 380
device.profile.description: Analog Stereo
device.profile.name: analog-stereo
device.serial: 0b0e_Jabra_Link_380_08C8C230B3FF
device.string: front:1
device.vendor.id: 0b0e
device.vendor.name: GN Netcom
module-udev-detect.discovered: 1
sysfs.path: /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1.1/1-3.1.1:1.0/sound/card1
udev.id: usb-0b0e_Jabra_Link_380_08C8C230B3FF-00
}

Device 2 - Built-in speaker:

const data = {
formFactor: internal
deviceName: alsa_output.pci-0000_00_1f.3.analog-stereo
portName: analog-output-speaker
deviceDescription: Built-in Audio Analog Stereo
portDescription: Speakers
}

device.properties = {
alsa.card: 0
alsa.card_name: HDA Intel PCH
alsa.class: generic
alsa.device: 0
alsa.driver_name: snd_hda_intel
alsa.id: ALC3234 Analog
alsa.long_card_name: HDA Intel PCH at 0xef240000 irq 135
alsa.name: ALC3234 Analog
alsa.resolution_bits: 16
alsa.subclass: generic-mix
alsa.subdevice: 0
alsa.subdevice_name: subdevice #0
device.access_mode: mmap+timer
device.api: alsa
device.buffering.buffer_size: 352800
device.buffering.fragment_size: 176400
device.bus: pci
device.bus_path: pci-0000:00:1f.3
device.class: sound
device.description: Built-in Audio Analog Stereo
device.form_factor: internal
device.icon_name: audio-card-pci
device.product.id: a2f0
device.product.name: 200 Series PCH HD Audio
device.profile.description: Analog Stereo
device.profile.name: analog-stereo
device.string: front:0
device.vendor.id: 8086
device.vendor.name: Intel Corporation
module-udev-detect.discovered: 1
sysfs.path: /devices/pci0000:00/0000:00:1f.3/sound/card0
}

Can you please tell me why you want to change the icon determination? Because the old solution works. There are so many possibilities to connect a audio device to a pc, that I doubt that it is possible for all combinations to determine the right icon. Would it not be better to allow users select an icon for a device in the configuration, just is case the determination selects wrong icon.

At last it is for me not relevant which icons it determines., I just wish they are different for each device.

And here is the function is used to log the properties:
function listProperties(item) {
var properties = ""
for (var p in item)
if (typeof item[p] != "function")
properties += (p + ": " + item[p] + "\n")
return properties
}

@Phen-Ro
Copy link
Author

Phen-Ro commented Mar 27, 2024

I see the first one has device.icon_name: audio-card-usb and the second device.icon_name: audio-card-pci. Rather than ignoring audio-card-analog*, I'll update the code to ignore audio-card*. Perhaps that will be sufficient?

The reason I want to respect icon listed in the device properties is to make it easier for me to set what I want for each device. I use a conf file in .config/wireplumber/wireplumber.conf.d to set names, descriptions, and icons. The code that currently exists to auto-detect the icon is good, but the easiest way for me to customize the icon is to just set it explicitly wireplumber.

I can imagine a configuration page that lets users set descriptions/icons for each device within this widget, but it feels overkill to make when you can "just" config wireplumber. (Well, after re-writing your config files for the 3rd time because Pipewire keeps changing session config formats.)

In my opinion, the real problem is that whatever sets the icon_name/icon-name property chooses icons that aren't representative of the device.

@jkhunter
Copy link
Owner

jkhunter commented Apr 3, 2024

Hi, now I understood your use case. Thanks for it. I do not use wireplumber and I do not define some icons manually. I think this is a very rare use cases and what you try to archive in the plugin is probably not possible. In my opinion you try to figure out if the default icon property have a default value, but there is no indicator for it. And it is not possible to archive it by checking the value of the default icon.

We can make a option in the config to force using the icons from the device property, and if you set the icons manually you can force the plugin to use it.

Yes, the real problem is, that the default icons are wrong. If you want to fix it, it would be better to fix it at the source of the issue (some kde project?)

We can discuss it, if you think it is possible to check if a given default icon is correct or not. But in my opinion it is not possible. I'm open for suggestions.

BTW: I just wanted to make it work with plasma6. I never wanted to be a maintainer for it.

@jkhunter jkhunter closed this Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants