Skip to content

Commit

Permalink
Added Theme switching for XFCE
Browse files Browse the repository at this point in the history
  • Loading branch information
harshau007 committed Jun 18, 2024
1 parent 97b5448 commit 7e8c4e7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
48 changes: 33 additions & 15 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,23 @@ func getShellTheme() string {
return strings.TrimSpace(string(output))
}

func getThemeNameXFCE() string {
cmd := exec.Command("xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName", "-v")
output, err := cmd.Output()
if err != nil {
fmt.Println("Curr theme Error:", err)
}

return strings.TrimSpace(string(output))
}

func (a *App) CurrentTheme() string {
var currThemeName string
switch desktopEnv {
case "kde":
currThemeName = getLookAndFeelPackageKDE()
case "xfce":
cmd := exec.Command("xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName", "-v")
output, err := cmd.Output()
if err != nil {
fmt.Println("Curr theme Error:", err)
}

currThemeName = strings.TrimSpace(string(output))
currThemeName = getThemeNameXFCE()
case "gnome":
cmd := exec.Command("gsettings", "get", "org.gnome.desktop.interface", "color-scheme")
output, err := cmd.Output()
Expand Down Expand Up @@ -194,15 +198,29 @@ func (a *App) ToggleTheme(dark bool) {
}
}
case "xfce":
if dark {
style = "Adwaita-dark"
xfceThemeName := getThemeNameXFCE()
if strings.Contains(xfceThemeName, "Qogir") {
if dark {
style = "Qogir-dark"
} else {
style = "Adwaita"
}
cmd := exec.Command("xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName", "-s", style)
_, err := cmd.Output()
if err != nil {
fmt.Println("failed to change XFCE theme:", err)
}
} else {
style = "Adwaita"
}
cmd := exec.Command("xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName", "-s", style)
_, err := cmd.Output()
if err != nil {
fmt.Println("failed to change XFCE theme:", err)
if dark {
style = "Adwaita-dark"
} else {
style = "Adwaita"
}
cmd := exec.Command("xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName", "-s", style)
_, err := cmd.Output()
if err != nil {
fmt.Println("failed to change XFCE theme:", err)
}
}
default:
fmt.Println("unsupported desktop environment:", desktopEnv)
Expand Down
Binary file modified build/bin/welcome
Binary file not shown.
2 changes: 2 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const App: React.FC = () => {
"org.kde.breezedark.desktop",
"com.github.vinceliuice.Qogir-dark",
"Qogirdark",
"Qogir-dark",
"Qogir-win-dark",
];

useEffect(() => {
Expand Down

0 comments on commit 7e8c4e7

Please sign in to comment.