-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind-hyprland-updates.sh
executable file
·20 lines (15 loc) · 1.27 KB
/
find-hyprland-updates.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq
# This will get the latest release of hyprland
HYPRLAND_TAG=$(curl https://api.github.com/repos/hyprwm/Hyprland/releases/latest | jq -r .tag_name)
sed -i "s/^\(\s*\).*\( ### REPLACE_HYPRLAND_TAG$\)/\1ref = \"refs\/tags\/$HYPRLAND_TAG\";\2/g" flake.nix
HYPRLAND_PLUGINS_TAG=$(curl https://api.github.com/repos/hyprwm/hyprland-plugins/tags | jq -r .[0].name)
sed -i "s/^\(\s*\).*\( ### REPLACE_HYPRLAND_PLUGINS_TAG$\)/\1ref = \"refs\/tags\/$HYPRLAND_PLUGINS_TAG\";\2/g" flake.nix
TAG_SHA=$(curl https://api.github.com/repos/hyprwm/Hyprland/tags | jq -r ".[] | select(.name | contains(\"$HYPRLAND_TAG\")).commit.sha")
SPLIT_MONITOR_SHA=$(curl https://raw.githubusercontent.com/Duckonaut/split-monitor-workspaces/main/hyprpm.toml | grep $TAG_SHA | sed 's/#.*//g' | jq -r .[1])
if [ -z "$SPLIT_MONITOR_SHA" ]; then
# We'll just take the most recent build and hope it works...
SPLIT_MONITOR_SHA=$(curl "https://api.github.com/repos/Duckonaut/split-monitor-workspaces/commits?per_page=50" | jq -r ".[0].sha")
echo "Could not find matching split-monitor-workspaces commit, using the most recent commit, $SPLIT_MONITOR_SHA, instead."
fi
sed -i "s/^\(\s*\).*\( ### REPLACE_SPLIT_MONITOR_REV$\)/\1rev = \"$SPLIT_MONITOR_SHA\";\2/g" flake.nix