Skip to content

Revamp browser install scripts with snap/flatpak support and merge reset-theme into global-theme#1339

Closed
thepinak503 wants to merge 7 commits into
ChrisTitusTech:mainfrom
thepinak503:pr/browser-fixes
Closed

Revamp browser install scripts with snap/flatpak support and merge reset-theme into global-theme#1339
thepinak503 wants to merge 7 commits into
ChrisTitusTech:mainfrom
thepinak503:pr/browser-fixes

Conversation

@thepinak503

@thepinak503 thepinak503 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR overhauls the browser installation scripts across the board and merges the reset theme functionality directly into global-theme.sh there is no need of more separate script.

Browser changes

Every browser script now properly handles Debian-based distros with smart package manager routing:

  • Brave: Native apt repo on Debian, snap on Ubuntu, flatpak fallback, it replaces the bare curl | sh approach
  • Chromium: Snap on Ubuntu, apt everywhere else
  • Firefox: Removes the snap Firefox on Ubuntu and sets up the Mozilla apt repo with proper pin priority, installs the real Firefox. Debian stays on firefox-esr
  • Google Chrome: Added missing wget ca-certificates deps, downloads to /tmp instead of cwd, flatpak as fallback
  • Vivaldi: Snap on Ubuntu, apt repo on Debian
  • Zen Browser: Snap on Ubuntu (candidate channel), flatpak elsewhere
  • Waterfox: Flatpak install for apt-based distros (no deb exists upstream)
  • Thorium: Fixed function name typo and switched from curl to wget --no-hsts for repo setup
  • Lynx: Fixed indentation in case block
  • Other scripts (LibreWolf, Tor) left as-is — they already worked fine

Global theme revamp

global-theme.sh now has a clean menu:

  • Option 1: Apply dark theme (original behavior)
  • Option 2: Reset theme to distribution defaults
  • Option 3: Cancel

The reset function detects the desktop environment automatically and restores default themes, icons, cursors, fonts, wallpapers, and panel layouts. It also cleans up GTK/QT config files and theme environment variables that might have been left behind. Supports GNOME, KDE, XFCE, Cinnamon, MATE, Budgie, LXDE, LXQt, Deepin, Pantheon, Sway, Hyprland, i3, bspwm, dwm, qtile, Openbox, Enlightenment, UKUI, Lomiri, and COSMIC.

Other checklists

  • Added checkSnap() helper to common-script.sh alongside the existing checkFlatpak()
  • Syntax-verified all changed scripts with bash -n

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9794274a31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +34 to +36
if command_exists snap && snap list firefox 2>/dev/null | grep -q firefox; then
printf "%b\n" "${YELLOW}Removing Snap Firefox...${RC}"
"$ESCALATION_TOOL" snap remove firefox

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle existing snap Firefox before the installed check

On Ubuntu systems where the current snap/transitional Firefox is already installed, command_exists firefox is true before this block is reached, so the script prints "already installed" and never removes the snap or configures the Mozilla apt repo. That leaves exactly the snap package this new Ubuntu path is meant to replace; detect/remove the snap before the outer installed check or distinguish snap Firefox from the desired apt install.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

apt-get|nala)
"$ESCALATION_TOOL" rm -fv /etc/apt/sources.list.d/thorium.list
"$ESCALATION_TOOL" curl http://dl.thorium.rocks/debian/dists/stable/thorium.list -o /etc/apt/sources.list.d/thorium.list
"$ESCALATION_TOOL" wget --no-hsts -P /etc/apt/sources.list.d/ http://dl.thorium.rocks/debian/dists/stable/thorium.list

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Install or require wget before using it

The apt/nala path now depends on wget, but checkEnv only verifies curl and this script does not install wget before invoking it. On minimal Debian/Ubuntu systems where wget is absent, Thorium installation fails here after deleting the old repo file, so either keep using the checked curl dependency or install/require wget first.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

printf "%b\n" "2. ${YELLOW}Reset Theme to Defaults${RC}"
printf "%b\n" "3. ${YELLOW}Cancel${RC}"
printf "%b" "Enter your choice [1-3]: "
read -r CHOICE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Disable multi-select for the new theme prompt

This newly added menu makes Global Theme interactive, but its catalog entry still defaults to multi_select = true, so users can queue it with other commands in a batch. The merged runner will reach this read and block or consume terminal input before later queued tasks; this is the interactive/state-dependent case the repo instructions require opting out of, so set the Global Theme entry to multi_select = false with this change.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread core/tabs/system-setup/global-theme.sh Outdated
Comment on lines +539 to +540
if command_exists sudo; then
sudo sed -i '/^QT_QPA_PLATFORMTHEME=/d; /^GTK_THEME=/d' /etc/environment 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use configured escalation for environment cleanup

The reset path only edits /etc/environment when sudo exists, ignoring the already selected ESCALATION_TOOL. On supported doas-only systems, or when running as root without sudo installed, a previous dark-theme run can leave GTK_THEME/QT_QPA_PLATFORMTHEME in /etc/environment, so the reset reports success while global dark theming still comes back after login.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +8 to +9
"$ESCALATION_TOOL" gpg --batch --yes --dearmor -o /etc/apt/keyrings/packages.mozilla.org.gpg /tmp/mozilla-key.gpg 2>/dev/null || {
"$ESCALATION_TOOL" cp /tmp/mozilla-key.gpg /etc/apt/keyrings/packages.mozilla.org.asc

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Signed-By aligned with the fallback key file

If gpg --dearmor fails or gpg is not installed, the fallback writes the Mozilla key to packages.mozilla.org.asc, but the generated apt source still points Signed-By at packages.mozilla.org.gpg. In that environment apt update cannot use the fallback key file, so either install/require gpg or make the source reference the actual fallback path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@thepinak503

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6101346397

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +31 to +33
if [ "$DTYPE" = "ubuntu" ] && command_exists snap && snap list firefox 2>/dev/null | grep -q firefox; then
printf "%b\n" "${YELLOW}Removing Snap Firefox...${RC}"
"$ESCALATION_TOOL" snap remove firefox

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install Firefox after removing the snap

On stock Ubuntu 22.04/24.04 systems the firefox deb package is a transitional wrapper to the snap, so after this removes the snap, command_exists firefox can still succeed via /usr/bin/firefox. In that case the new Mozilla APT setup is skipped and the user is left with a broken/no Firefox instead of the requested install; purge the transitional package or perform the repo install before relying on command_exists.

Useful? React with 👍 / 👎.

Comment thread core/tabs/system-setup/global-theme.sh Outdated

resetWMCommon() {
for wm_dir in i3 bspwm qtile dwm; do
rm -f "$HOME/.config/$wm_dir/config" "$HOME/.config/$wm_dir/theme" 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not delete window-manager configs during reset

When option 2 reaches this helper for i3/bspwm/qtile/dwm, and also from the Sway/Hyprland branches that call it, this removes the user's main WM config files rather than just undoing theme changes. Those files commonly contain keybindings, autostart commands, monitor layout, and other session-critical settings, so a "Reset Theme to Defaults" can irreversibly break the user's desktop without a backup or confirmation; limit the reset to theme-owned settings or preserve these configs.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@thepinak503

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41bc97f789

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/tabs/system-setup/global-theme.sh Outdated
}

resetSway() {
rm -f "$HOME/.config/sway/config" 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid deleting Sway user configuration during theme reset

When XDG_CURRENT_DESKTOP is Sway, choosing "Reset Theme to Defaults" removes ~/.config/sway/config, which normally contains keybindings, outputs, autostart commands, and other session behavior rather than just theme settings. Because resetDE calls this before printing that tiling-WM configs are not theme-only, a user trying to reset colors can lose their working WM configuration; this path should skip Sway or edit only known theme-related settings.

Useful? React with 👍 / 👎.

Comment on lines +36 to +38
if command_exists firefox; then
"$ESCALATION_TOOL" "$PACKAGER" purge -y firefox 2>/dev/null || true
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep existing native Firefox installs intact

On Ubuntu, after this script has installed the Mozilla .deb once, command_exists firefox is true and snap list firefox is false, so a later run purges the existing firefox package before reaching the idempotent install check. If the Mozilla repo update or reinstall then fails, the user is left without Firefox; the removal should be limited to the Ubuntu transitional/snap package or avoided when the installed package is already the intended native Firefox.

Useful? React with 👍 / 👎.

@thepinak503

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 81482595ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lookandfeeltool -a org.kde.breezedark.desktop
successOutput
exit 0
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop the KDE theme path before generic Qt setup

In a KDE session, choosing "Apply Dark Theme" now returns from applyTheming instead of terminating as it did before, so applyDarkTheme continues into the generic setup and writes QT_QPA_PLATFORMTHEME=qt6ct globally. That overrides KDE's native Qt platform theme for future sessions and can break Breeze/KDE integration after the script already applied org.kde.breezedark.desktop; keep the KDE path terminal or skip the generic Qt env setup for KDE.

Useful? React with 👍 / 👎.

Comment thread core/tabs/system-setup/global-theme.sh Outdated
}

resetOpenbox() {
rm -f "$HOME/.config/openbox/rc.xml" 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid wiping Openbox rc.xml for a theme reset

When XDG_CURRENT_DESKTOP resolves to Openbox and the user chooses "Reset Theme to Defaults", this removes the whole rc.xml and replaces it with the system default. That file contains keybindings, mouse bindings, and application rules in addition to theme settings, so a theme reset silently discards unrelated Openbox customization; update only the theme fields or warn/skip like the other WM-specific paths.

Useful? React with 👍 / 👎.

@thepinak503

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@thepinak503

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98ce27cdec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +31 to +33
if [ "$DTYPE" = "ubuntu" ] && command_exists snap && snap list firefox 2>/dev/null | grep -q firefox; then
printf "%b\n" "${YELLOW}Removing Snap Firefox...${RC}"
"$ESCALATION_TOOL" snap remove firefox

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Defer removing Snap Firefox until replacement succeeds

On Ubuntu systems that already have Snap Firefox, this removes the working snap before the Mozilla apt repo is added and before the deb install succeeds. Because the script runs with set -e, any later network, repo, or apt failure aborts after this point and leaves the user without Firefox. Install and validate the replacement first, or postpone snap removal until after the apt install completes successfully.

Useful? React with 👍 / 👎.

}

resetLXQt() {
rm -f "$HOME/.config/lxqt/lxqt.conf" "$HOME/.config/lxqt/panel.conf" "$HOME/.config/lxqt/session.conf" 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve non-theme LXQt configuration files

For LXQt users who choose Reset Theme to Defaults, this deletes panel.conf and session.conf along with lxqt.conf. Those files hold panel layout and session settings, so a theme reset can wipe unrelated desktop configuration without a backup or explicit warning. Limit this path to LXQt appearance settings, or back up these files before removing them.

Useful? React with 👍 / 👎.

@FluffyPunk

Copy link
Copy Markdown
Contributor

First of all, one feature - one PR. You are doing two things, which are affected in 2 different vectors.
Second, snap is piece of crap. Still. Between snap and flatpak, I would get AppImage and just don't give a damn thing.
Third, rewriting Brave from their own universal script, which already handles ALL the popular cases, to something else is the worst idea ever(even with fact that I hate vanilla Brave itself)

I make a bet that @ChrisTitusTech will just say "PR is too bad" and will just close that

@ChrisTitusTech

Copy link
Copy Markdown
Owner

So this is where all my tokens went...

@FluffyPunk

Copy link
Copy Markdown
Contributor

So this is where all my tokens went...

Wait, what? D:

@ChrisTitusTech

Copy link
Copy Markdown
Owner

Split these up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants