Skip to content

Commit

Permalink
Added theming for XFCE
Browse files Browse the repository at this point in the history
  • Loading branch information
harshau007 committed Jun 18, 2024
1 parent 7e8c4e7 commit 654ef57
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ func (a *App) ToggleTheme(dark bool) {
xfceThemeName := getThemeNameXFCE()
if strings.Contains(xfceThemeName, "Qogir") {
if dark {
style = "Qogir-dark"
style = "Qogir-Dark"
} else {
style = "Adwaita"
}
cmd := exec.Command("xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName", "-s", style)
cmd := exec.Command("sh", "-c", fmt.Sprintf("xfconf-query -c xsettings -p /Net/ThemeName -s %s && xfconf-query -c xfwm4 -p /general/theme -s %s", style, style))
_, err := cmd.Output()
if err != nil {
fmt.Println("failed to change XFCE theme:", err)
Expand All @@ -216,7 +216,7 @@ func (a *App) ToggleTheme(dark bool) {
} else {
style = "Adwaita"
}
cmd := exec.Command("xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName", "-s", style)
cmd := exec.Command("sh", "-c", fmt.Sprintf("xfconf-query -c xsettings -p /Net/ThemeName -s %s && xfconf-query -c xfwm4 -p /general/theme -s %s", style, style))
_, err := cmd.Output()
if err != nil {
fmt.Println("failed to change XFCE theme:", err)
Expand Down
Binary file modified build/bin/welcome
Binary file not shown.
24 changes: 13 additions & 11 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ const App: React.FC = () => {
"Qogir-win-dark",
];

useEffect(() => {
const fetchTheme = async () => {
try {
const currTheme = await CurrentTheme();
const fileExist = await CheckFileExists();
setIsAutoStart(fileExist);
setIsDarkMode(Themes.includes(currTheme));
} catch (error) {
console.error("Failed to fetch current theme:", error);
}
};
const fetchTheme = async () => {
try {
const currTheme = await CurrentTheme();
const fileExist = await CheckFileExists();
setIsAutoStart(fileExist);
setIsDarkMode(Themes.includes(currTheme));
} catch (error) {
console.error("Failed to fetch current theme:", error);
}
};

useEffect(() => {
fetchTheme();
const interval = setInterval(fetchTheme, 1000);
return () => clearInterval(interval);
}, []);

const toggleTheme = async () => {
Expand Down

0 comments on commit 654ef57

Please sign in to comment.