fix: Correct caps on gamescope with workaround service

Based on work by m2Giles
This commit is contained in:
Kyle Gospodnetich 2023-12-31 17:15:00 -08:00
parent 39599c864a
commit ca9d13efd4
3 changed files with 22 additions and 0 deletions

View File

@ -421,6 +421,7 @@ RUN /tmp/image-info.sh && \
systemctl enable bazzite-flatpak-manager.service && \
systemctl disable rpm-ostreed-automatic.timer && \
systemctl enable ublue-update.timer && \
systemctl enable gamescope-workaround.service && \
systemctl enable bazzite-hardware-setup.service && \
systemctl enable tailscaled.service && \
systemctl enable dev-hugepages1G.mount && \

View File

@ -0,0 +1,20 @@
[Unit]
Description=Workaround gamescope not having the correct caps
ConditionFileIsExecutable=/usr/bin/gamescope
After=local-fs.target
[Service]
Type=oneshot
# Copy if it doens't exist
ExecStartPre=/usr/bin/bash -c "[ -x /usr/local/bin/.gamescope ] || /usr/bin/cp /usr/bin/gamescope /usr/local/bin/.gamescope"
# This is faster than using .mount unit. Also allows for the previous line/cleanup
ExecStartPre=/usr/bin/mount --bind /usr/local/bin/.gamescope /usr/bin/gamescope
# Fix caps
ExecStart=/usr/sbin/setcap 'cap_sys_nice=eip' /usr/bin/gamescope
# Clean-up after ourselves
ExecStop=/usr/bin/umount /usr/bin/gamescope
ExecStop=/usr/bin/rm /usr/local/bin/.gamescope
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
C /usr/local/bin/.gamescope - - - - /usr/bin/gamescope