mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2024-11-16 22:25:59 +01:00
Config: use hyprutils helper (#183)
* config: use hyprutils helper CMake: add version, add hyprutils * Nix: add hyprutils dep flake.lock: update * Nix: add hyprwayland-scanner dep
This commit is contained in:
parent
13fcdd79ef
commit
f3a6e51d92
5 changed files with 97 additions and 54 deletions
|
@ -1,6 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.4)
|
cmake_minimum_required(VERSION 3.4)
|
||||||
project(hyprpaper
|
project(hyprpaper
|
||||||
DESCRIPTION "A blazing fast wayland wallpaper utility"
|
DESCRIPTION "A blazing fast wayland wallpaper utility"
|
||||||
|
VERSION 0.7.0
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
|
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
|
||||||
|
@ -71,7 +72,7 @@ add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-m
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols cairo pango pangocairo libjpeg libwebp hyprlang>=0.2.0)
|
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols cairo pango pangocairo libjpeg libwebp hyprlang>=0.2.0 hyprutils>=0.2.0)
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCFILES "src/*.cpp")
|
file(GLOB_RECURSE SRCFILES "src/*.cpp")
|
||||||
|
|
||||||
|
|
79
flake.lock
79
flake.lock
|
@ -2,8 +2,12 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"hyprlang": {
|
"hyprlang": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": [
|
||||||
"systems": "systems"
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": [
|
||||||
|
"systems"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713121246,
|
"lastModified": 1713121246,
|
||||||
|
@ -19,23 +23,53 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"hyprutils": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": [
|
||||||
|
"systems"
|
||||||
|
]
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1708475490,
|
"lastModified": 1721071737,
|
||||||
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
|
"narHash": "sha256-qmC9jGfbE4+EIBbbSAkrfR/p49wShjpv4/KztgE/P54=",
|
||||||
"owner": "NixOS",
|
"owner": "hyprwm",
|
||||||
"repo": "nixpkgs",
|
"repo": "hyprutils",
|
||||||
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
|
"rev": "eb1ceff2b87f6820789249f63faa8e9dcb54d05f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "hyprwm",
|
||||||
"ref": "nixos-unstable",
|
"repo": "hyprutils",
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"hyprwayland-scanner": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": [
|
||||||
|
"systems"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720215857,
|
||||||
|
"narHash": "sha256-JPdL+Qul+jEueAn8CARfcWP83eJgwkhMejQYfDvrgvU=",
|
||||||
|
"owner": "hyprwm",
|
||||||
|
"repo": "hyprwayland-scanner",
|
||||||
|
"rev": "d5fa094ca27e0039be5e94c0a80ae433145af8bb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hyprwm",
|
||||||
|
"repo": "hyprwayland-scanner",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712963716,
|
"lastModified": 1712963716,
|
||||||
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
|
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
|
||||||
|
@ -54,8 +88,10 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"hyprlang": "hyprlang",
|
"hyprlang": "hyprlang",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"hyprutils": "hyprutils",
|
||||||
"systems": "systems_2"
|
"hyprwayland-scanner": "hyprwayland-scanner",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"systems": "systems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
@ -72,21 +108,6 @@
|
||||||
"repo": "default-linux",
|
"repo": "default-linux",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689347949,
|
|
||||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
45
flake.nix
45
flake.nix
|
@ -3,10 +3,26 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
hyprlang.url = "github:hyprwm/hyprlang";
|
|
||||||
|
|
||||||
systems.url = "github:nix-systems/default-linux";
|
systems.url = "github:nix-systems/default-linux";
|
||||||
|
|
||||||
|
hyprutils = {
|
||||||
|
url = "github:hyprwm/hyprutils";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.systems.follows = "systems";
|
||||||
|
};
|
||||||
|
|
||||||
|
hyprlang = {
|
||||||
|
url = "github:hyprwm/hyprlang";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.systems.follows = "systems";
|
||||||
|
inputs.hyprutils.follows = "hyprutils";
|
||||||
|
};
|
||||||
|
|
||||||
|
hyprwayland-scanner = {
|
||||||
|
url = "github:hyprwm/hyprwayland-scanner";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.systems.follows = "systems";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
@ -31,16 +47,19 @@
|
||||||
in {
|
in {
|
||||||
overlays = {
|
overlays = {
|
||||||
default = self.overlays.hyprpaper;
|
default = self.overlays.hyprpaper;
|
||||||
hyprpaper = final: prev: rec {
|
hyprpaper = lib.composeManyExtensions [
|
||||||
hyprpaper = final.callPackage ./nix/default.nix {
|
inputs.hyprlang.overlays.default
|
||||||
stdenv = final.gcc13Stdenv;
|
inputs.hyprutils.overlays.default
|
||||||
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
inputs.hyprwayland-scanner.overlays.default
|
||||||
commit = self.rev or "";
|
(final: prev: rec {
|
||||||
inherit (final.xorg) libXdmcp;
|
hyprpaper = final.callPackage ./nix/default.nix {
|
||||||
inherit (inputs.hyprlang.packages.${final.system}) hyprlang;
|
stdenv = final.gcc13Stdenv;
|
||||||
};
|
version = "0.7.0" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||||
hyprpaper-debug = hyprpaper.override {debug = true;};
|
commit = self.rev or "";
|
||||||
};
|
};
|
||||||
|
hyprpaper-debug = hyprpaper.override {debug = true;};
|
||||||
|
})
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = eachSystem (system: {
|
packages = eachSystem (system: {
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
file,
|
file,
|
||||||
fribidi,
|
fribidi,
|
||||||
hyprlang,
|
hyprlang,
|
||||||
|
hyprutils,
|
||||||
|
hyprwayland-scanner,
|
||||||
libdatrie,
|
libdatrie,
|
||||||
libGL,
|
libGL,
|
||||||
libjpeg,
|
libjpeg,
|
||||||
|
@ -22,7 +24,7 @@
|
||||||
wayland,
|
wayland,
|
||||||
wayland-protocols,
|
wayland-protocols,
|
||||||
wayland-scanner,
|
wayland-scanner,
|
||||||
libXdmcp,
|
xorg,
|
||||||
commit,
|
commit,
|
||||||
debug ? false,
|
debug ? false,
|
||||||
version ? "git",
|
version ? "git",
|
||||||
|
@ -45,6 +47,7 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
cmake
|
cmake
|
||||||
|
hyprwayland-scanner
|
||||||
pkg-config
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -54,6 +57,7 @@ stdenv.mkDerivation {
|
||||||
file
|
file
|
||||||
fribidi
|
fribidi
|
||||||
hyprlang
|
hyprlang
|
||||||
|
hyprutils
|
||||||
libdatrie
|
libdatrie
|
||||||
libGL
|
libGL
|
||||||
libjpeg
|
libjpeg
|
||||||
|
@ -67,15 +71,15 @@ stdenv.mkDerivation {
|
||||||
wayland
|
wayland
|
||||||
wayland-protocols
|
wayland-protocols
|
||||||
wayland-scanner
|
wayland-scanner
|
||||||
libXdmcp
|
xorg.libXdmcp
|
||||||
util-linux
|
util-linux
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://github.com/hyprwm/hyprpaper";
|
|
||||||
description = "A blazing fast wayland wallpaper utility with IPC controls";
|
description = "A blazing fast wayland wallpaper utility with IPC controls";
|
||||||
|
homepage = "https://github.com/hyprwm/hyprpaper";
|
||||||
license = licenses.bsd3;
|
license = licenses.bsd3;
|
||||||
platforms = platforms.linux;
|
|
||||||
mainProgram = "hyprpaper";
|
mainProgram = "hyprpaper";
|
||||||
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "ConfigManager.hpp"
|
#include "ConfigManager.hpp"
|
||||||
#include "../Hyprpaper.hpp"
|
#include "../Hyprpaper.hpp"
|
||||||
|
#include <hyprutils/path/Path.hpp>
|
||||||
|
|
||||||
static Hyprlang::CParseResult handleWallpaper(const char* C, const char* V) {
|
static Hyprlang::CParseResult handleWallpaper(const char* C, const char* V) {
|
||||||
const std::string COMMAND = C;
|
const std::string COMMAND = C;
|
||||||
|
@ -196,14 +197,11 @@ std::string CConfigManager::getMainConfigPath() {
|
||||||
if (!g_pHyprpaper->m_szExplicitConfigPath.empty())
|
if (!g_pHyprpaper->m_szExplicitConfigPath.empty())
|
||||||
return g_pHyprpaper->m_szExplicitConfigPath;
|
return g_pHyprpaper->m_szExplicitConfigPath;
|
||||||
|
|
||||||
static const char* xdgConfigHome = getenv("XDG_CONFIG_HOME");
|
static const auto paths = Hyprutils::Path::findConfig("hyprpaper");
|
||||||
std::string configPath;
|
if (paths.first.has_value())
|
||||||
if (!xdgConfigHome)
|
return paths.first.value();
|
||||||
configPath = getenv("HOME") + std::string("/.config");
|
|
||||||
else
|
else
|
||||||
configPath = xdgConfigHome;
|
throw std::runtime_error("Could not find config in HOME, XDG_CONFIG_HOME, XDG_CONFIG_DIRS or /etc/hypr.");
|
||||||
|
|
||||||
return configPath + "/hypr/hyprpaper.conf";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// trim from both ends
|
// trim from both ends
|
||||||
|
|
Loading…
Reference in a new issue