Добавлена базовая поддержка работы биндинга обоев на оконных менеджерах под Linux, пока только поддержка работы через feh и рестора через nitrogen
This commit is contained in:
parent
95012997fc
commit
0aa926c4a1
|
|
@ -53,6 +53,9 @@
|
||||||
static std::map<std::string, bool> defBlurs;
|
static std::map<std::string, bool> defBlurs;
|
||||||
// Fallback settings
|
// Fallback settings
|
||||||
static std::string fallbackPath;
|
static std::string fallbackPath;
|
||||||
|
//meow
|
||||||
|
bool IsNitrogen = false;
|
||||||
|
bool IsFeh = false;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -60,8 +63,22 @@
|
||||||
void desktopEnvironmentInit(){
|
void desktopEnvironmentInit(){
|
||||||
printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n");
|
printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n");
|
||||||
if (desktop != "uninitialized") {
|
if (desktop != "uninitialized") {
|
||||||
|
printf("[desktopEnvironmentInit] Running on standalone Window Manager?Trying identify configuration...\n");
|
||||||
|
// If Nitrogen wallpaper manager and feh is aviable we can just use nitrogen --restore command and feh --bg-scale:P
|
||||||
|
if (FILE *file = fopen("/usr/bin/nitrogen", "r")){
|
||||||
|
IsNitrogen = true;
|
||||||
|
printf("[desktopEnvironmentInit] Nitrogen wallpaper manager detected!I will try to use it...\n");
|
||||||
|
fclose(file);
|
||||||
|
}else{ fclose(file); }
|
||||||
|
if (FILE *file = fopen("/usr/bin/feh", "r")) {
|
||||||
|
IsFeh = true;
|
||||||
|
printf("[desktopEnvironmentInit] Feh detected!I will try to use it...\n");
|
||||||
|
fclose(file);
|
||||||
|
} else{ fclose(file); }
|
||||||
|
if(!IsNitrogen && !IsFeh){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
desktop = shState->oneshot().desktopEnv;
|
desktop = shState->oneshot().desktopEnv;
|
||||||
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin") {
|
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin") {
|
||||||
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin") {
|
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin") {
|
||||||
|
|
@ -349,6 +366,11 @@ end:
|
||||||
Debug() << "[wallpaperSet] Wallpaper command:" << command.str();
|
Debug() << "[wallpaperSet] Wallpaper command:" << command.str();
|
||||||
int result = system(command.str().c_str());
|
int result = system(command.str().c_str());
|
||||||
Debug() << "[wallpaperSet ] Result:" << result;
|
Debug() << "[wallpaperSet ] Result:" << result;
|
||||||
|
} else if (IsFeh == true) {
|
||||||
|
//path
|
||||||
|
printf("[wallpaperSet] Trying set wallpapers via feh\n");
|
||||||
|
std::string cmd = std::string("feh --bg-scale '") + path + "'";
|
||||||
|
std::system(cmd.c_str());
|
||||||
} else {
|
} else {
|
||||||
std::ifstream srcHint(gameDirStr + path);
|
std::ifstream srcHint(gameDirStr + path);
|
||||||
std::ofstream dstHint(fallbackPath);
|
std::ofstream dstHint(fallbackPath);
|
||||||
|
|
@ -473,6 +495,8 @@ RB_METHOD(wallpaperReset){
|
||||||
Debug() << "[wallpaperReset] Reset wallpaper command:" << command.str();
|
Debug() << "[wallpaperReset] Reset wallpaper command:" << command.str();
|
||||||
int result = system(command.str().c_str());
|
int result = system(command.str().c_str());
|
||||||
Debug() << "[wallpaperReset] Reset result:" << result;
|
Debug() << "[wallpaperReset] Reset result:" << result;
|
||||||
|
} else if (IsNitrogen == true){
|
||||||
|
system("nitrogen --restore");
|
||||||
} else {
|
} else {
|
||||||
if (remove(fallbackPath.c_str()) != 0) {
|
if (remove(fallbackPath.c_str()) != 0) {
|
||||||
Debug() << "[wallpaperReset] Failed to delete:" << fallbackPath;
|
Debug() << "[wallpaperReset] Failed to delete:" << fallbackPath;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue