mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Sound(Linux): Don't abuse manufactor
This commit is contained in:
@@ -8,32 +8,36 @@ array [ //root
|
||||
dict entry( //object
|
||||
object path "/org/bluez/hci0/dev_03_21_8B_91_16_4D"
|
||||
array [
|
||||
dict entry( //property
|
||||
string "org.bluez.Device1"
|
||||
array [
|
||||
dict entry(
|
||||
string "Address"
|
||||
variant string "03:21:8B:91:16:4D"
|
||||
)
|
||||
dict entry(
|
||||
string "Name"
|
||||
variant string "JBL TUNE160BT"
|
||||
)
|
||||
dict entry(
|
||||
string "Connected"
|
||||
variant boolean true
|
||||
)
|
||||
]
|
||||
)
|
||||
dict entry( //property
|
||||
string "org.bluez.Battery1"
|
||||
array [
|
||||
dict entry(
|
||||
string "Percentage"
|
||||
variant byte 100
|
||||
)
|
||||
]
|
||||
)
|
||||
dict entry( //property
|
||||
string "org.bluez.Device1"
|
||||
array [
|
||||
dict entry(
|
||||
string "Address"
|
||||
variant string "03:21:8B:91:16:4D"
|
||||
)
|
||||
dict entry(
|
||||
string "Name"
|
||||
variant string "JBL TUNE160BT"
|
||||
)
|
||||
dict entry(
|
||||
string "Icon"
|
||||
variant string "audio-headset"
|
||||
)
|
||||
dict entry(
|
||||
string "Connected"
|
||||
variant boolean true
|
||||
)
|
||||
]
|
||||
)
|
||||
dict entry( //property
|
||||
string "org.bluez.Battery1"
|
||||
array [
|
||||
dict entry(
|
||||
string "Percentage"
|
||||
variant byte 100
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
typedef struct FFSoundDevice
|
||||
{
|
||||
FFstrbuf identifier; // Used internally, not guaranteed to be initialized
|
||||
FFstrbuf name;
|
||||
FFstrbuf manufacturer;
|
||||
uint8_t volume; // 0-100%
|
||||
|
||||
@@ -12,8 +12,9 @@ static void paSinkInfoCallback(pa_context *c, const pa_sink_info *i, int eol, vo
|
||||
return;
|
||||
|
||||
FFSoundDevice* device = ffListAdd(userdata);
|
||||
ffStrbufInitS(&device->identifier, i->name);
|
||||
ffStrbufInitS(&device->name, i->description);
|
||||
ffStrbufInitS(&device->manufacturer, i->name);
|
||||
ffStrbufInitS(&device->manufacturer, i->driver);
|
||||
device->volume = i->mute ? 0 : (uint8_t) (i->volume.values[0] * 100 / PA_VOLUME_NORM);
|
||||
device->active = i->active_port && i->active_port->available == PA_PORT_AVAILABLE_YES;
|
||||
device->main = false;
|
||||
@@ -28,7 +29,7 @@ static void paServerInfoCallback(pa_context *c, const pa_server_info *i, void *u
|
||||
|
||||
FF_LIST_FOR_EACH(FFSoundDevice, device, *(FFlist*)userdata)
|
||||
{
|
||||
if(ffStrbufEqualS(&device->manufacturer, i->default_sink_name))
|
||||
if(ffStrbufEqualS(&device->identifier, i->default_sink_name))
|
||||
{
|
||||
device->main = true;
|
||||
device->active = true; // Treat the default sink as always active
|
||||
|
||||
Reference in New Issue
Block a user