Infolabel for skin name
Is there not a way to easily pull the skin name for use in conditional visibility?  I see options for theme/color/font/string/aspect-ratio but nothing to grab the current active skin name.

I'm hoping I am missing something - or maybe this could be an easy add?  I would like to be able to hide/show certain controls/windows based on the active skin.

Show them in what? If it's an addon then just use the resources/skins/ folder and make a skin folder for each the skin you want to have different designs for.
Wouldn't that mean a lot of duplicate code?  IN this case - the way the addon was built references a couple of Estuary's includes and variables (like Top Bar, Bottom Bar, HomeFanartVar,etc).  I'm looking to just ignore/replace those couple of lines for a skin like confluence (which doesn't have the same includes and variables) using the condition/visible options.

It seems like that would be simpler and less code to execute than recreating for each skin.  I wrote a patch that I believe would work - but I don't have access to a build system right now to test.

I realize that the likely fix is skinners should be building off the Estuary naming convention - but there are a lot of older/other skins that are being adapted and I'm trying to keep things looking good/working.  Maybe there's a better way I'm missing?
Ignore the previous patch - it was a mess due to whitespace cleaning.

I sill believe it can be handy to be able to use the skin name as an infolabel.  Here is a patch that adds this functionality:


From 5c50bc8ea74582b3e9f009c3b0ce186e668843de Mon Sep 17 00:00:00 2001
From: Jay M <[email protected]>
Date: Sat, 6 Apr 2019 14:02:59 -0700
Subject: [PATCH] skin infolabel

add declaration
 .../xbmc/GUIInfoManager.cpp                               | 8 +++++++-
 .../xbmc/guilib/guiinfo/GUIInfoLabels.h                   | 1 +
 .../xbmc/guilib/guiinfo/SkinGUIInfo.cpp                   | 5 +++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index d1bc0bb..dbc0e6f 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -3990,6 +3990,11 @@ const infomap fanart_labels[] =  {{ "color1",           FANART_COLOR1 },
 ///                  _string_,
 ///     Returns the current fontset from Font.xml.
 ///   }
+///   \table_row3{   <b>`Skin.Name`</b>,
+///                  \anchor Skin_Name
+///                  _string_,
+///     Returns the current skin name.
+///   }
 /// \table_end
 /// -----------------------------------------------------------------------------
@@ -3997,7 +4002,8 @@ const infomap fanart_labels[] =  {{ "color1",           FANART_COLOR1 },
 const infomap skin_labels[] =    {{ "currenttheme",      SKIN_THEME },
                                   { "currentcolourtheme",SKIN_COLOUR_THEME },
                                   { "aspectratio",       SKIN_ASPECT_RATIO},
-                                  { "font",              SKIN_FONT}};
+                                  { "font",              SKIN_FONT},
+                                  { "name",              SKIN_NAME}};
 /// \page modules__General__List_of_gui_access
 /// \section modules__General__List_of_gui_access_Window Window
diff --git a/xbmc/guilib/guiinfo/GUIInfoLabels.h b/xbmc/guilib/guiinfo/GUIInfoLabels.h
index 0a2ee48..65021b3 100644
--- a/xbmc/guilib/guiinfo/GUIInfoLabels.h
+++ b/xbmc/guilib/guiinfo/GUIInfoLabels.h
@@ -367,6 +367,7 @@
 #define SKIN_HAS_THEME              606
 #define SKIN_ASPECT_RATIO           607
 #define SKIN_FONT                   608
+#define SKIN_NAME                   609
 #define SYSTEM_PRIVACY_POLICY       643
 #define SYSTEM_TOTAL_MEMORY         644
diff --git a/xbmc/guilib/guiinfo/SkinGUIInfo.cpp b/xbmc/guilib/guiinfo/SkinGUIInfo.cpp
index 65622c0..830ad0e 100644
--- a/xbmc/guilib/guiinfo/SkinGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/SkinGUIInfo.cpp
@@ -84,6 +84,11 @@ bool CSkinGUIInfo::GetLabel(std::string& value, const CFileItem *item, int conte
       value = CServiceBroker::GetSettings().GetString(CSettings::SETTING_LOOKANDFEEL_FONT);
       return true;
+    case SKIN_NAME:
+    {
+      value = CServiceBroker::GetSettings().GetString(CSettings::SETTING_LOOKANDFEEL_SKIN);
+      return true;
+    }
   return false;

I hope you can consider adding this!
If you're running an addon can't it read the guisettings.xml to find out which skin is currently be used?

<setting id="" default="true">skin.estuary</setting>

Also, best way to get your patch seen is to make a pull request on GitHub.
not sure if it suits your needs, but python addons can use:
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Thanks for the suggestions - I'm not dealing with the python files in the addon - but the xml files that control the windows.  There are a lot of references to specific includes that exist in Estuary that do not exist in other skins.  Therefore, I'm looking to disable those functions so the other skins don't fill the log with errors.

I'll update the patch (there were Kodi 18.1 changes) and submit a PR after testing.
Thread Rating:
  • 0 Vote(s) - 0 Average

Logout Mark Read Team Forum Stats Members Help
Infolabel for skin name00