Script to create linux launcher file

Script to create linux launcher file

#!/bin/bash
LANG="zh_CN.UTF-8"

if [ ! -d "${HOME}/.config/autostart" ] 
then
    mkdir -p ${HOME}/.config/autostart
fi
int=(505)
h_bug=(258)
w_bug=(258)
#---------------------------------------------------------------------------
VideoTitle="脚本工具箱-创建启动器文件"
SaveFileBox_BoxList="${HOME}/桌面\
|${HOME}/文档|${HOME}/图片\
|${HOME}/模板|${HOME}/音乐\
|${HOME}/视频|${HOME}/.config/autostart"
SaveFileBox_title="选择在哪里创建启动器文件"
SaveFileBox_input_int="请选择"
name_text_a=""
name_text_b=""
name_text_c=""
SaveFile=", 选择可执行文件-必须是可执行文件"
box_z(){
zenity --forms --width=$int --height="150" \
                     --title="$VideoTitle" \
                     --text="$SaveFileBox_title" \
                     --add-combo="$SaveFileBox_input_int" \
                     --combo-values="$SaveFileBox_BoxList"
}
#---------------------------------------------------------------------------

box_x(){
zenity --title="$VideoTitle路径$box_z_1-$SaveFile" \
       --width=$w_bug --height=$h_bug --file-selection
}

#---------------------------------------------------------------------------
#     box_a(){
#     ewew=$(zenity) 这个时候是不成立的 ,里面不能有一个内在的变量出现
#     }
box_a(){
zenity --entry --width=$int \
              --title="输入起动器文件-显示名称[所见即所得]-点确定-在桌面生成" \
              --text="$name_text_a"
}
#---------------------------------------------------------------------------
box_b(){
zenity --entry --width=$int \
              --title="输入起动器文件名称 xxxx.desktop" \
              --text="$name_text_b"
}
#---------------------------------------------------------------------------
box_c(){
zenity --entry --width=$int \
              --title="[描述]-写上启动器-启动的脚本或程序的" \
              --text="$name_text_c"
}
#---------------------------------------------------------------------------
box_z_1=$(box_z) || exit
box_x_1=$(box_x) || exit
box_a_1=$(box_a) || exit
box_b_1=$(box_b) || exit
box_c_1=$(box_c) || exit
#---------------------------------------------------------------------------

cat > $box_z_1/$box_b_1.desktop<<EOT
[Desktop Entry]
Name=$box_a_1
Name[zh_CN]=$box_a_1
Comment=$box_c_1
Terminal=false
Type=Application
Categories=Graphics;
StartupNotify=true
Actions=Configure;Capture;
Exec=$box_x_1
Icon=utilities-terminal
EOT
chmod -R 750 $box_z_1/$box_b_1.desktop

exit 0

 

Guess you like

Origin blog.csdn.net/lcs910102814/article/details/115006125