Closed magictomagic closed 2 years ago
bask up some sctipts
#!/bin/bash
# if ! [[ "${generated_files[@]}" =~ $name.desktop ]]; then
# echo "create file"
# touch $desktop_scripts_location/$name.desktop
# fi
# echo $desktop_scripts_location/$name.desktop
XDG_DATA_HOME="$HOME/.local/share"
script="notify-send 'cccc'"
primitive_scripts_location="$HOME/.config/wofi/scripts"
desktop_scripts_location="$XDG_DATA_HOME/applications"
# change it after notify only update or create
files_to_generate=$(ls $primitive_scripts_location)
generated_files=$(ls $desktop_scripts_location)
# $1: Where to generate .desktop file
# $2: Where is the initial script directory
generate_scripts(){
for file in $1
do
# script_location=$2/$file
name=$(expr match "$file" '\(.*\)\.sh')
cat << EOF > $desktop_scripts_location/$name.desktop
[Desktop Entry]
Type=Application
Name=${name}
Exec=/bin/bash $2/$file
EOF
done
}
generate_scripts "${files_to_generate[*]}" $primitive_scripts_location
add in sway config:
exec . $HOME/.config/wofi/generate.sh >> /tmp/generate_${UID}.log