Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions bin/omarchy-brightness-keyboard
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,44 @@ fi
max_brightness="$(brightnessctl -d "$device" max)"
current_brightness="$(brightnessctl -d "$device" get)"

# Calculate step as 10% of max brightness. Keyboards with many levels (e.g. 512)
# need larger steps; keyboards with few levels (e.g. 3) fall back to step=1.
step=$(( max_brightness / 10 ))
(( step < 1 )) && step=1
# Calculate step as percentage-based to ensure consistent behavior
# Use 10 steps for smooth brightness control (0%, 10%, 20%, ..., 100%)
num_steps=10
step_size=$((max_brightness / num_steps))
[[ $step_size -lt 1 ]] && step_size=1

if [[ $direction == "cycle" ]]; then
new_brightness=$(( current_brightness + step ))
(( new_brightness > max_brightness )) && new_brightness=0
# Cycle through brightness levels: 0 -> 50% -> 100% -> 0
if [[ $current_brightness -eq 0 ]]; then
new_brightness=$((max_brightness / 2))
elif [[ $current_brightness -eq $((max_brightness / 2)) ]]; then
new_brightness=$max_brightness
else
new_brightness=0
fi
elif [[ $direction == "up" ]]; then
new_brightness=$(( current_brightness + step ))
(( new_brightness > max_brightness )) && new_brightness=$max_brightness
# Find the next brightness level going up
current_percent=$((current_brightness * 100 / max_brightness))
next_percent=$(( (current_percent / 10 + 1) * 10 ))
[[ $next_percent -gt 100 ]] && next_percent=100
new_brightness=$((max_brightness * next_percent / 100))
[[ $new_brightness -le $current_brightness ]] && new_brightness=$((current_brightness + step_size))
[[ $new_brightness -gt $max_brightness ]] && new_brightness=$max_brightness
else
new_brightness=$(( current_brightness - step ))
(( new_brightness < 0 )) && new_brightness=0
# Find the next brightness level going down
current_percent=$((current_brightness * 100 / max_brightness))
next_percent=$(( (current_percent + 5) / 10 * 10 ))
[[ $next_percent -ge $current_percent ]] && [[ $current_percent -gt 0 ]] && next_percent=$((next_percent - 10))
[[ $next_percent -lt 0 ]] && next_percent=0
new_brightness=$((max_brightness * next_percent / 100))
[[ $new_brightness -ge $current_brightness ]] && new_brightness=$((current_brightness - step_size))
[[ $new_brightness -lt 0 ]] && new_brightness=0
fi

# Set the new brightness.
[[ $new_brightness -lt 0 ]] && new_brightness=0
[[ $new_brightness -gt $max_brightness ]] && new_brightness=$max_brightness

brightnessctl -d "$device" set "$new_brightness" >/dev/null

# Use SwayOSD to display the new brightness setting.
percent=$((new_brightness * 100 / max_brightness))
omarchy-swayosd-kbd-brightness "$percent"
36 changes: 35 additions & 1 deletion bin/omarchy-cmd-screenshot
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"

(
Expand Down
20 changes: 18 additions & 2 deletions bin/omarchy-launch-walker
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}" "$@"
1 change: 1 addition & 0 deletions default/hypr/apps.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 16 additions & 0 deletions default/hypr/apps/screen-sharing.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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

# Allow input on screen sharing indicator windows (Chromium/Chrome WebRTC indicator)
windowrule = opacity 1.0 1.0, class:^(chrome-shill-webui|chrome-webui-media-router|chrome-extension),title:.*(screen|sharing|tab|cast).*
windowrule = nofocus, class:^(chrome-shill-webui|chrome-webui-media-router),title:.*indicator.*

# 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)

# Force the WebRTC indicator to be focusable and receive mouse events
layerrule = ignore_zero_containers on, class:^(chrome-shill-webui|chrome-webui-media-router)$
layerrule = no_anim on, class:^(chrome-shill-webui|chrome-webui-media-router)$
Comment on lines +6 to +16
25 changes: 25 additions & 0 deletions install/config/nvidia-chromium-flags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/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/chromium-flags"
mkdir -p "$CHROMIUM_FLAGS_DIR"

# Create a helper script that sets NVIDIA-optimized flags
cat > "$HOME/.config/chromium-flags/set-flags" << 'EOF'
#!/bin/bash
# NVIDIA-optimized Chromium flags for Wayland
# Prevents system lockups on media-heavy sites

# Use X11 backend instead of Wayland for Chromium on NVIDIA
# Wayland + NVIDIA + Chromium can cause lockups
export CHROMIUM_FLAGS="--ozone-platform=x11 --enable-features=VaapiVideoDecoder,VaapiVideoEncoder --disable-features=Vulkan, VulkanFromANGLE, DefaultANGLEVulkan"

# Apply to Electron apps too
export ELECTRON_OZONE_PLATFORM_HINT=x11
EOF

chmod +x "$HOME/.config/chromium-flags/set-flags"

Comment on lines +6 to +24
notify-send "NVIDIA Chromium flags installed" "Stability improvements applied for NVIDIA GPUs"
38 changes: 29 additions & 9 deletions install/config/powerprofilesctl-rules.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
if omarchy-battery-present; then
cat <<EOF | sudo tee "/etc/udev/rules.d/99-power-profile.rules"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"
EOF

sudo udevadm control --reload 2>/dev/null
sudo udevadm trigger --subsystem-match=power_supply 2>/dev/null
fi
#!/bin/bash

# Udev rules for automatic power profile switching based on AC/battery state.
# Handles both traditional Mains power supplies and USB-C power delivery.

echo "Installing power profile udev rules..."

# Get absolute path for the script
OMARCHY_SCRIPT="$(realpath "$HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set" 2>/dev/null || echo "$HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set")"

# Create udev rules for power profile switching
cat << RULESEOF > /tmp/99-power-profile.rules
# Power profile switching for traditional AC (Mains) power supplies
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $OMARCHY_SCRIPT battery"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $OMARCHY_SCRIPT ac"

# Power profile switching for USB-C Power Delivery
# Many modern laptops (ThinkPads, MacBooks, ultrabooks) use USB-C for charging
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $OMARCHY_SCRIPT battery"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $OMARCHY_SCRIPT ac"
RULESEOF

sudo mv /tmp/99-power-profile.rules /etc/udev/rules.d/99-power-profile.rules

# Reload udev rules and trigger power supply events
sudo udevadm control --reload 2>/dev/null
sudo udevadm trigger --subsystem-match=power_supply 2>/dev/null

echo "Power profile udev rules installed successfully!"
Comment on lines +25 to +29
40 changes: 40 additions & 0 deletions install/config/waybar-timezone-fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Fix Waybar clock timezone to use system local time instead of UTC
# See: https://github.com/basecamp/omarchy/issues/5380

echo "Fixing Waybar clock timezone..."

WAYBAR_CONFIG="$HOME/.config/waybar/config.jsonc"

if [[ -f "$WAYBAR_CONFIG" ]]; then
# Check if timezone is already set
if grep -q '"timezone"' "$WAYBAR_CONFIG"; then
echo "Timezone already configured in Waybar"
else
# Get system timezone
SYSTEM_TZ=$(timedatectl show --property=Timezone --value 2>/dev/null || echo "")

if [[ -n "$SYSTEM_TZ" ]]; then
# Use sed to add timezone to clock config
# Add timezone after the format line in the clock section
sed -i "/\"clock\":/{
n;s/\"format\"/\"timezone\": \"$SYSTEM_TZ\",\n \"format\"/
Comment on lines +19 to +22
}" "$WAYBAR_CONFIG"
echo "Added timezone '$SYSTEM_TZ' to Waybar clock config"
else
# Fallback: add empty timezone to use system local time
sed -i "/\"clock\":/{
n;s/\"format\"/\"timezone\": \"\",\n \"format\"/
}" "$WAYBAR_CONFIG"
echo "Added empty timezone (will use system local time)"
fi

# Restart waybar to apply changes
omarchy-restart-waybar 2>/dev/null || true
fi
else
echo "Waybar config not found at $WAYBAR_CONFIG"
fi

echo "Waybar clock timezone fix complete!"
22 changes: 22 additions & 0 deletions migrations/1777007316.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Fix screen sharing notification bar "Hide" button not responding
# See: https://github.com/basecamp/omarchy/issues/5373

Comment on lines +1 to +5
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)
Comment on lines +17 to +19
CONFEOF
notify-send "Screen sharing fix applied" "Restart Hyprland to apply changes"
fi
28 changes: 28 additions & 0 deletions migrations/1777007317.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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
NVIDIA_ENV_FILE="$HOME/.config/hypr/env-nvidia.conf"

if [[ ! -f $NVIDIA_ENV_FILE ]]; then
cat > "$NVIDIA_ENV_FILE" << 'CONFEOF'
# NVIDIA-specific environment variables for better Wayland compatibility
# Fix for: System lockups on NVIDIA GPUs when browsing media-heavy sites
# These flags improve stability and prevent DMA allocation errors

# 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"
fi
else
echo "No NVIDIA GPU detected, skipping NVIDIA-specific fixes"
fi
23 changes: 23 additions & 0 deletions migrations/1777007318.sh
Original file line number Diff line number Diff line change
@@ -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"
38 changes: 38 additions & 0 deletions migrations/1777007400.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# Fix auto power profile switching on USB-C only machines
# See: https://github.com/basecamp/omarchy/issues/5412

echo "Fixing power profile switching for USB-C machines..."

# Check if we're on a USB-C only machine
HAS_MAINS=$(cat /sys/class/power_supply/AC/type 2>/dev/null | grep -c "Mains" || echo 0)
HAS_USB=$(ls /sys/class/power_supply/*/type 2>/dev/null | xargs grep -l "USB" 2>/dev/null | head -1)

if [[ "$HAS_MAINS" -eq 0 && -n "$HAS_USB" ]]; then
echo "USB-C only machine detected, adding USB power supply udev rules..."
fi

# Update the udev rules for power profile switching
cat << 'EOF' | sudo tee "/etc/udev/rules.d/99-power-profile.rules" > /dev/null
# Power profile switching for traditional AC (Mains) power supplies
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"

# Power profile switching for USB-C Power Delivery
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"
Comment on lines +23 to +24

# Additional support for USB-C Power Source devices
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"
Comment on lines +16 to +28
EOF

# Ensure power-profiles-daemon is enabled
sudo systemctl enable power-profiles-daemon 2>/dev/null || true

# Reload udev rules and trigger power supply events
sudo udevadm control --reload 2>/dev/null
sudo udevadm trigger --subsystem-match=power_supply 2>/dev/null

notify-send "Power profile fix applied" "USB-C power profile switching enabled. Restart if not working."
Loading