diff --git a/bin/omarchy-capture-screenrecording b/bin/omarchy-capture-screenrecording index 68af8d63..8c047650 100755 --- a/bin/omarchy-capture-screenrecording +++ b/bin/omarchy-capture-screenrecording @@ -175,7 +175,10 @@ finalize_recording() { # Trim the first frame, and normalize audio to -14 LUFS if present, in a single pass local args=(-y -ss 0.1 -i "$latest" "${video_codec[@]}") if ffprobe -v error -select_streams a -show_entries stream=codec_type -of csv=p=0 "$latest" 2>/dev/null | grep -q audio; then - args+=(-af loudnorm=I=-14:TP=-1.5:LRA=11) + # Hard-mute the first 400ms to drop the PipeWire capture-open pop (a near-clipping + # transient around 130-200ms that a gentle fade-in can't attenuate enough), then a + # 50ms fade avoids a click at the boundary before loudnorm normalizes the rest. + args+=(-af "volume=enable='lt(t,0.4)':volume=0,afade=t=in:st=0.4:d=0.05,loudnorm=I=-14:TP=-1.5:LRA=11") fi local processed="${latest%.mp4}-processed.mp4" diff --git a/bin/omarchy-capture-text-extraction b/bin/omarchy-capture-text-extraction new file mode 100755 index 00000000..cb0c62b5 --- /dev/null +++ b/bin/omarchy-capture-text-extraction @@ -0,0 +1,26 @@ +#!/bin/bash + +# omarchy:summary=Extract text from a screenshot region with OCR +# omarchy:group=capture +# omarchy:examples=omarchy capture ocr + +# Keep hyprpicker alive until after grim captures so the screenshot sees the +# frozen overlay rather than live content shifting during teardown. +cleanup_freeze() { + [[ -n $PID ]] && kill $PID 2>/dev/null +} +trap cleanup_freeze EXIT + +hyprpicker -r -z >/dev/null 2>&1 & +PID=$! +sleep .1 +SELECTION=$(slurp 2>/dev/null) + +[[ -z $SELECTION ]] && exit 0 + +TEXT=$(grim -g "$SELECTION" - | tesseract stdin stdout --oem 1 --psm 6 -l eng --dpi 300 -c preserve_interword_spaces=1 2>/dev/null) || exit 1 + +[[ -z $TEXT ]] && exit 1 + +printf "%s" "$TEXT" | wl-copy +notify-send "󰴑 Copied text from selection to clipboard" diff --git a/bin/omarchy-hw-nvidia-gsp b/bin/omarchy-hw-nvidia-gsp new file mode 100755 index 00000000..06af2a3e --- /dev/null +++ b/bin/omarchy-hw-nvidia-gsp @@ -0,0 +1,6 @@ +#!/bin/bash + +# omarchy:summary=Detect whether the computer has an NVIDIA GPU with GSP firmware (Turing or newer). + +# GTX 16xx, RTX 20xx-50xx, RTX Pro, Quadro RTX, datacenter A/H/T/L series. +lspci | grep -i 'nvidia' | grep -qE "GTX 16[0-9]{2}|RTX [2-5][0-9]{3}|RTX PRO [0-9]{4}|Quadro RTX|RTX A[0-9]{4}|A[1-9][0-9]{2}|H[1-9][0-9]{2}|T4|L[0-9]+" diff --git a/bin/omarchy-hw-nvidia-without-gsp b/bin/omarchy-hw-nvidia-without-gsp new file mode 100755 index 00000000..177e60b6 --- /dev/null +++ b/bin/omarchy-hw-nvidia-without-gsp @@ -0,0 +1,6 @@ +#!/bin/bash + +# omarchy:summary=Detect whether the computer has an NVIDIA GPU without GSP firmware (Maxwell/Pascal/Volta). + +# GTX 9xx/10xx, GT 10xx, Quadro P/M/GV, MX series, Titan X/Xp/V, Tesla V100. +lspci | grep -i 'nvidia' | grep -qE "GTX (9[0-9]{2}|10[0-9]{2})|GT 10[0-9]{2}|Quadro [PM][0-9]{3,4}|Quadro GV100|MX *[0-9]+|Titan (X|Xp|V)|Tesla V100" diff --git a/bin/omarchy-install-steam b/bin/omarchy-install-steam index 8d88f7d7..5765ea84 100755 --- a/bin/omarchy-install-steam +++ b/bin/omarchy-install-steam @@ -5,6 +5,28 @@ set -e -echo "Now pick dependencies matching your graphics card" -sudo pacman -S steam +PACKAGES=(steam) + +# Pick the lib32 vulkan provider matching detected GPU(s) so pacman doesn't prompt. +if omarchy-hw-nvidia-gsp; then + PACKAGES+=(lib32-nvidia-utils) +elif omarchy-hw-nvidia-without-gsp; then + PACKAGES+=(lib32-nvidia-580xx-utils) +fi + +declare -A VULKAN_DRIVERS=( + [Intel]=lib32-vulkan-intel + [AMD]=lib32-vulkan-radeon +) +for vendor in "${!VULKAN_DRIVERS[@]}"; do + if lspci | grep -iE "(VGA|Display).*$vendor" >/dev/null; then + PACKAGES+=("${VULKAN_DRIVERS[$vendor]}") + fi +done + +omarchy-pkg-add "${PACKAGES[@]}" + +echo "" +echo "Steam will start automatically now. This might take a while..." + setsid gtk-launch steam >/dev/null 2>&1 & diff --git a/bin/omarchy-menu b/bin/omarchy-menu index d7dd9eb6..93bc0018 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -103,9 +103,10 @@ show_trigger_menu() { } show_capture_menu() { - case $(menu "Capture" " Screenshot\n Screenrecord\n󰃉 Color") in + case $(menu "Capture" " Screenshot\n Screenrecord\n󰴑 Text Extraction\n󰃉 Color") in *Screenshot*) omarchy-capture-screenshot ;; *Screenrecord*) show_screenrecord_menu ;; + *Text*) omarchy-capture-text-extraction ;; *Color*) pkill hyprpicker || hyprpicker -a ;; *) back_to show_trigger_menu ;; esac diff --git a/bin/omarchy-refresh-plymouth b/bin/omarchy-refresh-plymouth index 44dfe3d8..5a9671d7 100755 --- a/bin/omarchy-refresh-plymouth +++ b/bin/omarchy-refresh-plymouth @@ -3,7 +3,7 @@ # omarchy:summary=Overwrite the user config for the Plymouth drive decryption and boot sequence with the Omarchy default and rebuild it. # omarchy:requires-sudo=true -sudo cp ~/.local/share/omarchy/default/plymouth/* /usr/share/plymouth/themes/omarchy/ +sudo cp -r ~/.local/share/omarchy/default/plymouth/* /usr/share/plymouth/themes/omarchy/ sudo plymouth-set-default-theme omarchy if command -v limine-mkinitcpio &>/dev/null; then diff --git a/bin/omarchy-setup-dns b/bin/omarchy-setup-dns index fc88f81b..b62e0610 100755 --- a/bin/omarchy-setup-dns +++ b/bin/omarchy-setup-dns @@ -37,8 +37,8 @@ case "$dns" in Cloudflare) sudo tee /etc/systemd/resolved.conf >/dev/null <<'EOF' [Resolve] -DNS=1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com -FallbackDNS=9.9.9.9 149.112.112.112 +DNS=1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com +FallbackDNS=9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net DNSOverTLS=opportunistic EOF lock_dns_to_resolved @@ -47,8 +47,8 @@ EOF Google) sudo tee /etc/systemd/resolved.conf >/dev/null <<'EOF' [Resolve] -DNS=8.8.8.8#dns.google 8.8.4.4#dns.google -FallbackDNS=9.9.9.9 149.112.112.112 +DNS=8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google +FallbackDNS=9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net DNSOverTLS=opportunistic EOF lock_dns_to_resolved @@ -74,7 +74,7 @@ Custom) sudo tee /etc/systemd/resolved.conf >/dev/null < 1.0) - time_ratio = 1.0; - - # Apply easing curve: ease-out quadratic - # Formula: 1 - (1 - x)^2 - eased_ratio = 1 - ((1 - time_ratio) * (1 - time_ratio)); - - # Calculate fake progress based on eased ratio - global.fake_progress = eased_ratio * global.fake_progress_limit; - - # Update progress bar with fake progress - update_progress_bar(global.fake_progress); - } +fun refresh_callback() { + global.animation_frame++; + + # Animate fake progress to limit over time with easing + if (global.fake_progress_active == 1) { + # Calculate elapsed time since start + elapsed_time = global.animation_frame / 50.0; # Convert frames to seconds (50 FPS) + + # Calculate linear progress ratio (0 to 1) based on time + time_ratio = elapsed_time / global.fake_progress_duration; + if (time_ratio > 1.0) time_ratio = 1.0; + + # Apply easing curve: ease-out quadratic + # Formula: 1 - (1 - x)^2 + eased_ratio = 1 - ((1 - time_ratio) * (1 - time_ratio)); + + # Calculate fake progress based on eased ratio + global.fake_progress = eased_ratio * global.fake_progress_limit; + + # Update progress bar with fake progress + update_progress_bar(global.fake_progress); } +} - -Plymouth.SetRefreshFunction (refresh_callback); +Plymouth.SetRefreshFunction(refresh_callback); #----------------------------------------- Helper Functions -------------------------------- -fun update_progress_bar(progress) - { - # Only update if progress is moving forward - if (progress > global.max_progress) - { - global.max_progress = progress; - width = Math.Int(progress_bar.original_image.GetWidth() * progress); - if (width < 1) width = 1; # Ensure minimum width of 1 pixel - - progress_bar.image = progress_bar.original_image.Scale(width, progress_bar.original_image.GetHeight()); - progress_bar.sprite.SetImage(progress_bar.image); - } - } +fun update_progress_bar(progress) { + # Only update if progress is moving forward + if (progress > global.max_progress) { + global.max_progress = progress; -fun show_progress_bar() - { - progress_box.sprite.SetOpacity(1); - progress_bar.sprite.SetOpacity(1); - } + width = Math.Int(progress_bar.original_image.GetWidth() * progress); + if (width < 1) width = 1; # Ensure minimum width of 1 pixel -fun hide_progress_bar() - { - progress_box.sprite.SetOpacity(0); - progress_bar.sprite.SetOpacity(0); + progress_bar.image = progress_bar.original_image.Scale(width, progress_bar.original_image.GetHeight()); + progress_bar.sprite.SetImage(progress_bar.image); } +} -fun show_password_dialog() - { - lock.sprite.SetOpacity(1); - entry.sprite.SetOpacity(1); - } +fun show_progress_bar() { + progress_box.sprite.SetOpacity(1); + progress_bar.sprite.SetOpacity(1); +} -fun hide_password_dialog() - { - lock.sprite.SetOpacity(0); - entry.sprite.SetOpacity(0); - for (index = 0; bullet.sprites[index]; index++) - bullet.sprites[index].SetOpacity(0); - } +fun hide_progress_bar() { + progress_box.sprite.SetOpacity(0); + progress_bar.sprite.SetOpacity(0); +} -fun start_fake_progress() - { - # Don't reset if we already have progress - if (global.max_progress == 0.0) - { - global.fake_progress = 0.0; - global.real_progress = 0.0; - update_progress_bar(0.0); - } - global.fake_progress_active = 1; - global.animation_frame = 0; - } +fun show_password_dialog() { + lock.sprite.SetOpacity(1); + entry.sprite.SetOpacity(1); +} -fun stop_fake_progress() - { - global.fake_progress_active = 0; +fun hide_password_dialog() { + lock.sprite.SetOpacity(0); + entry.sprite.SetOpacity(0); + + for (index = 0; bullet.sprites[index]; index++) { + bullet.sprites[index].SetOpacity(0); } +} + +fun start_fake_progress() { + global.fake_progress_active = 1; + + # Reset fake progress + global.animation_frame = 0; + global.max_progress = 0.0; + global.fake_progress = 0.0; + global.fake_progress_start_time = 0.0; +} + +fun stop_fake_progress() { + global.fake_progress_active = 0; +} #----------------------------------------- Dialogue -------------------------------- @@ -119,7 +108,7 @@ entry.image = Image("entry.png"); bullet.image = Image("bullet.png"); entry.sprite = Sprite(entry.image); -entry.x = Window.GetWidth()/2 - entry.image.GetWidth() / 2; +entry.x = Window.GetWidth() / 2 - entry.image.GetWidth() / 2; entry.y = logo.sprite.GetY() + logo.image.GetHeight() + 40; entry.sprite.SetPosition(entry.x, entry.y, 10001); entry.sprite.SetOpacity(0); @@ -133,65 +122,60 @@ lock_width = 84 * lock_scale; scaled_lock = lock.image.Scale(lock_width, lock_height); lock.sprite = Sprite(scaled_lock); lock.x = entry.x - lock_width - 15; -lock.y = entry.y + entry.image.GetHeight()/2 - lock_height/2; +lock.y = entry.y + entry.image.GetHeight() / 2 - lock_height / 2; lock.sprite.SetPosition(lock.x, lock.y, 10001); lock.sprite.SetOpacity(0); # Bullet array bullet.sprites = []; -fun display_normal_callback () - { - hide_password_dialog(); - - # Get current mode - mode = Plymouth.GetMode(); - - # Only show progress bar for boot and resume modes - if ((mode == "boot" || mode == "resume") && global.password_shown == 1) - { - show_progress_bar(); - start_fake_progress(); - } +fun display_normal_callback() { + hide_password_dialog(); + + # Get current mode + mode = Plymouth.GetMode(); + + # Only show progress bar for boot and resume modes + if ((mode == "boot" || mode == "resume") && global.password_shown == 1) { + show_progress_bar(); + start_fake_progress(); + } +} + +fun display_password_callback(prompt, bullets) { + global.password_shown = 1; # Mark that password dialog has been shown + + # Stop fake progress when password dialog appears + stop_fake_progress(); + hide_progress_bar(); + show_password_dialog(); + + # Clear all bullets first + for (index = 0; bullet.sprites[index]; index++) { + bullet.sprites[index].SetOpacity(0); } -fun display_password_callback (prompt, bullets) - { - global.password_shown = 1; # Mark that password dialog has been shown - - # Reset progress when password dialog appears - stop_fake_progress(); - hide_progress_bar(); - global.max_progress = 0.0; - global.fake_progress = 0.0; - global.real_progress = 0.0; - show_password_dialog(); - - # Clear all bullets first - for (index = 0; bullet.sprites[index]; index++) - bullet.sprites[index].SetOpacity(0); - - # Create and show bullets for current password (max 21) - max_bullets = 21; - bullets_to_show = bullets; - if (bullets_to_show > max_bullets) - bullets_to_show = max_bullets; - - for (index = 0; index < bullets_to_show; index++) - { - if (!bullet.sprites[index]) - { - # Scale bullet image to 7x7 pixels - scaled_bullet = bullet.image.Scale(7, 7); - bullet.sprites[index] = Sprite(scaled_bullet); - bullet.x = entry.x + 20 + index * (7 + 5); - bullet.y = entry.y + entry.image.GetHeight() / 2 - 3.5; - bullet.sprites[index].SetPosition(bullet.x, bullet.y, 10002); - } - bullet.sprites[index].SetOpacity(1); - } + # Create and show bullets for current password (max 21) + max_bullets = 21; + bullets_to_show = bullets; + if (bullets_to_show > max_bullets) { + bullets_to_show = max_bullets; } + for (index = 0; index < bullets_to_show; index++) { + if (!bullet.sprites[index]) { + # Scale bullet image to 7x7 pixels + scaled_bullet = bullet.image.Scale(7, 7); + bullet.sprites[index] = Sprite(scaled_bullet); + bullet.x = entry.x + 20 + index * (7 + 5); + bullet.y = entry.y + entry.image.GetHeight() / 2 - 3.5; + bullet.sprites[index].SetPosition(bullet.x, bullet.y, 10002); + } + + bullet.sprites[index].SetOpacity(1); + } +} + Plymouth.SetDisplayNormalFunction(display_normal_callback); Plymouth.SetDisplayPasswordFunction(display_password_callback); @@ -214,44 +198,38 @@ progress_bar.y = progress_box.y + (progress_box.image.GetHeight() - progress_bar progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1); progress_bar.sprite.SetOpacity(0); -fun progress_callback (duration, progress) - { - global.real_progress = progress; - - # If real progress is above limit, stop fake progress and use real progress - if (progress > global.fake_progress_limit) - { - stop_fake_progress(); - update_progress_bar(progress); - } +fun progress_callback(duration, progress) { + # Track when fake progress starts + # Needed because duration and progress freeze during drive decryption + if (global.fake_progress_start_time == 0.0) { + global.fake_progress_start_time = duration; } -Plymouth.SetBootProgressFunction(progress_callback); + global.real_progress = progress; -#----------------------------------------- Quit -------------------------------- - -fun quit_callback () -{ - logo.sprite.SetOpacity (1); + # Use real progress once its unfrozen and exceeds fake progress + if (duration > global.fake_progress_start_time && progress > global.fake_progress) { + stop_fake_progress(); + update_progress_bar(progress); + } } -Plymouth.SetQuitFunction(quit_callback); +Plymouth.SetBootProgressFunction(progress_callback); #----------------------------------------- Message -------------------------------- message_sprite = Sprite(); message_sprite.SetPosition(10, 10, 10000); -fun display_message_callback (text) -{ - my_image = Image.Text(text, 1, 1, 1); - message_sprite.SetImage(my_image); +fun display_message_callback(text) { + message = Image.Text(text, 1, 1, 1); + message_sprite.SetImage(message); + message_sprite.SetOpacity(1); } -fun hide_message_callback (text) -{ +fun hide_message_callback(text) { message_sprite.SetOpacity(0); } -Plymouth.SetDisplayMessageFunction (display_message_callback); -Plymouth.SetHideMessageFunction (hide_message_callback); +Plymouth.SetDisplayMessageFunction(display_message_callback); +Plymouth.SetHideMessageFunction(hide_message_callback); diff --git a/install/config/all.sh b/install/config/all.sh index 2fd0f02c..bdd3f4ba 100644 --- a/install/config/all.sh +++ b/install/config/all.sh @@ -8,6 +8,7 @@ run_logged $OMARCHY_INSTALL/config/increase-sudo-tries.sh run_logged $OMARCHY_INSTALL/config/increase-lockout-limit.sh run_logged $OMARCHY_INSTALL/config/ssh-flakiness.sh run_logged $OMARCHY_INSTALL/config/increase-file-watchers.sh +run_logged $OMARCHY_INSTALL/config/increase-fd-limit.sh run_logged $OMARCHY_INSTALL/config/detect-keyboard-layout.sh run_logged $OMARCHY_INSTALL/config/xcompose.sh run_logged $OMARCHY_INSTALL/config/mise-work.sh diff --git a/install/config/hardware/nvidia.sh b/install/config/hardware/nvidia.sh index 5fb37232..dddcf7e4 100644 --- a/install/config/hardware/nvidia.sh +++ b/install/config/hardware/nvidia.sh @@ -1,15 +1,11 @@ -NVIDIA="$(lspci | grep -i 'nvidia')" - -if [[ -n $NVIDIA ]]; then +if lspci | grep -qi 'nvidia'; then # Check which kernel is installed and set appropriate headers package KERNEL_HEADERS="$(pacman -Qqs '^linux(-zen|-lts|-hardened)?$' | head -1)-headers" - # Turing+ (GTX 16xx, RTX 20xx-50xx, RTX Pro, Quadro RTX, datacenter A/H/T/L series) have GSP firmware - if echo "$NVIDIA" | grep -qE "GTX 16[0-9]{2}|RTX [2-5][0-9]{3}|RTX PRO [0-9]{4}|Quadro RTX|RTX A[0-9]{4}|A[1-9][0-9]{2}|H[1-9][0-9]{2}|T4|L[0-9]+"; then + if omarchy-hw-nvidia-gsp; then PACKAGES=(nvidia-open-dkms nvidia-utils lib32-nvidia-utils libva-nvidia-driver) GPU_ARCH="turing_plus" - # Maxwell (GTX 9xx), Pascal (GT/GTX 10xx, Quadro P, MX series), Volta (Titan V, Tesla V100, Quadro GV100) lack GSP - elif echo "$NVIDIA" | grep -qE "GTX (9[0-9]{2}|10[0-9]{2})|GT 10[0-9]{2}|Quadro [PM][0-9]{3,4}|Quadro GV100|MX *[0-9]+|Titan (X|Xp|V)|Tesla V100"; then + elif omarchy-hw-nvidia-without-gsp; then PACKAGES=(nvidia-580xx-dkms nvidia-580xx-utils lib32-nvidia-580xx-utils) GPU_ARCH="maxwell_pascal_volta" fi diff --git a/install/config/increase-fd-limit.sh b/install/config/increase-fd-limit.sh new file mode 100755 index 00000000..45f1e2ea --- /dev/null +++ b/install/config/increase-fd-limit.sh @@ -0,0 +1,11 @@ +# Raise soft file descriptor limit from systemd's default of 1024 to 65536 +# so dev tools (VS Code, Docker, dev servers, databases) get the headroom they need +sudo mkdir -p /etc/systemd/system.conf.d /etc/systemd/user.conf.d + +sudo tee /etc/systemd/system.conf.d/99-omarchy-nofile.conf >/dev/null <<'EOF' +[Manager] +DefaultLimitNOFILESoft=65536 +EOF + +sudo cp /etc/systemd/system.conf.d/99-omarchy-nofile.conf \ + /etc/systemd/user.conf.d/99-omarchy-nofile.conf diff --git a/install/omarchy-base.packages b/install/omarchy-base.packages index 4d609b8e..acdddc47 100644 --- a/install/omarchy-base.packages +++ b/install/omarchy-base.packages @@ -120,6 +120,8 @@ sushi swaybg swayosd system-config-printer +tesseract +tesseract-data-eng tldr tree-sitter-cli tmux diff --git a/migrations/1758734243.sh b/migrations/1758734243.sh new file mode 100644 index 00000000..a264567e --- /dev/null +++ b/migrations/1758734243.sh @@ -0,0 +1,3 @@ +echo "Install tesseract OCR and language data files" + +omarchy-pkg-add tesseract tesseract-data-eng \ No newline at end of file diff --git a/migrations/1764272475.sh b/migrations/1764272475.sh new file mode 100644 index 00000000..36a7299a --- /dev/null +++ b/migrations/1764272475.sh @@ -0,0 +1,2 @@ +echo "Update Plymouth theme for a smoother progress bar animation" +omarchy-refresh-plymouth diff --git a/migrations/1777813290.sh b/migrations/1777813290.sh new file mode 100755 index 00000000..e341c7a4 --- /dev/null +++ b/migrations/1777813290.sh @@ -0,0 +1,3 @@ +echo "Raise soft file descriptor limit so dev tools have headroom (takes effect after reboot)" + +bash $OMARCHY_PATH/install/config/increase-fd-limit.sh