mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 03:02:49 +00:00
Implement ability to disable certain SNI icons
Implements https://github.com/scorpion-26/gBar/issues/69 (nice)
This commit is contained in:
parent
37b0896d6d
commit
0e8634a227
4 changed files with 20 additions and 0 deletions
|
@ -165,7 +165,9 @@ EnableSNI: true
|
||||||
# SNIIconSize sets the icon size for a SNI icon.
|
# SNIIconSize sets the icon size for a SNI icon.
|
||||||
# SNIPaddingTop Can be used to push the Icon down. Negative values are allowed
|
# SNIPaddingTop Can be used to push the Icon down. Negative values are allowed
|
||||||
# SNIIconName overrides what icon from an icon theme to display.
|
# SNIIconName overrides what icon from an icon theme to display.
|
||||||
|
# SNIDisabled prevents an icon from being registered.
|
||||||
# For all SNI properties: The first parameter is a filter of the tooltip(The text that pops up, when the icon is hovered) of the icon.
|
# For all SNI properties: The first parameter is a filter of the tooltip(The text that pops up, when the icon is hovered) of the icon.
|
||||||
|
# The wildcard filter '*' does not work for SNIIconName and SNIDisabled
|
||||||
|
|
||||||
# Scale everything down to 25 pixels ('*' as filter means everything)
|
# Scale everything down to 25 pixels ('*' as filter means everything)
|
||||||
#SNIIconSize: *, 25
|
#SNIIconSize: *, 25
|
||||||
|
@ -175,6 +177,8 @@ EnableSNI: true
|
||||||
#SNIPaddingTop: Discord, 5
|
#SNIPaddingTop: Discord, 5
|
||||||
# Override the default icon given to gBar by discord to an icon theme supplied one (Example is from papirus theme)
|
# Override the default icon given to gBar by discord to an icon theme supplied one (Example is from papirus theme)
|
||||||
#SNIIconName: Discord, discord-tray
|
#SNIIconName: Discord, discord-tray
|
||||||
|
# Prevents steam from displaying. Note: Steam doesn't have a tooltip, which means the object path is filtered instead.
|
||||||
|
#SNIDisabled: steam, true
|
||||||
|
|
||||||
# These set the range for the network widget. The widget changes colors at six intervals:
|
# These set the range for the network widget. The widget changes colors at six intervals:
|
||||||
# - Below Min...Bytes ("under")
|
# - Below Min...Bytes ("under")
|
||||||
|
|
|
@ -299,6 +299,7 @@ void Config::Load()
|
||||||
AddConfigVar("SNIIconSize", config.sniIconSizes, lineView, foundProperty);
|
AddConfigVar("SNIIconSize", config.sniIconSizes, lineView, foundProperty);
|
||||||
AddConfigVar("SNIPaddingTop", config.sniPaddingTop, lineView, foundProperty);
|
AddConfigVar("SNIPaddingTop", config.sniPaddingTop, lineView, foundProperty);
|
||||||
AddConfigVar("SNIIconName", config.sniIconNames, lineView, foundProperty);
|
AddConfigVar("SNIIconName", config.sniIconNames, lineView, foundProperty);
|
||||||
|
AddConfigVar("SNIDisabled", config.sniDisabled, lineView, foundProperty);
|
||||||
// Modern map syntax
|
// Modern map syntax
|
||||||
AddConfigVar("WorkspaceSymbol", config.workspaceSymbols, lineView, foundProperty);
|
AddConfigVar("WorkspaceSymbol", config.workspaceSymbols, lineView, foundProperty);
|
||||||
// Legacy syntax
|
// Legacy syntax
|
||||||
|
|
|
@ -85,6 +85,7 @@ public:
|
||||||
std::unordered_map<std::string, uint32_t> sniIconSizes;
|
std::unordered_map<std::string, uint32_t> sniIconSizes;
|
||||||
std::unordered_map<std::string, int32_t> sniPaddingTop;
|
std::unordered_map<std::string, int32_t> sniPaddingTop;
|
||||||
std::unordered_map<std::string, std::string> sniIconNames;
|
std::unordered_map<std::string, std::string> sniIconNames;
|
||||||
|
std::unordered_map<std::string, bool> sniDisabled;
|
||||||
|
|
||||||
// Only affects outputs (i.e.: speakers, not microphones). This remaps the range of the volume; In percent
|
// Only affects outputs (i.e.: speakers, not microphones). This remaps the range of the volume; In percent
|
||||||
double audioMinVolume = 0.f; // Map the minimum volume to this value
|
double audioMinVolume = 0.f; // Map the minimum volume to this value
|
||||||
|
|
14
src/SNI.cpp
14
src/SNI.cpp
|
@ -166,8 +166,22 @@ namespace SNI
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wasExplicitOverride = false;
|
bool wasExplicitOverride = false;
|
||||||
|
for (auto& [filter, disabled] : Config::Get().sniDisabled)
|
||||||
|
{
|
||||||
|
if (ItemMatchesFilter(item, filter, wasExplicitOverride))
|
||||||
|
{
|
||||||
|
if (disabled)
|
||||||
|
{
|
||||||
|
LOG("SNI: Disabling item due to config");
|
||||||
|
// We're done here.
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// First try icon theme querying
|
// First try icon theme querying
|
||||||
std::string iconName;
|
std::string iconName;
|
||||||
|
wasExplicitOverride = false;
|
||||||
for (auto& [filter, name] : Config::Get().sniIconNames)
|
for (auto& [filter, name] : Config::Get().sniIconNames)
|
||||||
{
|
{
|
||||||
if (ItemMatchesFilter(item, filter, wasExplicitOverride))
|
if (ItemMatchesFilter(item, filter, wasExplicitOverride))
|
||||||
|
|
Loading…
Reference in a new issue