first Version
This commit is contained in:
commit
0c4bef47e8
149 changed files with 32273 additions and 0 deletions
64
scripts/test.sh
Executable file
64
scripts/test.sh
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
pid=()
|
||||
classes=()
|
||||
clientOnWorkspace=()
|
||||
images=()
|
||||
numberOnWorkspace=()
|
||||
area=()
|
||||
i=0
|
||||
|
||||
while read -r p w x y c; do
|
||||
if [[ $c ]]; then
|
||||
|
||||
pid[$i]="$p"
|
||||
classes[$i]="$c"
|
||||
clientOnWorkspace[$i]="$w"
|
||||
((numberOnWorkspace[w]+=1))
|
||||
area[$i]=$((x * y))
|
||||
|
||||
|
||||
|
||||
desktop=$(grep -l "StartupWMClass.*$c$" /usr/share/applications/*.desktop)
|
||||
echo $c
|
||||
if [ -z $desktop ]; then
|
||||
desktop=$(grep -Pl "Name\s*=\s*$c$" /usr/share/applications/*.desktop)
|
||||
fi
|
||||
if [ -z $desktop ]; then
|
||||
desktop=$(ls /usr/share/applications | grep -l /usr/share/applications/${c}.desktop)
|
||||
fi
|
||||
if [ -z $desktop ]; then
|
||||
process=$(ps -p ${p} -o comm=)
|
||||
desktop=$(grep -Pl "$process" /usr/share/applications/*.desktop)
|
||||
fi
|
||||
if [ -z $desktop ]; then
|
||||
desktop=$(grep -Pli "$c" /usr/share/applications/*.desktop)
|
||||
fi
|
||||
if [ -z $desktop ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
images[$i]=$(awk -F'[[:space:]]*=[[:space:]]*' '/Icon[[:space:]]*=/{print $2}' $desktop)
|
||||
ls /usr/share/icons/ePapirus-Dark/128x128/apps/${images[$i]}.svg
|
||||
((i=$i+1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fi
|
||||
done < <(hyprctl clients -j | jq -r '.[]|"\(.pid) \(.workspace.id) \(.size[0]) \(.size[1]) \(.initialClass)"')
|
||||
|
||||
for ((i=0; i<${#clientOnWorkspace[@]}; i++)); do
|
||||
clientInfos[i]='{"onWorkspace":"'${clientOnWorkspace[$i]}'","pid":"'${pid[$i]}'","class":"'${classes[$i]}'","mainOn":"''","icon":"'${images[$i]}'"}'
|
||||
echo ${clientInfos[$i]}
|
||||
done
|
||||
|
||||
|
||||
#for window in ${!windows[@]}; do
|
||||
# echo -n "${window} "
|
||||
# echo $(ps -p ${windows[$window]} -o comm=)
|
||||
#done
|
||||
|
||||
#test=$(ps -p ${windows[2]} -o comm=)
|
||||
#$(feh /usr/share/icons/Papirus-Dark/128x128/apps/${test}.svg)
|
Loading…
Add table
Add a link
Reference in a new issue