Add dwm desktop wallpaper support
This commit is contained in:
parent
47ca319dd0
commit
7690881a36
|
|
@ -58,6 +58,9 @@
|
||||||
static std::string originalBgMode = "";
|
static std::string originalBgMode = "";
|
||||||
// LXQT
|
// LXQT
|
||||||
static std::string DBUS_SESSION_BUS_ADDRESS = "";
|
static std::string DBUS_SESSION_BUS_ADDRESS = "";
|
||||||
|
// dwm (feh)
|
||||||
|
static std::string originalFehbgCmd = "";
|
||||||
|
static bool originalFehbgExists = false;
|
||||||
// Fallback settings
|
// Fallback settings
|
||||||
static std::string fallbackPath;
|
static std::string fallbackPath;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -113,6 +116,19 @@
|
||||||
}
|
}
|
||||||
infile.close();
|
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
|
//just reuse code :3
|
||||||
if (desktop == "lxqt"){
|
if (desktop == "lxqt"){
|
||||||
DBUS_SESSION_BUS_ADDRESS = SDL_getenv("DBUS_SESSION_BUS_ADDRESS");
|
DBUS_SESSION_BUS_ADDRESS = SDL_getenv("DBUS_SESSION_BUS_ADDRESS");
|
||||||
|
|
@ -462,6 +478,13 @@ end:
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
Debug() << "bliat ono slomalos\n";
|
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 {
|
} else {
|
||||||
std::ifstream srcHint(gameDirStr + path);
|
std::ifstream srcHint(gameDirStr + path);
|
||||||
std::ofstream dstHint(fallbackPath);
|
std::ofstream dstHint(fallbackPath);
|
||||||
|
|
@ -606,6 +629,12 @@ RB_METHOD(wallpaperReset){
|
||||||
Debug() << "bliat ono slomalos";
|
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 {
|
} else {
|
||||||
if (remove(fallbackPath.c_str()) != 0) {
|
if (remove(fallbackPath.c_str()) != 0) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
||||||
|
|
@ -293,6 +293,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData){
|
||||||
desktopEnv = "budgie";
|
desktopEnv = "budgie";
|
||||||
}else if (desktop.find("pantheon") != std::string::npos){
|
}else if (desktop.find("pantheon") != std::string::npos){
|
||||||
desktopEnv = "pantheon";
|
desktopEnv = "pantheon";
|
||||||
|
}else if (desktop.find("dwm") != std::string::npos){
|
||||||
|
desktopEnv = "dwm";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue