Open
Conversation
When an unknown monitor is plugged in, Hyprland's fallback rule picks a reasonable mode and scale but doesn't persist the choice. This adds a background script that captures those settings and writes desc:-based entries into monitors.conf, so every monitor becomes "known" after its first connection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an automatic monitor configuration persistence mechanism for Hyprland by introducing a background script that records Hyprland’s chosen mode/scale for newly-seen monitors into ~/.config/hypr/monitors.conf, and wires it into startup/hotplug handling.
Changes:
- Add
omarchy-monitor-autoconfigscript to detect unknown monitors and writemonitor=desc:...rules. - Start the script on login via Hyprland
exec-once. - Ensure
socatis installed (base packages + migration) for event-driven hotplug detection with a polling fallback.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
bin/omarchy-monitor-autoconfig |
Implements monitor scanning, config insertion, and socat/polling hotplug detection. |
default/hypr/autostart.conf |
Launches the new autoconfig script at session start. |
install/omarchy-base.packages |
Adds socat to the base install set. |
migrations/1772362507.sh |
Installs socat for existing users. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Install socat if not already present (needed for event-driven hotplug detection) | ||
| if ! command -v socat &>/dev/null; then | ||
| sudo pacman -S --noconfirm socat |
There was a problem hiding this comment.
For consistency with other migrations that install packages, consider adding --needed to the pacman -S invocation so reruns don’t attempt reinstalls (even though you already gate on command -v).
Suggested change
| sudo pacman -S --noconfirm socat | |
| sudo pacman -S --needed --noconfirm socat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When an unknown monitor is plugged in, Hyprland's fallback rule (
monitor=,preferred,auto,auto) picks a reasonable mode and scale — but that choice isn't persisted. Next time the same monitor appears, Hyprland starts fresh.This PR adds a background script (
omarchy-monitor-autoconfig) that:desc:entries for any not already inmonitors.confmonitoraddedevents via socat on Hyprland's socket2, then captures and saves the new monitor's settingsFor each detected monitor, the script:
desc:prefix from make + model (no serial, so it matches any unit of that model)monitors.confalready has a matchingdesc:entry — if so, skipshyprctl monitors -jmonitors.confnotify-sendPosition is always
auto— users can manually set positions later.Changes
bin/omarchy-monitor-autoconfigdefault/hypr/autostart.confexec-onceinstall/omarchy-base.packagessocatmigrations/1772362507.shTest plan
desc:entry in monitors.conf🤖 Generated with Claude Code