My Quick Notes

Ain't Nobody Got Time to Read

March 11, 2026

Tạo màn hình khóa vui nhộn trong Hyprland

Yêu cầu cài thêm:

  • grim: để chụp màn hình.
  • ImageMagick: để sửa ảnh.
  • Tạo script ~/.local/bin/lock_screen.sh với nội dung:

    #!/bin/bash
    
    # Take screenshot
    grim /tmp/screen.png
    
    # Pixelate it
    convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png
    
    # Optional: Add a overlay image at center
    # convert /tmp/screen.png <your_image> -gravity center -composite -matte /tmp/screen.png
    
    # Lock screen
    hyprlock
  • Thêm quyền chạy:

    chmod +x ~/.local/bin/lock_screen.sh
  • Sửa file ~/.config/hypr/hyprlock.conf để dùng file /tmp/screen.png như hình nền khóa:

    background {
        path = /tmp/screen.png
    }
  • Sửa file ~/.config/hypr/hyprland.conf gọi script lock_screen.sh khi bấm Window+L:

    # Lock screen when press $mainMod + L
    bind = $mainMod, L, exec, ~/.local/bin/lock_screen.sh
  • Sửa ~/.config/hypr/hypridle.conf để dùng lock_screen.sh khi tự động khóa màn hình:

    general {
        lock_cmd = pidof hyprlock | ~/.local/bin/lock_screen.sh
        before_sleep_cmd = loginctl lock-session
        after_sleep_cmd = hyprctl dispatch dpms on
    }
    
    listener {
        timeout = 300
        on-timeout = loginctl lock-session
    }
    
    listener {
        timeout = 360
        on-timeout = hyprctl dispatch dpms off
        on-resume = hyprctl dispatch dpms on
    }
Bài trướcCài đặt local edit prediction cho Zed
Bài tiếpCài đặt local agent trên Raspberry Pi 5 với OpenClaw và Ollama

Bình luận