Skip to content

Instantly share code, notes, and snippets.

@codedeep79
Last active May 24, 2026 00:24
Show Gist options
  • Select an option

  • Save codedeep79/8464b150b23ecc0f64db0f596a2bc7b5 to your computer and use it in GitHub Desktop.

Select an option

Save codedeep79/8464b150b23ecc0f64db0f596a2bc7b5 to your computer and use it in GitHub Desktop.
Viber's installation on Ubuntu
#!/bin/bash
echo "=========================================="
echo " VIBER INSTALLATION & DESKTOP ICON SCRIPT"
echo "=========================================="
# 1. Ensure the system has Flatpak and the user directories tool
echo "[1/4] Checking and installing environment dependencies..."
sudo apt update -qq
sudo apt install -y flatpak xdg-user-dirs
# 2. Add Flathub repository
echo "[2/4] Connecting to Flathub repository..."
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# 3. Install Viber
echo "[3/4] Downloading and installing Viber (This may take a few minutes)..."
flatpak install --user -y flathub com.viber.Viber
# 4. Create Desktop Icon
echo "[4/4] Creating shortcut on Desktop..."
# Determine the actual path of the user's Desktop directory
DESKTOP_PATH=$(xdg-user-dir DESKTOP)
if [ -z "$DESKTOP_PATH" ]; then
DESKTOP_PATH="$HOME/Desktop"
fi
# Default Flatpak icon path (user installation)
FLATPAK_ICON="$HOME/.local/share/flatpak/exports/share/applications/com.viber.Viber.desktop"
# Copy and grant permissions to the icon
if [ -f "$FLATPAK_ICON" ]; then
cp "$FLATPAK_ICON" "$DESKTOP_PATH/"
chmod +x "$DESKTOP_PATH/com.viber.Viber.desktop"
# Grant trusted permission to the shortcut (required on modern Ubuntu/GNOME)
gio set "$DESKTOP_PATH/com.viber.Viber.desktop" metadata::trusted true 2>/dev/null
echo "=> Successfully created icon at: $DESKTOP_PATH"
else
echo "=> [Warning] Could not find the original file to copy to Desktop. You can still open Viber from the application menu."
fi
echo "=========================================="
echo " COMPLETE! YOU CAN NOW USE VIBER. "
echo "=========================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment