From 8ddc5887ae601a8b4f46734f8fe149815195a817 Mon Sep 17 00:00:00 2001 From: zjeffer <4633209+zjeffer@users.noreply.github.com> Date: Thu, 26 Oct 2023 22:49:11 +0200 Subject: [PATCH 1/4] Improvements in install script --- .gitignore | 1 + Makefile | 2 +- install.sh | 36 ++++++++++++++++++++++++++++-------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 66e8893..8dfab38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ obj/ *.so compile_flags.txt +compile_commands.json \ No newline at end of file diff --git a/Makefile b/Makefile index e54b3f3..c08a73f 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ check_env: exit 1; \ fi @if pkg-config --exists hyprland; then \ - echo 'Hyprland headers found.'; \ + echo 'Hyprland headers found in: '`pkg-config --variable=includedir hyprland`; \ else \ echo 'Hyprland headers not available. Run `make all` in the root Hyprland directory.'; \ exit 1; \ diff --git a/install.sh b/install.sh index 8e1faa3..d120ad5 100755 --- a/install.sh +++ b/install.sh @@ -2,9 +2,19 @@ # This script is used to install hyprload, in a known location progress() { - echo -e "\033[1;32m$1\033[0m" + echo -e "\033[1;32m$1\033[0m" } +info() { + echo -e "\033[1;34m$1\033[0m" +} + +warn() { + echo -e "\033[1;31m$1\033[0m" +} + +set -e + HYPRLOAD_PATH=$HOME/.local/share/hyprload HYPRLOAD_SOURCE_PATH="$HYPRLOAD_PATH/src" @@ -12,9 +22,11 @@ HYPRLOAD_SOURCE_PATH="$HYPRLOAD_PATH/src" progress "[1/7] Cloning hyprload to $HYPRLOAD_SOURCE_PATH" if [ -d "$HYPRLOAD_SOURCE_PATH" ]; then - git -C "$HYPRLOAD_SOURCE_PATH" pull + info "Updating existing hyprload source" + git -C "$HYPRLOAD_SOURCE_PATH" pull origin main else - git clone https://github.com/duckonaut/hyprload.git "$HYPRLOAD_SOURCE_PATH" --depth 1 + info "Cloning hyprload source" + git clone https://github.com/duckonaut/hyprload.git "$HYPRLOAD_SOURCE_PATH" --depth 1 fi progress "[2/7] Cloned hyprload source to $HYPRLOAD_SOURCE_PATH" @@ -24,19 +36,27 @@ HYPRLAND_PATH="$HYPRLOAD_PATH/include/hyprland" progress "[3/7] Setting up hyprland source in $HYPRLAND_PATH" if [ -d "$HYPRLAND_PATH" ]; then - git -C "$HYPRLAND_PATH" pull + info "Updating existing hyprland source" + git -C "$HYPRLAND_PATH" pull origin main else - git clone https://github.com/hyprwm/Hyprland.git "$HYPRLAND_PATH" --recursive + info "Cloning hyprland source" + git clone https://github.com/hyprwm/Hyprland.git "$HYPRLAND_PATH" --recursive fi HYPRLAND_COMMIT="" if [ -z $(which hyprctl) ]; then - HYPRLAND_COMMIT=$(git -C "$HYPRLAND_PATH" rev-parse HEAD) + warn "hyprctl not found, using latest Hyprland commit" + HYPRLAND_COMMIT=$(git -C "$HYPRLAND_PATH" rev-parse HEAD) else - HYPRLAND_COMMIT=$(hyprctl version | grep "commit" | cut -d " " -f 8 | sed 's/dirty$//') - git -C "$HYPRLAND_PATH" checkout "$HYPRLAND_COMMIT" + info "hyprctl found, using commit from hyprctl" + HYPRLAND_COMMIT=$(hyprctl version | grep "commit" | cut -d " " -f 8 | sed 's/dirty$//') + git -C "$HYPRLAND_PATH" checkout "$HYPRLAND_COMMIT" fi +if [ -z "$(ls -A $HYPRLAND_PATH)" ]; then + warn "ERROR: Hyprland was not cloned properly." + exit 1 +fi progress "[4/7] Set up hyprland source in $HYPRLAND_PATH at commit $HYPRLAND_COMMIT" From 8d7c7747fd660a02d344244f53fe7be061439439 Mon Sep 17 00:00:00 2001 From: zjeffer <4633209+zjeffer@users.noreply.github.com> Date: Sat, 28 Oct 2023 23:09:40 +0200 Subject: [PATCH 2/4] Added .cache to .gitignore (generated by clangd) --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8dfab38..ac0e38e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ obj/ *.so compile_flags.txt -compile_commands.json \ No newline at end of file +compile_commands.json +.cache/ From 80cc3737a696809c32621de855c9bfadc2addcfd Mon Sep 17 00:00:00 2001 From: zjeffer <4633209+zjeffer@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:21:08 +0100 Subject: [PATCH 3/4] Init & update Hyprland submodules after checkout --- install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install.sh b/install.sh index d120ad5..525ef18 100755 --- a/install.sh +++ b/install.sh @@ -53,6 +53,9 @@ else git -C "$HYPRLAND_PATH" checkout "$HYPRLAND_COMMIT" fi +info "Checking out Hyprland submodules" +git -C "$HYPRLAND_PATH" submodule update --init --recursive + if [ -z "$(ls -A $HYPRLAND_PATH)" ]; then warn "ERROR: Hyprland was not cloned properly." exit 1 From 037613c86c6ee89caa4028014f77969ec2099d7c Mon Sep 17 00:00:00 2001 From: zjeffer <4633209+zjeffer@users.noreply.github.com> Date: Sun, 5 Nov 2023 18:21:03 +0100 Subject: [PATCH 4/4] Fix debug logging still using old format --- src/util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 352da0e..02973ef 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -198,9 +198,9 @@ namespace hyprload { int exit = pclose(pipe); - Debug::log(LOG, " [hyprload] Command: %s", command.c_str()); - Debug::log(LOG, " [hyprload] Exit code: %d", exit); - Debug::log(LOG, " [hyprload] Result: %s", result.c_str()); + Debug::log(LOG, " [hyprload] Command: {}", command); + Debug::log(LOG, " [hyprload] Exit code: {}", exit); + Debug::log(LOG, " [hyprload] Result: {}", result); return std::make_tuple(exit, result); }