mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
Add toggles to disable cheevos leds and ROCKNIX screenshot.
This commit is contained in:
@@ -5,31 +5,36 @@
|
||||
|
||||
. /etc/profile
|
||||
|
||||
# Disable rocknix-screenshot while retroarch is running
|
||||
if pgrep -f "retroarch" > /dev/null; then
|
||||
echo "RetroArch is running, skipping screenshot."
|
||||
exit 1
|
||||
# Enable / Disable rocknix screenshot
|
||||
ROCKNIX_SCREENSHOT=$(get_setting "rocknix.screenshot.enabled")
|
||||
if [ ! -n "${ROCKNIX_SCREENSHOT}" ]; then
|
||||
set_setting "rocknix.screenshot.enabled" "0"
|
||||
fi
|
||||
|
||||
# Folder to save screenshots
|
||||
SAVE_DIR="/storage/roms/screenshots"
|
||||
if [ "${ROCKNIX_SCREENSHOT}" == "1" ]; then
|
||||
# Disable rocknix-screenshot while retroarch is running
|
||||
if pgrep -f "retroarch" > /dev/null; then
|
||||
echo "RetroArch is running, skipping screenshot."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the folder if it doesn't exist
|
||||
mkdir -p "$SAVE_DIR"
|
||||
# Folder to save screenshots
|
||||
SAVE_DIR="/storage/roms/screenshots"
|
||||
|
||||
# Generate a timestamped filename
|
||||
FILENAME="$(date +'%Y-%m-%d-%H%M%S').png"
|
||||
FULL_PATH="${SAVE_DIR}/${FILENAME}"
|
||||
# Create the folder if it doesn't exist
|
||||
mkdir -p "$SAVE_DIR"
|
||||
|
||||
# Get focused window geometry
|
||||
GEOMETRY=$(swaymsg -t get_tree | jq -r '
|
||||
# Generate a timestamped filename
|
||||
FILENAME="$(date +'%Y-%m-%d-%H%M%S').png"
|
||||
FULL_PATH="${SAVE_DIR}/${FILENAME}"
|
||||
|
||||
# Get focused window geometry
|
||||
GEOMETRY=$(swaymsg -t get_tree | jq -r '
|
||||
..
|
||||
| select(.type? == "con" and .focused == true)
|
||||
| "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"'
|
||||
)
|
||||
|
||||
# Take screenshot of the focused window
|
||||
grim -g "$GEOMETRY" "$FULL_PATH"
|
||||
|
||||
echo "Screenshot saved to $FULL_PATH"
|
||||
| select(.type? == "con" and .focused == true)
|
||||
| "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"'
|
||||
)
|
||||
|
||||
# Take screenshot of the focused window
|
||||
grim -g "$GEOMETRY" "$FULL_PATH"
|
||||
fi
|
||||
|
||||
@@ -2,12 +2,18 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX)
|
||||
|
||||
if [ -z "${QUIRK_DEVICE}" ] || [ -z "${HW_DEVICE}" ]; then
|
||||
. /etc/profile
|
||||
. /etc/profile.d/001-functions
|
||||
|
||||
# Get Cheevos LED state
|
||||
CHEEVOS_LED=$(get_setting "global.retroachievements.leds")
|
||||
if [ ! -n "${CHEEVOS_LED}" ]; then
|
||||
set_setting "global.retroachievements.leds" "0"
|
||||
fi
|
||||
|
||||
if [ -f "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/achievements" ]; then
|
||||
"/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/achievements" $* &
|
||||
elif [ -f "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/achievements" ]; then
|
||||
"/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/achievements" $* &
|
||||
if [ "${CHEEVOS_LED}" == "1" ]; then
|
||||
if [ -f "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/achievements" ]; then
|
||||
"/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/achievements" $* &
|
||||
elif [ -f "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/achievements" ]; then
|
||||
"/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/achievements" $* &
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user