forked from Shinonome/dots-hyprland
stuff
This commit is contained in:
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
getactivewin(){
|
||||
winname=$(hyprctl activewindow | grep -e 'title: ' | sed 's/title: //' | sed 's/\t//')
|
||||
echo "$winname"
|
||||
}
|
||||
|
||||
getactivewin
|
||||
|
||||
if [ "$1" == "--once" ]; then
|
||||
exit 0
|
||||
else
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
|
||||
getactivewin
|
||||
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
+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 "change" | while read -r _; do
|
||||
dostuff
|
||||
done
|
||||
Executable
+112
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
icons=("" "" "" "" "" "" "" "")
|
||||
|
||||
gettime() {
|
||||
FULL=$(cat /sys/class/power_supply/BAT0/energy_full)
|
||||
NOW=$(cat /sys/class/power_supply/BAT0/energy_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
|
||||
echo '#5AA8ED'
|
||||
else
|
||||
echo '#9ECE6A'
|
||||
fi
|
||||
}
|
||||
|
||||
cirbgcolor() {
|
||||
if [[ "$CAPACITY" -le 20 && "$STATE" = "Discharging" ]]; then
|
||||
echo '#EF738A'
|
||||
else
|
||||
echo 'transparent'
|
||||
fi
|
||||
}
|
||||
|
||||
color() {
|
||||
if [ "$CAPACITY" -le 20 ]; then
|
||||
echo '#EF738A'
|
||||
else
|
||||
echo '#9ECE6A'
|
||||
fi
|
||||
}
|
||||
|
||||
bgcolor() {
|
||||
if [ "$CAPACITY" -le 20 ]; then
|
||||
echo '#EF738A'
|
||||
else
|
||||
echo 'transparent'
|
||||
fi
|
||||
}
|
||||
|
||||
wattage() {
|
||||
echo "$(bc -l <<< "scale=1; $RATE / 1000000") W"
|
||||
}
|
||||
|
||||
while true; do
|
||||
RATE=$(cat /sys/class/power_supply/BATT/power_now)
|
||||
CAPACITY=$(cat /sys/class/power_supply/BATT/capacity)
|
||||
STATE=$(cat /sys/class/power_supply/BATT/status)
|
||||
|
||||
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
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
icons=("" "" "")
|
||||
|
||||
# initial
|
||||
icon=${icons[$(awk -v n="$(light)" 'BEGIN{print int(n/34)}')]}
|
||||
echo '{ "level": '"$(light)"', "icon": "'"$icon"'" }'
|
||||
|
||||
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
|
||||
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
+23
@@ -0,0 +1,23 @@
|
||||
#!/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] == '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'
|
||||
|
||||
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 - | while read -r line; do
|
||||
# echo $line
|
||||
getoptions
|
||||
done
|
||||
fi
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
getopen(){
|
||||
ans=$(eww windows | grep -e "$1")
|
||||
if [ "${ans:0:1}" == "*" ]; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
fi
|
||||
}
|
||||
|
||||
getopen $1
|
||||
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
+226
@@ -0,0 +1,226 @@
|
||||
#!/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"
|
||||
|
||||
playerctl -F metadata mpris:artUrl 2>/dev/null | while read -r COVER_URL; do
|
||||
if [[ "$COVER_URL" = https* ]]; then
|
||||
# if [ ! -e "eww_covers/$(basename "$COVER_URL")" ]; then
|
||||
# wget -N "$COVER_URL" -o /dev/null
|
||||
# # wget -N "$COVER_URL" -o "$IMGPATH"
|
||||
# fi
|
||||
|
||||
# ln -s "$(basename "$COVER_URL")" "$IMGPATH"
|
||||
|
||||
# echo "$IMGPATH"
|
||||
coverurl="$(playerctl metadata mpris:artUrl)"
|
||||
wget -O "$IMGPATH" "$coverurl" -q
|
||||
coverpath="$IMGPATH"
|
||||
wal -c
|
||||
themejson=$(wal -i "$IMGPATH" -n -t -e -s | grep -e 'color1' | sed 's/'\''/"/g')
|
||||
printf '{"image": "eww_covers/'"$coverpath"'", "color": '"$themejson"'}\n'
|
||||
# printf '{"image": "eww_covers/'"$coverpath"'"}\n'
|
||||
|
||||
# echo "$themejson" | gojq '.colors'
|
||||
# echo 'COLORS: '
|
||||
|
||||
# notify-send 'eww' 'i found a url!'
|
||||
cd ..
|
||||
# notify-send 'eww color changer' "here i go in the dir that has $(ls | tr '\n' ' ')"
|
||||
echo '//Auto generated color theme for image at:' "$coverurl" > './tmp/_colorscheme.colorpallete'
|
||||
printf '$colorbg: ' >> './tmp/_colorscheme.colorpallete'
|
||||
echo "$themejson" | gojq '.colors.color0' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$colortext: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color4' | 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'
|
||||
# printf '$colormusic: ' >> './tmp/_colorscheme.colorpallete'
|
||||
# printf "$themejson" | gojq '.colors.color4' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
# echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
|
||||
# Border gradient: color6 -> color5 -> color7
|
||||
gradient1=$(echo -n "$themejson" | gojq '.colors.color6' | sed 's/"//g')
|
||||
gradient2=$(echo -n "$themejson" | gojq '.colors.color5' | sed 's/"//g')
|
||||
gradient3=$(echo -n "$themejson" | gojq '.colors.color7' | sed 's/"//g')
|
||||
|
||||
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'
|
||||
|
||||
# cp './tmp/_colorscheme.colorpallete' './css/_colorscheme.scss'
|
||||
cd "eww_covers" || exit
|
||||
# notify-send 'eww color changer' 'okie dokie'
|
||||
elif [ "$COVER_URL" = "" ]; then
|
||||
echo '{"image": "", "color": "$bg"}'
|
||||
else
|
||||
COVER_URL="${COVER_URL:7}"
|
||||
cp "$COVER_URL" "$IMGPATH"
|
||||
coverpath="$IMGPATH"
|
||||
wal -c
|
||||
themejson=$(wal -i "$IMGPATH" -n -t -e -s | grep -e 'color1' | sed 's/'\''/"/g')
|
||||
printf '{"image": "eww_covers/'"$coverpath"'", "color": '"$themejson"'}\n'
|
||||
# echo "$themejson"
|
||||
|
||||
printf '{"image": "'"$COVER_URL"'", "color": '"$themejson"'}\n'
|
||||
# printf '{"image": "eww_covers/'"$coverpath"'"}\n'
|
||||
|
||||
# echo "$themejson" | gojq '.colors'
|
||||
# echo 'COLORS: '
|
||||
|
||||
# notify-send 'eww' 'i found a file!'
|
||||
|
||||
cd ..
|
||||
# notify-send 'eww color changer' "here i go in the dir that has $(ls | tr '\n' ' ')"
|
||||
echo '//Auto generated color theme for image at:' "$coverurl" > './tmp/_colorscheme.colorpallete'
|
||||
printf '$colorbg: ' >> './tmp/_colorscheme.colorpallete'
|
||||
echo "$themejson" | gojq '.colors.color0' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
printf '$colortext: ' >> './tmp/_colorscheme.colorpallete'
|
||||
printf "$themejson" | gojq '.colors.color4' | 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'
|
||||
# printf '$colormusic: ' >> './tmp/_colorscheme.colorpallete'
|
||||
# printf "$themejson" | gojq '.colors.color4' | sed 's/"//g' | tr '\n' ';' >> './tmp/_colorscheme.colorpallete'
|
||||
# echo '' >> './tmp/_colorscheme.colorpallete'
|
||||
|
||||
# Border gradient: color6 -> color5 -> color7
|
||||
gradient1=$(echo -n "$themejson" | gojq '.colors.color6' | sed 's/"//g')
|
||||
gradient2=$(echo -n "$themejson" | gojq '.colors.color5' | sed 's/"//g')
|
||||
gradient3=$(echo -n "$themejson" | gojq '.colors.color7' | sed 's/"//g')
|
||||
|
||||
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'
|
||||
|
||||
# cp './tmp/_colorscheme.colorpallete' './css/_colorscheme.scss'
|
||||
cd "eww_covers" || exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# SANITIZE FIX
|
||||
sanitize() {
|
||||
echo "$1" | sed 's/"/\"/g'
|
||||
}
|
||||
|
||||
if [ "$1" = "cover" ]; then
|
||||
get_cover
|
||||
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
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
tmp=./dunst-history.json
|
||||
lock="./dunst-toggle.lock"
|
||||
lockinfo="./dunst-lock-info"
|
||||
|
||||
touch $lockinfo
|
||||
|
||||
declare ids
|
||||
export toggle_icon=""
|
||||
|
||||
get_ids() {
|
||||
mapfile -t ids < <(dunstctl history | jq -r ".data[] | .[] | select(.appname.data != \"Spotify\") | .id.data")
|
||||
}
|
||||
|
||||
get_notif() {
|
||||
echo -n '['
|
||||
|
||||
for id in "${ids[@]}"; do
|
||||
mapfile -t n < <(jq -r ".data[] | .[] | select(.id.data == $id) | .appname.data, .summary.data, .body.data" "$tmp" | sed -r '/^\s*$/d' | sed -e 's/\%/ percent/g')
|
||||
echo -n ''$([ $id -eq ${ids[0]} ] || echo ,)' { '
|
||||
echo -n '"id": "'"$id"'", "appname": "'"${n[0]}"'", "summary": "'"${n[1]}"'", "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
+105
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/bash
|
||||
dummy='{"address":"_none","at":[0,0],"class":"workspace","size":[0,0],"title":"<___overview_workspace>","workspace":{"id":<___overview_workspace>, "name": "<___overview_workspace>"}}'
|
||||
|
||||
getwins() {
|
||||
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=(0 0 0 0 0 0 0 0 0 0)
|
||||
|
||||
wsid=0
|
||||
|
||||
# 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))
|
||||
if [[ "${workspacecnt[wsid]}" != "0" ]]; then
|
||||
workspace[wsid]+=","
|
||||
fi
|
||||
|
||||
clientclass=$(echo $client | gojq '.class' | sed 's/"//g')
|
||||
iconpath=''
|
||||
|
||||
if [ -f "scripts/cache/$clientclass" ]; then
|
||||
iconpath=$(cat scripts/cache/$clientclass)
|
||||
if [ ! -f "${iconpath}" ]; then # Cache refresh if icon doesnt exist
|
||||
iconpath=$(scripts/get-icon.py "$clientclass")
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
else
|
||||
iconpath=$(scripts/get-icon.py "$clientclass")
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
if [[ ${iconpath} = "not found" ]]; then
|
||||
iconpath=$(scripts/get-icon.py "$(echo "${classarr[i]##*.}" | tr '[:upper:]' '[:lower:]')")
|
||||
if [[ ! ${iconpath} = "not found" ]]; then
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
else
|
||||
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
|
||||
|
||||
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
|
||||
if [[ ${workspace[i]} == "[" ]]; then
|
||||
workspace[i]+=$(echo $dummy | sed "s/<___overview_workspace>/$((i+1))/g")
|
||||
fi
|
||||
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 - | while read -r line; do
|
||||
getwins
|
||||
done
|
||||
fi
|
||||
Executable
+105
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/bash
|
||||
dummy='{"address":"_none","at":[0,0],"class":"workspace","size":[0,0],"title":"<___overview_workspace>","workspace":{"id":<___overview_workspace>, "name": "<___overview_workspace>"}}'
|
||||
|
||||
getwins() {
|
||||
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=(0 0 0 0 0 0 0 0 0 0)
|
||||
|
||||
wsid=0
|
||||
|
||||
# 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))
|
||||
if [[ "${workspacecnt[wsid]}" != "0" ]]; then
|
||||
workspace[wsid]+=","
|
||||
fi
|
||||
|
||||
clientclass=$(echo $client | gojq '.class' | sed 's/"//g')
|
||||
iconpath=''
|
||||
|
||||
if [ -f "scripts/cache/$clientclass" ]; then
|
||||
iconpath=$(cat scripts/cache/$clientclass)
|
||||
if [ ! -f "${iconpath}" ]; then # Cache refresh if icon doesnt exist
|
||||
iconpath=$(scripts/get-icon.py "$clientclass")
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
else
|
||||
iconpath=$(scripts/get-icon.py "$clientclass")
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
fi
|
||||
if [[ ${iconpath} = "not found" ]]; then
|
||||
iconpath=$(scripts/get-icon.py "$(echo "${classarr[i]##*.}" | tr '[:upper:]' '[:lower:]')")
|
||||
if [[ ! ${iconpath} = "not found" ]]; then
|
||||
rm "scripts/cache/$clientclass"
|
||||
echo "${iconpath}" > "scripts/cache/$clientclass"
|
||||
else
|
||||
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
|
||||
|
||||
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
|
||||
if [[ ${workspace[i]} == "[" ]]; then
|
||||
workspace[i]+=$(echo $dummy | sed "s/<___overview_workspace>/$((i+1))/g")
|
||||
fi
|
||||
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 - | 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 @@
|
||||
state=$(eww get rev_ostg)
|
||||
|
||||
if [[ "$state" == "false" ]]; then
|
||||
eww open osettings
|
||||
eww update oquery=''
|
||||
hyprctl keyword monitor eDP-1, addreserved, 32, 0, 30, -30
|
||||
# hyprctl keyword decoration:dim_inactive true
|
||||
eww update rev_ostg=true
|
||||
sleep 0.3
|
||||
wtype -k tab
|
||||
else
|
||||
eww update rev_ostg=false
|
||||
hyprctl keyword monitor eDP-1, addreserved, 32, 0, 0, 0
|
||||
# hyprctl keyword decoration:dim_inactive false
|
||||
sleep 0.3
|
||||
eww close osettings
|
||||
eww update oquery=''
|
||||
fi
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
volicons=("" "" "")
|
||||
|
||||
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"
|
||||
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")"'"}'
|
||||
|
||||
# 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 '"size": ' \
|
||||
| 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 - | while read -r line; do
|
||||
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 - | while read -r line; do
|
||||
geticonlist
|
||||
done
|
||||
fi
|
||||
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# define colors
|
||||
colors=("#f38ba8" "#fab387" "#a6e3a1" "#89b4fa") # Active Workspaces
|
||||
dimmed=("#7DCFFF" "#f9e2af" "#94e2d5" "#b4befe") # Inactive workspaces
|
||||
empty="#313244" # Empty workspaces
|
||||
|
||||
# get initial focused workspace
|
||||
focusedws=$(hyprctl -j monitors | jaq -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]}]}
|
||||
|
||||
if [ $focusedws -eq "$1" ]; then
|
||||
echo -n "${colors[$mon]}"
|
||||
else
|
||||
echo -n "${dimmed[$mon]}"
|
||||
fi
|
||||
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() {
|
||||
o[$1]=$2
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | gojq -r '.[]|"\(.id) \(.monitor)"')
|
||||
}
|
||||
# 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 ']'
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
# main loop
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
|
||||
case ${line%>>*} in
|
||||
"workspace")
|
||||
focusedws=${line#*>>}
|
||||
;;
|
||||
"focusedmon")
|
||||
focusedws=${line#*,}
|
||||
;;
|
||||
"createworkspace")
|
||||
workspace_event "${line#*>>}" 1
|
||||
;;
|
||||
"destroyworkspace")
|
||||
workspace_event "${line#*>>}" 0
|
||||
;;
|
||||
"monitor"*)
|
||||
monitor_event
|
||||
;;
|
||||
esac
|
||||
generate
|
||||
done
|
||||
Reference in New Issue
Block a user