From c76762fb24d2a5ca724661a38a30638f25f9854f Mon Sep 17 00:00:00 2001 From: AnmiTaliDev Date: Sat, 15 Aug 2026 06:47:14 +0500 Subject: [PATCH 1/4] Add Budgie desktop wallpaper support --- binding-mri/wallpaper-binding.cpp | 12 ++++++------ src/oneshot.cpp | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/binding-mri/wallpaper-binding.cpp b/binding-mri/wallpaper-binding.cpp index 94e1bf4..6ffcd68 100644 --- a/binding-mri/wallpaper-binding.cpp +++ b/binding-mri/wallpaper-binding.cpp @@ -153,8 +153,8 @@ } infile.close(); } - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin") { - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie") { if (desktop == "cinnamon") bgsetting = g_settings_new("org.cinnamon.desktop.background"); else if (desktop == "deepin") bgsetting = g_settings_new("com.deepin.wrap.gnome.desktop.background"); else bgsetting = g_settings_new("org.gnome.desktop.background"); @@ -358,13 +358,13 @@ end: } std::string gameDirStr(gameDir); desktopEnvironmentInit(); - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie") { std::stringstream hexColor; hexColor << "#" << std::hex << color; g_settings_set_string(bgsetting, "picture-options", "scaled"); g_settings_set_string(bgsetting, "primary-color", hexColor.str().c_str()); g_settings_set_string(bgsetting, "color-shading-type", "solid"); - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie") { g_settings_set_string(bgsetting, "picture-uri", ("file://" + gameDirStr + path).c_str()); } else { g_settings_set_string(bgsetting, "picture-filename", (gameDirStr + path).c_str()); @@ -506,8 +506,8 @@ RB_METHOD(wallpaperReset){ MacDesktop::ResetBackground(); #else desktopEnvironmentInit(); - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin") { - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie") { g_settings_set_string(bgsetting, "picture-uri", defPictureURI.c_str()); } else { g_settings_set_string(bgsetting, "picture-filename", defPictureURI.c_str()); diff --git a/src/oneshot.cpp b/src/oneshot.cpp index f976fcd..211f431 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -289,6 +289,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData){ desktopEnv = "lxqt"; }else if (desktop.find("deepin") != std::string::npos){ desktopEnv = "deepin"; + }else if (desktop.find("budgie") != std::string::npos){ + desktopEnv = "budgie"; } } From 47ca319dd0a0bd215308bf5d20dfccd2c2f98e1e Mon Sep 17 00:00:00 2001 From: AnmiTaliDev Date: Sat, 15 Aug 2026 06:51:44 +0500 Subject: [PATCH 2/4] Add Pantheon desktop wallpaper support --- binding-mri/wallpaper-binding.cpp | 12 ++++++------ src/oneshot.cpp | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/binding-mri/wallpaper-binding.cpp b/binding-mri/wallpaper-binding.cpp index 6ffcd68..3d408f6 100644 --- a/binding-mri/wallpaper-binding.cpp +++ b/binding-mri/wallpaper-binding.cpp @@ -153,8 +153,8 @@ } infile.close(); } - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie") { - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") { if (desktop == "cinnamon") bgsetting = g_settings_new("org.cinnamon.desktop.background"); else if (desktop == "deepin") bgsetting = g_settings_new("com.deepin.wrap.gnome.desktop.background"); else bgsetting = g_settings_new("org.gnome.desktop.background"); @@ -358,13 +358,13 @@ end: } std::string gameDirStr(gameDir); desktopEnvironmentInit(); - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") { std::stringstream hexColor; hexColor << "#" << std::hex << color; g_settings_set_string(bgsetting, "picture-options", "scaled"); g_settings_set_string(bgsetting, "primary-color", hexColor.str().c_str()); g_settings_set_string(bgsetting, "color-shading-type", "solid"); - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") { g_settings_set_string(bgsetting, "picture-uri", ("file://" + gameDirStr + path).c_str()); } else { g_settings_set_string(bgsetting, "picture-filename", (gameDirStr + path).c_str()); @@ -506,8 +506,8 @@ RB_METHOD(wallpaperReset){ MacDesktop::ResetBackground(); #else desktopEnvironmentInit(); - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie") { - if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") { + if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") { g_settings_set_string(bgsetting, "picture-uri", defPictureURI.c_str()); } else { g_settings_set_string(bgsetting, "picture-filename", defPictureURI.c_str()); diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 211f431..3558c78 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -291,6 +291,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData){ desktopEnv = "deepin"; }else if (desktop.find("budgie") != std::string::npos){ desktopEnv = "budgie"; + }else if (desktop.find("pantheon") != std::string::npos){ + desktopEnv = "pantheon"; } } From 7690881a3694276dbd29d1a7424eab9198be4789 Mon Sep 17 00:00:00 2001 From: AnmiTaliDev Date: Sat, 15 Aug 2026 07:01:35 +0500 Subject: [PATCH 3/4] Add dwm desktop wallpaper support --- binding-mri/wallpaper-binding.cpp | 29 +++++++++++++++++++++++++++++ src/oneshot.cpp | 2 ++ 2 files changed, 31 insertions(+) diff --git a/binding-mri/wallpaper-binding.cpp b/binding-mri/wallpaper-binding.cpp index 3d408f6..fd0d289 100644 --- a/binding-mri/wallpaper-binding.cpp +++ b/binding-mri/wallpaper-binding.cpp @@ -58,6 +58,9 @@ static std::string originalBgMode = ""; // LXQT static std::string DBUS_SESSION_BUS_ADDRESS = ""; + // dwm (feh) + static std::string originalFehbgCmd = ""; + static bool originalFehbgExists = false; // Fallback settings static std::string fallbackPath; #endif @@ -113,6 +116,19 @@ } infile.close(); } + if (desktop == "dwm"){ + const char* homeC = SDL_getenv("HOME"); + if (!homeC) return; + std::string path = std::string(homeC) + "/.fehbg"; + std::ifstream infile(path); + if (infile) { + std::stringstream buffer; + buffer << infile.rdbuf(); + originalFehbgCmd = buffer.str(); + originalFehbgExists = !originalFehbgCmd.empty(); + infile.close(); + } + } //just reuse code :3 if (desktop == "lxqt"){ DBUS_SESSION_BUS_ADDRESS = SDL_getenv("DBUS_SESSION_BUS_ADDRESS"); @@ -462,6 +478,13 @@ end: if (status != 0) { Debug() << "bliat ono slomalos\n"; } + } else if (desktop == "dwm") { + std::string concatPath = gameDirStr + path; + std::string cmd = "feh --bg-scale \"" + concatPath + "\""; + int status = std::system(cmd.c_str()); + if (status != 0) { + Debug() << "bliat ono slomalos\n"; + } } else { std::ifstream srcHint(gameDirStr + path); std::ofstream dstHint(fallbackPath); @@ -606,6 +629,12 @@ RB_METHOD(wallpaperReset){ Debug() << "bliat ono slomalos"; } } + } else if(desktop == "dwm"){ + std::string cmd = originalFehbgExists ? originalFehbgCmd : "xsetroot -solid black"; + int status = std::system(cmd.c_str()); + if (status != 0) { + Debug() << "bliat ono slomalos"; + } } else { if (remove(fallbackPath.c_str()) != 0) { #ifdef DEBUG diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 3558c78..409e98e 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -293,6 +293,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData){ desktopEnv = "budgie"; }else if (desktop.find("pantheon") != std::string::npos){ desktopEnv = "pantheon"; + }else if (desktop.find("dwm") != std::string::npos){ + desktopEnv = "dwm"; } } From feac662e1d9dc64377dd91b35675837b26055747 Mon Sep 17 00:00:00 2001 From: AnmiTaliDev Date: Sat, 15 Aug 2026 07:08:56 +0500 Subject: [PATCH 4/4] Detect active wallpaper tool (feh/nitrogen) by state file mtime instead of WM/DE name --- binding-mri/wallpaper-binding.cpp | 64 ++++++++++++++++++++++--------- src/oneshot.cpp | 2 - 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/binding-mri/wallpaper-binding.cpp b/binding-mri/wallpaper-binding.cpp index fd0d289..836941a 100644 --- a/binding-mri/wallpaper-binding.cpp +++ b/binding-mri/wallpaper-binding.cpp @@ -39,6 +39,7 @@ #include #include #include + #include static std::string desktop = "uninitialized"; // GNOME settings static GSettings *bgsetting; @@ -58,7 +59,8 @@ static std::string originalBgMode = ""; // LXQT static std::string DBUS_SESSION_BUS_ADDRESS = ""; - // dwm (feh) + // Wallpaper utility (feh/nitrogen), used when no known DE is detected + static std::string wpTool = ""; static std::string originalFehbgCmd = ""; static bool originalFehbgExists = false; // Fallback settings @@ -71,7 +73,7 @@ printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n"); if (desktop != "uninitialized") return; - + desktop = shState->oneshot().desktopEnv; if (desktop == "nope") { return; @@ -116,19 +118,6 @@ } infile.close(); } - if (desktop == "dwm"){ - const char* homeC = SDL_getenv("HOME"); - if (!homeC) return; - std::string path = std::string(homeC) + "/.fehbg"; - std::ifstream infile(path); - if (infile) { - std::stringstream buffer; - buffer << infile.rdbuf(); - originalFehbgCmd = buffer.str(); - originalFehbgExists = !originalFehbgCmd.empty(); - infile.close(); - } - } //just reuse code :3 if (desktop == "lxqt"){ DBUS_SESSION_BUS_ADDRESS = SDL_getenv("DBUS_SESSION_BUS_ADDRESS"); @@ -268,7 +257,34 @@ desktop = "kde_error"; } } else { - fallbackPath = std::string(SDL_getenv("HOME")) + "/Desktop/ONESHOT_hint.png"; + const char* homeC = SDL_getenv("HOME"); + std::string home = homeC ? homeC : ""; + std::string fehbgPath = home + "/.fehbg"; + std::string nitrogenPath = home + "/.config/nitrogen/bg-saved.cfg"; + + struct stat fehStat, nitrogenStat; + bool fehExists = !home.empty() && stat(fehbgPath.c_str(), &fehStat) == 0; + bool nitrogenExists = !home.empty() && stat(nitrogenPath.c_str(), &nitrogenStat) == 0; + + if (fehExists && (!nitrogenExists || fehStat.st_mtime >= nitrogenStat.st_mtime)) { + wpTool = "feh"; + std::ifstream infile(fehbgPath); + if (infile) { + std::stringstream buffer; + buffer << infile.rdbuf(); + originalFehbgCmd = buffer.str(); + originalFehbgExists = !originalFehbgCmd.empty(); + infile.close(); + } + } else if (nitrogenExists) { + wpTool = "nitrogen"; + } else if (std::system("command -v feh >/dev/null 2>&1") == 0) { + wpTool = "feh"; + } else if (std::system("command -v nitrogen >/dev/null 2>&1") == 0) { + wpTool = "nitrogen"; + } else { + fallbackPath = home + "/Desktop/ONESHOT_hint.png"; + } } } #endif @@ -478,13 +494,20 @@ end: if (status != 0) { Debug() << "bliat ono slomalos\n"; } - } else if (desktop == "dwm") { + } else if (wpTool == "feh") { std::string concatPath = gameDirStr + path; std::string cmd = "feh --bg-scale \"" + concatPath + "\""; int status = std::system(cmd.c_str()); if (status != 0) { Debug() << "bliat ono slomalos\n"; } + } else if (wpTool == "nitrogen") { + std::string concatPath = gameDirStr + path; + std::string cmd = "nitrogen --set-scaled \"" + concatPath + "\""; + int status = std::system(cmd.c_str()); + if (status != 0) { + Debug() << "bliat ono slomalos\n"; + } } else { std::ifstream srcHint(gameDirStr + path); std::ofstream dstHint(fallbackPath); @@ -629,12 +652,17 @@ RB_METHOD(wallpaperReset){ Debug() << "bliat ono slomalos"; } } - } else if(desktop == "dwm"){ + } else if (wpTool == "feh") { std::string cmd = originalFehbgExists ? originalFehbgCmd : "xsetroot -solid black"; int status = std::system(cmd.c_str()); if (status != 0) { Debug() << "bliat ono slomalos"; } + } else if (wpTool == "nitrogen") { + int status = std::system("nitrogen --restore"); + if (status != 0) { + Debug() << "bliat ono slomalos"; + } } else { if (remove(fallbackPath.c_str()) != 0) { #ifdef DEBUG diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 409e98e..3558c78 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -293,8 +293,6 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData){ desktopEnv = "budgie"; }else if (desktop.find("pantheon") != std::string::npos){ desktopEnv = "pantheon"; - }else if (desktop.find("dwm") != std::string::npos){ - desktopEnv = "dwm"; } }