first Version
This commit is contained in:
commit
0c4bef47e8
149 changed files with 32273 additions and 0 deletions
3
backup/eww/scripts/backup.sh
Executable file
3
backup/eww/scripts/backup.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
rsync -av --exclude='/backup/' /home/willifan/.config/eww /home/willifan/.config/eww/backup
|
22
backup/eww/scripts/bluetooth.sh
Executable file
22
backup/eww/scripts/bluetooth.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Get the list of connected Bluetooth devices
|
||||
devices=$(bluetoothctl devices Connected | awk '{print $2}')
|
||||
|
||||
# Iterate through each device and get its name and battery percentage
|
||||
for device in $devices; do
|
||||
# Get the device info using bluetoothctl
|
||||
info=$(bluetoothctl info $device)
|
||||
|
||||
# Extract the name and battery percentage from the device info
|
||||
name=$(echo "$info" | grep "Name" | awk '{ for(i=2; i<=NF; i++) printf "%s ", $i;}')
|
||||
battery=$(echo "$info" | grep "Battery" | awk '{print $4}' | tr -d '()')
|
||||
done
|
||||
|
||||
eww update bluetoothDevices="$name: $battery%"
|
||||
|
||||
eww update bluetoothBattery="$battery"
|
||||
|
||||
if [[ !$devices ]]; then
|
||||
eww update bluetoothBattery="0"
|
||||
fi
|
38
backup/eww/scripts/brightness.sh
Executable file
38
backup/eww/scripts/brightness.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
brightness_file="/sys/class/backlight/intel_backlight/brightness"
|
||||
min_brightness=1
|
||||
max_brightness=96000
|
||||
|
||||
# Check if an argument is provided
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Error: Number argument is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Retrieve the argument value
|
||||
number_to_add=$1
|
||||
|
||||
# Validate if the argument is a number
|
||||
if ! [[ $number_to_add =~ ^-?[0-9]+$ ]]; then
|
||||
echo "Error: Invalid number argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read the current brightness value from the file
|
||||
current_brightness=$(cat "$brightness_file")
|
||||
|
||||
# Add the desired number to the current brightness
|
||||
new_brightness=$((current_brightness + number_to_add))
|
||||
|
||||
# Enforce minimum and maximum brightness values
|
||||
if (( new_brightness < min_brightness )); then
|
||||
new_brightness=$min_brightness
|
||||
elif (( new_brightness > max_brightness )); then
|
||||
new_brightness=$max_brightness
|
||||
fi
|
||||
|
||||
# Write the new brightness value back to the file
|
||||
echo "$new_brightness" >> "$brightness_file"
|
||||
|
||||
eww update brightnessValue="$new_brightness"
|
34
backup/eww/scripts/monitors.sh
Executable file
34
backup/eww/scripts/monitors.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
declare -A id
|
||||
declare -A horizontal
|
||||
declare -A vertical
|
||||
declare -A scale
|
||||
|
||||
generate() {
|
||||
|
||||
while read -r k h v s f; do
|
||||
id[$k]="$k"
|
||||
horizontal[$k]="$h"
|
||||
vertical[$k]="$v"
|
||||
scale[$k]="$s"
|
||||
done < <(hyprctl monitors -j | jq -r '.[]|"\(.id) \(.width) \(.height) \(.scale)"')
|
||||
|
||||
echo -n '['
|
||||
|
||||
for ((i = 0; i < ${#id[@]}; i++)); do
|
||||
echo -n ''$([ $i -eq 0 ] || echo ,)'{"id":"'$i'","width":"'${horizontal[$i]}'","height":"'${vertical[$i]}'",".scale":"'${scale[$i]}'"}'
|
||||
done
|
||||
|
||||
echo ']'
|
||||
|
||||
}
|
||||
|
||||
generate
|
||||
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
|
||||
if [[ ${line%>>*} == "monitor"* ]]; then
|
||||
generate
|
||||
fi
|
||||
done
|
||||
|
3
backup/eww/scripts/sussy.sh
Executable file
3
backup/eww/scripts/sussy.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
whoami > /home/willifan/text.txt
|
19
backup/eww/scripts/test.sh
Executable file
19
backup/eww/scripts/test.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
windows=()
|
||||
workspaces=()
|
||||
i=0
|
||||
while read -r k v; do
|
||||
windows[$i]="$k"
|
||||
i=$i+1
|
||||
workspaces[$i]="$v"
|
||||
done < <(hyprctl clients -j | jq -r '.[]|"\(.pid) \(.workspace.id)"')
|
||||
|
||||
for window in ${!windows[@]}; do
|
||||
echo $(ps -p ${windows[$window]} -o comm=)
|
||||
done
|
||||
|
||||
test=$(ps -p ${windows[5]} -o comm=)
|
||||
$(feh /usr/share/icons/Papirus-Dark/128x128/apps/${test}.svg)
|
36
backup/eww/scripts/volume.sh
Executable file
36
backup/eww/scripts/volume.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
min_volume="0"
|
||||
max_volume="100"
|
||||
|
||||
# Check if an argument is provided
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Error: Number argument is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Retrieve the argument value
|
||||
number_to_add=$1
|
||||
|
||||
# Validate if the argument is a number
|
||||
if ! [[ $number_to_add =~ ^-?[0-9]+$ ]]; then
|
||||
echo "Error: Invalid number argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read the current brightness value from the file
|
||||
current_volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}')
|
||||
|
||||
# Add the desired number to the current brightness
|
||||
new_volume=$((current_volume + number_to_add))
|
||||
|
||||
# Enforce minimum and maximum brightness values
|
||||
if (( new_volume < min_volume )); then
|
||||
new_volume=$min_volume
|
||||
elif (( new_volume > max_volume )); then
|
||||
new_volume=$max_volume
|
||||
fi
|
||||
|
||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ "${new_volume}%"
|
||||
|
||||
eww update volumeValue="$new_volume"
|
113
backup/eww/scripts/workspaces.sh
Executable file
113
backup/eww/scripts/workspaces.sh
Executable file
|
@ -0,0 +1,113 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get initial focused workspace
|
||||
focusedws=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
|
||||
|
||||
declare -A o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
|
||||
declare -A monitormap
|
||||
declare -A workspaces
|
||||
|
||||
# handle workspace create/destroy
|
||||
workspace_event() {
|
||||
if (( $1 <= 10 )); then
|
||||
o[$1]=$2
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
|
||||
fi
|
||||
if [ "$2" == "0" ]; then
|
||||
unset "workspaces[$1]"
|
||||
fi
|
||||
}
|
||||
|
||||
# handle monitor (dis)connects
|
||||
monitor_event() {
|
||||
while read -r k v; do monitormap["$k"]=$v; done < <(hyprctl -j monitors | jq -r '.[]|"\(.name) \(.id) "')
|
||||
}
|
||||
|
||||
# generate the json for eww
|
||||
generate() {
|
||||
|
||||
activeWorkspace=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
|
||||
|
||||
echo -n '['
|
||||
|
||||
for i in {1..10}; do
|
||||
active=0
|
||||
if [[ $activeWorkspace == $i ]]; then
|
||||
active=1
|
||||
fi
|
||||
echo -n ''$([ $i -eq 1 ] || echo ,)'{"num":"'$i'","occupied":"'${o[$i]}'","active":"'$active'"}'
|
||||
# echo -n ''$([ $i -eq 1 ] || echo ,) '{ "number": "'"$i"'", "activity": "'"$(status_activity $i)"'", "color": "'$(status "$i")'" }'
|
||||
done
|
||||
|
||||
# echo -n ',{"num":"'$focusedws'","clr":"'$(status "$focusedws")'"}'
|
||||
|
||||
echo ']'
|
||||
}
|
||||
|
||||
# setup
|
||||
|
||||
# add monitors
|
||||
monitor_event
|
||||
|
||||
# add workspaces
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
|
||||
|
||||
# get active workspace
|
||||
activeWorkspace=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
|
||||
|
||||
# check occupied workspaces
|
||||
for num in "${!workspaces[@]}"; do
|
||||
o[$num]=1
|
||||
done
|
||||
# generate initial widget
|
||||
generate
|
||||
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
|
||||
# echo "${#workspaces[@]} ${#o[@]}"
|
||||
# echo $line
|
||||
case ${line%>>*} in
|
||||
"focusedmon")
|
||||
focusedws=${line#*,}
|
||||
generate
|
||||
;;
|
||||
"createworkspace")
|
||||
# workspace_event "${line#*>>}" 1
|
||||
o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
|
||||
workspaces=()
|
||||
# add workspaces
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
|
||||
# check occupied workspaces
|
||||
for num in "${!workspaces[@]}"; do
|
||||
o[$num]=1
|
||||
done
|
||||
# focusedws=${line#*>>}
|
||||
generate
|
||||
;;
|
||||
"movewindow")
|
||||
generate
|
||||
;;
|
||||
"destroyworkspace")
|
||||
# workspace_event "${line#*>>}" 0
|
||||
o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
|
||||
workspaces=()
|
||||
# add workspaces
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
|
||||
# check occupied workspaces
|
||||
for num in "${!workspaces[@]}"; do
|
||||
o[$num]=1
|
||||
done
|
||||
generate
|
||||
;;
|
||||
"monitor"*)
|
||||
monitor_event
|
||||
generate
|
||||
;;
|
||||
"workspace")
|
||||
|
||||
generate
|
||||
;;
|
||||
esac
|
||||
# echo $line
|
||||
# generate
|
||||
done
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue