Skip to content

Commit

Permalink
Merge pull request #42 from ublue-os/main
Browse files Browse the repository at this point in the history
[pull] main from ublue-os:main
  • Loading branch information
pull[bot] authored Jan 9, 2025
2 parents a9cb211 + b93f40d commit ea2acce
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
is_latest_version: true
is_stable_version: true
kernel_flavor: bazzite # must match a kernel_flavor from akmods repo
kernel_version: 6.12.8-207.bazzite.fc41.x86_64 # must match a cached version of the above flavor
kernel_version: 6.12.8-201.bazzite.fc41.x86_64 # must match a cached version of the above flavor
exclude:
- base_name: bazzite
target_nvidia_flavor: nvidia
Expand Down
3 changes: 3 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ RUN --mount=type=cache,dst=/var/cache/rpm-ostree \
yafti \
stress-ng \
btrfs-assistant \
podman-compose \
edk2-ovmf \
qemu \
libvirt \
Expand Down Expand Up @@ -734,6 +735,8 @@ RUN rm -f /etc/profile.d/toolbox.sh && \
cp --no-dereference --preserve=links /usr/lib/libdrm.so.2 /usr/lib/libdrm.so && \
cp --no-dereference --preserve=links /usr/lib64/libdrm.so.2 /usr/lib64/libdrm.so && \
sed -i 's@/usr/bin/steam@/usr/bin/bazzite-steam@g' /usr/share/applications/steam.desktop && \
echo "Replace steam BPM shortcut action" && \
sed -i 's@Exec=steam steam://open/bigpicture@Exec=/usr/bin/bazzite-steam-bpm@g' /usr/share/applications/steam.desktop && \
mkdir -p /etc/skel/.config/autostart/ && \
cp "/usr/share/applications/steam.desktop" "/etc/skel/.config/autostart/steam.desktop" && \
sed -i 's@/usr/bin/bazzite-steam %U@/usr/bin/bazzite-steam -silent %U@g' /etc/skel/.config/autostart/steam.desktop && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,30 @@ _toggle-autologin:
else
sudo touch $DESKTOP_AUTOLOGIN
fi

# Restore the "Return to Gaming Mode" shortcut on the Desktop
restore-gamemode-shortcut:
#!/usr/bin/bash
# Define paths
SHORTCUT_FILE="$HOME/Desktop/Return.desktop"
SKEL_FILE="/etc/skel/Desktop/Return.desktop"
# Check if the shortcut already exists
if [ -f "$SHORTCUT_FILE" ]; then
echo "The shortcut 'Return to Gaming Mode' already exists at $SHORTCUT_FILE."
echo "No changes were made."
exit 0
fi
# Check if the original file exists in skel
if [ ! -f "$SKEL_FILE" ]; then
echo "Error: The original file does not exist at $SKEL_FILE."
echo "Unable to restore the shortcut."
exit 1
fi
# Copy the file from skel to the desktop
echo "Restoring the 'Return to Gaming Mode' shortcut from $SKEL_FILE..."
mkdir -p "$HOME/Desktop" # Ensure the Desktop directory exists
cp "$SKEL_FILE" "$SHORTCUT_FILE"
# Ensure the file is executable
chmod +x "$SHORTCUT_FILE"
echo "Shortcut restored successfully at $SHORTCUT_FILE."
echo "Note: The first time you use the shortcut, it may ask you to trust it. Please accept."
40 changes: 20 additions & 20 deletions system_files/desktop/shared/usr/libexec/bazzite-hardware-setup
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ IMAGE_FLAVOR=$(jq -r '."image-flavor"' < $IMAGE_INFO)
FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)

# SCRIPT VERSION
HWS_VER=52
HWS_VER=53
HWS_VER_FILE="/etc/bazzite/hws_version"
HWS_VER_RAN=$(cat $HWS_VER_FILE)

Expand Down Expand Up @@ -256,27 +256,10 @@ fi
# SURFACE FIXES
if [[ ":Microsoft:" =~ ":$VEN_ID:" ]]; then
if ! [[ -f "/etc/modules-load.d/surface.conf" ]]; then
sed 's/^ *//' > "/etc/modules-load.d/surface.conf" << EOF
# Add modules necessary for Disk Encryption via keyboard
surface_aggregator
surface_aggregator_registry
surface_aggregator_hub
surface_hid_core
8250_dw
# Surface Laptop 3/Surface Book 3 and later
surface_hid
surface_kbd
EOF
if [[ "AuthenticAMD" == "$CPU_VENDOR" ]]; then
printf "# Support GPIO pins on AMD Surfaces\npinctrl_amd\n" >> "/etc/modules-load.d/surface.conf"
printf "# Support GPIO pins on AMD Surfaces\npinctrl_amd\n" > "/etc/modules-load.d/surface.conf"
elif [[ "GenuineIntel" == "$CPU_VENDOR" ]]; then
sed 's/^ *//' >> "/etc/modules-load.d/surface.conf" << EOF
# Support LPSS on Intel Surfaces
intel_lpss
intel_lpss_pci
sed 's/^ *//' > "/etc/modules-load.d/surface.conf" << EOF
# Support GPIO pins on Intel Surfaces
# Surface Book 2
pinctrl_sunrisepoint
Expand All @@ -292,8 +275,25 @@ EOF
# For Surface Pro 10/Surface Laptop 6
pinctrl_meteorlake
# Support LPSS on Intel Surfaces
intel_lpss
intel_lpss_pci
EOF
fi
sed 's/^ *//' >> "/etc/modules-load.d/surface.conf" << EOF
# Add modules necessary for Disk Encryption via keyboard
surface_aggregator
surface_aggregator_registry
surface_aggregator_hub
surface_hid_core
8250_dw
# Surface Laptop 3/Surface Book 3 and later
surface_hid
surface_kbd
EOF
fi
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

SYS_ID="$(/usr/libexec/hwsupport/sysid)"

if /usr/libexec/hwsupport/valve-hardware || [[ ":ROG Ally RC71L:ROG Ally X RC72LA:G1618-04:G1617-01:G1619-05:AIR Plus:AIR 1S:AIR 1S Limited:AIR:AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:AOKZOE A1 Pro:G1619-04:Win600:Loki Max:Loki Zero:Loki MiniPro:V3:ONEXPLAYER F1:ONEXPLAYER F1L:ONEXPLAYER F1 EVA-01:" =~ ":$SYS_ID:" ]]; then
exit 0
fi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

SYS_ID="$(/usr/libexec/hwsupport/sysid)"

# KDE Specific fractional scaling
if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
exit 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

SYS_ID="$(/usr/libexec/hwsupport/sysid)"

if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
exit 0
fi
Expand Down
114 changes: 104 additions & 10 deletions system_files/desktop/shared/usr/share/ublue-os/just/80-bazzite.just
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,113 @@ _install-system-flatpaks:
FLATPAK_LIST="$(curl https://raw.githubusercontent.com/ublue-os/bazzite/main/installer/${FLATPAKS} | tr '\n' ' ')"
flatpak --system -y install --or-update ${FLATPAK_LIST}

# Configure grub bootmenu visibility and fix duplicate entries
# Configure grub bootmenu visibility. pass action 'help' for more info.
configure-grub ACTION="":
#!/usr/bin/bash
echo "Editing grub is no longer recommended and this script has been removed"
echo
echo "Reason:"
echo "Grub is auto-hidden now on successful boots and reappears only if you"
echo "shutdown too early. You can still access it by holding shift. Deck"
echo "images will also automatically rollback after 2 failed boots, so grub"
echo "will need to be visible for you to see that."
source /usr/lib/ujust/ujust.sh
# Function to display usage/help with some color
print_help() {
echo -e "Usage: ujust configure-grub <option>"
echo
echo -e "Where <option> can be:"
echo -e " ${bold}${cyan}hide${normal} = GRUB is hidden after a successful boot, even for dual-boot setups."
echo -e " ${bold}${yellow}unhide${normal} = GRUB is hidden after a successful boot, but it will show if dual-booting."
echo -e " ${bold}${green}show${normal} = GRUB always shows on boot."
echo
echo "If <option> is omitted, you will be prompted to choose interactively."
}
# Function to get the current GRUB menu_auto_hide setting and explain it
get_current_setting() {
local CURRENT_SETTING
CURRENT_SETTING=$(sudo grub2-editenv - list | grep menu_auto_hide | cut -d= -f2)
if [ -z "$CURRENT_SETTING" ]; then
echo "Current GRUB menu_auto_hide setting: ${bold}${red}Not Set (default to 0)${normal}"
echo "Explanation:"
echo " - ${bold}0${normal}: GRUB always shows on boot."
return 0
else
case "$CURRENT_SETTING" in
0)
echo "Current GRUB menu_auto_hide setting: ${bold}${green}0 (Always Show)${normal}"
echo "Explanation:"
echo " - ${bold}0${normal}: GRUB always shows on boot."
;;
1)
echo "Current GRUB menu_auto_hide setting: ${bold}${yellow}1 (Hide After Successful Boot)${normal}"
echo "Explanation:"
echo " - ${bold}1${normal}: GRUB is hidden after a successful boot, but it will show if dual-booting."
;;
2)
echo "Current GRUB menu_auto_hide setting: ${bold}${cyan}2 (Always Hide)${normal}"
echo "Explanation:"
echo " - ${bold}2${normal}: GRUB is hidden after a successful boot, even for dual-boot setups."
;;
*)
echo "Current GRUB menu_auto_hide setting: ${bold}${red}Unknown${normal}"
echo "Explanation:"
echo " - This setting is unrecognized. Reset it to 0, 1, or 2."
;;
esac
fi
}
# Interactive menu for choosing the new behavior
interactive_menu() {
local options=(
"Always Hide Grub (menu_auto_hide=2)"
"Hide After Successful Boot (menu_auto_hide=1)"
"Always Show Grub (menu_auto_hide=0)"
"Exit without changes"
)
local choice
choice=$(ugum choose "${options[@]}")
echo "$choice"
}
# Function to apply the selected setting
apply_setting() {
local selected_option="$1"
# Support the interactive strings as well as short commands
case "$(echo "$selected_option" | tr '[:upper:]' '[:lower:]')" in
*"(menu_auto_hide=2)"*|hide)
sudo grub2-editenv - set menu_auto_hide=2
echo "GRUB menu is now set to ${bold}${cyan}Always Hide${normal}."
;;
*"(menu_auto_hide=1)"*|unhide)
sudo grub2-editenv - set menu_auto_hide=1
echo "GRUB menu is now set to ${bold}${yellow}Hide After Successful Boot${normal}."
;;
*"(menu_auto_hide=0)"*|show)
sudo grub2-editenv - set menu_auto_hide=0
echo "GRUB menu is now set to ${bold}${green}Always Show${normal}."
;;
*"exit without changes"*|exit)
echo "${bold}No changes were made. Exiting...${normal}"
;;
help)
print_help
;;
*)
echo "${bold}${red}Invalid option selected. No changes were made.${normal}"
;;
esac
}
OPTION="{{ ACTION }}" # from “configure-grub ACTION=...”
if [ "$OPTION" == "help" ]; then
print_help
exit 0
fi
get_current_setting
echo
echo "You can edit /etc/default/grub to change settings manually, then:"
echo "grub2-mkconfig -o /etc/grub2-efi.cfg"
# If no ACTION was passed, go interactive
if [ -z "$OPTION" ]; then
NEW_SETTING=$(interactive_menu)
if [ -n "$NEW_SETTING" ]; then
apply_setting "$NEW_SETTING"
else
echo "${bold}No changes were made.${normal}"
fi
else
apply_setting "$OPTION"
fi

# Add user to "input" group required by certain controller drivers
add-user-to-input-group:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,42 @@ fix-reset-steam:
sleep 1
bazzite-steam &
exit 0

# Toggle Bluetooth headset profile mode. If enabled, mic will be disabled on the Bluetooth device preventing the switch to headset profile, which has poor audio quality. Disable to restore mic functionality.
toggle-bt-mic:
#!/usr/bin/bash
CONFIG_FILE="/etc/wireplumber/wireplumber.conf.d/51-mitigate-annoying-profile-switch.conf"
# Check current status
CURRENT_STATE="Disabled"
if [ -f "$CONFIG_FILE" ]; then
CURRENT_STATE="Enabled"
fi
# Prompt user for action
echo "Bluetooth headset profile mitigation is currently: ${bold}${CURRENT_STATE}${normal}"
echo "Enable or Disable Bluetooth headset profile mitigation?"
OPTION=$(ugum choose Enable Disable)
if [[ "${OPTION,,}" == "enable" ]]; then
echo "You chose to enable mitigation. This will disable headset mic functionality."
echo "Requesting root privileges..."
sudo mkdir -p "$(dirname "$CONFIG_FILE")"
echo 'wireplumber.settings = {' | sudo tee "$CONFIG_FILE" > /dev/null
echo ' bluetooth.autoswitch-to-headset-profile = false' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo '}' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo '' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo 'monitor.bluez.properties = {' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo ' bluez5.roles = [ a2dp_sink a2dp_source ]' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo '}' | sudo tee -a "$CONFIG_FILE" > /dev/null
systemctl --user restart wireplumber
echo "Mitigation has been ${green}${b}enabled${n}. Headset profile switching is now disabled."
elif [[ "${OPTION,,}" == "disable" ]]; then
echo "You chose to disable mitigation. This will restore headset mic functionality."
echo "Requesting root privileges..."
if sudo rm -f "$CONFIG_FILE"; then
systemctl --user restart wireplumber
echo "Mitigation has been ${red}${b}disabled${n}. Headset profile switching is now allowed."
else
echo "Failed to disable mitigation. Ensure you have sufficient permissions."
fi
else
echo "No changes were made."
fi

0 comments on commit ea2acce

Please sign in to comment.