This commit is contained in:
2025-10-29 12:36:16 +02:00
parent 9c893c61b7
commit 5dab98c7b9
7 changed files with 145 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ icons=0
max-icon-size=64
default-timeout=10000
ignore-timeout=1
on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga
[urgency=normal]
border-color=#FFFFFF

View File

@@ -59,4 +59,4 @@ elif [ "${BLOCK_BUTTON:-}" = "3" ]; then
else
notify-send "Bluetooth" "No Bluetooth manager found" -t 3000
fi
fi
fi

View File

@@ -205,6 +205,12 @@ bindsym $mod+Escape exec swaylock -f -c 000000
## Session // Sleep // <><Shift> s ##
bindsym $mod+Shift+s exec systemctl suspend
## Mouse // Toggle Position // <> q ##
#bindsym q exec /home/raga/repos/linux/sway-new-config/mouse-toggle.sh
## Mouse // Enable/Disable Toggle // <><Shift> o ##
bindsym $mod+Shift+o exec /home/raga/repos/linux/sway-new-config/mouse-toggle.sh toggle
###############################################################################
# System Management (Arch Linux alternatives)
###############################################################################
@@ -512,4 +518,4 @@ exec --no-startup-id nm-applet
# Include additional config files if they exist
include /etc/sway/config.d/*
bindsym $mod+x exec "$(file="/tmp/click"; if test "0" = "$(cat "$file")"; then printf '1\n' > "$file"; else printf '0\n' > "$file"; fi)"
#bindsym $mod+x exec "$(file="/tmp/click"; if test "0" = "$(cat "$file")"; then printf '1\n' > "$file"; else printf '0\n' > "$file"; fi)"

View File

@@ -81,7 +81,7 @@ interval = 1800
[[block]]
block = "time"
format = " $icon $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S') "
format = " $icon $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S%z') "
interval = 1
[icons]

View File

@@ -147,3 +147,5 @@ alias info="pacman -Si "
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
source /usr/share/nvm/init-nvm.sh
source ~/.aliases

View File

@@ -52,6 +52,16 @@ else
exit 1
fi
# Copy .aliases to home directory
echo ""
print_status "Installing .aliases configuration..."
if cp "$SCRIPT_DIR/.aliases" ~/.aliases; then
print_success ".aliases installed to ~/.aliases"
else
print_error "Failed to copy .aliases"
exit 1
fi
# Copy .p10k.zsh to home directory
echo ""
print_status "Installing Powerlevel10k configuration..."

123
mouse-toggle.sh Executable file
View File

@@ -0,0 +1,123 @@
#!/bin/bash
# Mouse toggle script for Sway
# Toggles mouse position 60 pixels left/right on each execution
# Requires ydotool and ydotoold daemon running
# Configuration
### 1T KARAMBWANS
MOVE_DISTANCE=120
#RANDOM_NUM=$((RANDOM % 101)) # Generate 0-100
#RANDOM_DELAY=$(echo "scale=3; 0.5 + $RANDOM_NUM / 1000" | bc)
RANDOM_DELAY=0.575
RANDOM_DELAY_LEFT=0.05
### ANTIVENOM POTIONS
#MOVE_DISTANCE=50
#RANDOM_DELAY=0.6
#RANDOM_DELAY_LEFT=0.6
### DRAGON JAVELINS
#MOVE_DISTANCE=50
#RANDOM_DELAY=0.1
#RANDOM_DELAY_LEFT=0.3
### PRAYER BONES
MOVE_DISTANCE=90
#RANDOM_NUM=$((RANDOM % 101)) # Generate 0-100
#RANDOM_DELAY=$(echo "scale=3; 0.5 + $RANDOM_NUM / 1000" | bc)
RANDOM_DELAY=0.100
RANDOM_DELAY_LEFT=0.05
STATE_FILE="/tmp/mouse_toggle_state"
TIMESTAMP_FILE="/tmp/mouse_toggle_timestamp"
ENABLED_FILE="/tmp/mouse_toggle_enabled"
LOCK_FILE="/tmp/mouse_toggle_lock"
RESET_TIMEOUT=1 # Reset to right after 1 second
# 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 "Script is already running, skipping..."
exit 0
fi
# Create lock file
echo $$ > "$LOCK_FILE"
# Clean up lock file on exit
trap 'rm -f "$LOCK_FILE"' EXIT
# Check if script should toggle on/off or execute
if [ "$1" = "toggle" ]; then
if [ -f "$ENABLED_FILE" ]; then
rm "$ENABLED_FILE"
echo "Mouse toggle script DISABLED"
else
echo "enabled" > "$ENABLED_FILE"
echo "Mouse toggle script ENABLED"
fi
exit 0
fi
# Check if script is enabled
if [ ! -f "$ENABLED_FILE" ]; then
echo "Mouse toggle script is DISABLED. Use '$0 toggle' to enable."
exit 0
fi
# Check if ydotoold daemon is running
if ! pgrep -x "ydotoold" > /dev/null; then
echo "Starting ydotoold daemon..."
sudo ydotoold &
sleep 1
fi
# Get current timestamp
CURRENT_TIME=$(date +%s)
# Read current state and timestamp
if [ -f "$STATE_FILE" ] && [ -f "$TIMESTAMP_FILE" ]; then
LAST_ACTION=$(cat "$STATE_FILE")
LAST_TIME=$(cat "$TIMESTAMP_FILE")
TIME_DIFF=$((CURRENT_TIME - LAST_TIME))
# If more than RESET_TIMEOUT seconds have passed, reset to "right"
if [ $TIME_DIFF -gt $RESET_TIMEOUT ]; then
echo "More than ${RESET_TIMEOUT}s since last action, resetting to move right first"
LAST_ACTION="left" # Set to left so next action will be right
fi
else
LAST_ACTION="left" # Default to left so first action is right
fi
# Toggle the action and move mouse
if [ "$LAST_ACTION" = "right" ]; then
# Last action was right, so move left
echo "Moving mouse left ($MOVE_DISTANCE pixels) and clicking (delay: ${RANDOM_DELAY}s)"
ydotool mousemove -- -$MOVE_DISTANCE 0
sleep $RANDOM_DELAY # Random delay between 0.3-0.5s
ydotool click 0xC0 # Left click
echo "left" > "$STATE_FILE"
echo "$CURRENT_TIME" > "$TIMESTAMP_FILE"
else
# Last action was left (or unknown), so move right
echo "Moving mouse right ($MOVE_DISTANCE pixels) and clicking (delay: ${RANDOM_DELAY}s)"
ydotool mousemove -- $MOVE_DISTANCE 0
sleep $RANDOM_DELAY_LEFT # Random delay between 0.1-0.2s
ydotool click 0xC0 # Left click
echo "right" > "$STATE_FILE"
echo "$CURRENT_TIME" > "$TIMESTAMP_FILE"
fi