diff --git a/.gitignore b/.gitignore index 66e8893..ac0e38e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ obj/ *.so compile_flags.txt +compile_commands.json +.cache/ 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..525ef18 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,30 @@ 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 +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 +fi progress "[4/7] Set up hyprland source in $HYPRLAND_PATH at commit $HYPRLAND_COMMIT" 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); }