Skip to content

Commit f34d7fe

Browse files
committed
chore: remove KROSSHAIR_SCALE, clean up README and install messages
Drop the KROSSHAIR_SCALE env var (hardcode scale to 1). Rewrite README to focus on crosshair-maker integration, remove nixos/requirements sections, and update AUR install messages to match.
1 parent c54d565 commit f34d7fe

4 files changed

Lines changed: 170 additions & 134 deletions

File tree

.github/workflows/release.yml

Lines changed: 138 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,58 @@ on:
55
branches: [main]
66

77
jobs:
8+
check-skip:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
should_skip: ${{ steps.check.outputs.skip }}
12+
steps:
13+
- name: Check if this is a version bump commit
14+
id: check
15+
run: |
16+
MSG="${{ github.event.head_commit.message }}"
17+
if echo "$MSG" | grep -q "^chore: bump version"; then
18+
echo "skip=true" >> $GITHUB_OUTPUT
19+
else
20+
echo "skip=false" >> $GITHUB_OUTPUT
21+
fi
22+
823
version:
24+
needs: [check-skip]
25+
if: needs.check-skip.outputs.should_skip == 'false'
926
runs-on: ubuntu-latest
1027
outputs:
1128
new_version: ${{ steps.bump.outputs.new_version }}
29+
old_version: ${{ steps.bump.outputs.old_version }}
1230
steps:
1331
- uses: actions/checkout@v5
1432
with:
1533
fetch-depth: 0
16-
- name: Install tools
17-
run: |
18-
sudo apt-get update
19-
sudo apt-get install -y python python-pip
20-
pip install --user bumpver
21-
- name: Calculate version bump
34+
- name: Determine version bump
2235
id: bump
2336
run: |
24-
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
25-
if [ -n "$LAST_TAG" ]; then
26-
COMMITS=$(git log $LAST_TAG..HEAD --pretty=%s)
27-
else
28-
COMMITS=$(git log HEAD --pretty=%s)
37+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
38+
OLD_VERSION=${LAST_TAG#v}
39+
IFS='.' read -r MAJOR MINOR PATCH <<< "$OLD_VERSION"
40+
41+
COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=%s 2>/dev/null || git log HEAD --pretty=%s)
42+
43+
if echo "$COMMITS" | grep -q "^feat:"; then
44+
MINOR=$((MINOR + 1))
45+
PATCH=0
46+
elif echo "$COMMITS" | grep -q "^chore:\|^fix:\|^docs:"; then
47+
PATCH=$((PATCH + 1))
2948
fi
49+
3050
if echo "$COMMITS" | grep -q "^BREAKING CHANGE:"; then
31-
bumpver update --major
32-
elif echo "$COMMITS" | grep -q "^feat:"; then
33-
bumpver update --minor
34-
else
35-
bumpver update --patch
51+
MAJOR=$((MAJOR + 1))
52+
MINOR=0
53+
PATCH=0
3654
fi
37-
NEW_VERSION=$(bumpver show | grep -E "^[0-9]+\.[0-9]+\.[0-9]+" | head -1)
55+
56+
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
3857
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
39-
- name: Bump PKGBUILD versions
40-
run: |
41-
sed -i "s/pkgver=.*/pkgver=${{ steps.bump.outputs.new_version }}/" PKGBUILD
42-
sed -i "s/pkgver=.*/pkgver=${{ steps.bump.outputs.new_version }}/" aur/PKGBUILD
43-
cd aur && makepkg --printsrcinfo > .SRCINFO
44-
- name: Upload version files (uncommitted)
45-
uses: actions/upload-artifact@v6
46-
with:
47-
name: version-files
48-
path: |
49-
PKGBUILD
50-
aur/
58+
echo "old_version=$OLD_VERSION" >> $GITHUB_OUTPUT
59+
echo "Bumping $OLD_VERSION -> $NEW_VERSION"
5160
5261
build:
5362
needs: [version]
@@ -56,10 +65,6 @@ jobs:
5665
- uses: actions/checkout@v5
5766
with:
5867
fetch-depth: 0
59-
- uses: actions/download-artifact@v7
60-
with:
61-
name: version-files
62-
path: .
6368
- name: Install system dependencies
6469
run: |
6570
sudo apt-get update
@@ -76,90 +81,130 @@ jobs:
7681
elif [ "$ARCH" = "aarch64" ]; then
7782
echo "arch_name=aarch64" >> $GITHUB_OUTPUT
7883
fi
84+
- name: Update PKGBUILD versions
85+
run: |
86+
VERSION=${{ needs.version.outputs.new_version }}
87+
sed -i "s/pkgver=.*/pkgver=$VERSION/" PKGBUILD
88+
sed -i "s/pkgver=.*/pkgver=$VERSION/" aur/PKGBUILD
7989
- name: Create tarball
8090
run: |
81-
mkdir -p krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}
82-
cp lib/krosshair.so krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}/
83-
cp krosshair.json krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}/
84-
cp LICENSE krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}/ 2>/dev/null || true
85-
tar -czf krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}.tar.gz -C krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }} .
86-
- name: Generate checksum
87-
run: sha256sum krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}.tar.gz > krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}.sha256
88-
- name: Upload artifacts
91+
ARCH_NAME=${{ steps.arch.outputs.arch_name }}
92+
VERSION=${{ needs.version.outputs.new_version }}
93+
mkdir -p krosshair-linux-${ARCH_NAME}
94+
cp lib/krosshair.so krosshair-linux-${ARCH_NAME}/
95+
cp krosshair.json krosshair-linux-${ARCH_NAME}/
96+
cp LICENSE krosshair-linux-${ARCH_NAME}/ 2>/dev/null || true
97+
tar -czf krosshair-linux-${ARCH_NAME}.tar.gz -C krosshair-linux-${ARCH_NAME} .
98+
sha256sum krosshair-linux-${ARCH_NAME}.tar.gz > krosshair-linux-${ARCH_NAME}.sha256
99+
- name: Upload build artifacts
89100
uses: actions/upload-artifact@v6
90101
with:
91-
name: krosshair-${{ needs.version.outputs.new_version }}-${{ steps.arch.outputs.arch_name }}
102+
name: build-output
92103
path: |
93-
krosshair-*.tar.gz
94-
krosshair-*.sha256
104+
PKGBUILD
105+
aur/
106+
krosshair-linux-*.tar.gz
107+
krosshair-linux-*.sha256
95108
96-
commit-and-release:
109+
release:
97110
needs: [version, build]
98111
runs-on: ubuntu-latest
112+
permissions:
113+
contents: write
99114
steps:
100115
- uses: actions/checkout@v5
101116
with:
102117
ref: main
103118
fetch-depth: 0
104119
- uses: actions/download-artifact@v7
105120
with:
106-
path: artifacts
107-
- name: Restore version files from successful build
108-
run: |
109-
mkdir -p aur
110-
cp artifacts/version-files/PKGBUILD .
111-
cp -r artifacts/version-files/aur/* aur/
112-
- name: Commit version bump and create tag
121+
name: build-output
122+
path: .
123+
- name: Configure git
113124
run: |
114125
git config user.name "GitHub Action"
115126
git config user.email "action@github.com"
116-
git add PKGBUILD aur/
117-
git commit -m "chore: bump version to v${{ needs.version.outputs.new_version }}" || echo "No changes to commit"
118-
git tag "v${{ needs.version.outputs.new_version }}" -f
119-
git push origin main
120-
git push origin "v${{ needs.version.outputs.new_version }}" -f
127+
gh auth setup-git
121128
env:
122129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123-
- name: Push to AUR
130+
- name: Commit version bump and tag
124131
run: |
125-
mkdir -p ~/.ssh
126-
echo "$AUR_SSH_KEY" > ~/.ssh/aur
127-
chmod 600 ~/.ssh/aur
128-
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
129-
rm -rf aur
130-
if git clone ssh://aur@aur.archlinux.org/krosshair.git aur 2>&1; then
131-
echo "Cloned existing AUR repo"
132-
cp -r artifacts/version-files/aur/* aur/
133-
cd aur
134-
else
135-
echo "Creating new AUR repo"
136-
mkdir aur
137-
cp -r artifacts/version-files/aur/* aur/
138-
cd aur
139-
git init
140-
git remote add origin ssh://aur@aur.archlinux.org/krosshair.git
141-
fi
142-
makepkg --printsrcinfo > .SRCINFO
143-
git config user.name "GitHub Action"
144-
git config user.email "action@github.com"
145-
git add PKGBUILD .SRCINFO krosshair.install
146-
git commit -m "Update to v${{ needs.version.outputs.new_version }}" || echo "No changes to commit"
147-
git push origin master
132+
VERSION=${{ needs.version.outputs.new_version }}
133+
git add PKGBUILD aur/
134+
git commit -m "chore: bump version to v${VERSION}" || echo "No changes to commit"
135+
git tag "v${VERSION}" -f
136+
git push origin main
137+
git push origin "v${VERSION}" -f
148138
env:
149-
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
150-
- name: Create release with assets
139+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140+
- name: Create GitHub release
151141
run: |
152-
ARCH=$(uname -m)
153-
if [ "$ARCH" = "x86_64" ]; then
142+
VERSION=${{ needs.version.outputs.new_version }}
143+
ARCH_NAME=$(uname -m)
144+
if [ "$ARCH_NAME" = "x86_64" ]; then
154145
ARCH_NAME="x86_64"
155-
elif [ "$ARCH" = "aarch64" ]; then
146+
elif [ "$ARCH_NAME" = "aarch64" ]; then
156147
ARCH_NAME="aarch64"
157148
fi
158-
gh release delete "v${{ needs.version.outputs.new_version }}" --yes 2>/dev/null || true
159-
gh release create "v${{ needs.version.outputs.new_version }}" \
160-
--title "v${{ needs.version.outputs.new_version }}" \
161-
--notes "Release v${{ needs.version.outputs.new_version }}" \
162-
artifacts/krosshair-${{ needs.version.outputs.new_version }}-${ARCH_NAME}/krosshair-${{ needs.version.outputs.new_version }}-${ARCH_NAME}.tar.gz \
163-
artifacts/krosshair-${{ needs.version.outputs.new_version }}-${ARCH_NAME}/krosshair-${{ needs.version.outputs.new_version }}-${ARCH_NAME}.sha256
149+
gh release delete "v${VERSION}" --yes 2>/dev/null || true
150+
gh release create "v${VERSION}" \
151+
--title "v${VERSION}" \
152+
--notes "Release v${VERSION}" \
153+
krosshair-linux-${ARCH_NAME}.tar.gz \
154+
krosshair-linux-${ARCH_NAME}.sha256
155+
env:
156+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157+
158+
aur:
159+
needs: [version, build, release]
160+
runs-on: ubuntu-latest
161+
container: archlinux:latest
162+
steps:
163+
- uses: actions/download-artifact@v7
164+
with:
165+
name: build-output
166+
path: .
167+
- name: Push to AUR
168+
run: |
169+
VERSION=${{ needs.version.outputs.new_version }}
170+
pacman -Sy --noconfirm openssh git sudo
171+
172+
useradd -m builduser
173+
echo "builduser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
174+
175+
mkdir -p /home/builduser/.ssh
176+
echo "$AUR_SSH_KEY" > /home/builduser/.ssh/aur
177+
chmod 600 /home/builduser/.ssh/aur
178+
chmod 700 /home/builduser/.ssh
179+
chown -R builduser:builduser /home/builduser/.ssh
180+
ssh-keyscan aur.archlinux.org >> /home/builduser/.ssh/known_hosts
181+
182+
cp -r aur /home/builduser/aur
183+
chown -R builduser:builduser /home/builduser/aur
184+
185+
sudo -u builduser VERSION="$VERSION" bash -c '
186+
cd /home/builduser
187+
if git clone ssh://aur@aur.archlinux.org/krosshair.git aur-push 2>&1; then
188+
echo "Cloned existing AUR repo"
189+
else
190+
echo "Creating new AUR repo"
191+
mkdir -p aur-push
192+
cd aur-push
193+
git init
194+
git remote add origin ssh://aur@aur.archlinux.org/krosshair.git
195+
cd ..
196+
fi
197+
198+
cp aur/PKGBUILD aur-push/
199+
cp aur/krosshair.install aur-push/
200+
201+
cd aur-push
202+
makepkg --printsrcinfo > .SRCINFO
203+
git config user.name "GitHub Action"
204+
git config user.email "action@github.com"
205+
git add PKGBUILD .SRCINFO krosshair.install
206+
git commit -m "Update to v${VERSION}" || echo "No changes to commit"
207+
GIT_SSH_COMMAND="ssh -i /home/builduser/.ssh/aur -o StrictHostKeyChecking=no" git push origin master
208+
'
164209
env:
165-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210+
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,39 @@ A crosshair overlay for games on linux using vulkan.
55
![quake](img/quake-crosshair.png)
66

77
## Installation
8-
`make && make install`
98

10-
On nixos-unstable: Add `krosshair` (or clone and add `(callPackage <local krosshair repo path>/derivation.nix { })`) to packages and `nixos-rebuild switch`.
9+
### AUR
10+
11+
```bash
12+
yay -S krosshair
13+
```
14+
15+
### From source
16+
17+
```bash
18+
git clone https://github.com/fibsussy/krosshair.git
19+
cd krosshair
20+
make
21+
```
1122

1223
## Usage
13-
Simply start the your game with `KROSSHAIR=1` set. When using steam, put `KROSSHAIR=1 %command%` into the launch options of your game. Additionally you can use the following variables to customize your crosshair.
14-
- `KROSSHAIR_IMG=/path/to/crosshair-image.png` (i've provided some crosshairs in [here](https://github.com/krob64/krosshair/tree/main/crosshairs), copy them wherever you like)
15-
- alternatively you can use a [crosshair generator site](https://crosshair.themeta.gg/) (or [this one](https://guywiddacaptain.github.io/aimX/))
24+
25+
```bash
26+
export KROSSHAIR=1
27+
your-game
28+
```
29+
30+
For Steam games, add `KROSSHAIR=1 %command%` to launch options.
31+
1632
## crosshair-maker integration
1733

18-
If you have [crosshair-maker](https://github.com/fibsussy/crosshair-maker) installed, krosshair automatically uses your currently selected crosshair — no configuration needed. The currently active project's exported PNG (`~/.config/crosshair-maker/projects/current.png`) is loaded as the overlay. You can still override this with `KROSSHAIR_IMG` if you want.
34+
krosshair works out of the box with [crosshair-maker](https://github.com/fibsussy/crosshair-maker), a crosshair overlay creator with SVG rendering and preview. The currently selected crosshair is automatically exported to `~/.config/crosshair-maker/projects/current.png`, which krosshair picks up as its default — just launch your game with `export KROSSHAIR=1` and go.
1935

20-
- `KROSSHAIR_SCALE=1.0` (scaling the scrosshair may make it look blurry, i'd suggest to just create a bigger/smaller crosshair)
36+
You can override the image with `export KROSSHAIR_IMG=/path/to/crosshair.png` if you want to use a custom file.
2137

2238
## Can i get banned for this?
2339
I don't know, use at your own risk. I've only used it in Quake Champions and STRAFTAT, both of which don't really have an anticheat.
2440

25-
## Setting up requirements
26-
Needs Vulkan libs to build.
27-
All requirements can be set up with `nix-shell' when nix is installed.
28-
2941
## Issues
3042
As of now, the overlay leaks a bit of memory everytime you alt-tab out of/into the game, as well as everytime the window is being resized and upon resolution changes. It's not a big leak and shouldn't cause any problems, but it's still worth noting.
3143
I've tried fixing it multiple times but have always hit a dead-end. If someone more experienced with vulkan wants to help, take a look at [this issue](https://github.com/krob64/krosshair/issues/1). I know it's a bit of a mess, this whole project is based on a morally questionable apex legends project which i'm unsure if i should link to it here, coupled with me jumping into it right after completing the vulkan tutorial.

aur/krosshair.install

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@ post_install() {
44
echo ""
55
echo "==> Getting Started:"
66
echo ""
7-
echo " 1. Run your game with KROSSHAIR=1 set"
8-
echo " Example: KROSSHAIR=1 your-game"
7+
echo " KROSSHAIR=1 your-game"
98
echo ""
10-
echo " 2. For Steam games, add to launch options:"
11-
echo " KROSSHAIR=1 %command%"
9+
echo " For Steam games, add to launch options:"
10+
echo " KROSSHAIR=1 %command%"
1211
echo ""
13-
echo "==> Customization:"
14-
echo " KROSSHAIR_IMG=/path/to/crosshair.png"
15-
echo " KROSSHAIR_SCALE=1.0"
12+
echo "==> crosshair-maker integration:"
13+
echo " If crosshair-maker is installed, your currently selected"
14+
echo " crosshair is used automatically. Override with:"
15+
echo " export KROSSHAIR_IMG=/path/to/crosshair.png"
1616
echo ""
17-
echo "==> Sample crosshairs installed at:"
18-
echo " /usr/share/krosshair/crosshairs/"
19-
echo ""
20-
echo "==> For more info: https://github.com/fibsussy/krosshair"
17+
echo "==> For more info: https://github.com/krob64/krosshair"
2118
echo ""
2219
}
2320

src/layer.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -962,26 +962,8 @@ static void ensure_swapchain_crosshair(swapchain_data_t* data,
962962
&data->crosshair_upload_buffer_mem, data->crosshair_image);
963963
}
964964

965-
float scale = 1;
966-
const char* scale_str = getenv("KROSSHAIR_SCALE");
967-
if (scale_str) {
968-
char* end = NULL;
969-
for (float scale_cvt = strtof(scale_str, &end); scale_str != end;
970-
scale_cvt = strtof(scale_str, &end)) {
971-
printf("got scale: %f\n", scale_cvt);
972-
scale = scale_cvt;
973-
scale_str = end;
974-
if (errno == ERANGE) {
975-
printf("KROSSHAIR_SCALE invalid.\n");
976-
scale = 1;
977-
}
978-
}
979-
}
980-
981-
printf("scale: %f\n", scale);
982-
983965
setup_vertices((float)data->width, (float)data->height,
984-
(float)tex_height, (float)tex_width, scale);
966+
(float)tex_height, (float)tex_width, 1.0f);
985967

986968
data->crosshair_uploaded = 1;
987969
}

0 commit comments

Comments
 (0)