From c70ad02033b58ee6bc2c22b4b3f7a85c81a65e42 Mon Sep 17 00:00:00 2001 From: k4rli Date: Sun, 23 Nov 2025 00:27:02 +0200 Subject: [PATCH] test --- amd-gpu-performance.service | 19 +++++ autoclicker-stop.sh | 12 +++ autoclicker.sh | 136 ++++++++++++++++++++++++++++++ git-commit-sign-prepare-gpg.sh | 10 +++ gpu-benchmark-fix.sh | 90 ++++++++++++++++++++ gpu-performance-mode.sh | 59 +++++++++++++ home_dotfiles/.config/sway/config | 36 ++++++-- mouse-toggle.sh | 2 +- 8 files changed, 356 insertions(+), 8 deletions(-) create mode 100644 amd-gpu-performance.service create mode 100755 autoclicker-stop.sh create mode 100755 autoclicker.sh create mode 100644 git-commit-sign-prepare-gpg.sh create mode 100755 gpu-benchmark-fix.sh create mode 100755 gpu-performance-mode.sh diff --git a/amd-gpu-performance.service b/amd-gpu-performance.service new file mode 100644 index 0000000..092035f --- /dev/null +++ b/amd-gpu-performance.service @@ -0,0 +1,19 @@ +[Unit] +Description=AMD GPU High Performance Mode +After=multi-user.target + +[Service] +Type=oneshot +ExecStart=/bin/bash -c 'echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level' +ExecStart=/bin/bash -c 'echo 2 > /sys/class/drm/card0/device/pp_dpm_sclk' +ExecStart=/bin/bash -c 'echo 3 > /sys/class/drm/card0/device/pp_dpm_mclk' +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target + + + + + + diff --git a/autoclicker-stop.sh b/autoclicker-stop.sh new file mode 100755 index 0000000..6ce3b11 --- /dev/null +++ b/autoclicker-stop.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Script to stop the autoclicker +STATE_FILE="/tmp/autoclicker_running" + +if [ -f "$STATE_FILE" ]; then + rm -f "$STATE_FILE" + echo "Autoclicker stop signal sent!" +else + echo "Autoclicker is not running." +fi + diff --git a/autoclicker.sh b/autoclicker.sh new file mode 100755 index 0000000..00c55e1 --- /dev/null +++ b/autoclicker.sh @@ -0,0 +1,136 @@ +#!/bin/bash + +# Autoclicker script for Sway +# Clicks continuously with random delays and periodic breaks +# Press ESC to stop +# Requires ydotool and ydotoold daemon running + +# Configuration +MIN_DELAY=51 # Minimum delay in milliseconds +MAX_DELAY=689 # Maximum delay in milliseconds +MIN_CLICKS_BEFORE_BREAK=50 # Minimum clicks before break +MAX_CLICKS_BEFORE_BREAK=300 # Maximum clicks before break +MIN_BREAK=5 # Minimum break duration in seconds +MAX_BREAK=10 # Maximum break duration in seconds + +STATE_FILE="/tmp/autoclicker_running" +LOCK_FILE="/tmp/autoclicker_lock" + +# Check if ydotool is available +if ! command -v ydotool &> /dev/null; then + echo "Error: ydotool is not installed. Install it with: sudo pacman -S ydotool" + exit 1 +fi + +# Check if bc is available (needed for random delay calculation) +if ! command -v bc &> /dev/null; then + echo "Error: bc is not installed. Install it with: sudo pacman -S bc" + exit 1 +fi + +# Check if script is already running (prevent multiple instances) +if [ -f "$LOCK_FILE" ]; then + echo "Autoclicker is already running!" + echo "Press ESC to stop it." + exit 0 +fi + +# Create lock file +echo $$ > "$LOCK_FILE" + +# Clean up lock file on exit +cleanup() { + rm -f "$LOCK_FILE" + rm -f "$STATE_FILE" + echo "" + echo "Autoclicker stopped." +} +trap cleanup EXIT INT TERM + +# Check if ydotoold daemon is running +if ! pgrep -x "ydotoold" > /dev/null; then + echo "Starting ydotoold daemon..." + sudo ydotoold & + sleep 1 +fi + +# Create state file to indicate running +echo "running" > "$STATE_FILE" + +# Function to generate random delay in seconds +get_random_delay() { + local min=$1 + local max=$2 + local range=$((max - min)) + local random_ms=$((min + RANDOM % (range + 1))) + echo "scale=3; $random_ms / 1000" | bc +} + +# Function to generate random number of clicks before break +get_random_clicks() { + local min=$1 + local max=$2 + local range=$((max - min)) + echo $((min + RANDOM % (range + 1))) +} + +# Function to check if ESC key was pressed (by checking if state file was removed) +check_exit() { + if [ ! -f "$STATE_FILE" ]; then + echo "Exit signal received!" + exit 0 + fi +} + +echo "==========================================" +echo "Autoclicker started!" +echo "==========================================" +echo "Configuration:" +echo " - Click delay: ${MIN_DELAY}-${MAX_DELAY}ms" +echo " - Break every: ${MIN_CLICKS_BEFORE_BREAK}-${MAX_CLICKS_BEFORE_BREAK} clicks (random)" +echo " - Break duration: ${MIN_BREAK}-${MAX_BREAK}s" +echo "" +echo "Press ESC or run: rm $STATE_FILE" +echo "==========================================" +echo "" + +click_count=0 +total_clicks=0 +clicks_before_break=$(get_random_clicks $MIN_CLICKS_BEFORE_BREAK $MAX_CLICKS_BEFORE_BREAK) +echo "Next break will be after $clicks_before_break clicks" +echo "" + +while true; do + check_exit + + # Generate random delay before this click + delay=$(get_random_delay $MIN_DELAY $MAX_DELAY) + + # Perform click (suppress ydotool output) + ydotool click 0xC0 2>/dev/null + click_count=$((click_count + 1)) + total_clicks=$((total_clicks + 1)) + + # Convert delay to milliseconds for display + delay_ms=$(echo "$delay * 1000" | bc | cut -d'.' -f1) + + # Show each click with its delay + echo "Click #$total_clicks (delay: ${delay_ms}ms, next break in $((clicks_before_break - click_count)) clicks)" + + # Check if it's time for a break + if [ $click_count -ge $clicks_before_break ]; then + break_duration=$(get_random_delay $((MIN_BREAK * 1000)) $((MAX_BREAK * 1000))) + echo "" + echo "[Break] Completed $clicks_before_break clicks (total: $total_clicks). Taking a break for ${break_duration}s..." + sleep "$break_duration" + click_count=0 + # Generate new random click count for next cycle + clicks_before_break=$(get_random_clicks $MIN_CLICKS_BEFORE_BREAK $MAX_CLICKS_BEFORE_BREAK) + echo "[Resumed] Next break will be after $clicks_before_break clicks" + echo "" + else + # Wait the random delay before next click + sleep "$delay" + fi +done + diff --git a/git-commit-sign-prepare-gpg.sh b/git-commit-sign-prepare-gpg.sh new file mode 100644 index 0000000..89dbf99 --- /dev/null +++ b/git-commit-sign-prepare-gpg.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +#gpg --full-generate-key + +#gpg --list-secret-keys --keyid-format=long + +#gpg --armor --export .. + +#git config --global commit.gpgsign true + diff --git a/gpu-benchmark-fix.sh b/gpu-benchmark-fix.sh new file mode 100755 index 0000000..ba3e066 --- /dev/null +++ b/gpu-benchmark-fix.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Comprehensive AMD GPU Performance Fix for Benchmarking + +# Colors for output +RED='\033[0:31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +echo -e "${GREEN}=== AMD RX 6900 XT Benchmark Performance Fix ===${NC}" +echo "" + +# Find the AMD GPU +GPU_PATH="" +for card in /sys/class/drm/card[0-9]; do + if [ -f "$card/device/power_dpm_force_performance_level" ]; then + GPU_PATH="$card/device" + GPU_CARD=$(basename $(dirname $GPU_PATH)) + break + fi +done + +if [ -z "$GPU_PATH" ]; then + echo -e "${RED}ERROR: Could not find AMD GPU!${NC}" + exit 1 +fi + +echo -e "${GREEN}Found GPU at: $GPU_PATH${NC}" +echo "" + +# Show current state +echo "=== BEFORE ===" +echo "Performance Level: $(cat $GPU_PATH/power_dpm_force_performance_level)" +echo "Core Clock:" +cat $GPU_PATH/pp_dpm_sclk | grep "\*" +echo "Memory Clock:" +cat $GPU_PATH/pp_dpm_mclk | grep "\*" +echo "" + +# Apply fixes +echo -e "${YELLOW}Applying performance fixes...${NC}" + +# 1. Set performance level to high +echo "high" | sudo tee $GPU_PATH/power_dpm_force_performance_level > /dev/null +echo "✓ Set performance level to HIGH" + +# 2. Force highest core clock +echo "2" | sudo tee $GPU_PATH/pp_dpm_sclk > /dev/null +echo "✓ Forced highest core clock (2600MHz)" + +# 3. Force highest memory clock +echo "3" | sudo tee $GPU_PATH/pp_dpm_mclk > /dev/null +echo "✓ Forced highest memory clock (2000MHz effective)" + +# 4. Set power limit to maximum if available +if [ -f "$GPU_PATH/hwmon/hwmon*/power1_cap_max" ]; then + MAX_POWER=$(cat $GPU_PATH/hwmon/hwmon*/power1_cap_max) + echo "$MAX_POWER" | sudo tee $GPU_PATH/hwmon/hwmon*/power1_cap > /dev/null 2>&1 + echo "✓ Set power limit to maximum" +fi + +echo "" +echo "=== AFTER ===" +echo "Performance Level: $(cat $GPU_PATH/power_dpm_force_performance_level)" +echo "Core Clock:" +cat $GPU_PATH/pp_dpm_sclk | grep "\*" +echo "Memory Clock:" +cat $GPU_PATH/pp_dpm_mclk | grep "\*" +echo "" + +echo -e "${GREEN}GPU is now at maximum performance!${NC}" +echo "" +echo -e "${YELLOW}Additional tips:${NC}" +echo "1. Close all background applications" +echo "2. Make sure Sway compositor isn't limiting FPS" +echo "3. Run benchmark in fullscreen mode" +echo "4. Check CPU governor is set to 'performance'" +echo "" +echo "To check CPU governor:" +echo " cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | head -1" +echo "" +echo "To set CPU to performance mode:" +echo " echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" +echo "" +echo -e "${GREEN}Now run your benchmark!${NC}" + + + + + diff --git a/gpu-performance-mode.sh b/gpu-performance-mode.sh new file mode 100755 index 0000000..517d970 --- /dev/null +++ b/gpu-performance-mode.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# Force AMD GPU to high performance mode for gaming/benchmarking + +# Find the AMD GPU card (not integrated graphics) +GPU_PATH="" +for card in /sys/class/drm/card[0-9]; do + if [ -f "$card/device/power_dpm_force_performance_level" ]; then + GPU_PATH="$card/device" + break + fi +done + +if [ -z "$GPU_PATH" ]; then + echo "ERROR: Could not find AMD GPU!" + exit 1 +fi + +echo "Found GPU at: $GPU_PATH" + +echo "=== AMD GPU Performance Mode Script ===" +echo "" + +# Check current state +echo "Current settings:" +echo "Performance Level: $(cat $GPU_PATH/power_dpm_force_performance_level)" +echo "" +echo "Core Clock States:" +cat $GPU_PATH/pp_dpm_sclk +echo "" +echo "Memory Clock States:" +cat $GPU_PATH/pp_dpm_mclk +echo "" + +# Force high performance +echo "Forcing high performance mode..." +echo "high" | sudo tee $GPU_PATH/power_dpm_force_performance_level + +# Force highest clock states +echo "Forcing maximum clock states..." +echo "2" | sudo tee $GPU_PATH/pp_dpm_sclk +echo "3" | sudo tee $GPU_PATH/pp_dpm_mclk + +echo "" +echo "=== New settings ===" +echo "Performance Level: $(cat $GPU_PATH/power_dpm_force_performance_level)" +echo "" +echo "Core Clock States:" +cat $GPU_PATH/pp_dpm_sclk +echo "" +echo "Memory Clock States:" +cat $GPU_PATH/pp_dpm_mclk +echo "" +echo "GPU should now run at maximum performance!" +echo "Run your benchmark now." +echo "" +echo "To revert to auto mode, run:" +echo "echo 'auto' | sudo tee $GPU_PATH/power_dpm_force_performance_level" + + diff --git a/home_dotfiles/.config/sway/config b/home_dotfiles/.config/sway/config index 0decec5..a58c160 100644 --- a/home_dotfiles/.config/sway/config +++ b/home_dotfiles/.config/sway/config @@ -75,15 +75,23 @@ output * bg /home/raga/.config/sway/wallpaper.jpg fill # You can get your output names by running: swaymsg -t get_outputs # DP-2 is the primary monitor on the left, and DP-1 is on the right. output HDMI-A-1 { -#output DP-2 { -# mode 2560x1440@60Hz - mode 2560x1440@120Hz position 0 0 + +# ECO +# mode 2560x1440@60Hz + +# FULL + mode 2560x1440@120Hz } output DP-1 { - modeline 586.59 2560 2568 2600 2640 1440 1529 1537 1543 +hsync -vsync position 2560 0 + +# ECO +# mode 2560x1440@60Hz + +# FULL + modeline 586.59 2560 2568 2600 2640 1440 1529 1537 1543 +hsync -vsync } ############################################################################### @@ -106,9 +114,13 @@ exec swayidle -w \ ############################################################################### # Estonian keyboard layout configuration -input type:keyboard { - xkb_layout "ee" - xkb_variant "nodeadkeys" +# input type:keyboard { +# xkb_layout "ee" +# xkb_variant "nodeadkeys" +# } +input * { + xkb_layout "ee,it" +# xkb_options "grp:alt_shift_toggle" } # Enable touchpad tap, natural scroll @@ -159,6 +171,9 @@ floating_modifier $mod normal # Launcher dialogs ############################################################################### +## Keyboard // Toggle Layout // l ## +bindsym $alt+Shift+L input * xkb_switch_layout next + ## Launch // Terminal // <> Enter ## bindsym $mod+Return exec $term @@ -211,6 +226,12 @@ bindsym $mod+Shift+s exec systemctl suspend ## Mouse // Enable/Disable Toggle // <> o ## bindsym $mod+Shift+o exec /home/raga/repos/linux/sway-new-config/mouse-toggle.sh toggle +## Mouse // Start Autoclicker // <> a ## +bindsym $mod+Shift+a exec kitty -e /home/raga/repos/linux/sway-new-config/autoclicker.sh + +## Mouse // Stop Autoclicker // <> Escape ## +#bindsym Escape exec /home/raga/repos/linux/sway-new-config/autoclicker-stop.sh + ############################################################################### # System Management (Arch Linux alternatives) ############################################################################### @@ -465,6 +486,7 @@ bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+ # Screenshots bindsym Print exec grim - | swappy -f - + bindsym $mod+Print exec grim -g "$(slurp)" - | swappy -f - ## Modify // Toggle Bar // <> i ## diff --git a/mouse-toggle.sh b/mouse-toggle.sh index 0d2a4c3..9c2bc42 100755 --- a/mouse-toggle.sh +++ b/mouse-toggle.sh @@ -24,7 +24,7 @@ RANDOM_DELAY_LEFT=0.05 #RANDOM_DELAY_LEFT=0.3 ### PRAYER BONES -MOVE_DISTANCE=90 +MOVE_DISTANCE=120 #RANDOM_NUM=$((RANDOM % 101)) # Generate 0-100 #RANDOM_DELAY=$(echo "scale=3; 0.5 + $RANDOM_NUM / 1000" | bc) RANDOM_DELAY=0.100