feat(script): Removed
This commit is contained in:
1 parent
8c2f278281
commit
b9bebfb09f
2 files changed
-122
No files matched your search
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
|
||||||
|
|
||||||
power() { #? Power Options
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
reset) #? Reset Changes.
|
|
||||||
Power_Manager "$@"
|
|
||||||
;;
|
|
||||||
save) #? Save Power by disabling features
|
|
||||||
Power_Manager "$@"
|
|
||||||
;;
|
|
||||||
unset) #? Unset specific changes
|
|
||||||
Power_Manager "$@"
|
|
||||||
;;
|
|
||||||
game) #? Toggle Game mode
|
|
||||||
Power_Manager "$@"
|
|
||||||
;;
|
|
||||||
*)Parameters "$Function"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
"$@"
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Configuration files
|
|
||||||
ConfDir="$HOME/.config"
|
|
||||||
hyprlandConf="$ConfDir/hypr/hyprland.conf"
|
|
||||||
windowRules="$ConfDir/hypr/UserConfigs/WindowRules.conf"
|
|
||||||
animFile="$ConfDir/hypr/UserConfigs/UserSettings.conf"
|
|
||||||
PowManFile="$HOME/.cache/PowerManager.conf"
|
|
||||||
|
|
||||||
# Command-line option
|
|
||||||
powerOpt="$1"; shift
|
|
||||||
|
|
||||||
# Function to append a line to PowerManager.conf
|
|
||||||
append() {
|
|
||||||
grep -q "$1" "$PowManFile" || { echo "$1" >> "$PowManFile"; echo "$2"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to remove a line from PowerManager.conf
|
|
||||||
remove() {
|
|
||||||
grep -q "$1" "$PowManFile" && { sed -i "/$1/d" "$PowManFile"; echo "$2"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure PowerManager.conf is sourced in hyprland.conf
|
|
||||||
source_files() {
|
|
||||||
[[ ! -f $PowManFile ]] && { touch $PowManFile && echo "Added: $hyprlandConf"; }
|
|
||||||
grep -q "source = $PowManFile" "$hyprlandConf" || { echo "source = $PowManFile #! This File is modified by Power_Manager options(To remove: 'Power_Manager reset')" >> "$hyprlandConf"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print help message
|
|
||||||
print_help() {
|
|
||||||
echo "Usage: PowerManager $powerOpt [options]"
|
|
||||||
sed -n "/^$powerOpt() {/,/^}/p" "$0" | sed -n '/case/,/esac/p' | grep ') #?' | awk '{gsub(/^[ \t]+/, ""); gsub(/\)/, "]"); gsub(/\|/, "] ["); print}' | awk '{print "["$0}' | awk -F '#?' '{sub("\\?", "", $2); printf "%-30s %s\n", $1, $2}'
|
|
||||||
}
|
|
||||||
|
|
||||||
# Reset power-related settings
|
|
||||||
reset() {
|
|
||||||
: > "$PowManFile"
|
|
||||||
grep -q "source = $PowManFile" "$hyprlandConf" && { sed -i "\#source = $PowManFile#d" "$hyprlandConf"; }
|
|
||||||
sed -i 's/^\s*#!\(.*windowrule.*opacity\)/\1/' "$windowRules"
|
|
||||||
sed -i 's/\(animation = borderangle,\) 0,/\1 1,/' "$animFile"
|
|
||||||
hyprctl reload
|
|
||||||
}
|
|
||||||
|
|
||||||
# Save power-related settings based on command-line options
|
|
||||||
save() {
|
|
||||||
[[ -z "$@" ]] && { print_help; }
|
|
||||||
source_files
|
|
||||||
declare -A processed_flags
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ "${processed_flags[$arg]}" != "true" ]; then
|
|
||||||
case $arg in
|
|
||||||
-a|--animations) append "animations:enabled = 0" "DISABLE Animations" ;;
|
|
||||||
-ba|--borderangle) append "animation = borderangle, 0" "DISABLE Border angle animation" ;;
|
|
||||||
-b|--blur) append "decoration:blur:enabled = 0" "DISABLE Blur" ;;
|
|
||||||
-o|--opacity)
|
|
||||||
if grep -q '^[^#]*windowrule.*opacity' "$windowRules"; then
|
|
||||||
sed -i '/^[^#]*windowrule.*opacity/s/^/#!/' "$windowRules" && echo "DISABLE Transparent opacity"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*) echo "Unknown flag: $arg"; print_help; exit 1 ;;
|
|
||||||
esac
|
|
||||||
processed_flags[$arg]="true"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Unset (revert) power-related settings based on command-line options
|
|
||||||
unset() {
|
|
||||||
[[ -z "$@" ]] && { print_help; }
|
|
||||||
source_files
|
|
||||||
declare -A processed_flags
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ "${processed_flags[$arg]}" != "true" ]; then
|
|
||||||
case $arg in
|
|
||||||
-a|--animations) remove "animations:enabled = 0" "ENABLE Animations" ;;
|
|
||||||
-ba|--borderangle)
|
|
||||||
remove "animation = borderangle, 0" "ENABLE Border angle animation"
|
|
||||||
sed -i 's/\(animation = borderangle,\) 0,/\1 1,/' "$animFile"
|
|
||||||
;;
|
|
||||||
-b|--blur) remove "decoration:blur:enabled = 0" "ENABLE Blur" ;;
|
|
||||||
-o|--opacity) sed -i 's/^\s*#!\(.*windowrule.*opacity\)/\1/' "$windowRules" ;;
|
|
||||||
*) echo "Unknown flag: $arg"; print_help; exit 1 ;;
|
|
||||||
esac
|
|
||||||
processed_flags[$arg]="true"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
hyprctl reload
|
|
||||||
}
|
|
||||||
|
|
||||||
# Placeholder function for handling power-saving options
|
|
||||||
max() {
|
|
||||||
echo "Placeholder function for handling power-saving options"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute the selected function based on the provided command-line option
|
|
||||||
$powerOpt "$@"
|
|
||||||
Reference in new issue
Block a user