configuration form the arch linux stored
This commit is contained in:
36
scripts/lichess_perf.sh
Executable file
36
scripts/lichess_perf.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to revert settings
|
||||
cleanup() {
|
||||
# Revert CPU governor to default
|
||||
sudo cpupower frequency-set -g schedutil >/dev/null 2>&1
|
||||
# Reset Firefox priorities
|
||||
for pid in $(pgrep -f "firefox.*lichess-perf"); do
|
||||
renice -n 0 -p $pid >/dev/null 2>&1
|
||||
ionice -c 2 -n 7 -p $pid >/dev/null 2>&1
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Trap signals to ensure cleanup
|
||||
trap cleanup SIGINT SIGTERM EXIT
|
||||
|
||||
# Activate performance mode for CPU
|
||||
sudo cpupower frequency-set -g performance >/dev/null 2>&1
|
||||
|
||||
# Launch Firefox with dedicated profile
|
||||
firefox -P lichess-perf &
|
||||
|
||||
# Wait for Firefox to start
|
||||
sleep 5
|
||||
|
||||
# Apply maximum priority to Firefox processes
|
||||
for pid in $(pgrep -f "firefox.*lichess-perf"); do
|
||||
renice -n -20 -p $pid >/dev/null 2>&1
|
||||
ionice -c 1 -n 0 -p $pid >/dev/null 2>&1
|
||||
done
|
||||
|
||||
# Wait until Firefox window closes
|
||||
while pgrep -f "firefox.*lichess-perf" >/dev/null; do
|
||||
sleep 5
|
||||
done
|
||||
46
scripts/move_workspace.sh
Executable file
46
scripts/move_workspace.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
TARGET="$1"
|
||||
|
||||
# Exit if no target is specified
|
||||
if [ -z "$TARGET" ]; then
|
||||
echo "Usage: $0 <target_workspace_number>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the current workspace number and all workspace numbers
|
||||
CURRENT=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused).num')
|
||||
WORKSPACES=($(i3-msg -t get_workspaces | jq -r '.[] | .num' | sort -n))
|
||||
|
||||
# Find the index of the current workspace and target workspace
|
||||
CURRENT_INDEX=$(printf "%s\n" "${WORKSPACES[@]}" | grep -n "^$CURRENT$" | cut -d: -f1)
|
||||
TARGET_INDEX=$(printf "%s\n" "${WORKSPACES[@]}" | grep -n "^$TARGET$" | cut -d: -f1)
|
||||
|
||||
# Calculate the direction of movement
|
||||
if [ -z "$TARGET_INDEX" ]; then
|
||||
# The target workspace doesn't exist, we can move directly
|
||||
i3-msg "rename workspace $CURRENT to $TARGET"
|
||||
else
|
||||
# The target workspace exists, determine the direction of shift
|
||||
if [ "$CURRENT_INDEX" -lt "$TARGET_INDEX" ]; then
|
||||
# Moving to a higher number
|
||||
for (( i=CURRENT_INDEX; i<TARGET_INDEX; i++ )); do
|
||||
i3-msg "rename workspace ${WORKSPACES[$i]} to TEMP"
|
||||
i3-msg "rename workspace ${WORKSPACES[$i+1]} to ${WORKSPACES[$i]}"
|
||||
i3-msg "rename workspace TEMP to ${WORKSPACES[$i+1]}"
|
||||
done
|
||||
elif [ "$CURRENT_INDEX" -gt "$TARGET_INDEX" ]; then
|
||||
# Moving to a lower number
|
||||
for (( i=CURRENT_INDEX-1; i>=TARGET_INDEX; i-- )); do
|
||||
i3-msg "rename workspace ${WORKSPACES[$i]} to TEMP"
|
||||
i3-msg "rename workspace ${WORKSPACES[$i-1]} to ${WORKSPACES[$i]}"
|
||||
i3-msg "rename workspace TEMP to ${WORKSPACES[$i-1]}"
|
||||
done
|
||||
fi
|
||||
# Finally, move the current workspace to the target position
|
||||
i3-msg "rename workspace $CURRENT to $TARGET"
|
||||
fi
|
||||
|
||||
# Focus on the new workspace
|
||||
i3-msg "workspace number $TARGET"
|
||||
|
||||
21
scripts/wallpaper-time.sh
Normal file
21
scripts/wallpaper-time.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
EVENING_THRESH=15
|
||||
NIGHT_THRESH=18
|
||||
while true
|
||||
do
|
||||
HOUR=$(date +%k)
|
||||
if [[ $HOUR > $NIGHT_THRESH ]];
|
||||
then
|
||||
WALLPAPER=night
|
||||
elif [[ $HOUR > $EVENING_THRESH ]];
|
||||
then
|
||||
WALLPAPER=evening
|
||||
else
|
||||
WALLPAPER=day
|
||||
fi
|
||||
|
||||
printf "Setting wallpaper to %s" $WALLPAPER
|
||||
feh --bg-fill ~/wallpaper/$WALLPAPER.png
|
||||
sleep 900
|
||||
done
|
||||
32
scripts/wallpaper_changer.sh
Executable file
32
scripts/wallpaper_changer.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
WALLPAPER_DIR="$HOME/wallpaper"
|
||||
COUNTER_FILE="$HOME/.wallpaper-counter"
|
||||
LAST_WALLPAPER_FILE="$HOME/.last-wallpaper"
|
||||
|
||||
# Create counter file if it doesn't exist
|
||||
if [ ! -f $COUNTER_FILE ]; then
|
||||
echo "0" > $COUNTER_FILE
|
||||
fi
|
||||
|
||||
# Read the counter from the file
|
||||
COUNTER=$(cat $COUNTER_FILE)
|
||||
|
||||
# Get a list of all wallpapers, exclude lock.png
|
||||
WALLPAPERS=($(find $WALLPAPER_DIR -type f \( -iname "*.jpg" -o -iname "*.png" \) ! -iname "lock.png"))
|
||||
NUM_WALLPAPERS=${#WALLPAPERS[@]}
|
||||
|
||||
# If the last wallpaper is stored, set it
|
||||
if [ -f $LAST_WALLPAPER_FILE ]; then
|
||||
feh --bg-fill "$(cat $LAST_WALLPAPER_FILE)"
|
||||
fi
|
||||
|
||||
# Set the wallpaper
|
||||
feh --bg-fill "${WALLPAPERS[$COUNTER]}"
|
||||
|
||||
# Store the last wallpaper
|
||||
echo "${WALLPAPERS[$COUNTER]}" > $LAST_WALLPAPER_FILE
|
||||
|
||||
# Update the counter
|
||||
COUNTER=$(( (COUNTER + 1) % NUM_WALLPAPERS ))
|
||||
echo $COUNTER > $COUNTER_FILE
|
||||
Reference in New Issue
Block a user