mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-24 12:12:09 +00:00
SNI: Fall back to Title when ToolTip isn't set
This adds a way to filter items, which don't have a nice object path nor a tooltip. https://github.com/scorpion-26/gBar/issues/92#issuecomment-2089845752
This commit is contained in:
parent
b3f037db5b
commit
808d6d5989
1 changed files with 23 additions and 1 deletions
24
src/SNI.cpp
24
src/SNI.cpp
|
@ -11,6 +11,7 @@
|
|||
#include <libdbusmenu-gtk/menu.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <filesystem>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace SNI
|
||||
|
@ -152,10 +153,31 @@ namespace SNI
|
|||
{
|
||||
LOG("SNI: Error querying tooltip");
|
||||
}
|
||||
LOG("SNI: Title: " << data->item.tooltip);
|
||||
LOG("SNI: Tooltip: " << data->item.tooltip);
|
||||
g_variant_unref(tooltip);
|
||||
}
|
||||
|
||||
if (data->item.tooltip.empty())
|
||||
{
|
||||
LOG("SNI: No tooltip found, using title as tooltip");
|
||||
// No tooltip, use title as tooltip
|
||||
GVariant* title = getProperty("Title");
|
||||
if (title)
|
||||
{
|
||||
const gchar* titleStr = g_variant_get_string(title, nullptr);
|
||||
if (titleStr != nullptr)
|
||||
{
|
||||
data->item.tooltip = titleStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("SNI: Error querying title");
|
||||
}
|
||||
LOG("SNI: Fallback tooltip: " << data->item.tooltip);
|
||||
g_variant_unref(title);
|
||||
}
|
||||
}
|
||||
|
||||
// Query menu
|
||||
GVariant* menuPath = getProperty("Menu");
|
||||
if (menuPath)
|
||||
|
|
Loading…
Reference in a new issue