Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package hyprpaper for openSUSE:Factory checked in at 2023-10-13 23:15:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hyprpaper (Old) and /work/SRC/openSUSE:Factory/.hyprpaper.new.20540 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hyprpaper" Fri Oct 13 23:15:46 2023 rev:2 rq:1117681 version:0.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/hyprpaper/hyprpaper.changes 2023-06-03 00:06:50.637854401 +0200 +++ /work/SRC/openSUSE:Factory/.hyprpaper.new.20540/hyprpaper.changes 2023-10-13 23:16:41.443417845 +0200 @@ -1,0 +2,11 @@ +Fri Oct 13 14:20:20 UTC 2023 - Soc Virnyl Estela <socvirnyl.est...@uncomfyhalomacro.pl> + +- Update to version 0.4.0: + * Add dependencies to readme + * [RFC] Filetype detection without extension + * Added support for XDG_CONFIG_HOME + * Support for symlinks + * Clear wallpaper from monitor before destroying ouput + * Reset hasATarget when issuing wallpaper command + +------------------------------------------------------------------- Old: ---- hyprpaper-0.3.0.tar.gz New: ---- hyprpaper-0.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hyprpaper.spec ++++++ --- /var/tmp/diff_new_pack.hqTM50/_old 2023-10-13 23:16:42.127443627 +0200 +++ /var/tmp/diff_new_pack.hqTM50/_new 2023-10-13 23:16:42.131443778 +0200 @@ -16,26 +16,29 @@ # +%global __builder ninja Name: hyprpaper Summary: Wayland wallpaper utility with IPC controls -Version: 0.3.0 +Version: 0.4.0 Release: 0 License: BSD-3-Clause URL: https://github.com/hyprwm/hyprpaper Source0: https://github.com/hyprwm/hyprpaper/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -BuildRequires: gcc-c++ +BuildRequires: Mesa-libGLESv3-devel BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: ninja +BuildRequires: pkgconfig(gtk-layer-shell-0) BuildRequires: pkgconfig(hyprland-protocols) BuildRequires: pkgconfig(libglvnd) BuildRequires: pkgconfig(libjpeg) +BuildRequires: pkgconfig(libmagic) BuildRequires: pkgconfig(pango) BuildRequires: pkgconfig(pangocairo) BuildRequires: pkgconfig(wayland-protocols) >= 1.24 BuildRequires: pkgconfig(wayland-server) >= 1.20.0 -BuildRequires: pkgconfig(xwaylandproto) BuildRequires: pkgconfig(wlroots) >= 0.15.0 -BuildRequires: Mesa-libGLESv3-devel -BuildRequires: pkgconfig(gtk-layer-shell-0) +BuildRequires: pkgconfig(xwaylandproto) %description Hyprpaper is a wallpaper utility for Hyprland. @@ -48,6 +51,7 @@ %build # Necessary to allow build make protocols + %cmake %cmake_build ++++++ hyprpaper-0.3.0.tar.gz -> hyprpaper-0.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/CMakeLists.txt new/hyprpaper-0.4.0/CMakeLists.txt --- old/hyprpaper-0.3.0/CMakeLists.txt 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/CMakeLists.txt 2023-08-03 13:00:55.000000000 +0200 @@ -64,6 +64,7 @@ OpenGL GLESv2 pthread + magic ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_SOURCE_DIR}/wlr-layer-shell-unstable-v1-protocol.o ${CMAKE_SOURCE_DIR}/xdg-shell-protocol.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/README.md new/hyprpaper-0.4.0/README.md --- old/hyprpaper-0.3.0/README.md 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/README.md 2023-08-03 13:00:55.000000000 +0200 @@ -21,6 +21,12 @@ ``` *the output binary will be in `./build/`, copy it to your PATH, e.g. `/usr/bin`* +#### Dependencies +On OpenSUSE: +``` +sudo zypper install ninja gcc-c++ wayland-protocols-devel Mesa-libGLESv3-devel +``` + # Usage Hyprpaper is controlled by the config, like this: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/nix/default.nix new/hyprpaper-0.4.0/nix/default.nix --- old/hyprpaper-0.3.0/nix/default.nix 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/nix/default.nix 2023-08-03 13:00:55.000000000 +0200 @@ -5,6 +5,7 @@ cmake, ninja, cairo, + file, fribidi, libdatrie, libjpeg, @@ -34,6 +35,7 @@ buildInputs = [ cairo + file fribidi libdatrie libjpeg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/src/Hyprpaper.cpp new/hyprpaper-0.4.0/src/Hyprpaper.cpp --- old/hyprpaper-0.3.0/src/Hyprpaper.cpp 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/src/Hyprpaper.cpp 2023-08-03 13:00:55.000000000 +0200 @@ -121,7 +121,13 @@ continue; m_mWallpaperTargets[wp] = CWallpaperTarget(); - m_mWallpaperTargets[wp].create(wp); + if (std::filesystem::is_symlink(wp)) { + auto real_wp = std::filesystem::read_symlink(wp); + m_mWallpaperTargets[wp].create(real_wp); + } else { + m_mWallpaperTargets[wp].create(wp); + } + } g_pConfigManager->m_dRequestedPreloads.clear(); @@ -264,6 +270,8 @@ if (it != m_mMonitorActiveWallpaperTargets.end()) m_mMonitorActiveWallpaperTargets.erase(it); + PMONITOR->hasATarget = true; + if (PMONITOR->pCurrentLayerSurface) { PMONITOR->pCurrentLayerSurface = nullptr; @@ -597,4 +605,4 @@ const std::string XDG_RUNTIME_DIR = getenv("XDG_RUNTIME_DIR"); const auto LOCKFILE = XDG_RUNTIME_DIR + "/hyprpaper.lock"; unlink(LOCKFILE.c_str()); -} \ No newline at end of file +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/src/config/ConfigManager.cpp new/hyprpaper-0.4.0/src/config/ConfigManager.cpp --- old/hyprpaper-0.3.0/src/config/ConfigManager.cpp 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/src/config/ConfigManager.cpp 2023-08-03 13:00:55.000000000 +0200 @@ -6,23 +6,13 @@ // Read file from default location // or from an explicit location given by user - std::string configPath; - if (g_pHyprpaper->m_szExplicitConfigPath.empty()) { - const char* const ENVHOME = getenv("HOME"); - configPath = ENVHOME + std::string("/.config/hypr/hyprpaper.conf"); - } else { - configPath = g_pHyprpaper->m_szExplicitConfigPath; - } + std::string configPath = getMainConfigPath(); std::ifstream ifs; ifs.open(configPath); if (!ifs.good()) { - if (g_pHyprpaper->m_szExplicitConfigPath.empty()) { - Debug::log(CRIT, "No config file provided. Default config file `~/.config/hypr/hyprpaper.conf` couldn't be opened."); - } else { - Debug::log(CRIT, "No config file provided. Specified file `%s` couldn't be opened.", configPath.c_str()); - } + Debug::log(CRIT, "Config file `%s` couldn't be opened.", configPath.c_str()); exit(1); } @@ -58,6 +48,20 @@ } } +std::string CConfigManager::getMainConfigPath() { + if (!g_pHyprpaper->m_szExplicitConfigPath.empty()) + return g_pHyprpaper->m_szExplicitConfigPath; + + static const char* xdgConfigHome = getenv("XDG_CONFIG_HOME"); + std::string configPath; + if (!xdgConfigHome) + configPath = getenv("HOME") + std::string("/.config"); + else + configPath = xdgConfigHome; + + return configPath + "/hypr/hyprpaper.conf"; +} + std::string CConfigManager::removeBeginEndSpacesTabs(std::string str) { while (str[0] == ' ' || str[0] == '\t') { str = str.substr(1); @@ -184,10 +188,10 @@ void CConfigManager::handleUnloadAll(const std::string& COMMAND, const std::string& VALUE) { std::vector<std::string> toUnload; - for (auto&[name, target] : g_pHyprpaper->m_mWallpaperTargets) { + for (auto& [name, target] : g_pHyprpaper->m_mWallpaperTargets) { bool exists = false; - for (auto&[mon, target2] : g_pHyprpaper->m_mMonitorActiveWallpaperTargets) { + for (auto& [mon, target2] : g_pHyprpaper->m_mMonitorActiveWallpaperTargets) { if (&target == target2) { exists = true; break; @@ -206,7 +210,7 @@ // trim from both ends std::string CConfigManager::trimPath(std::string path) { - //trims whitespaces, tabs and new line feeds + // trims whitespaces, tabs and new line feeds size_t pathStartIndex = path.find_first_not_of(" \t\r\n"); size_t pathEndIndex = path.find_last_not_of(" \t\r\n"); return path.substr(pathStartIndex, pathEndIndex - pathStartIndex + 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/src/config/ConfigManager.hpp new/hyprpaper-0.4.0/src/config/ConfigManager.hpp --- old/hyprpaper-0.3.0/src/config/ConfigManager.hpp 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/src/config/ConfigManager.hpp 2023-08-03 13:00:55.000000000 +0200 @@ -9,6 +9,7 @@ CConfigManager(); std::deque<std::string> m_dRequestedPreloads; + std::string getMainConfigPath(); private: std::string parseError; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/src/events/Events.cpp new/hyprpaper-0.4.0/src/events/Events.cpp --- old/hyprpaper-0.3.0/src/events/Events.cpp 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/src/events/Events.cpp 2023-08-03 13:00:55.000000000 +0200 @@ -137,6 +137,7 @@ for (auto& m : g_pHyprpaper->m_vMonitors) { if (m->wayland_name == name) { Debug::log(LOG, "Destroying output %s", m->name.c_str()); + g_pHyprpaper->clearWallpaperFromMonitor(m->name); std::erase_if(g_pHyprpaper->m_vMonitors, [&](const auto& other) { return other->wayland_name == name; }); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpaper-0.3.0/src/render/WallpaperTarget.cpp new/hyprpaper-0.4.0/src/render/WallpaperTarget.cpp --- old/hyprpaper-0.3.0/src/render/WallpaperTarget.cpp 2023-05-29 18:35:41.000000000 +0200 +++ new/hyprpaper-0.4.0/src/render/WallpaperTarget.cpp 2023-08-03 13:00:55.000000000 +0200 @@ -1,5 +1,7 @@ #include "WallpaperTarget.hpp" +#include <magic.h> + CWallpaperTarget::~CWallpaperTarget() { cairo_surface_destroy(m_pCairoSurface); } @@ -17,8 +19,22 @@ CAIROSURFACE = JPEG::createSurfaceFromJPEG(path); m_bHasAlpha = false; } else { - Debug::log(CRIT, "unrecognized image %s", path.c_str()); - exit(1); + // magic is slow, so only use it when no recognized extension is found + auto handle = magic_open(MAGIC_NONE|MAGIC_COMPRESS); + magic_load(handle, nullptr); + + const auto type_str = std::string(magic_file(handle, path.c_str())); + const auto first_word = type_str.substr(0, type_str.find(" ")); + + if (first_word == "PNG") { + CAIROSURFACE = cairo_image_surface_create_from_png(path.c_str()); + } else if (first_word == "JPEG") { + CAIROSURFACE = JPEG::createSurfaceFromJPEG(path); + m_bHasAlpha = false; + } else { + Debug::log(CRIT, "unrecognized image %s", path.c_str()); + exit(1); + } } if (cairo_surface_status(CAIROSURFACE) != CAIRO_STATUS_SUCCESS) {