forked from Shinonome/dots-hyprland
stuff
This commit is contained in:
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
hyprctl activewindow -j | gojq -c --monochrome-output
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "window>>" | while read -r line; do
|
||||
hyprctl activewindow -j | gojq -c --monochrome-output
|
||||
done
|
||||
fi
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
focusedws=$(hyprctl activewindow -j | gojq '.workspace.id')
|
||||
echo $focusedws
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "workspace>>" | while read -r line; do
|
||||
case ${line%>>*} in
|
||||
"workspace")
|
||||
focusedws=${line#*>>}
|
||||
echo $focusedws
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
icon() {
|
||||
if [[ $STATUS == "no" ]]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if [[ $STATUS == "no" ]]; then
|
||||
rfkill block all
|
||||
notify-send --urgency=normal -i airplane-mode-symbolic "Airplane Mode" "Airplane mode has been turned on!"
|
||||
else
|
||||
rfkill unblock all
|
||||
notify-send --urgency=normal -i airplane-mode-disabled-symbolic "Airplane Mode" "Airplane mode has been turned off!"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $1 == "toggle" ]]; then
|
||||
toggle
|
||||
else
|
||||
while true; do
|
||||
STATUS="$(rfkill list | sed -n 2p | awk '{print $3}')"
|
||||
icon
|
||||
sleep 3;
|
||||
done
|
||||
fi
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
geticonlist() {
|
||||
classes=$(hyprctl clients | grep -e 'class: ' | sed 's/\tclass: //')
|
||||
addresses=$(hyprctl clients | grep -e ' -> ')
|
||||
# echo "$classes"
|
||||
IFS=$'\n'
|
||||
classarr=($(echo "$classes"))
|
||||
addressarr=($(echo "$addresses"))
|
||||
iconarr=($(echo "$classes"))
|
||||
|
||||
for i in "${!classarr[@]}"; do
|
||||
addressarr[i]=$(echo "0x${addressarr[i]% -> *}" | sed 's/Window //')
|
||||
# echo "${addressarr[i]}"
|
||||
done
|
||||
|
||||
for i in "${!classarr[@]}"; do
|
||||
classarr[i]=$(echo ${classarr[i]})
|
||||
if [ -f "scripts/cache/${classarr[i]}" ]; then
|
||||
iconarr[i]=$(cat scripts/cache/${classarr[i]})
|
||||
if [ ! -f "${iconarr[i]}" ]; then # Cache refresh if icon doesnt exist
|
||||
iconarr[i]=$(scripts/get-icon.py "${classarr[i]}")
|
||||
echo "${iconarr[i]}" > "scripts/cache/${classarr[i]}"
|
||||
fi
|
||||
else
|
||||
iconarr[i]=$(scripts/get-icon.py "${classarr[i]}")
|
||||
echo "${iconarr[i]}" > "scripts/cache/${classarr[i]}"
|
||||
fi
|
||||
if [[ ${iconarr[i]} = "not found" ]]; then
|
||||
iconarr[i]=$(scripts/get-icon.py "$(echo "${classarr[i]##*.}" | tr '[:upper:]' '[:lower:]')")
|
||||
if [[ ! ${iconarr[i]} = "not found" ]]; then
|
||||
rm "scripts/cache/${classarr[i]}"
|
||||
echo "${iconarr[i]}" > "scripts/cache/${classarr[i]}"
|
||||
else
|
||||
iconarr[i]="/home/$USER/.local/share/icons/candy-icons/mimetypes/scalable/application-x-theme.svg"
|
||||
rm "scripts/cache/${classarr[i]}"
|
||||
echo "${iconarr[i]}" > "scripts/cache/${classarr[i]}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
printf '['
|
||||
for i in "${!classarr[@]}"; do
|
||||
if [ $i -ne 0 ]; then
|
||||
printf ', '
|
||||
fi
|
||||
# printf '{'
|
||||
# printf "\"${addressarr[i]}\": \"${iconarr[i]}\""
|
||||
# printf '}'
|
||||
printf "\"${iconarr[i]}\""
|
||||
done
|
||||
printf ']\n'
|
||||
}
|
||||
|
||||
geticonlist
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
|
||||
geticonlist
|
||||
done
|
||||
fi
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
cp -r images/svg/osu_dark/* images/svg/
|
||||
|
||||
filelist=$(ls 'images/svg' -p | grep -v /)
|
||||
|
||||
IFS=$'\n'
|
||||
filearr=($(echo "$filelist"))
|
||||
|
||||
for i in "${!filearr[@]}"; do
|
||||
# echo "images/svg/${filearr[$i]}"
|
||||
sed -i "s/white/$1/gi" "images/svg/${filearr[$i]}"
|
||||
done
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
IFS=$'\n'
|
||||
entrynames=( $(cat 'scripts/cache/entrynames.txt' | fzf --filter="$1" | head -n 10) )
|
||||
entries=( $(cat 'scripts/cache/entries.txt') )
|
||||
|
||||
definitelyNotMath() {
|
||||
if [[ ${1:0:1} != "0" \
|
||||
&& ${1:0:1} != "1" \
|
||||
&& ${1:0:1} != "2" \
|
||||
&& ${1:0:1} != "3" \
|
||||
&& ${1:0:1} != "4" \
|
||||
&& ${1:0:1} != "5" \
|
||||
&& ${1:0:1} != "6" \
|
||||
&& ${1:0:1} != "7" \
|
||||
&& ${1:0:1} != "8" \
|
||||
&& ${1:0:1} != "9" ]]; then
|
||||
echo 'true'
|
||||
else
|
||||
echo 'false'
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$1" == ">"* ]]; then
|
||||
cd ~/.config/eww
|
||||
if [[ "$1" == ">load"* ]]; then
|
||||
searching=$(echo "$1" | sed 's/>load //g' | sed 's/>load//g')
|
||||
profilenames=( $(ls css/savedcolors/ | grep .txt | sed 's/_iconcolor_//g' | sed 's/.txt//g' | fzf --filter="$searching") )
|
||||
echo -n '['
|
||||
for x in "${!profilenames[@]}"; do
|
||||
if [ "$x" != "0" ]; then
|
||||
printf ','
|
||||
fi
|
||||
echo -n '{"name": "'"${profilenames[x]}"'", "exec": ">load '"${profilenames[x]}"'"}'
|
||||
done
|
||||
echo -n ']'
|
||||
else
|
||||
echo '[]'
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "${!entrynames[@]}" == "" && $(definitelyNotMath "$1") == "false" ]]; then
|
||||
mathAns=$(qalc $1 | head -n 1)
|
||||
mathAns="${mathAns#*= }"
|
||||
mathAns="${mathAns#*≈ }"
|
||||
if [[ "$mathAns" == *"error"* ]]; then
|
||||
echo '[]'
|
||||
exit 0
|
||||
else
|
||||
echo '[{"name": "'"$mathAns"'", "exec": "wl-copy \"'"$mathAns"'\""}]'
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf '['
|
||||
|
||||
for x in "${!entrynames[@]}"; do
|
||||
if [ "$x" != "0" ]; then
|
||||
printf ','
|
||||
fi
|
||||
echo -n $(echo $entries | gojq -c '."'"${entrynames[x]}"'"')
|
||||
done
|
||||
|
||||
printf ']'
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/bash
|
||||
dostuff(){
|
||||
sinks=$(pactl list sink-inputs \
|
||||
| grep -e "Sink Input" \
|
||||
| sed 's/Sink Input #//')
|
||||
names=$(pactl list sink-inputs \
|
||||
| sed 's/"//g' \
|
||||
| sed 's/application-name://' \
|
||||
| grep -e "application.name" \
|
||||
| sed 's/application.name = //' \
|
||||
| sed 's/\t\t//' )
|
||||
vols=$(pactl list sink-inputs \
|
||||
| grep -e "Volume:" \
|
||||
| sed 's/Volume: front-left: //' \
|
||||
| sed 's/front-right: //' \
|
||||
| sed 's/front-right: //' \
|
||||
| tr " " "\n" \
|
||||
| grep -e % \
|
||||
| sed 's/%//g')
|
||||
icons=$(pactl list sink-inputs \
|
||||
| grep -e 'application.icon_name' \
|
||||
| sed 's/\t//g' \
|
||||
| sed 's/application.icon_name = //g')
|
||||
|
||||
# echo "-=-=-=-=-=-=-=-=- Debug: Raw value -=-=-=-=-=-=-=-=-"
|
||||
# echo "$sinks"
|
||||
# echo "$names"
|
||||
# echo "$vols"
|
||||
|
||||
IFS=$'\n'
|
||||
sinkarr=($(echo "$sinks"))
|
||||
namearr=($(echo "$names"))
|
||||
volarr=($(echo "$vols"))
|
||||
|
||||
# Functions
|
||||
sanitize() {
|
||||
echo "$1" | sed 's/"/\"/g'
|
||||
}
|
||||
|
||||
geticon() {
|
||||
# notify-send "${volarr[$((i*2))]}"
|
||||
if ["${volarr[$(($1*2))]}" -eq "0"]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Print final JSON
|
||||
printf '['
|
||||
for i in "${!sinkarr[@]}"; do
|
||||
if [ $i -ne 0 ]; then
|
||||
printf ', '
|
||||
fi
|
||||
# echo -n '{''"sink": "'"${sinkarr[$i]}"'", "name": "'"${namearr[$i]}"', "icon": "'"$(geticon $i)"'", "volume": "'"${volarr[$((i*2))]}"'"}'
|
||||
echo -n '{''"sink": "'"${sinkarr[$i]}"'", "name": "'"${namearr[$i]}"'", "volume": "'"${volarr[$((i*2))]}"'"}'
|
||||
# printf "\n"
|
||||
done
|
||||
printf ']\n'
|
||||
|
||||
# echo "$sinks"
|
||||
# echo "$names"
|
||||
# echo "$vols"
|
||||
}
|
||||
|
||||
dostuff
|
||||
|
||||
pactl subscribe | rg --line-buffered "on sink" | while read -r _; do
|
||||
dostuff
|
||||
done
|
||||
Executable
+133
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
icons=("" "" "" "" "" "" "" "")
|
||||
|
||||
gettime() {
|
||||
FULL=$(cat /sys/class/power_supply/BATT/charge_full)
|
||||
NOW=$(cat /sys/class/power_supply/BATT/charge_now)
|
||||
|
||||
if [ "$RATE" -gt 0 ]; then
|
||||
if [ "$STATE" = "Discharging" ]; then
|
||||
EX="$NOW / $RATE"
|
||||
else
|
||||
EX="($FULL - $NOW) / $RATE"
|
||||
fi
|
||||
date -u -d@"$(bc -l <<< "$EX * 3600")" +%H:%M
|
||||
fi
|
||||
}
|
||||
|
||||
geticon() {
|
||||
if [ "$STATE" = "Charging" ]; then
|
||||
level=$(awk -v n="$CAPACITY" 'BEGIN{print int((n-1)/12)}')
|
||||
echo "${icons[$level]}"
|
||||
else
|
||||
level=$(awk -v n="$CAPACITY" 'BEGIN{print int((n-1)/12)}')
|
||||
echo "${icons[$level]}"
|
||||
fi
|
||||
}
|
||||
|
||||
status() {
|
||||
if [ "$STATE" = "Charging" ]; then
|
||||
echo -n "charging"
|
||||
|
||||
if [ "$RATE" -gt 0 ]; then
|
||||
echo ", $(gettime) left"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
elif [ "$STATE" = "Discharging" ]; then
|
||||
echo "$(gettime)h left"
|
||||
else
|
||||
echo "fully charged"
|
||||
fi
|
||||
}
|
||||
|
||||
statch() {
|
||||
if [ "$STATE" = "Discharging" ]; then #Not charging, below 20%
|
||||
if [ "$CAPACITY" -le 5 ]; then
|
||||
echo 'deadly'
|
||||
elif [ "$CAPACITY" -le 10 ]; then
|
||||
echo 'critical'
|
||||
elif [ "$CAPACITY" -le 30 ]; then
|
||||
echo 'low'
|
||||
else
|
||||
echo 'normal'
|
||||
fi
|
||||
else
|
||||
echo 'charging'
|
||||
fi
|
||||
}
|
||||
|
||||
chargestatus() {
|
||||
if [ "$STATE" = "Charging" ]; then
|
||||
echo -n ""
|
||||
elif [ "$STATE" = "Discharging" ]; then
|
||||
echo -n ""
|
||||
fi
|
||||
}
|
||||
|
||||
circolor() {
|
||||
if [[ "$CAPACITY" -le 20 && "$STATE" = "Discharging" ]]; then
|
||||
cat images/svg/color.txt
|
||||
else
|
||||
cat images/svg/color.txt
|
||||
fi
|
||||
}
|
||||
|
||||
cirbgcolor() {
|
||||
if [[ "$CAPACITY" -le 50 && "$STATE" = "Discharging" ]]; then
|
||||
echo '#EF738A'
|
||||
else
|
||||
echo 'transparent'
|
||||
fi
|
||||
}
|
||||
|
||||
color() {
|
||||
if [ "$CAPACITY" -le 20 ]; then
|
||||
echo '#EF738A'
|
||||
else
|
||||
echo 'white'
|
||||
fi
|
||||
}
|
||||
|
||||
bgcolor() {
|
||||
if [ "$CAPACITY" -le 20 ]; then
|
||||
echo '#EF738A'
|
||||
else
|
||||
echo 'transparent'
|
||||
fi
|
||||
}
|
||||
|
||||
wattage() {
|
||||
echo "$(bc -l <<< "scale=1; $RATE / 1000000") W"
|
||||
}
|
||||
|
||||
warnedlow=0
|
||||
|
||||
while true; do
|
||||
RATE=$(cat /sys/class/power_supply/BATT/voltage_now)
|
||||
CAPACITY=$(cat /sys/class/power_supply/BATT/capacity)
|
||||
STATE=$(cat /sys/class/power_supply/BATT/status)
|
||||
|
||||
if [[ "$CAPACITY" -le 5 && "$STATE" = "Discharging" ]]; then
|
||||
if [ $warnedlow == 0 ]; then
|
||||
warnedlow=1
|
||||
notify-send 'FREAKING PLUG IN THE CHARGER ALREADY' '!!111!!1!123!!!' -u critical -a 'eww'
|
||||
fi
|
||||
elif [[ "$CAPACITY" -le 10 && "$STATE" = "Discharging" ]]; then
|
||||
if [ $warnedlow == 0 ]; then
|
||||
warnedlow=1
|
||||
notify-send 'Battery verrry low' 'Hello?' -u critical -a 'eww'
|
||||
fi
|
||||
elif [[ "$CAPACITY" -le 20 && "$STATE" = "Discharging" ]]; then
|
||||
if [ $warnedlow == 0 ]; then
|
||||
warnedlow=1
|
||||
notify-send 'Battery low' 'Plug in your charger pweeeeaaase :>' -u critical -a 'eww'
|
||||
fi
|
||||
else
|
||||
warnedlow=0
|
||||
fi
|
||||
|
||||
echo '{"quickicon": "'"$(chargestatus)"'", "icon": "'"$(geticon)"'", "percentage": '"$CAPACITY"', "wattage": "'"$(wattage)"'", "status": "'"$(status)"'", "circolor": "'"$(circolor)"'", "cirbgcolor": "'"$(cirbgcolor)"'", "color": "'"$(color)"'", "bgcolor": "'"$(bgcolor)"'" }'
|
||||
sleep 3
|
||||
done
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A baticon=([10]="" [20]="" [30]="" [40]="" [50]="" [60]="" [70]="" [80]="" [90]="" [100]="")
|
||||
|
||||
toggle() {
|
||||
status=$(rfkill -J | jq -r '.rfkilldevices[] | select(.type == "bluetooth") | .soft' | head -1)
|
||||
|
||||
if [ "$status" = "unblocked" ]; then
|
||||
rfkill block bluetooth
|
||||
else
|
||||
rfkill unblock bluetooth
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" = "toggle" ]; then
|
||||
toggle
|
||||
else
|
||||
while true; do
|
||||
powered=$(bluetoothctl show | rg Powered | cut -f 2- -d ' ')
|
||||
status=$(bluetoothctl info)
|
||||
name=$(echo "$status" | rg Name | cut -f 2- -d ' ')
|
||||
mac=$(echo "$status" | head -1 | awk '{print $2}' | tr ':' '_')
|
||||
|
||||
if [[ "$(echo "$status" | rg Percentage)" != "" ]]; then
|
||||
battery=$(upower -i /org/freedesktop/UPower/devices/headset_dev_"$mac" | rg percentage | awk '{print $2}' | cut -f 1 -d '%')
|
||||
batt_icon=${baticon[$battery]}
|
||||
else
|
||||
batt_icon=""
|
||||
fi
|
||||
|
||||
if [ "$powered" = "yes" ]; then
|
||||
if [ "$status" != "Missing device address argument" ]; then
|
||||
text="$name"
|
||||
icon=""
|
||||
color="#89b4fa"
|
||||
else
|
||||
icon=""
|
||||
text="Disconnected"
|
||||
color="#45475a"
|
||||
fi
|
||||
else
|
||||
icon=""
|
||||
text="Bluetooth off"
|
||||
color="#45475a"
|
||||
fi
|
||||
|
||||
echo '{ "icon": "'"$icon"'", "batt_icon": "'"$batt_icon"'", "text": "'"$text"'", "color": "'"$color"'" }'
|
||||
|
||||
sleep 3
|
||||
done
|
||||
fi
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
icons=("" "" "")
|
||||
XDG_CACHE_HOME="$HOME/.cache"
|
||||
date="$XDG_CACHE_HOME/eww/osd_brightness.date"
|
||||
lock=0
|
||||
|
||||
showhide() {
|
||||
# get dates
|
||||
rundate=$(cat "$date")
|
||||
currentdate=$(date +%s)
|
||||
|
||||
# handle showing
|
||||
if [ "$rundate" = "$currentdate" ] && [ "$lock" -eq 0 ]; then
|
||||
eww open osd
|
||||
eww update osd_bright=true
|
||||
lock=1
|
||||
elif [ "$((currentdate - rundate))" = "2" ] && [ "$lock" -eq 1 ]; then
|
||||
eww update osd_bright=false
|
||||
if [ "$(eww get osd_vol)" = "false" ] && [ "$(eww get osd_bright)" = "false" ]; then
|
||||
dummy=$(eww close osd)
|
||||
fi
|
||||
lock=0
|
||||
fi
|
||||
}
|
||||
|
||||
osd() {
|
||||
if [ ! -f "$date" ]; then
|
||||
mkdir -p "$XDG_CACHE_HOME/eww"
|
||||
fi
|
||||
date +%s > "$date"
|
||||
# showhide
|
||||
}
|
||||
|
||||
osd_handler() {
|
||||
lock=0
|
||||
rundate=0
|
||||
if [ ! -f "$date" ]; then
|
||||
mkdir -p "$XDG_CACHE_HOME/eww"
|
||||
echo 0 > "$date"
|
||||
fi
|
||||
|
||||
while true; do
|
||||
showhide
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
dummy=$(eww close osd)
|
||||
}
|
||||
|
||||
if [ "$1" = "osd" ]; then
|
||||
osd
|
||||
else
|
||||
# initial
|
||||
icon=${icons[$(awk -v n="$(light)" 'BEGIN{print int(n/34)}')]}
|
||||
echo '{ "level": '"$(light)"', "icon": "'"$icon"'" }'
|
||||
|
||||
osd_handler &
|
||||
udevadm monitor | rg --line-buffered "backlight" | while read -r _; do
|
||||
icon="${icons[$(awk -v n="$(light)" 'BEGIN{print int(n/34)}')]}"
|
||||
|
||||
echo '{ "level": '"$(light)"', "icon": "'"$icon"'" }'
|
||||
done
|
||||
fi
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
OPACITY=0.7
|
||||
|
||||
IMGPATH=$1
|
||||
coverurl=$2
|
||||
|
||||
coverpath="$IMGPATH"
|
||||
wal -c
|
||||
lightdark=$(cat scripts/workdir/__mode_light_dark.txt)
|
||||
wal -i "$IMGPATH" -n -t -s -e $lightdark -q
|
||||
themejson=$(cat ~/.cache/wal/colors.json | gojq -c)
|
||||
themejson="${themejson::-1}"
|
||||
themejson="$themejson"',"source":"'"$3"'"}'
|
||||
echo $themejson
|
||||
|
||||
printf '{"image": "'"$coverpath"'", "color": '"$themejson"'}\n'
|
||||
|
||||
# Get color in rgb
|
||||
colorsreg=$(cat ~/.cache/wal/colors-putty.reg)
|
||||
rgb_bg=$(echo $colorsreg | tr ' ' '\n' | grep 'Colour3')
|
||||
rgb_bg="${rgb_bg#*=}"
|
||||
rgb_bg="${rgb_bg#*\"}"
|
||||
rgb_bg="${rgb_bg::-1}"
|
||||
rgb_bg='rgba('"$rgb_bg"','"$OPACITY"')'
|
||||
# echo $rgb_bg
|
||||
|
||||
# notify-send 'eww' 'i found a url!'
|
||||
|
||||
# Write to scss
|
||||
echo '//Auto generated color theme for image at:' "$coverurl" > './tmp/_colorscheme.colorpallete'
|
||||
echo '@function bluetint($color, $percentage) { @return mix(#CDDFED, $color, $percentage); }' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '@function blueshade($color, $percentage) { @return mix(#152E50, $color, $percentage); }' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$colorbarbg: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.special.background' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$colorbg: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$rgb_bg"';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$colortext: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.special.foreground' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color0: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color1' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color1: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color2' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color2: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color3' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color3: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color4' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color4: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color5' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color5: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color6' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color6: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color7' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$color7: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color4' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
|
||||
|
||||
gradient1=$(echo -n "$themejson" | gojq '.colors.color1' | sed 's/"//g')
|
||||
gradient2=$(echo -n "$themejson" | gojq '.colors.color2' | sed 's/"//g')
|
||||
gradient3=$(echo -n "$themejson" | gojq '.colors.color4' | sed 's/"//g')
|
||||
|
||||
# Write hyprland color config
|
||||
echo '# Auto generated color theme for image at:' "$coverurl" > './tmp/colors_generated.conf'
|
||||
echo 'general {' >> './tmp/colors_generated.conf'
|
||||
echo ' col.active_border = rgba('"${gradient1#*#}FF"') rgba('"${gradient2#*#}FF"') rgba('"${gradient3#*#}FF"') 45deg' >> './tmp/colors_generated.conf'
|
||||
echo ' col.inactive_border = rgba('"${gradient1#*#}66"')' >> './tmp/colors_generated.conf'
|
||||
echo '}' >> './tmp/colors_generated.conf'
|
||||
|
||||
# Print json to stdout
|
||||
printf "$themejson" | gojq '.special.foreground' | sed 's/"//g' > 'tmp/_iconcolor.txt'
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
cd ~/.config/eww/ || exit
|
||||
|
||||
if [ $1 == "get" ]; then
|
||||
hyprctl keyword misc:disable_autoreload true
|
||||
cp './tmp/_iconcolor.txt' './css/_iconcolor.txt'
|
||||
cp './tmp/_colorscheme.colorpallete' './css/_colorscheme.scss'
|
||||
cp './tmp/colors_generated.conf' ~/.config/hypr/colors.conf
|
||||
applycolor=$(cat './css/_iconcolor.txt')
|
||||
scripts/applycolor "$applycolor"
|
||||
elif [ $1 == "default" ]; then
|
||||
hyprctl keyword misc:disable_autoreload true
|
||||
cp './css/_iconcolor_default.txt' './css/_iconcolor.txt'
|
||||
cp css/_colorscheme_default.scss css/_colorscheme.scss
|
||||
cp ~/.config/hypr/colors_default.conf ~/.config/hypr/colors.conf
|
||||
applycolor=$(cat css/_iconcolor.txt)
|
||||
scripts/applycolor "$applycolor"
|
||||
elif [ $1 == "save" ]; then
|
||||
eww close themer
|
||||
eww update themer_open=false
|
||||
cp "css/_iconcolor.txt" "css/savedcolors/_iconcolor_$2.txt"
|
||||
cp "css/_colorscheme.scss" "css/savedcolors/_colorscheme_$2.scss"
|
||||
cp ~/.config/hypr/colors.conf ~/.config/hypr/savedcolors/colors_$2.conf
|
||||
elif [ $1 == "load" ]; then
|
||||
hyprctl keyword misc:disable_autoreload true
|
||||
eww close themer
|
||||
eww update themer_open=false
|
||||
cp "css/savedcolors/_iconcolor_$2.txt" "css/_iconcolor.txt"
|
||||
cp "css/savedcolors/_colorscheme_$2.scss" "css/_colorscheme.scss"
|
||||
cp ~/.config/hypr/savedcolors/colors_$2.conf ~/.config/hypr/colors.conf
|
||||
applycolor=$(cat css/_iconcolor.txt)
|
||||
scripts/applycolor "$applycolor"
|
||||
fi
|
||||
|
||||
hyprctl reload
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
cd ~
|
||||
eww close dashboard
|
||||
|
||||
if [[ "$1" == "--web" ]]; then
|
||||
app=$2
|
||||
eval "${app%\%*}" &
|
||||
else
|
||||
app=$1
|
||||
eval "${app%\%*}" &
|
||||
pkill dashactivate
|
||||
fi
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/bash
|
||||
if [ "$1" == "enable" ]; then
|
||||
hyprctl keyword bindm ,mouse:273,resizewindow
|
||||
hyprctl keyword bindm ,mouse:274,movewindow
|
||||
hyprctl keyword bind ,mouse_up,workspace,+1
|
||||
hyprctl keyword bind ,mouse_down,workspace,-1
|
||||
eww update editing=true
|
||||
elif [ "$1" == "disable" ]; then
|
||||
hyprctl keyword unbind ,mouse:273
|
||||
hyprctl keyword unbind ,mouse:274
|
||||
hyprctl keyword unbind ,mouse_up
|
||||
hyprctl keyword unbind ,mouse_down
|
||||
eww update editing=false
|
||||
fi
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/bash
|
||||
if [[ $1 == '_none' ]]; then
|
||||
hyprctl dispatch workspace $2
|
||||
else
|
||||
hyprctl dispatch focuswindow address:$1
|
||||
fi
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
import gi
|
||||
import sys
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Predefine class corrections
|
||||
if sys.argv[1] == 'Code':
|
||||
sys.argv[1] = 'code'
|
||||
elif sys.argv[1] == 'code-url-handler':
|
||||
sys.argv[1] = 'code'
|
||||
elif sys.argv[1] == 'Microsoft-edge':
|
||||
sys.argv[1] = 'microsoft-edge'
|
||||
elif sys.argv[1] == 'GitHub Desktop':
|
||||
sys.argv[1] = 'github-desktop'
|
||||
elif sys.argv[1] == 'org.kde.kolourpaint':
|
||||
sys.argv[1] = 'kolourpaint'
|
||||
elif sys.argv[1] == 'osu!':
|
||||
sys.argv[1] = 'osu'
|
||||
elif sys.argv[1].find("Minecraft") != -1:
|
||||
sys.argv[1] = 'minecraft'
|
||||
# elif sys.argv[1] == 'ru-turikhay-tlauncher-bootstrap-Bootstrap':
|
||||
# sys.argv[1] = 'minecraft'
|
||||
|
||||
icon_name = sys.argv[1]
|
||||
icon_theme = Gtk.IconTheme.get_default()
|
||||
icon = icon_theme.lookup_icon(icon_name, 48, 0)
|
||||
if icon:
|
||||
print(icon.get_filename())
|
||||
else:
|
||||
print("not found")
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/bash
|
||||
getoptions(){
|
||||
gaps_in=$(hyprctl getoption general:gaps_in -j | gojq -r -c '.int')
|
||||
gaps_out=$(hyprctl getoption general:gaps_out -j | gojq -r -c '.int')
|
||||
border_size=$(hyprctl getoption general:border_size -j | gojq -r -c '.int')
|
||||
force_no_accel=$(hyprctl getoption input:force_no_accel -j | gojq -r -c '.int')
|
||||
input_sensitivity=$(hyprctl getoption input:sensitivity -j | gojq -r -c '.float')
|
||||
touchpad_disable_while_typing=$(hyprctl getoption input:touchpad:disable_while_typing -j | gojq -r -c '.int')
|
||||
touchpad_clickfinger_behavior=$(hyprctl getoption input:touchpad:clickfinger_behavior -j | gojq -r -c '.int')
|
||||
blur=$(hyprctl getoption decoration:blur -j | gojq -r -c '.int')
|
||||
blur_size=$(hyprctl getoption decoration:blur_size -j | gojq -r -c '.int')
|
||||
blur_passes=$(hyprctl getoption decoration:blur_passes -j | gojq -r -c '.int')
|
||||
blur_xray=$(hyprctl getoption decoration:blur_xray -j | gojq -r -c '.int')
|
||||
|
||||
echo -n '{'
|
||||
echo -n "\"gaps_in\":$gaps_in,"
|
||||
echo -n "\"gaps_out\":$gaps_out,"
|
||||
echo -n "\"border_size\":$border_size,"
|
||||
echo -n "\"force_no_accel\":$force_no_accel,"
|
||||
echo -n "\"input_sensitivity\":$input_sensitivity,"
|
||||
echo -n "\"touchpad_disable_while_typing\":$touchpad_disable_while_typing,"
|
||||
echo -n "\"touchpad_clickfinger_behavior\":$touchpad_clickfinger_behavior,"
|
||||
echo -n "\"blur\":$blur,"
|
||||
echo -n "\"blur_size\":$blur_size,"
|
||||
echo -n "\"blur_passes\":$blur_passes,"
|
||||
echo -n "\"blur_xray\":$blur_xray,"
|
||||
|
||||
echo '"dummy":0}'
|
||||
}
|
||||
|
||||
getoptions
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
elif [ "$1" == "tickle" ]; then
|
||||
hyprctl keyword input:force_no_accel $(hyprctl getoption input:force_no_accel -j | gojq -r -c '.int')
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "activelayout>>" | while read -r line; do
|
||||
# echo $line
|
||||
getoptions
|
||||
done
|
||||
fi
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
|
||||
echo $line
|
||||
done
|
||||
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
if [[ "$1" == "--close" ]]; then
|
||||
hyprctl keyword monitor eDP-1,1920x1080@60,0x0,1
|
||||
hyprctl keyword monitor eDP-1,addreserved,53,0,0,0
|
||||
else
|
||||
hyprctl keyword monitor eDP-1,1920x1080@60,0x0,0.5
|
||||
hyprctl keyword monitor eDP-1,addreserved,533,600,960,960
|
||||
fi
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
appname=$1
|
||||
|
||||
if [[ "$1" == "code-url-handler" ]];then
|
||||
echo 'code'
|
||||
elif [[ "$1" == "gnome-tweaks" ]];then
|
||||
echo 'org.gnome.tweaks'
|
||||
elif [[ "$1" == "org."* ]];then
|
||||
appname="${appname#*.}"
|
||||
appname="${appname#*.}"
|
||||
echo $appname
|
||||
fi
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
getopen(){
|
||||
ans=$(eww windows | grep -e "$1")
|
||||
if [ "${ans:0:1}" == "*" ]; then
|
||||
echo "true"
|
||||
else
|
||||
echo "false"
|
||||
fi
|
||||
}
|
||||
|
||||
getopen $1
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
|
||||
if [[ "$1" == ">"* ]]; then
|
||||
args=( $1 )
|
||||
~/.config/eww/scripts/toggle-overview.sh --close &
|
||||
if [[ "${args[0]}" == ">music" ]]; then
|
||||
scripts/colormanage get
|
||||
elif [[ "${args[0]}" == ">load" ]]; then
|
||||
scripts/colormanage load "${args[1]}"
|
||||
elif [[ "${args[0]}" == ">save" ]]; then
|
||||
scripts/colormanage save "${args[1]}"
|
||||
elif [[ "${args[0]}" == ">light" ]]; then
|
||||
scripts/togglelight light
|
||||
elif [[ "${args[0]}" == ">dark" ]]; then
|
||||
scripts/togglelight dark
|
||||
elif [[ "${args[0]}" == ">wall" ]]; then
|
||||
scripts/colorgen 'images/wallpaper/wallpaper' '[Local wallpaper]' ''
|
||||
scripts/colormanage get
|
||||
else
|
||||
# notify-send 'eww' 'Invalid command!'
|
||||
false
|
||||
fi
|
||||
else
|
||||
cd ~
|
||||
~/.config/eww/scripts/toggle-overview.sh --close &
|
||||
app=$1
|
||||
eval "${app%\%*}" &
|
||||
pkill launchapp
|
||||
fi
|
||||
|
||||
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import desktop_entry_lib
|
||||
import os
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
full_output = {}
|
||||
|
||||
def read(target_file) -> None:
|
||||
entry = desktop_entry_lib.DesktopEntry.from_file(target_file)
|
||||
|
||||
print("Name: " + str(entry.Name.default_text))
|
||||
print("Comment: " + str(entry.Comment.default_text))
|
||||
print("Exec: " + str(entry.Exec))
|
||||
|
||||
|
||||
def getProperties(target_file) -> None:
|
||||
entry = desktop_entry_lib.DesktopEntry.from_file(target_file)
|
||||
|
||||
# iconcmd = "/usr/bin/geticons " + str(entry.Icon)
|
||||
# iconcmd = "/usr/bin/geticons"
|
||||
# iconpath = str(subprocess.check_output(str(iconcmd), shell=True))
|
||||
|
||||
# return
|
||||
props = {
|
||||
"name": str(entry.Name.default_text),
|
||||
"comment": str(entry.Comment.default_text),
|
||||
"exec": str(entry.Exec),
|
||||
"icon": str(entry.Icon)
|
||||
}
|
||||
return props
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
entryFile = open("scripts/cache/entries.txt", "w")
|
||||
# Get files
|
||||
entries = list(str(s) for s in os.listdir("/usr/share/applications"))
|
||||
entries_flatpak = list(str(s) for s in os.listdir("/var/lib/flatpak/exports/share/applications"))
|
||||
entries_local = list(str('../../.local/share/applications/' + s) for s in os.listdir("../../.local/share/applications/"))
|
||||
|
||||
for app in entries:
|
||||
alreadythere = False
|
||||
for localized in entries_local:
|
||||
if app in localized:
|
||||
alreadythere = True
|
||||
|
||||
if not(alreadythere):
|
||||
entries_local.append(str('/usr/share/applications/'+app))
|
||||
|
||||
for app in entries_flatpak:
|
||||
alreadythere = False
|
||||
for localized in entries_local:
|
||||
if app in localized:
|
||||
alreadythere = True
|
||||
|
||||
if not(alreadythere):
|
||||
entries_local.append(str('/var/lib/flatpak/exports/share/applications/'+app))
|
||||
|
||||
# Get properties
|
||||
for app in entries_local:
|
||||
if app.find('.desktop') == -1: # Skip files that aren't desktop entries
|
||||
continue
|
||||
this_entry = getProperties(app)
|
||||
|
||||
full_output[this_entry['name']] = (this_entry)
|
||||
|
||||
# output=json.dumps(this_entry)
|
||||
# print(output)
|
||||
entryFile.write(json.dumps(full_output))
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import desktop_entry_lib
|
||||
import os
|
||||
import json
|
||||
# from fuzzysearch import find_near_matches
|
||||
|
||||
def read(target_file) -> None:
|
||||
entry = desktop_entry_lib.DesktopEntry.from_file(target_file)
|
||||
|
||||
print("Name: " + str(entry.Name.default_text))
|
||||
print("Comment: " + str(entry.Comment.default_text))
|
||||
print("Exec: " + str(entry.Exec))
|
||||
|
||||
|
||||
def getProperties(target_file) -> None:
|
||||
entry = desktop_entry_lib.DesktopEntry.from_file(target_file)
|
||||
|
||||
# return
|
||||
props = {
|
||||
"name": str(entry.Name.default_text),
|
||||
"comment": str(entry.Comment.default_text),
|
||||
"exec": str(entry.Exec),
|
||||
"icon": str(entry.Icon)
|
||||
}
|
||||
return props
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
entryFile = open("scripts/cache/entrynames.txt", "w")
|
||||
# Get files
|
||||
entries = list(str(s) for s in os.listdir("/usr/share/applications"))
|
||||
entries_flatpak = list(str(s) for s in os.listdir("/var/lib/flatpak/exports/share/applications"))
|
||||
entries_local = list(str('../../.local/share/applications/' + s) for s in os.listdir("../../.local/share/applications/"))
|
||||
|
||||
for app in entries:
|
||||
alreadythere = False
|
||||
for localized in entries_local:
|
||||
if app in localized:
|
||||
alreadythere = True
|
||||
|
||||
if not(alreadythere):
|
||||
entries_local.append(str('/usr/share/applications/'+app))
|
||||
|
||||
for app in entries_flatpak:
|
||||
alreadythere = False
|
||||
for localized in entries_local:
|
||||
if app in localized:
|
||||
alreadythere = True
|
||||
|
||||
if not(alreadythere):
|
||||
entries_local.append(str('/var/lib/flatpak/exports/share/applications/'+app))
|
||||
|
||||
# Get properties
|
||||
for app in entries_local:
|
||||
if app.find('.desktop') == -1: # Skip files that aren't desktop entries
|
||||
continue
|
||||
|
||||
thisEntry = getProperties(app)
|
||||
|
||||
entryFile.write(thisEntry['name'])
|
||||
entryFile.write('\n')
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
while true; do
|
||||
# human-readable
|
||||
freeH=$(free -h --si | rg "Mem:")
|
||||
swapfreeH=$(free -h --si | rg "Swap:")
|
||||
# non-human-readable
|
||||
freeN=$(free --mega | rg "Mem:")
|
||||
swapfreeN=$(free --mega | rg "Swap:")
|
||||
|
||||
total="$(echo "$freeH" | awk '{ print $2 }')"
|
||||
used="$(echo "$freeH" | awk '{ print $3 }')"
|
||||
t="$(echo "$freeN" | awk '{ print $2 }')"
|
||||
u="$(echo "$freeN" | awk '{ print $3 }')"
|
||||
|
||||
swaptotal="$(echo "$swapfreeH" | awk '{ print $2 }')"
|
||||
swapused="$(echo "$swapfreeH" | awk '{ print $3 }')"
|
||||
swapt="$(echo "$swapfreeN" | awk '{ print $2 }')"
|
||||
swapu="$(echo "$swapfreeN" | awk '{ print $3 }')"
|
||||
|
||||
free=$(printf '%.1fG' "$(bc -l <<< "($t - $u) / 1000")")
|
||||
perc=$(printf '%.1f' "$(free -m | rg Mem | awk '{print ($3/$2)*100}')")
|
||||
|
||||
swapfree=$(printf '%.1fG' "$(bc -l <<< "($swapt - $swapu) / 1000")")
|
||||
swapperc=$(printf '%.1f' "$(free -m | rg Swap | awk '{print ($3/$2)*100}')")
|
||||
|
||||
echo '{ "total": "'"$total"'", "used": "'"$used"'", "free": "'"$free"'", "swaptotal": "'"$swaptotal"'", "swapused": "'"$swapused"'", "swappercentage": '"$swapperc"', "percentage": '"$perc"' }'
|
||||
|
||||
sleep 3
|
||||
done
|
||||
Executable
+138
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
get_status() {
|
||||
s=$1
|
||||
if [ "$s" = "Playing" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
get_length_sec() {
|
||||
len=$1
|
||||
if [ -z "$len" ]; then
|
||||
echo 0
|
||||
else
|
||||
bc <<< "$len / 1000000"
|
||||
fi
|
||||
}
|
||||
|
||||
get_length_time() {
|
||||
len=$1
|
||||
if [ -n "$len" ]; then
|
||||
len=$(bc <<< "$len / 1000000 + 1")
|
||||
date -d@"$len" +%M:%S
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
get_position() {
|
||||
pos=$1
|
||||
len=$2
|
||||
if [ -n "$pos" ]; then
|
||||
bc -l <<< "$pos / $len * 100"
|
||||
else
|
||||
echo 0
|
||||
fi
|
||||
}
|
||||
|
||||
get_position_time() {
|
||||
pos=$1
|
||||
if [ -n "$pos" ]; then
|
||||
date -d@"$(bc <<< "$pos / 1000000")" +%M:%S
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
get_cover() {
|
||||
# COVER_URL=$1
|
||||
mkdir -p "eww_covers"
|
||||
cd "eww_covers" || exit
|
||||
|
||||
IMGPATH="cover_art"
|
||||
echo '{"image": "eww_covers/cover_art_default"}'
|
||||
|
||||
playerctl -F metadata mpris:artUrl 2>/dev/null | while read -r COVER_URL; do
|
||||
music_source=''
|
||||
if [[ "$COVER_URL" = https* ]]; then
|
||||
music_source=''
|
||||
coverurl="$(playerctl metadata mpris:artUrl)"
|
||||
coverurl_highres_yt="$(echo $coverurl | sed 's/hqdefault/maxresdefault/g')"
|
||||
coverurl_highres_soundcloud="$(echo $coverurl | sed 's/80x80/500x500/g')"
|
||||
|
||||
# SoundCloud
|
||||
if [[ "$coverurl" == *"sndcdn"* ]]; then
|
||||
music_source=''
|
||||
wget -O "$IMGPATH""_soundcloud" "$coverurl_highres_soundcloud" -q –read-timeout=0.1
|
||||
cp "$IMGPATH""_soundcloud" "$IMGPATH"
|
||||
imgsize=$(echo $(du -b '/home/end/.config/eww/eww_covers/cover_art' | tr '\t' '\n' | grep -v 'cover_art'))
|
||||
fi
|
||||
# Youtube
|
||||
if [[ "$coverurl" == *"ytimg"* ]]; then
|
||||
music_source=''
|
||||
wget -O "$IMGPATH""_yt" "$coverurl_highres_yt" -q –read-timeout=0.1
|
||||
cp "$IMGPATH""_yt" "$IMGPATH"
|
||||
imgsize=$(echo $(du -b '/home/end/.config/eww/eww_covers/cover_art' | tr '\t' '\n' | grep -v 'cover_art'))
|
||||
fi
|
||||
# Fallback
|
||||
if [ "$imgsize" == "0" ]; then
|
||||
wget -O "$IMGPATH""_lowres" "$coverurl" -q –read-timeout=0.1
|
||||
cp "$IMGPATH""_lowres" "$IMGPATH"
|
||||
fi
|
||||
|
||||
#Generate colors
|
||||
cd ..
|
||||
scripts/colorgen 'eww_covers/'$IMGPATH $coverurl "$music_source"
|
||||
cd "eww_covers"
|
||||
elif [ "$COVER_URL" = "" ]; then
|
||||
echo '{"image": "", "color": "$bg"}'
|
||||
else
|
||||
COVER_URL="${COVER_URL:7}"
|
||||
cp "$COVER_URL" "$IMGPATH"
|
||||
|
||||
cd ..
|
||||
scripts/colorgen '"eww_covers/'$IMGPATH'"' $coverurl "$music_source"
|
||||
cd "eww_covers"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# SANITIZE FIX
|
||||
sanitize() {
|
||||
echo "$1" | sed 's/"/\"/g'
|
||||
}
|
||||
|
||||
if [ "$1" = "cover" ]; then
|
||||
get_cover
|
||||
elif [ "$1" = "name" ]; then
|
||||
echo '{"artist": "", "title": ""}'
|
||||
playerctl -F metadata -f '{{title}}\{{artist}}\' 2>/dev/null | while IFS="$(printf '\\')" read -r title artist; do
|
||||
|
||||
len=$(playerctl metadata mpris:length)
|
||||
|
||||
gojq --null-input -r -c \
|
||||
--arg artist "$(sanitize "$artist")" \
|
||||
--arg title "$(sanitize "$title")" \
|
||||
'{"artist": $artist, "title": $title}'
|
||||
|
||||
done
|
||||
else
|
||||
echo '{"artist": "", "title": "", "status": "", "position": "", "position_time": "", "length": ""}'
|
||||
playerctl -F metadata -f '{{title}}\{{artist}}\{{status}}\{{position}}\' 2>/dev/null | while IFS="$(printf '\\')" read -r title artist status position; do
|
||||
|
||||
len=$(playerctl metadata mpris:length)
|
||||
|
||||
gojq --null-input -r -c \
|
||||
--arg artist "$(sanitize "$artist")" \
|
||||
--arg title "$(sanitize "$title")" \
|
||||
--arg status "$(get_status "$status")" \
|
||||
--arg pos "$(get_position "$position" "$len")" \
|
||||
--arg pos_time "$(get_position_time "$position")" \
|
||||
--arg length "$(get_length_time "$len")" \
|
||||
'{"artist": $artist, "title": $title, "status": $status, "position": $pos, "position_time": $pos_time, "length": $length}'
|
||||
|
||||
done
|
||||
fi
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
toggle() {
|
||||
status=$(rfkill -J | jaq -r '.rfkilldevices[] | select(.type == "wlan") | .soft' | head -1)
|
||||
|
||||
if [ "$status" = "unblocked" ]; then
|
||||
rfkill block wlan
|
||||
else
|
||||
rfkill unblock wlan
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" = "toggle" ]; then
|
||||
toggle
|
||||
else
|
||||
while true; do
|
||||
status=$(nmcli g | tail -n 1 | awk '{print $1}')
|
||||
signal=$(nmcli -f in-use,signal dev wifi | rg "\*" | awk '{ print $2 }')
|
||||
essid=$(nmcli -t -f NAME connection show --active | head -n1 | sed 's/\"/\\"/g')
|
||||
|
||||
icons=("" "" "" "" "")
|
||||
|
||||
if [ "$status" = "disconnected" ] ; then
|
||||
icon=""
|
||||
color="#988ba2"
|
||||
else
|
||||
level=$(awk -v n="$signal" 'BEGIN{print int((n-1)/20)}')
|
||||
if [ "$level" -gt 4 ]; then
|
||||
level=4
|
||||
fi
|
||||
|
||||
icon=${icons[$level]}
|
||||
color="#cba6f7"
|
||||
fi
|
||||
|
||||
echo '{ "essid": "'"$essid"'", "icon": "'"$icon"'", "color": "'"$color"'" }'
|
||||
|
||||
sleep 3
|
||||
done
|
||||
fi
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
tmp=scripts/cache/dunst-history.json
|
||||
lock="scripts/cache/dunst-toggle.lock"
|
||||
lockinfo="scripts/cache/dunst-lock-info"
|
||||
|
||||
touch $lockinfo
|
||||
|
||||
declare ids
|
||||
export toggle_icon=""
|
||||
|
||||
sanitize() {
|
||||
retstr=$(echo $1 | sed 's/\\\\/\\\\\\\\/g' | sed 's/"/\\"/g')
|
||||
|
||||
# echo "original: $1"
|
||||
echo "$retstr"
|
||||
# echo 'sanitized'
|
||||
}
|
||||
|
||||
get_ids() {
|
||||
mapfile -t ids < <(dunstctl history | gojq -r ".data[] | .[] | select(.appname.data != \"Spotify\") | .id.data")
|
||||
}
|
||||
|
||||
get_notif() {
|
||||
echo -n '['
|
||||
|
||||
for id in "${ids[@]}"; do
|
||||
mapfile -t n < <(gojq -r ".data[] | .[] | select(.id.data == $id) | .appname.data, .summary.data, .body.data" "$tmp" | sed -r '/^\s*$/d' | sed -e 's/\%/ percent/g')
|
||||
ohkay=$(sanitize "${n[1]}")
|
||||
# echo $ohkay
|
||||
echo -n ''$([ $id -eq ${ids[0]} ] || echo ,)' { '
|
||||
echo -n '"id": "'"$id"'", "appname": "'"${n[0]}"'", "summary": "'"$ohkay"'", "body": "'"${n[2]}"'"'
|
||||
echo -n '}'
|
||||
done
|
||||
|
||||
echo ']'
|
||||
}
|
||||
|
||||
toggle() {
|
||||
dunstctl set-paused toggle
|
||||
|
||||
if [ ! -f "$lock" ]; then
|
||||
export toggle_icon=""
|
||||
touch "$lock"
|
||||
else
|
||||
export toggle_icon=""
|
||||
rm "$lock"
|
||||
fi
|
||||
|
||||
echo "icon_change" > $lockinfo
|
||||
}
|
||||
|
||||
clear() {
|
||||
systemctl --user restart dunst
|
||||
echo "icon_change" > $lockinfo
|
||||
}
|
||||
|
||||
get_icon() {
|
||||
if [ ${#ids[@]} -eq 0 ]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" == "toggle" ]; then
|
||||
toggle
|
||||
dunstctl history > "$tmp"
|
||||
elif [ "$1" == "clear" ]; then
|
||||
clear
|
||||
dunstctl history > "$tmp"
|
||||
elif [ "$1" == "icons" ]; then
|
||||
dunstctl history > "$tmp"
|
||||
get_ids
|
||||
echo '{"toggle_icon": "'"$toggle_icon"'", "icon": "'"$(get_icon)"'"}'
|
||||
tail -f "$lockinfo" | while read -r; do
|
||||
get_ids
|
||||
echo '{"toggle_icon": "'"$toggle_icon"'", "icon": "'"$(get_icon)"'"}'
|
||||
done
|
||||
else
|
||||
dunstctl history > "$tmp"
|
||||
get_ids
|
||||
get_notif
|
||||
tail -f "$tmp" 2>/dev/null | rg --line-buffered "aa\{sv\}" | while read -r; do
|
||||
get_ids
|
||||
get_notif
|
||||
done
|
||||
fi
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
exit 0 # BLURS ARE FUCKING UNSTABLE AAAAAAA
|
||||
|
||||
current_addresses=("$(hyprctl layers -j | jq -r '.[] | .levels | ."2" | .[] | select(.namespace == "gtk-layer-shell") | .address')")
|
||||
for current_address in ${current_addresses[@]}; do
|
||||
hyprctl keyword layerrule "blur,address:$current_address"
|
||||
hyprctl keyword layerrule "ignorezero,address:$current_address"
|
||||
done
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/bash
|
||||
dummy='{"thumbnail": null}'
|
||||
|
||||
getwins() {
|
||||
overviewopen=$(scripts/isopen.sh overview)
|
||||
if [ "$overviewopen" == "true" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
focusedws=$(hyprctl -j monitors | gojq -r '.[] | select(.focused == true) | .activeWorkspace.id')
|
||||
hyprctlclients=$(hyprctl clients -j \
|
||||
| grep -v '"xwayland": ' \
|
||||
| grep -v '"grouped": ' \
|
||||
| grep -v '"pid": ' \
|
||||
| grep -v '"fullscreenMode": ' \
|
||||
| grep -v '"monitor": ' \
|
||||
| grep -v '"floating": ' \
|
||||
| grep -v '"fullscreen": ' \
|
||||
| grep -v '"pinned":') # | grep -v ""name":")
|
||||
# echo '-=-=-=- final output -=-=-=-'
|
||||
# echo "$toprint"
|
||||
# echo $(echo "$hyprctlclients") # Print on one line only
|
||||
|
||||
workspace=('[' '[' '[' '[' '[' '[' '[' '[' '[' '[')
|
||||
workspacecnt=(1 1 1 1 1 1 1 1 1 1)
|
||||
outputstring='{'
|
||||
|
||||
wsid=0
|
||||
|
||||
# echo $hyprctlclients | gojq -c '.[]'
|
||||
|
||||
IFS=$'\n'
|
||||
clientsarr=( $(echo $hyprctlclients | gojq -c '.[]') )
|
||||
|
||||
#For every window
|
||||
for client in "${clientsarr[@]}"; do
|
||||
wsid=$(echo $client | gojq -c '.workspace.id')
|
||||
((wsid-=1))
|
||||
if [[ "$wsid" == "-100" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "${workspacecnt[wsid]}" != "0" ]]; then
|
||||
workspace[wsid]+=","
|
||||
fi
|
||||
|
||||
clientclass=$(echo $client | gojq '.class' | sed 's/"//g')
|
||||
iconpath=''
|
||||
thumbnailpath=''
|
||||
|
||||
# Get thumbnail
|
||||
clientaddress=$(echo $client | gojq '.address' | sed 's/"//g')
|
||||
atx=$(echo $client | gojq -c '.at[0]')
|
||||
aty=$(echo $client | gojq -c '.at[1]')
|
||||
sizex=$(echo $client | gojq -c '.size[0]')
|
||||
sizey=$(echo $client | gojq -c '.size[1]')
|
||||
if [ "$(( wsid + 1 ))" == "$focusedws" ]; then
|
||||
grim -g "$atx,$aty ""$sizex"'x'"$sizey" "scripts/cache/thumbnails/$clientaddress.png" -q 1 -t png -l 9
|
||||
fi
|
||||
|
||||
# If thumbnail available
|
||||
if [ -f "scripts/cache/thumbnails/$clientaddress.png" ]; then
|
||||
thumbnailpath="scripts/cache/thumbnails/$clientaddress.png"
|
||||
fi
|
||||
|
||||
client="\"$clientaddress\": \"$thumbnailpath\","
|
||||
outputstring+="$client"
|
||||
|
||||
# echo -n "Window: $clientclass"
|
||||
# echo '; icon path: '"$iconpath"
|
||||
|
||||
|
||||
# echo "Count: ${workspacecnt[wsid]}"
|
||||
# echo 'ADDED TO: workspace '"$wsid"
|
||||
# echo ' --> '"${workspace[wsid]}"
|
||||
((workspacecnt[wsid]+=1))
|
||||
done
|
||||
|
||||
outputstring=${outputstring::-1}
|
||||
outputstring+='}'
|
||||
|
||||
# echo $outputstring
|
||||
}
|
||||
|
||||
# Do stuff here
|
||||
getwins
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
while true; do
|
||||
getwins
|
||||
sleep 0.8
|
||||
done
|
||||
fi
|
||||
Executable
+124
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/bash
|
||||
dummy='{"address":"_none","at":[0,0],"class":"workspace","size":[1920,1080],"title":"<___overview_workspace>","workspace":{"id":<___overview_workspace>, "name": "<___overview_workspace>"}}'
|
||||
|
||||
getwins() {
|
||||
hyprctlclients=$(hyprctl clients -j \
|
||||
| grep -v '"mapped": ' \
|
||||
| grep -v '"hidden": ' \
|
||||
| grep -v '"floating": ' \
|
||||
| grep -v '"monitor": ' \
|
||||
| grep -v '"pid": ' \
|
||||
| grep -v '"xwayland": ' \
|
||||
| grep -v '"pinned":' \
|
||||
| grep -v '"fullscreen": ' \
|
||||
| grep -v '"fullscreenMode": ' \
|
||||
| grep -v '"fakeFullscreen": ' \
|
||||
| grep -v '"grouped": ')
|
||||
|
||||
workspace=('[' '[' '[' '[' '[' '[' '[' '[' '[' '[')
|
||||
workspacecnt=(1 1 1 1 1 1 1 1 1 1)
|
||||
|
||||
wsid=0
|
||||
for i in 0 1 2 3 4; do
|
||||
workspace[i]+=$(echo $dummy | sed "s/<___overview_workspace>/$((i+1))/g")
|
||||
done
|
||||
|
||||
# echo $hyprctlclients | gojq -c '.[]'
|
||||
|
||||
IFS=$'\n'
|
||||
clientsarr=( $(echo $hyprctlclients | gojq -c '.[]') )
|
||||
|
||||
#For every window
|
||||
for client in "${clientsarr[@]}"; do
|
||||
wsid=$(echo $client | gojq -c '.workspace.id')
|
||||
((wsid-=1))
|
||||
iconpath=''
|
||||
clientclass=$(echo "$client" | gojq '.class' | sed 's/"//g')
|
||||
if [[ "$clientclass" == "" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "$wsid" == "-100" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "${workspacecnt[wsid]}" != "0" ]]; then
|
||||
workspace[wsid]+=","
|
||||
fi
|
||||
|
||||
# If thumbnail available
|
||||
# if [ -f "scripts/cache/thumbnails/$clientaddress.png" ]; then
|
||||
# thumbnailpath="scripts/cache/thumbnails/$clientaddress.png"
|
||||
# fi
|
||||
|
||||
# Get app icon
|
||||
if [ -f "scripts/cache/$clientclass" ]; then
|
||||
iconpath=$(cat scripts/cache/$clientclass)
|
||||
if [ ! -f "${iconpath}" ]; then # Cache refresh if icon doesnt exist
|
||||
iconpath=$(geticons "$clientclass" | head -n 1)
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
else
|
||||
iconpath=$(geticons "$clientclass" | head -n 1)
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
if [[ ${iconpath} == "" ]]; then
|
||||
# Retry with lowercase if icon not found
|
||||
iconpath=$(geticons $(echo "${classarr[i]##*.}" | tr '[:upper:]' '[:lower:]' | sed 's/\ /-/g') | head -n 1)
|
||||
if [[ ! ${iconpath} = "" ]]; then
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
else
|
||||
newname=$(scripts/iconpatch $clientclass)
|
||||
iconpath=$(geticons "$newname" | head -n 1)
|
||||
if [[ ! ${iconpath} = "" ]]; then
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
else
|
||||
# Fallback app icon, replace the path below to the fallback icon of your choice
|
||||
iconpath="/home/$USER/.local/share/icons/candy-icons/mimetypes/scalable/application-x-theme.svg"
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
client=${client::-1}
|
||||
client+=",\"icon\": \"$iconpath\"}"
|
||||
workspace[wsid]+="$client" # Add window to workspace JSON
|
||||
|
||||
# echo -n "Window: $clientclass"
|
||||
# echo '; icon path: '"$iconpath"
|
||||
|
||||
|
||||
# echo "Count: ${workspacecnt[wsid]}"
|
||||
# echo 'ADDED TO: workspace '"$wsid"
|
||||
# echo ' --> '"${workspace[wsid]}"
|
||||
((workspacecnt[wsid]+=1))
|
||||
done
|
||||
|
||||
for i in 0 1 2 3 4; do
|
||||
workspace[i]+=']'
|
||||
done
|
||||
|
||||
# echo '-=-=-=-=-=- Summary -=-=-=-=-=-'
|
||||
|
||||
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=- PRINT STUFF HERE -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
echo -n '['
|
||||
for i in 0 1 2 3 4; do
|
||||
if [[ $i != 0 ]]; then
|
||||
echo -n ','
|
||||
fi
|
||||
echo -n "${workspace[i]}"
|
||||
done
|
||||
echo ']'
|
||||
}
|
||||
|
||||
# Do stuff here
|
||||
getwins
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "window>>" | while read -r line; do
|
||||
getwins
|
||||
done
|
||||
fi
|
||||
Executable
+119
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/bash
|
||||
dummy='{"address":"_none","at":[0,0],"class":"workspace","size":[1920,1080],"title":"<___overview_workspace>","workspace":{"id":<___overview_workspace>, "name": "<___overview_workspace>"}}'
|
||||
|
||||
getwins() {
|
||||
hyprctlclients=$(hyprctl clients -j \
|
||||
| grep -v '"mapped": ' \
|
||||
| grep -v '"hidden": ' \
|
||||
| grep -v '"floating": ' \
|
||||
| grep -v '"monitor": ' \
|
||||
| grep -v '"pid": ' \
|
||||
| grep -v '"xwayland": ' \
|
||||
| grep -v '"pinned":' \
|
||||
| grep -v '"fullscreen": ' \
|
||||
| grep -v '"fullscreenMode": ' \
|
||||
| grep -v '"fakeFullscreen": ' \
|
||||
| grep -v '"grouped": ')
|
||||
|
||||
|
||||
|
||||
workspace=('[' '[' '[' '[' '[' '[' '[' '[' '[' '[')
|
||||
workspacecnt=(1 1 1 1 1 1 1 1 1 1)
|
||||
|
||||
wsid=0
|
||||
for i in 5 6 7 8 9; do
|
||||
workspace[i]+=$(echo $dummy | sed "s/<___overview_workspace>/$((i+1))/g")
|
||||
done
|
||||
|
||||
# echo $hyprctlclients | gojq -c '.[]'
|
||||
|
||||
IFS=$'\n'
|
||||
clientsarr=( $(echo $hyprctlclients | gojq -c '.[]') )
|
||||
for client in "${clientsarr[@]}"; do
|
||||
wsid=$(echo $client | gojq -c '.workspace.id')
|
||||
((wsid-=1))
|
||||
iconpath=''
|
||||
clientclass=$(echo $client | gojq '.class' | sed 's/"//g')
|
||||
if [[ "$clientclass" == "" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "$wsid" == "-100" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "${workspacecnt[wsid]}" != "0" ]]; then
|
||||
workspace[wsid]+=","
|
||||
fi
|
||||
|
||||
# Get app icon
|
||||
if [ -f "scripts/cache/$clientclass" ]; then
|
||||
iconpath=$(cat scripts/cache/$clientclass)
|
||||
if [ ! -f "${iconpath}" ]; then # Cache refresh if icon doesnt exist
|
||||
iconpath=$(geticons "$clientclass" | head -n 1)
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
else
|
||||
iconpath=$(geticons "$clientclass" | head -n 1)
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
if [[ ${iconpath} == "" ]]; then
|
||||
# Retry with lowercase if icon not found
|
||||
iconpath=$(geticons $(echo "$clientclass" | tr '[:upper:]' '[:lower:]' | sed 's/\ /-/g') | head -n 1)
|
||||
if [[ ! ${iconpath} = "" ]]; then
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
else
|
||||
newname=$(scripts/iconpatch $clientclass)
|
||||
iconpath=$(geticons "$newname" | head -n 1)
|
||||
if [[ ! ${iconpath} = "" ]]; then
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
else
|
||||
# Fallback app icon, replace the path below to the fallback icon of your choice
|
||||
iconpath="/home/$USER/.local/share/icons/candy-icons/mimetypes/scalable/application-x-theme.svg"
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
client=${client::-1}
|
||||
client+=",\"icon\": \"$iconpath\"}"
|
||||
workspace[wsid]+="$client" # Add window to workspace JSON
|
||||
|
||||
# echo -n "Window: $clientclass"
|
||||
# echo '; icon path: '"$iconpath"
|
||||
|
||||
|
||||
# echo "Count: ${workspacecnt[wsid]}"
|
||||
# echo 'ADDED TO: workspace '"$wsid"
|
||||
# echo ' --> '"${workspace[wsid]}"
|
||||
((workspacecnt[wsid]+=1))
|
||||
done
|
||||
|
||||
for i in 5 6 7 8 9; do
|
||||
workspace[i]+=']'
|
||||
done
|
||||
|
||||
# echo '-=-=-=-=-=- Summary -=-=-=-=-=-'
|
||||
|
||||
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=- PRINT STUFF HERE -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
echo -n '['
|
||||
for i in 5 6 7 8 9; do
|
||||
if [[ $i != 5 ]]; then
|
||||
echo -n ','
|
||||
fi
|
||||
echo -n "${workspace[i]}"
|
||||
done
|
||||
echo ']'
|
||||
}
|
||||
|
||||
# Do stuff here
|
||||
getwins
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "window>>" | while read -r line; do
|
||||
getwins
|
||||
done
|
||||
fi
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
selected=$(eval $2 get selected)
|
||||
|
||||
|
||||
if [[ $selected == "_none" ]] || [[ $selected == "" ]]; then
|
||||
eval "$2 update selected=$1"
|
||||
selected=$(eval $2 get selected)
|
||||
else
|
||||
hyprctl dispatch movetoworkspacesilent $3,address:$selected
|
||||
|
||||
eval "$2 update selected=_none"
|
||||
selected=$(eval $2 get selected)
|
||||
fi
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
plugged=0
|
||||
|
||||
swaybg -i images/wallpaper/wallpaper-cultured &
|
||||
|
||||
while true; do
|
||||
STATE=$(cat /sys/class/power_supply/BATT/status)
|
||||
if [[ "$STATE" = "Charging" ]]; then
|
||||
if [ "$plugged" -eq "0" ]; then
|
||||
plugged=1
|
||||
notify-send 'Aghh~~~~'
|
||||
play scripts/supersecretsettings/culture.mp3
|
||||
fi
|
||||
else
|
||||
plugged=0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
cp ~/.config/hypr/hyprland.conf temporary_config.conf && cp temporary_config.conf ~/.config/hypr/hyprland.conf
|
||||
rm temporary_config.conf
|
||||
|
||||
pkill swaybg
|
||||
swaybg -i images/wallpaper/wallpaper-normal
|
||||
|
||||
kill $(pidof eww) && eww open bar && eww open bg-decor
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
state=$(hyprctl getoption decoration:rounding -j | gojq '.int')
|
||||
|
||||
if [[ "$state" != "0" || "$1" == "--enable" ]]; then
|
||||
hyprctl keyword decoration:rounding 0
|
||||
hyprctl keyword general:gaps_in 0
|
||||
hyprctl keyword general:gaps_out 0
|
||||
if [[ "$2" == "--border" ]]; then
|
||||
hyprctl keyword general:border_size "$3"
|
||||
else
|
||||
hyprctl keyword general:border_size 1
|
||||
fi
|
||||
else
|
||||
hyprctl reload
|
||||
fi
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/bash
|
||||
state=$(eww get rev_dash)
|
||||
|
||||
if [[ "$state" == "true" || "$1" == "--close" ]]; then
|
||||
eww update anim_open_dash=false
|
||||
eww update rev_dash=false
|
||||
sleep 0.08
|
||||
eww close dashboard
|
||||
else
|
||||
scripts/toggle-overview.sh --close &
|
||||
scripts/toggle-osettings.sh --close &
|
||||
scripts/toggle-onotify.sh --close &
|
||||
eww update anim_open_dash=true
|
||||
eww open dashboard
|
||||
eww update rev_dash=true
|
||||
fi
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/bash
|
||||
state=$(eww get music_open)
|
||||
|
||||
if [[ "$state" == "true" || "$1" == "--close" ]]; then
|
||||
eww update anim_open_music=false
|
||||
eww update music_open=false
|
||||
sleep 0.2
|
||||
eww close music
|
||||
else
|
||||
eww update anim_open_music=true
|
||||
eww open music
|
||||
eww update music_open=true
|
||||
fi
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/bash
|
||||
state=$(eww get rev_ontf)
|
||||
state_ostg=$(eww get rev_ostg)
|
||||
|
||||
if [[ "$state" == "true" || "$1" == "--close" ]]; then
|
||||
eww update anim_open_ontf=false
|
||||
eww update rev_ontf=false
|
||||
eww update force_sys_rev=false
|
||||
sleep 0.3
|
||||
eww close onotify
|
||||
else
|
||||
~/.config/eww/scripts/toggle-overview.sh --close --nooffset &
|
||||
~/.config/eww/scripts/toggle-osettings.sh --close --nooffset &
|
||||
eww update anim_open_ontf=true
|
||||
eww open onotify
|
||||
eww update rev_ontf=true &
|
||||
eww update force_sys_rev=true &
|
||||
# Effects
|
||||
# ~/.config/eww/scripts/open-blurred.sh
|
||||
sleep 0.3
|
||||
if [[ "$state_ostg" == "true" ]]; then
|
||||
eww close osettings
|
||||
eww update oquery=''
|
||||
fi
|
||||
fi
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/bash
|
||||
state=$(eww get rev_ostg)
|
||||
state_ontf=$(eww get rev_ontf)
|
||||
|
||||
if [[ "$state" == "true" || "$1" == "--close" ]]; then
|
||||
eww update anim_open_ostg=false &
|
||||
eww update rev_ostg=false &
|
||||
sleep 0.3
|
||||
eww close osettings
|
||||
eww update oquery=''
|
||||
else # state = false
|
||||
~/.config/eww/scripts/toggle-overview.sh --close --nooffset &
|
||||
~/.config/eww/scripts/toggle-onotify.sh --close --nooffset &
|
||||
eww update anim_open_ostg=true &
|
||||
eww update oquery='' &
|
||||
eww open osettings
|
||||
eww update rev_ostg=true &
|
||||
# Effects
|
||||
# ~/.config/eww/scripts/open-blurred.sh
|
||||
sleep 0.3
|
||||
if [[ "$state_ostg" == "true" ]]; then
|
||||
eww close onotify
|
||||
fi
|
||||
fi
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/bash
|
||||
state=$(eww get open_overview)
|
||||
|
||||
cd ~/.config/eww
|
||||
|
||||
if [[ "$state" == "true" || "$1" == "--close" ]]; then
|
||||
eww close overview &
|
||||
eww update overview_query='' &
|
||||
eww update open_overview=false &
|
||||
else
|
||||
scripts/listentrynames.py &
|
||||
scripts/listentries.py &
|
||||
eww update overview_query='' &
|
||||
eww update overview_hover_name='{"class":"LMB: Focus | MMB: Close | RMB: Select/Move","title":"Activities Overview","workspace":{"id":5,"name":"5"},"icon": "/usr/share/icons/breeze-dark/actions/16/window.svg"}' &
|
||||
eww open overview
|
||||
eww update open_overview=true
|
||||
fi
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/bash
|
||||
state=$(eww get rev_themer)
|
||||
|
||||
if [[ "$state" == "true" || "$1" == "--close" ]]; then
|
||||
eww update anim_open_themer=false
|
||||
eww update rev_themer=false
|
||||
sleep 0.25
|
||||
eww close themer
|
||||
else
|
||||
eww update anim_open_themer=true
|
||||
eww open themer
|
||||
eww update rev_themer=true
|
||||
fi
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
if [ "$1" == "light" ]; then
|
||||
echo -n '-l' > 'scripts/workdir/__mode_light_dark.txt'
|
||||
cp css/savedcolors/_iconcolor_default.txt css/_iconcolor_default.txt
|
||||
else
|
||||
echo -n '' > 'scripts/workdir/__mode_light_dark.txt'
|
||||
cp css/savedcolors/_iconcolor_default.txt css/_iconcolor_default.txt
|
||||
fi
|
||||
Executable
+118
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
volicons=("" "" "")
|
||||
XDG_CACHE_HOME="$HOME/.cache"
|
||||
date="$XDG_CACHE_HOME/eww/osd_vol.date"
|
||||
lock=0
|
||||
|
||||
showhide() {
|
||||
# get dates
|
||||
rundate=$(cat "$date")
|
||||
currentdate=$(date +%s)
|
||||
|
||||
# handle showing
|
||||
if [ "$rundate" = "$currentdate" ] && [ "$lock" -eq 0 ]; then
|
||||
eww open osd
|
||||
eww update osd_vol=true
|
||||
lock=1
|
||||
elif [ "$((currentdate - rundate))" = "2" ] && [ "$lock" -eq 1 ]; then
|
||||
eww update osd_vol=false
|
||||
if [ "$(eww get osd_vol)" = "false" ] && [ "$(eww get osd_bright)" = "false" ]; then
|
||||
dummy=$(eww close osd)
|
||||
fi
|
||||
lock=0
|
||||
fi
|
||||
}
|
||||
|
||||
osd() {
|
||||
if [ ! -f "$date" ]; then
|
||||
mkdir -p "$XDG_CACHE_HOME/eww"
|
||||
fi
|
||||
date +%s > "$date"
|
||||
showhide
|
||||
}
|
||||
|
||||
osd_handler() {
|
||||
lock=0
|
||||
rundate=0
|
||||
if [ ! -f "$date" ]; then
|
||||
mkdir -p "$XDG_CACHE_HOME/eww"
|
||||
echo 0 > "$date"
|
||||
fi
|
||||
|
||||
while true; do
|
||||
showhide
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
dummy=$(eww close osd)
|
||||
}
|
||||
|
||||
vol() {
|
||||
wpctl get-volume @DEFAULT_AUDIO_$1@ | awk '{print int($2*100)}'
|
||||
}
|
||||
ismuted() {
|
||||
wpctl get-volume @DEFAULT_AUDIO_"$1"@ | rg -i muted
|
||||
echo $?
|
||||
}
|
||||
setvol() {
|
||||
wpctl set-volume @DEFAULT_AUDIO_"$1"@ "$(awk -v n="$2" 'BEGIN{print (n / 100)}')"
|
||||
}
|
||||
setmute() {
|
||||
wpctl set-mute @DEFAULT_AUDIO_"$1"@ toggle
|
||||
}
|
||||
|
||||
if [ "$1" = "mute" ]; then
|
||||
if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then
|
||||
echo "Can only mute SINK or SOURCE"; exit 1
|
||||
fi
|
||||
setmute "$2"
|
||||
elif [ "$1" = "setvol" ]; then
|
||||
if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then
|
||||
echo "Can only set volume for SINK or SOURCE"; exit 1
|
||||
elif [ "$3" -lt 1 ] || [ "$3" -gt 100 ]; then
|
||||
echo "Volume must be between 1 and 100"; exit 1
|
||||
fi
|
||||
setvol "$2" "$3"
|
||||
elif [ "$1" = "osd" ]; then
|
||||
osd
|
||||
else
|
||||
# initial values
|
||||
lvl=$(awk -v n="$(vol "SINK")" 'BEGIN{print int(n/34)}')
|
||||
ismuted=$(ismuted "SINK")
|
||||
|
||||
if [ "$ismuted" = 1 ]; then
|
||||
icon="${volicons[$lvl]}"
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
audio=1
|
||||
if [ "$(wpctl status | grep 'MUTED')" == "" ]; then
|
||||
audio=1
|
||||
else
|
||||
audio=0
|
||||
fi
|
||||
|
||||
echo '{"icon":"'"$icon"'","audio":"'"$audio"'","percent":"'"$(vol "SINK")"'","microphone":"'"$(vol "SOURCE")"'"}'
|
||||
|
||||
osd_handler &
|
||||
# event loop
|
||||
pactl subscribe | rg --line-buffered "on sink" | while read -r _; do
|
||||
lvl=$(awk -v n="$(vol "SINK")" 'BEGIN{print int(n/34)}')
|
||||
ismuted=$(ismuted "SINK")
|
||||
|
||||
if [ "$ismuted" = 1 ]; then
|
||||
icon="${volicons[$lvl]}"
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
audio=1
|
||||
if [ "$(wpctl status | grep 'MUTED')" == "" ]; then
|
||||
audio=1
|
||||
else
|
||||
audio=0
|
||||
fi
|
||||
|
||||
echo '{"icon":"'"$icon"'","audio":"'"$audio"'","percent":"'"$(vol "SINK")"'","microphone":"'"$(vol "SOURCE")"'"}'
|
||||
done
|
||||
fi
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/bash
|
||||
getwinlist(){
|
||||
toprint=$(hyprctl clients -j \
|
||||
| grep -v '"xwayland": ' \
|
||||
| grep -v '"grouped": ' \
|
||||
| grep -v '"pid": ' \
|
||||
| grep -v '"fullscreenMode": ' \
|
||||
| grep -v '"monitor": ' \
|
||||
| grep -v '"floating": ' \
|
||||
| grep -v '"fullscreen": ' \
|
||||
| grep -v '"at": ' \
|
||||
| grep -v '"pinned":') # | grep -v ""name":")
|
||||
# echo '-=-=-=- final output -=-=-=-'
|
||||
# echo "$toprint"
|
||||
echo $(echo "$toprint") # Print on one line only
|
||||
}
|
||||
|
||||
getwinlist
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "window>>" | while read -r line; do
|
||||
# echo $line
|
||||
getwinlist
|
||||
done
|
||||
fi
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
geticonlist() {
|
||||
classes=$(hyprctl clients | grep -e 'class: ' | sed 's/class: Code/class: code/' | sed 's/\tclass: //')
|
||||
addresses=$(hyprctl clients | grep -e ' -> ')
|
||||
# echo "$classes"
|
||||
IFS=$'\n'
|
||||
classarr=($(echo "$classes"))
|
||||
|
||||
printf '['
|
||||
for i in "${!classarr[@]}"; do
|
||||
if [ $i -ne 0 ]; then
|
||||
printf ', '
|
||||
fi
|
||||
printf "$i"
|
||||
done
|
||||
echo ']'
|
||||
}
|
||||
|
||||
geticonlist
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "window>>" | while read -r line; do
|
||||
geticonlist
|
||||
done
|
||||
fi
|
||||
|
||||
Executable
+153
@@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# define colors
|
||||
colors=("#FFFFFF" "#fab387" "#a6e3a1" "#89b4fa") # Active Workspaces
|
||||
dimmed=("rgba(174,172,182,0.7)" "#f9e2af" "#94e2d5" "#b4befe") # Inactive workspaces
|
||||
empty='rgba(146,145,145,0.5)' # Empty workspaces
|
||||
|
||||
# get initial focused workspace
|
||||
focusedws=$(hyprctl -j monitors | gojq -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
|
||||
|
||||
# set color for each workspace
|
||||
status() {
|
||||
if [ "${o[$1]}" -eq 1 ]; then
|
||||
mon=${monitormap[${workspaces[$1]}]}
|
||||
echo -n "${dimmed[$mon]}"
|
||||
else
|
||||
echo -n "$empty"
|
||||
fi
|
||||
}
|
||||
|
||||
status_activity() {
|
||||
if [ "${o[$1]}" -eq 1 ]; then
|
||||
mon=${monitormap[${workspaces[$1]}]}
|
||||
|
||||
if [ $focusedws -eq "$1" ]; then
|
||||
echo -n "active"
|
||||
else
|
||||
echo -n "inactive"
|
||||
fi
|
||||
else
|
||||
echo -n "empty"
|
||||
fi
|
||||
}
|
||||
|
||||
# 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 | gojq -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 | gojq -r '.[]|"\(.name) \(.id) "')
|
||||
}
|
||||
|
||||
# generate the json for eww
|
||||
generate() {
|
||||
echo -n '['
|
||||
|
||||
for i in {1..10}; do
|
||||
echo -n ''$([ $i -eq 1 ] || echo ,)'{"num":"'$i'","clr":"'$(status "$i")'"}'
|
||||
# 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 | gojq -r '.[]|"\(.id) \(.monitor)"')
|
||||
|
||||
# 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 | gojq -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 | gojq -r '.[]|"\(.id) \(.monitor)"')
|
||||
# check occupied workspaces
|
||||
for num in "${!workspaces[@]}"; do
|
||||
o[$num]=1
|
||||
done
|
||||
generate
|
||||
;;
|
||||
"monitor"*)
|
||||
monitor_event
|
||||
generate
|
||||
;;
|
||||
esac
|
||||
# echo $line
|
||||
# generate
|
||||
done
|
||||
|
||||
# main loop
|
||||
# socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "workspace|mon(itor)?" | while read -r line; do
|
||||
# case ${line%>>*} in
|
||||
# "workspace")
|
||||
# focusedws=${line#*>>}
|
||||
# generate
|
||||
# ;;
|
||||
# "focusedmon")
|
||||
# focusedws=${line#*,}
|
||||
# generate
|
||||
# ;;
|
||||
# "createworkspace")
|
||||
# workspace_event "${line#*>>}" 1
|
||||
# focusedws=${line#*>>}
|
||||
# # generate
|
||||
# ;;
|
||||
# "destroyworkspace")
|
||||
# workspace_event "${line#*>>}" 0
|
||||
# generate
|
||||
# ;;
|
||||
# "monitor"*)
|
||||
# monitor_event
|
||||
# generate
|
||||
# ;;
|
||||
# esac
|
||||
# done
|
||||
Reference in New Issue
Block a user