nothing is ever that easyDoctor Watson wrote: ↑Tuesday 2nd March 2021 1:54pm I see that that there’s a lot of activity regarding my question. Thanks for that, but this surpasses my humble Gambas programming knowledge.
Steve, I tried the gsettings and they work fine but then, what can I do with it?
Bruce, I tried your Public Sub, but it didn’t give a result.
To make sure, I put a Label on a Form and then ran:
Public Sub Form_Open()
Dim sTheme As String
sTheme = "this should be replaced with the Theme's name"
Shell "dconf read /org/$XDG_SESSION_DESKTOP/desktop/interface/gtk-theme" To sTheme
Label1.Text = RTrim(sTheme)
If Label1.text = "" Then Label1.text = "Failed to read Theme name"
End
And the result was "Failed to read Theme name".
I also tried the other 2 dconf lines but again the results are empty strings.
So I think it’s better that I stay with something I can handle for the moment, unless someone finds a magic solution.
But perhaps in the future ………...
the best one to use is $XDG_CURRENT_DESKTOP but it's upper case.
open a terminal and type "import" to see a list of available environment variables.
the expression ${XDG_CURRENT_DESKTOP,,} turns it into lower case but it is a "bash" instruction.
Gambas uses sh not bash by default.
so you need to set bash as the shell to use (a simple addition to the start of the code)
try this..
Public Sub Form_Open()
System.Shell = System,.Find("bash")
Dim sTheme As String
sTheme = "this should be replaced with the Theme's name"
Shell "dconf read /org/${XDG_CURRENT_DESKTOP,,}/desktop/interface/gtk-theme" To sTheme
Label1.Text = RTrim(sTheme)
If Label1.text = "" Then Label1.text = "Failed to read Theme name"
End