mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Add dwm desktop wallpaper support
This commit is contained in:
parent
47ca319dd0
commit
7690881a36
2 changed files with 31 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue