From b6b35f9f332560801d88adbb4b0ba7d3ba5c931d Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Mon, 25 Nov 2024 11:07:32 -0600 Subject: [PATCH] feat: set mutter experimental kms-modifiers for nvidia (#1978) --- build_files/base/07-base-image-changes.sh | 15 ++++++- just/bluefin-system.just | 41 ------------------- ...zz0-bluefin-modifications.gschema.override | 1 - 3 files changed, 13 insertions(+), 44 deletions(-) diff --git a/build_files/base/07-base-image-changes.sh b/build_files/base/07-base-image-changes.sh index 5ec4480b89b..d8d06d5e745 100755 --- a/build_files/base/07-base-image-changes.sh +++ b/build_files/base/07-base-image-changes.sh @@ -63,11 +63,22 @@ elif [[ "${BASE_IMAGE_NAME}" = "silverblue" ]]; then sed -i 's@\[Desktop Entry\]@\[Desktop Entry\]\nHidden=true@g' /usr/share/applications/org.gnome.SystemMonitor.desktop fi + # Add Mutter experimental-features + MUTTER_EXP_FEATS="'scale-monitor-framebuffer', 'xwayland-native-scaling'" + if [[ "${IMAGE_NAME}" =~ nvidia ]]; then + MUTTER_EXP_FEATS="'kms-modifiers', ${MUTTER_EXP_FEATS}" + fi + tee /usr/share/glib-2.0/schemas/zz1-bluefin-modifications-mutter-exp-feats.gschema.override << EOF +[org.gnome.mutter] +experimental-features=[${MUTTER_EXP_FEATS}] +EOF + # GNOME Terminal is replaced with Ptyxis in F41+ + # Make schema valid on GNOME <47 which do not contain the accent-color key or xwayland-native-scaling mutter feature if [[ "${FEDORA_MAJOR_VERSION}" -lt "41" ]]; then sed -i 's@\[Desktop Entry\]@\[Desktop Entry\]\nNoDisplay=true@g' /usr/share/applications/org.gnome.Terminal.desktop sed -i 's@accent-color="slate"@@g' /usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override - sed -i 's@'", "\''xwayland-native-scaling'\''@@g' /usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override + sed -i 's@'", "\''xwayland-native-scaling'\''@@g' /usr/share/glib-2.0/schemas/zz1-bluefin-modifications-mutter-exp-feats.gschema.override fi # Create symlinks from old to new wallpaper names for backwards compatibility @@ -84,8 +95,8 @@ elif [[ "${BASE_IMAGE_NAME}" = "silverblue" ]]; then mkdir -p /tmp/bluefin-schema-test find /usr/share/glib-2.0/schemas/ -type f ! -name "*.gschema.override" -exec cp {} /tmp/bluefin-schema-test/ \; cp /usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override /tmp/bluefin-schema-test/ + cp /usr/share/glib-2.0/schemas/zz1-bluefin-modifications-mutter-exp-feats.gschema.override /tmp/bluefin-schema-test/ echo "Running error test for bluefin gschema override. Aborting if failed." - # We are omitting "--strict" from the schema validation since GNOME <47 do not contain the accent-color keys. # We should ideally refactor this to handle multiple GNOME version schemas better glib-compile-schemas --strict /tmp/bluefin-schema-test echo "Compiling gschema to include bluefin setting overrides" diff --git a/just/bluefin-system.just b/just/bluefin-system.just index ea88ae388fe..ecafba01b87 100644 --- a/just/bluefin-system.just +++ b/just/bluefin-system.just @@ -72,47 +72,6 @@ toggle-devmode: rpm-ostree rebase $NEW_IMAGE fi -# alias for gnome-vrr -[group('System')] -gnome-vrr: - @ujust toggle-gnome-vrr - -# Enable or Disable Gnome-VRR -[group('System')] -toggle-gnome-vrr: - #!/usr/bin/env bash - source /usr/lib/ujust/ujust.sh - if gsettings get org.gnome.mutter experimental-features | grep -q "variable-refresh-rate" ; then - CURRENT_STATE="Enabled" - else - CURRENT_STATE="Disabled" - fi - echo "Gnome-VRR is currently ${CURRENT_STATE}" - echo "Enable or Disable Gnome-VRR" - OPTION=$(Choose Enable Disable) - CURRENT_SETTINGS=($(gsettings get org.gnome.mutter experimental-features | tr -d "[]'," | xargs -n1)) - if [[ "${OPTION,,}" =~ ^enable ]]; then - echo "Enabling Gnome-VRR" - CURRENT_SETTINGS+=("variable-refresh-rate") - FINAL_ARRAY=() - for item in "${CURRENT_SETTINGS[@]}"; do - FINAL_ARRAY+=("\"$item\"") - done - FINAL=$(printf "[%s]\n" "$(IFS=,; echo "${FINAL_ARRAY[*]}")") - gsettings set org.gnome.mutter experimental-features "${FINAL}" - fi - if [[ "${OPTION,,}" =~ ^disable ]]; then - echo "Disabling Gnome-VRR" - NO_VRR_ARRAY=($(printf "%s\n" "${CURRENT_SETTINGS[@]}" | grep -v "variable-refresh-rate")) - FINAL_ARRAY=() - for item in "${NO_VRR_ARRAY[@]}"; do - FINAL_ARRAY+=("\"$item\"") - done - FINAL=$(printf "[%s]\n" "$(IFS=,; echo "${FINAL_ARRAY[*]}")") - gsettings set org.gnome.mutter experimental-features "${FINAL}" - fi - echo "To apply the changes make sure you logout and restart your session" - # Ptyxis terminal transparency [group('System')] ptyxis-transparency opacity="0.95": diff --git a/system_files/silverblue/usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override b/system_files/silverblue/usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override index 5a9eb72b736..8023a010953 100644 --- a/system_files/silverblue/usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override +++ b/system_files/silverblue/usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override @@ -66,7 +66,6 @@ sort-directories-first=true sort-directories-first=true [org.gnome.mutter] -experimental-features=['scale-monitor-framebuffer', 'xwayland-native-scaling'] check-alive-timeout=uint32 20000 [org.gnome.software]