Skip to content

Commit

Permalink
feat: set mutter experimental kms-modifiers for nvidia (#1978)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsherman authored Nov 25, 2024
1 parent 520de03 commit b6b35f9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 44 deletions.
15 changes: 13 additions & 2 deletions build_files/base/07-base-image-changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
41 changes: 0 additions & 41 deletions just/bluefin-system.just
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit b6b35f9

Please sign in to comment.