some hyprland configs and other stuff
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
stack_file="/tmp/hide_window_pid_stack.txt"
|
||||
|
||||
function hide_window(){
|
||||
pid=$(hyprctl activewindow -j | jq '.pid')
|
||||
hyprctl dispatch movetoworkspacesilent 88,pid:$pid
|
||||
echo $pid >> $stack_file
|
||||
}
|
||||
|
||||
function show_window(){
|
||||
pid=$(tail -1 $stack_file && sed -i '$d' $stack_file)
|
||||
[ -z $pid ] && exit
|
||||
|
||||
current_workspace=$(hyprctl activeworkspace -j | jq '.id')
|
||||
hyprctl dispatch movetoworkspacesilent $current_workspace,pid:$pid
|
||||
}
|
||||
|
||||
|
||||
if [ ! -z $1 ]
|
||||
then
|
||||
if [ "$1" == "h" ]
|
||||
then
|
||||
hide_window
|
||||
else
|
||||
show_window
|
||||
fi
|
||||
fi
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
############ Variables ############
|
||||
enable_battery=false
|
||||
battery_charging=false
|
||||
|
||||
####### Check availability ########
|
||||
for battery in /sys/class/power_supply/*BAT*; do
|
||||
if [[ -f "$battery/uevent" ]]; then
|
||||
enable_battery=true
|
||||
if [[ $(cat /sys/class/power_supply/*/status | head -1) == "Charging" ]]; then
|
||||
battery_charging=true
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
############# Output #############
|
||||
if [[ $enable_battery == true ]]; then
|
||||
if [[ $battery_charging == true ]]; then
|
||||
echo -n "(+) "
|
||||
fi
|
||||
echo -n "$(cat /sys/class/power_supply/*/capacity | head -1)"%
|
||||
if [[ $battery_charging == false ]]; then
|
||||
echo -n " remaining"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ''
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
for cmd in "$@"; do
|
||||
eval "command -v ${cmd%% *}" >/dev/null 2>&1 || continue
|
||||
eval "$cmd" &
|
||||
exit
|
||||
done
|
||||
exit 1
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
CONFIG_DIR="$HOME/.config/hypr/hyprland/configs"
|
||||
CURRENT_CONFIG_FILE="$HOME/.config/hypr/hyprland/active.conf"
|
||||
|
||||
# List of available configs in order to cycle through
|
||||
CONFIGS=("powersave" "balanced" "performance")
|
||||
|
||||
# Read current config or set default
|
||||
if [[ -f "$CURRENT_CONFIG_FILE" ]]; then
|
||||
CURRENT_CONFIG=$(grep -oP '^#\s*\K\w+' "$CURRENT_CONFIG_FILE" | head -n1)
|
||||
else
|
||||
CURRENT_CONFIG="${CONFIGS[0]}"
|
||||
fi
|
||||
|
||||
# Find current config index
|
||||
INDEX=0
|
||||
for i in "${!CONFIGS[@]}"; do
|
||||
if [[ "${CONFIGS[$i]}" = "$CURRENT_CONFIG" ]]; then
|
||||
INDEX=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Calculate next config index (with wrap-around)
|
||||
NEXT_INDEX=$(( (INDEX + 1) % ${#CONFIGS[@]} ))
|
||||
NEXT_CONFIG="${CONFIGS[$NEXT_INDEX]}"
|
||||
|
||||
# Update current config file
|
||||
printf "# ${NEXT_CONFIG}\n" > "$CURRENT_CONFIG_FILE"
|
||||
printf "# AUTO-GENERATED FILE\n" >> "$CURRENT_CONFIG_FILE"
|
||||
cat "${CONFIG_DIR}/${NEXT_CONFIG}.conf" >> "$CURRENT_CONFIG_FILE"
|
||||
|
||||
if [[ "$NEXT_CONFIG" == "powersave" ]]; then
|
||||
sudo auto-cpufreq --force powersave
|
||||
elif [[ "$NEXT_CONFIG" == "performance" ]]; then
|
||||
sudo auto-cpufreq --force performance
|
||||
elif [[ "$NEXT_CONFIG" == "balanced" ]]; then
|
||||
sudo auto-cpufreq --force reset
|
||||
else
|
||||
notify-send -u critical "Unknown config: $NEXT_CONFIG"
|
||||
fi
|
||||
|
||||
# Reload Hyprland
|
||||
hyprctl reload
|
||||
|
||||
# Notification
|
||||
notify-send -t 3000 "Hyprland Config" "Switched to ${NEXT_CONFIG} config"
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
hyprctl dispatch "$1" $(((($(hyprctl activeworkspace -j | jq -r .id) - 1) / 10) * 10 + $2))
|
||||
Reference in New Issue
Block a user