{"id":48093538,"url":"https://github.com/aserper/arch-lidswitch","last_synced_at":"2026-04-04T15:33:38.439Z","repository":{"id":312207184,"uuid":"1046682649","full_name":"aserper/arch-lidswitch","owner":"aserper","description":"A script for omarchy (arch+hyprland) that installs an intelligent watchdog that listens to events coming from your laptop lidswitch closing/opening and then modifies your hyprland configuration accordingly","archived":false,"fork":false,"pushed_at":"2025-12-13T07:05:23.000Z","size":16,"stargazers_count":5,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-23T14:43:10.980Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aserper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-29T04:10:48.000Z","updated_at":"2025-12-18T04:25:18.000Z","dependencies_parsed_at":"2025-08-29T08:29:55.789Z","dependency_job_id":"8f5e0f0e-4d44-495b-aa44-45e73baacb2c","html_url":"https://github.com/aserper/arch-lidswitch","commit_stats":null,"previous_names":["aserper/arch-lidswitch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aserper/arch-lidswitch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserper%2Farch-lidswitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserper%2Farch-lidswitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserper%2Farch-lidswitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserper%2Farch-lidswitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aserper","download_url":"https://codeload.github.com/aserper/arch-lidswitch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserper%2Farch-lidswitch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31403959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T15:33:33.224Z","updated_at":"2026-04-04T15:33:37.655Z","avatar_url":"https://github.com/aserper.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hyprland Lid Switch Handler\n\nAn automatic lid switch handler for Hyprland that intelligently manages monitor configuration when using laptops with external displays.\n\n## Features\n\n- 🔄 **Automatic Monitor Management**: Seamlessly switches between laptop and external monitors based on lid state\n- 🖥️ **Smart Detection**: Automatically detects laptop screen (eDP-*) and external monitors (DP-*/HDMI-*/USB-C-*)\n- ⚡ **Instant Response**: Real-time lid state monitoring with ~1 second response time  \n- 🛡️ **Safe Implementation**: Uses Hyprland's native `hyprctl` commands - no dangerous systemd modifications\n- 🔧 **Zero Configuration**: Works out of the box after installation\n- 📝 **Comprehensive Logging**: Debug-friendly logs for troubleshooting\n- 🔁 **Automatic Startup**: Systemd user service starts with your session\n- 💤 **Smart Power Management**: Hibernates when lid closes without external monitor\n\n## How It Works\n\n### Lid Closed + External Monitor Connected\n- Disables laptop internal display\n- External monitor becomes the primary display\n- All workspaces remain accessible\n\n### Lid Opened\n- Re-enables laptop internal display  \n- Restores dual monitor configuration\n- Maintains your workspace layout\n\n### Lid Closed + No External Monitor\n- Hibernates the system automatically\n\n## Requirements\n\n- **OS**: Arch Linux (or similar)\n- **Desktop**: Hyprland window manager\n- **Hardware**: Laptop with ACPI lid switch support\n- **Session**: Wayland session\n\n## Installation\n\n### Quick Install\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/aserper/hyprland-lid-switch/main/install-hyprland-lid-switch.sh | bash\n```\n\n### Manual Install\n\n1. **Download the installer**:\n   ```bash\n   wget https://raw.githubusercontent.com/aserper/hyprland-lid-switch/main/install-hyprland-lid-switch.sh\n   chmod +x install-hyprland-lid-switch.sh\n   ```\n\n2. **Run the installer**:\n   ```bash\n   ./install-hyprland-lid-switch.sh\n   ```\n\n3. **Test the installation**:\n   Close your laptop lid to verify it works!\n\n## What Gets Installed\n\nThe installer creates the following files:\n\n```\n~/.config/hypr/scripts/\n├── lid-switch.sh      # Core lid switch logic\n└── lid-monitor.sh     # Background monitor daemon\n\n~/.config/systemd/user/\n└── lid-monitor.service # Systemd service configuration\n```\n\n## Usage\n\n### Service Management\n\n```bash\n# Check service status\nsystemctl --user status lid-monitor.service\n\n# Start service\nsystemctl --user start lid-monitor.service\n\n# Stop service  \nsystemctl --user stop lid-monitor.service\n\n# Restart service\nsystemctl --user restart lid-monitor.service\n\n# Disable auto-start\nsystemctl --user disable lid-monitor.service\n\n# Re-enable auto-start\nsystemctl --user enable lid-monitor.service\n```\n\n### Manual Testing\n\n```bash\n# Test lid close behavior\n~/.config/hypr/scripts/lid-switch.sh close\n\n# Test lid open behavior\n~/.config/hypr/scripts/lid-switch.sh open\n\n# Auto-detect current lid state\n~/.config/hypr/scripts/lid-switch.sh\n```\n\n### Monitoring Logs\n\n```bash\n# View monitor daemon logs\ntail -f /tmp/hypr-lid-monitor.log\n\n# View switch action logs  \ntail -f /tmp/hypr-lid-switch.log\n\n# View systemd service logs\njournalctl --user -u lid-monitor.service -f\n```\n\n## Troubleshooting\n\n### Service Not Starting\n\n1. **Check service status**:\n   ```bash\n   systemctl --user status lid-monitor.service\n   ```\n\n2. **Verify Hyprland is running**:\n   ```bash\n   echo $XDG_SESSION_TYPE  # Should output 'wayland'\n   hyprctl monitors        # Should list your monitors\n   ```\n\n3. **Check lid detection**:\n   ```bash\n   cat /proc/acpi/button/lid/*/state\n   ```\n\n### Lid Events Not Detected\n\n1. **Verify ACPI support**:\n   ```bash\n   ls /proc/acpi/button/lid/\n   ```\n   \n2. **Check for alternative lid detection**:\n   ```bash\n   find /sys -name \"*lid*\" -type f 2\u003e/dev/null\n   ```\n\n3. **Manual detection test**:\n   ```bash\n   ~/.config/hypr/scripts/lid-monitor.sh\n   # Check /tmp/hypr-lid-monitor.log for state changes\n   ```\n\n### Wrong Monitor Detection\n\n1. **List current monitors**:\n   ```bash\n   hyprctl monitors\n   ```\n\n2. **Edit the configuration** in `~/.config/hypr/scripts/lid-switch.sh`:\n   ```bash\n   # Update LAPTOP_DISPLAY variable if needed\n   LAPTOP_DISPLAY=\"your-laptop-monitor-name\"\n   ```\n\n3. **Restart the service**:\n   ```bash\n   systemctl --user restart lid-monitor.service\n   ```\n\n## Customization\n\n### Monitor Resolution and Positioning\n\nEdit `~/.config/hypr/scripts/lid-switch.sh` to customize monitor settings:\n\n```bash\n# In handle_lid_open() function, modify these lines:\nhyprctl keyword monitor \"$LAPTOP_DISPLAY,2880x1920@120,0x0,2\"\nhyprctl keyword monitor \"$CURRENT_EXTERNAL,5120x1440@144,1440x0,1\"\n```\n\n### Response Timing\n\nAdjust the polling interval in `~/.config/hypr/scripts/lid-monitor.sh`:\n\n```bash\n# Change sleep duration (default: 1 second)\nsleep 0.5  # For faster response\nsleep 2    # For less CPU usage\n```\n\n### Logging\n\nDisable logging by commenting out `log_message` calls or redirect to `/dev/null`:\n\n```bash\nLOG_FILE=\"/dev/null\"\n```\n\n## Uninstallation\n\n```bash\n# Stop and disable service\nsystemctl --user stop lid-monitor.service\nsystemctl --user disable lid-monitor.service\n\n# Remove files\nrm -f ~/.config/hypr/scripts/lid-switch.sh\nrm -f ~/.config/hypr/scripts/lid-monitor.sh  \nrm -f ~/.config/systemd/user/lid-monitor.service\n\n# Clean up logs\nrm -f /tmp/hypr-lid-*.log\n\n# Reload systemd\nsystemctl --user daemon-reload\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faserper%2Farch-lidswitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faserper%2Farch-lidswitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faserper%2Farch-lidswitch/lists"}