mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2024-12-22 04:19:47 +01:00
added unload all
This commit is contained in:
parent
e5d64c0be9
commit
3571e20b55
3 changed files with 26 additions and 0 deletions
|
@ -67,6 +67,8 @@ If you use a lot of wallpapers, consider unloading those that you no longer need
|
|||
|
||||
You can issue a `hyprctl hyprpaper unload [PATH]` to do that.
|
||||
|
||||
You can also issue a `hyprctl hyprpaper unload all` to unload all inactive wallpapers.
|
||||
|
||||
<br/>
|
||||
|
||||
For other compositors, the socket works like socket1 of Hyprland, and is located in `/tmp/hypr/.hyprpaper.sock` (this path only when Hyprland is not running!)
|
||||
|
|
|
@ -112,6 +112,11 @@ void CConfigManager::parseKeyword(const std::string& COMMAND, const std::string&
|
|||
}
|
||||
|
||||
void CConfigManager::handleWallpaper(const std::string& COMMAND, const std::string& VALUE) {
|
||||
if (VALUE == "all") {
|
||||
handleUnloadAll(COMMAND, VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (VALUE.find_first_of(',') == std::string::npos) {
|
||||
parseError = "wallpaper failed (syntax)";
|
||||
return;
|
||||
|
@ -173,3 +178,21 @@ void CConfigManager::handleUnload(const std::string& COMMAND, const std::string&
|
|||
|
||||
g_pHyprpaper->unloadWallpaper(WALLPAPER);
|
||||
}
|
||||
|
||||
void CConfigManager::handleUnloadAll(const std::string& COMMAND, const std::string& VALUE) {
|
||||
for (auto&[name, target] : g_pHyprpaper->m_mWallpaperTargets) {
|
||||
|
||||
bool exists = false;
|
||||
for (auto&[mon, target2] : g_pHyprpaper->m_mMonitorActiveWallpaperTargets) {
|
||||
if (&target == target2) {
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (exists)
|
||||
continue;
|
||||
|
||||
g_pHyprpaper->unloadWallpaper(name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ private:
|
|||
void handleWallpaper(const std::string&, const std::string&);
|
||||
void handlePreload(const std::string&, const std::string&);
|
||||
void handleUnload(const std::string&, const std::string&);
|
||||
void handleUnloadAll(const std::string&, const std::string&);
|
||||
|
||||
friend class CIPCSocket;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue