Flatpak is a cross-platform package management tool for installing applications on Linux systems. This tutorial will show you how to use a script to create a case-insensitive startup command, allowing you to quickly launch Flatpak-installed applications (such as QQ, WeChat, Telegram, Discord, and Signal) using commands like qq , QQ , and wechat . The script is simple to use, compatible with Linux distributions like Ubuntu and Debian, and supports one-click cleanup.
Create the Startup Script
1. Create the Script File
Use any text editor (nano, vim, gedit, code, etc.). Here, we use nano :
nano ~/flatapps-setup.sh
2. Write the Script
Copy the following complete script into the editor (this is your Flatpak launcher script):
#!/bin/bash
# Create a directory
sudo mkdir -p /usr/local/bin/flatapps
sudo chown $USER:$USER /usr/local/bin/flatapps
cd /usr/local/bin/flatapps
# Create a startup script
echo -e '#!/bin/bash\nflatpak run com.qq.QQ' > qq
echo -e '#!/bin/bash\nflatpak run com.tencent.WeChat' > wechat
echo -e '#!/bin/bash\nflatpak run com.g.telegram.desktop' > telegram
echo -e '#!/bin/bash\nflatpak run com.discordapp.Discord' > discord
echo -e '#!/bin/bash\nflatpak run org.signal.Signal' > signal
# Empowerment
chmod +x qq wechat telegram discord signal
# Create case-sensitive soft links
ln -sf qq QQ
ln -sf wechat WeChat
ln -sf telegram Telegram
ln -sf discord Discord
ln -sf signal Signal
# Add to PATH
grep -qxF 'export PATH=$PATH:/usr/local/bin/flatapps' ~/.bashrc || \
echo 'export PATH=$PATH:/usr/local/bin/flatapps' >> ~/.bashrc
echo "Installation complete! Restart the terminal or execute source ~/.bashrc to take effect."
3. Execute the Script
Save and run:
bash flatapps-setup.sh
source ~/.bashrc
Done! Now type qq , QQ , wechat , WeChat , etc., to launch the respective Flatpak apps.
One-Click Removal
1. Create the Removal Script
Use nano to create the cleanup script:
nano ~/flatapps-remove.sh
2. Write the Removal Script
Copy the following complete script:
#!/bin/bash
sudo rm -rf /usr/local/bin/flatapps
sed -i '/\/usr\/local\/bin\/flatapps/d' ~/.bashrc
echo "The flatapps directory and PATH record have been completely deleted."
3. Execute Removal
Run to clean up:
bash flatapps-remove.sh
source ~/.bashrc
Notes
- Ensure Flatpak and target apps (eg, com.qq.QQ ) are installed.
- Run scripts with bash ; use sudo for permission issues.
- Removal script only deletes the launcher, not the Flatpak apps.







0 Comments