From 9f5db99394cd0e53b796009c23d1218779b3140b Mon Sep 17 00:00:00 2001 From: Don Williams Date: Fri, 7 Aug 2026 09:07:00 -0400 Subject: Add .zprofile check to fix flatpak apps ```sh if [ -f /etc/profile ]; then source /etc/profile fi ``` thanks to @jfabernathy for finding and reporting it On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: CHANGELOG.md modified: copy.sh modified: scripts/lib_detect.sh --- CHANGELOG.md | 9 +++++++++ copy.sh | 3 +++ scripts/lib_detect.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32c2438f..0f068244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ ## Added: +- Selecting `zsh` now updates `.zprofile` + + ```sh + if [ -f /etc/profile ]; then + source /etc/profile + fi + ``` + - This should help resolve flatpak apps not showing in rofi menu + - Thanks to `@jfabernathy` for finding it - `docs/Keybinds.md` a layout of all the default keybinds - Option for event drive disable of eDP-1 on lid close - `kitty.conf` and `ghostty/config` are now saved to `UserConfigs` directory diff --git a/copy.sh b/copy.sh index d3e83b4c..7e9b45b9 100755 --- a/copy.sh +++ b/copy.sh @@ -1082,6 +1082,9 @@ if is_nixos && ! command -v waybar-weather >/dev/null 2>&1; then echo "Install the current NixOS-Hyprland version to install waybar-weather applet for Waybar" 2>&1 | tee -a "$LOG" fi +# Ensure shell profile sources /etc/profile (fixes flatpak not showing in rofi on Debian) +ensure_shell_profile_sources_etc_profile "$LOG" + printf "\n%.0s" {1..2} printf "${OK} GREAT! KooL's Hyprland-Dots is now Loaded & Ready !!! " printf "\n%.0s" {1..1} diff --git a/scripts/lib_detect.sh b/scripts/lib_detect.sh index 26449962..4c73f41a 100644 --- a/scripts/lib_detect.sh +++ b/scripts/lib_detect.sh @@ -142,6 +142,46 @@ adjust_qt_quick_controls_style() { fi } +# Ensure ~/.zprofile (zsh) and ~/.profile (bash) source /etc/profile. +# On Debian with zsh, /etc/profile sets up flatpak XDG data dirs so flatpak +# apps appear in the rofi menu. Without this entry the rofi app menu is often +# missing all flatpak-installed applications. +ensure_shell_profile_sources_etc_profile() { + local log="${1:-/dev/null}" + local user_shell + local entry_marker='source /etc/profile' + local entry + entry="$(printf 'if [ -f /etc/profile ]; then\n source /etc/profile\nfi')" + + user_shell="$(basename "${SHELL:-bash}")" + + _add_etc_profile_entry() { + local profile_file="$1" + local plog="$2" + if [ ! -f "$profile_file" ]; then + echo "${NOTE:-[NOTE]} Creating $profile_file and adding /etc/profile source entry (fixes flatpak in rofi on Debian)" 2>&1 | tee -a "$plog" + printf '\n# Source /etc/profile to ensure system paths (e.g. flatpak) are available\n%s\n' "$entry" > "$profile_file" + elif ! grep -qF "$entry_marker" "$profile_file"; then + echo "${NOTE:-[NOTE]} Adding /etc/profile source entry to $profile_file (fixes flatpak in rofi on Debian)" 2>&1 | tee -a "$plog" + printf '\n# Source /etc/profile to ensure system paths (e.g. flatpak) are available\n%s\n' "$entry" >> "$profile_file" + else + echo "${INFO:-[INFO]} $profile_file already sources /etc/profile; no changes needed." 2>&1 | tee -a "$plog" + fi + } + + # zsh: check ~/.zprofile when the user's shell is zsh + if [ "$user_shell" = "zsh" ]; then + echo "${INFO:-[INFO]} zsh detected - checking ~/.zprofile for /etc/profile source entry..." 2>&1 | tee -a "$log" + _add_etc_profile_entry "$HOME/.zprofile" "$log" + fi + + # bash: check ~/.profile when bash is the default shell and the file already exists + if [ "$user_shell" = "bash" ] && [ -f "$HOME/.profile" ]; then + echo "${INFO:-[INFO]} bash detected - checking ~/.profile for /etc/profile source entry..." 2>&1 | tee -a "$log" + _add_etc_profile_entry "$HOME/.profile" "$log" + fi +} + # Decide waybar config/style based on chassis type. Echoes chosen config path. detect_waybar_config() { if hostnamectl | grep -q 'Chassis: desktop'; then -- cgit v1.2.3