Sound: change option --sound-show-all to --sound-type

This commit is contained in:
李通洲
2023-01-31 21:12:47 +08:00
parent 7132762c9c
commit 00e044c431
5 changed files with 25 additions and 7 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ static void defaultConfig(FFinstance* instance)
instance->config.bluetoothShowDisconnected = false;
instance->config.soundShowAll = false;
instance->config.soundType = FF_SOUND_TYPE_MAIN;
ffStrbufInitA(&instance->config.batteryDir, 0);
+1 -1
View File
@@ -113,7 +113,7 @@ Module specific options:
--disk-show-subvolumes <?value>: Set if subvolumes should be printed. Default is false
--disk-show-unknown <?value>: Set if unknown (unable to detect sizes) volumes should be printed. Default is false
--bluetooth-show-disconnected: <?value>: Set if disconnected bluetooth devices should be printed. Default is false
--sound-show-all: <?value>: Set if all sound devices should be printed. Default is false
--sound-type: <value>: Set what type of sound devices should be printed. Should be either main, active or all. Default is main
--battery-dir <folder>: The directory where the battery folders are. Standard: /sys/class/power_supply/
--cpu-temp <?value>: Detect and display CPU temperature if supported. Default is false
--gpu-temp <?value>: Detect and display GPU temperature if supported. Default is false
+9 -2
View File
@@ -1261,8 +1261,15 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
instance->config.diskShowUnknown = optionParseBoolean(value);
else if(strcasecmp(key, "--bluetooth-show-disconnected") == 0)
instance->config.bluetoothShowDisconnected = optionParseBoolean(value);
else if(strcasecmp(key, "--sound-show-all") == 0)
instance->config.soundShowAll = optionParseBoolean(value);
else if(strcasecmp(key, "--sound-type") == 0)
{
optionParseEnum(key, value, &instance->config.soundType,
"main", FF_SOUND_TYPE_MAIN,
"active", FF_SOUND_TYPE_ACTIVE,
"all", FF_SOUND_TYPE_ALL,
NULL
);
}
else if(strcasecmp(key, "--battery-dir") == 0)
optionParseString(key, value, &instance->config.batteryDir);
else if(strcasecmp(key, "--separator-string") == 0)
+8 -1
View File
@@ -34,6 +34,13 @@ typedef enum FFLogoType
FF_LOGO_TYPE_NONE, //--logo none
} FFLogoType;
typedef enum FFSoundType
{
FF_SOUND_TYPE_MAIN,
FF_SOUND_TYPE_ACTIVE,
FF_SOUND_TYPE_ALL,
} FFSoundType;
typedef enum FFBinaryPrefixType
{
FF_BINARY_PREFIX_TYPE_IEC, // 1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ... (standard)
@@ -203,7 +210,7 @@ typedef struct FFconfig
FFstrbuf weatherOutputFormat;
uint32_t weatherTimeout;
bool soundShowAll;
FFSoundType soundType;
FFstrbuf osFile;
+6 -2
View File
@@ -40,8 +40,12 @@ static void printSound(FFinstance* instance, FFlist* devices)
FF_LIST_FOR_EACH(FFSoundDevice, device, *devices)
{
if(!device->active && !instance->config.soundShowAll)
continue;
switch (instance->config.soundType)
{
case FF_SOUND_TYPE_MAIN: if (!device->main) continue; break;
case FF_SOUND_TYPE_ACTIVE: if (!device->active) continue; break;
case FF_SOUND_TYPE_ALL: break;
}
*(FFSoundDevice**)ffListAdd(&filtered) = device;
}