diff --git a/bin/omarchy-cmd-screenshot b/bin/omarchy-cmd-screenshot index 9036c99582..295565460b 100755 --- a/bin/omarchy-cmd-screenshot +++ b/bin/omarchy-cmd-screenshot @@ -63,6 +63,34 @@ get_rectangles() { hyprctl clients -j | jq -r --arg ws "$active_workspace" '.[] | select(.workspace.id == ($ws | tonumber)) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' } +# Check if we're on an HDR display (NVIDIA GPUs often have issues with HDR screenshots) +is_hdr_nvidia() { + if command -v nvidia-smi &>/dev/null; then + # Check if any monitor is in HDR mode + hyprctl monitors -j 2>/dev/null | jq -e '.[] | select(.dynamic == true or .activeMonitor != null)' >/dev/null 2>&1 + return $? + fi + return 1 +} + +# Take screenshot with proper color handling for HDR displays +take_screenshot() { + local selection="$1" + local filepath="$2" + local use_wayfreeze="${3:-false}" + + if [[ $use_wayfreeze == "true" && -x $(command -v wayfreeze) ]]; then + # Use wayfreeze for HDR displays where hyprpicker causes color issues + wayfreeze -w & + FREEZE_PID=$! + sleep 0.2 + grim -g "$selection" "$filepath" || { kill $FREEZE_PID 2>/dev/null; return 1; } + kill $FREEZE_PID 2>/dev/null + else + grim -g "$selection" "$filepath" || return 1 + fi +} + # Select based on mode case "$MODE" in region) @@ -121,7 +149,13 @@ FILENAME="screenshot-$(date +'%Y-%m-%d_%H-%M-%S').png" FILEPATH="$OUTPUT_DIR/$FILENAME" if [[ $PROCESSING == "slurp" ]]; then - grim -g "$SELECTION" "$FILEPATH" || exit 1 + # Use wayfreeze if available and we have HDR issues, otherwise use hyprpicker + USE_WAYFREEZE="false" + if [[ -x $(command -v wayfreeze) ]]; then + USE_WAYFREEZE="true" + fi + + take_screenshot "$SELECTION" "$FILEPATH" "$USE_WAYFREEZE" || exit 1 wl-copy <"$FILEPATH" ( diff --git a/bin/omarchy-launch-walker b/bin/omarchy-launch-walker index cda02c4134..fe36860221 100755 --- a/bin/omarchy-launch-walker +++ b/bin/omarchy-launch-walker @@ -9,7 +9,23 @@ fi # Ensure walker service is running if ! pgrep -f "walker --gapplication-service" > /dev/null; then - setsid uwsm-app -- env GSK_RENDERER=cairo walker --gapplication-service & + setsid uwsm-app -- walker --gapplication-service & fi -exec walker --width 644 --maxheight 300 --minheight 300 "$@" +# Use default settings unless overridden by arguments +WALKER_WIDTH="${WALKER_WIDTH:-644}" +WALKER_MAXHEIGHT="${WALKER_MAXHEIGHT:-300}" +WALKER_MINHEIGHT="${WALKER_MINHEIGHT:-300}" + +# Check if --width, --maxheight, --minheight are passed in arguments +if [[ "$*" != *"--width"* ]]; then + WALKER_ARGS+=("--width" "$WALKER_WIDTH") +fi +if [[ "$*" != *"--maxheight"* ]]; then + WALKER_ARGS+=("--maxheight" "$WALKER_MAXHEIGHT") +fi +if [[ "$*" != *"--minheight"* ]]; then + WALKER_ARGS+=("--minheight" "$WALKER_MINHEIGHT") +fi + +exec walker "${WALKER_ARGS[@]}" "$@" diff --git a/default/hypr/apps.conf b/default/hypr/apps.conf index 777692cd49..b9f7de5aa5 100644 --- a/default/hypr/apps.conf +++ b/default/hypr/apps.conf @@ -16,3 +16,4 @@ source = ~/.local/share/omarchy/default/hypr/apps/typora.conf source = ~/.local/share/omarchy/default/hypr/apps/terminals.conf source = ~/.local/share/omarchy/default/hypr/apps/walker.conf source = ~/.local/share/omarchy/default/hypr/apps/webcam-overlay.conf +source = ~/.local/share/omarchy/default/hypr/apps/screen-sharing.conf diff --git a/default/hypr/apps/screen-sharing.conf b/default/hypr/apps/screen-sharing.conf new file mode 100644 index 0000000000..0e9b94c067 --- /dev/null +++ b/default/hypr/apps/screen-sharing.conf @@ -0,0 +1,17 @@ +# Screen sharing notification bar fixes +# Fix for: Screen sharing notification bar "Hide" button not responding to clicks +# The notification bar from Chromium/Chrome needs proper input handling + +# Note: These rules use Hyprland 0.53+ match: syntax + +# WebRTC indicator windows from Chromium should float and not steal focus +# but should still receive input for the Hide button +windowrule = float on, match:title ^(chrome-shill-webui|chrome-webui-media-router)$ +windowrule = no_focus on, match:title ^(chrome-shill-webui|chrome-webui-media-router)$ + +# Screen sharing notification bar - float and receive input +windowrule = float on, match:title .*(screen sharing|Sharing|is sharing|Stop sharing|Hide).* +windowrule = noborder on, match:title .*(screen sharing|Sharing|is sharing|Stop sharing|Hide).* + +# Ensure WebRTC indicator layer windows can receive input +# Note: layerrule uses match:namespace for namespace matching diff --git a/install/config/nvidia-chromium-flags.sh b/install/config/nvidia-chromium-flags.sh new file mode 100644 index 0000000000..005113c816 --- /dev/null +++ b/install/config/nvidia-chromium-flags.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Install Chromium flags for better NVIDIA Wayland stability +# Fix for: System lockups on NVIDIA GPUs when browsing media-heavy sites + +CHROMIUM_FLAGS_DIR="$HOME/.config" +mkdir -p "$CHROMIUM_FLAGS_DIR" + +# Write NVIDIA-optimized Chromium flags to the config file Omarchy reads +cat > "$CHROMIUM_FLAGS_DIR/chromium-flags.conf" << 'CONFEOF' +# NVIDIA-optimized Chromium flags for Wayland systems with NVIDIA GPUs +--ozone-platform=x11 +--enable-features=VaapiVideoDecoder,VaapiVideoEncoder +--disable-features=Vulkan,VulkanFromANGLE,DefaultANGLEVulkan +CONFEOF + +# Also set environment variables for Electron apps +NVIDIA_ENV_FILE="$HOME/.config/hypr/envs.conf" +if ! grep -q "OZONE_PLATFORM,x11" "$NVIDIA_ENV_FILE" 2>/dev/null; then + cat >> "$NVIDIA_ENV_FILE" << 'ENVEOF' + +# NVIDIA Chromium/Electron stability +env = ELECTRON_OZONE_PLATFORM_HINT,x11 +env = OZONE_PLATFORM,x11 +ENVEOF +fi + +notify-send "NVIDIA Chromium flags installed" "Stability improvements applied for NVIDIA GPUs" diff --git a/migrations/1777007316.sh b/migrations/1777007316.sh new file mode 100644 index 0000000000..b85b070e03 --- /dev/null +++ b/migrations/1777007316.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Fix screen sharing notification bar "Hide" button not responding +# See: https://github.com/basecamp/omarchy/issues/5373 + +echo "Adding screen sharing notification bar fixes" + +# Add screen-sharing.conf to the app configs if it doesn't exist +SCREEN_SHARING_CONF="$HOME/.config/hypr/apps/screen-sharing.conf" +if [[ ! -f $SCREEN_SHARING_CONF ]]; then + cat > "$SCREEN_SHARING_CONF" << 'CONFEOF' +# Screen sharing notification bar fixes +# Fix for: Screen sharing notification bar "Hide" button not responding to clicks +# The notification bar from Chromium/Chrome needs to be on a layer that receives input + +# Ensure notification popups from browsers receive input +windowrule = float, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide) +windowrule = noborder, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide) +windowrule = noblur, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide) +CONFEOF + notify-send "Screen sharing fix applied" "Restart Hyprland to apply changes" +fi diff --git a/migrations/1777007317.sh b/migrations/1777007317.sh new file mode 100644 index 0000000000..c20a95f482 --- /dev/null +++ b/migrations/1777007317.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Fix NVIDIA GPU system lockups on media-heavy sites +# See: https://github.com/basecamp/omarchy/issues/5372 + +echo "Adding NVIDIA Wayland stability fixes" + +# Check if we're on NVIDIA +if command -v nvidia-smi &>/dev/null; then + # Add NVIDIA-specific environment variables to the existing envs.conf + NVIDIA_ENV_FILE="$HOME/.config/hypr/envs.conf" + + # Ensure the file exists and is sourced + if [[ ! -f $NVIDIA_ENV_FILE ]]; then + mkdir -p "$(dirname "$NVIDIA_ENV_FILE")" + touch "$NVIDIA_ENV_FILE" + fi + + # Check if NVIDIA fixes are already applied + if ! grep -q "# NVIDIA Wayland stability fixes" "$NVIDIA_ENV_FILE" 2>/dev/null; then + cat >> "$NVIDIA_ENV_FILE" << 'CONFEOF' + +# NVIDIA Wayland stability fixes +# Use X11 platform hint for Chromium/Electron on NVIDIA Wayland +# This prevents VA-API/Vulkan conflicts that cause lockups +env = ELECTRON_OZONE_PLATFORM_HINT,x11 +env = OZONE_PLATFORM,x11 +CONFEOF + notify-send "NVIDIA stability fix applied" "Restart Hyprland to apply NVIDIA stability improvements" + else + echo "NVIDIA stability fix already applied" + fi +else + echo "No NVIDIA GPU detected, skipping NVIDIA-specific fixes" +fi diff --git a/migrations/1777007318.sh b/migrations/1777007318.sh new file mode 100644 index 0000000000..ed204fa3b9 --- /dev/null +++ b/migrations/1777007318.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Fix screenshot regression with hyprpicker on HDR displays +# See: https://github.com/basecamp/omarchy/issues/5376 + +echo "Adding screenshot HDR fix" + +# Backup existing screenshot script +if [[ -f ~/.local/share/omarchy/bin/omarchy-cmd-screenshot ]]; then + cp ~/.local/share/omarchy/bin/omarchy-cmd-screenshot ~/.local/share/omarchy/bin/omarchy-cmd-screenshot.bak +fi + +# The fix adds wayfreeze fallback for HDR displays where hyprpicker causes color issues +# wayfreeze was removed in migration 1762156000, but it may still be needed for HDR compatibility +# This migration reinstalls wayfreeze for users who need it + +if ! omarchy-cmd-present wayfreeze; then + if gum confirm "Install wayfreeze for better HDR screenshot support?"; then + omarchy-pkg-add wayfreeze + fi +fi + +notify-send "Screenshot HDR fix applied" "Restart Hyprland to apply changes"