hyprmon icon indicating copy to clipboard operation
hyprmon copied to clipboard

[Feature Request] Auto detection of monitor setup

Open jdk2588 opened this issue 1 year ago • 13 comments

Thanks for building the utility @erans, it's helpful.

I saw the future roadmap for "Auto-switching profiles on monitor hotplug". Along similar lines, I have a couple of feature requests and would appreciate your input.

  • Auto-detection of addition and removal of monitors: I usually work with a dual monitor setup and turn off the laptop screen in lid-close position. The layout does not change automatically when monitors are added/removed. We can capture the events of Hyprland and then paint the TUI. I have worked on this feature and can send a PR for a review.

  • Unplugging the monitor setup with no fallback mechanism: When the laptop screen is disabled, it should fallback to the default profile, i.e, enabling the embedded display (eDP-1).

Would love to know your thoughts.

jdk2588 avatar Sep 15 '25 12:09 jdk2588

I will investigate how should I trigger these. These are a bit more hard core and (usually) requires an active process listening - but I will see if I can have some kind of a hook into udev to figure it out.

erans avatar Sep 15 '25 19:09 erans

First, thank you very much for that tool, really helpful. I have the same problem as @jdk2588 when I disconnect from my desk.

I expect you will need to register hyprmon as a service in this case. I found some who wrote a setup that could work. I will try to make the version for hyprmon. you can find that here

davzucky avatar Oct 22 '25 11:10 davzucky

@davzucky thanks. It looks interesting. I'm thinking outloud though, that maybe hypermon is not the right tool for this. or maybe it is if you want to setup a specific profile for specific devices. I need to look at that solution and see how it can be easily packaged.

erans avatar Oct 22 '25 19:10 erans

@erans, I got the setup working. The main problem I had was that I disable my laptop monitor when I'm working from a desk (home or office), and that when I unplug the USB-C my screen stay black as hyprmon doesn't reset.

Using what I link above I arrive at that setup

  1. Created multiple profile, default (for laptop only), home and office
  2. Create a switcher file as executable. for me that file is located under /home/david/.local/share/omarchy/bin/switcher
#!/bin/sh

# This script uses an optional environment variable $HYPR_BUILDIN_MON. If it is available, it is
# used to re-enable your display. Otherwise, the default setting ($DEFAULT_BUILDIN_ENABLE) is
# used.

BUILDIN_DISPLAY_NAME="eDP-2"  # Get the name of your buildin display using "hyprctl monitors all"
DEFAULT_BUILDIN_ENABLE="$BUILDIN_DISPLAY_NAME, highresxhighrr, 0x0, 1"

num_of_monitors=$(hyprctl monitors all | grep Monitor | wc -l)  # this might break in the feature
                                                                # or for different setups.

if [[ $num_of_monitors -eq 1 ]]; then
    # disable buildin monitor
    hyprmon --profile default
fi 
  1. Create the service for hpr mon reset /etc/systemd/user/hypr-display-reset.service
[Unit]
Description=Enables/disables the buildin display when connecting/disconnecting an HDMI cable.

[Service]
Type=oneshot
ExecStart=/home/david/.local/share/omarchy/bin/switcher
  1. setup udev rule /etc/udev/rules.d/hypr-display-reset.rules
ACTION=="change", SUBSYSTEM=="drm", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}="hypr-display-reset.service"
  1. Reload the daemon sudo systemctl daemon-reload

thank you @aron-hoogeveen for the tips. They are as well an ongoing discussion on Omarchy about using hyprmon for that https://github.com/basecamp/omarchy/issues/2858#issuecomment-3459312884

davzucky avatar Oct 29 '25 07:10 davzucky

so it seems this is (mostly) outside the scope of hyprmon itself. I wonder if all of this should just go into Omarchy in a more structured way. Just thinking out loud here :)

erans avatar Oct 30 '25 16:10 erans

Please, this would be very helpful. I started using Omarchy recently and it's great, but I just plugged in my second monitor and the OS is not able to detect it at all. It worked fine with my old computer that used Fedora and i3.

dlebedinsky avatar Dec 09 '25 02:12 dlebedinsky

I need to research this more. This would be a set of configuration files that will come with the package as it will require to execute certain codes while listening to hardware changes.

On Mon, Dec 8, 2025, 6:42 PM Daniel Lebedinsky @.***> wrote:

dlebedinsky left a comment (erans/hyprmon#29) https://github.com/erans/hyprmon/issues/29#issuecomment-3629958582

Please, this would be very helpful. I started using Omarchy recently and it's great, but I just plugged in my second monitor and the OS is not able to detect it at all. It worked fine with my old computer that used Fedora and i3.

— Reply to this email directly, view it on GitHub https://github.com/erans/hyprmon/issues/29#issuecomment-3629958582, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACUEZ3FYNJPAKA6D72AW34AYZKZAVCNFSM6AAAAACGRGJ2WGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMRZHE2TQNJYGI . You are receiving this because you were mentioned.Message ID: @.***>

erans avatar Dec 09 '25 06:12 erans

My second monitor was super grainy for a while, and it wasn't connected right away when I plugged it in. I tried doing the following: in .config/hypr/hyprland.conf: monitor=HDMI-A-1,1920x1080@60,auto,auto Then: hyprctl reload in terminal

The graininess did not go away, when I restarted my computer it was even still there briefly. But then it randomly vanished. I hope this helps someone.

dlebedinsky avatar Dec 09 '25 15:12 dlebedinsky

Just FYI, this is exactly what Kanshi does: https://gitlab.freedesktop.org/emersion/kanshi

seaofcolors avatar Apr 12 '26 21:04 seaofcolors

Could there maybe be a little installation script for hyprmon that would also create the desired configuration? Maybe I could look into adding this feature, if the author is interested.

martinpetrdev avatar Aug 01 '26 07:08 martinpetrdev

Sure. What did you have in mind? What should that script detect and do?

On Sat, Aug 1, 2026, 12:14 AM Martin Petr @.***> wrote:

martinpetrdev left a comment (erans/hyprmon#29) https://github.com/erans/hyprmon/issues/29#issuecomment-5150353766

Could there maybe be a little installation script for hyprmon that would also create the desired configuration? Maybe I could look into adding this feature, if the author is interested.

— Reply to this email directly, view it on GitHub https://github.com/erans/hyprmon/issues/29?email_source=notifications&email_token=AAACUEZ4TUXN33ZTAQTZXJL5HWKEXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJVGAZTKMZXGY3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5150353766, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACUE3T5PTXPHPK2EAGHRL5HWKEXAVCNFSNUABGKJSXA33TNF2G64TZHMYTAMZWHA3DGOJWGU5US43TOVSTWMZUGE3TOMJTGE3DJILWAI . Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS https://github.com/notifications/mobile/ios/AAACUE7H7SFHUFO3764KUSD5HWKEXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJVGAZTKMZXGY3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y and Android https://github.com/notifications/mobile/android/AAACUE2MUQZAG224CNBU6K35HWKEXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJVGAZTKMZXGY3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI. Download it today! You are receiving this because you were mentioned.Message ID: @.***>

erans avatar Aug 01 '26 19:08 erans

We could create a small service that would call some hyprmon command (or the more proper way would be to listen to hyprland socket) and hyprmon would then get the list of connected monitors and could switch profiles automatically based on configuration.

We could either create a small bash script that would just download and correctly place the binary and the service and activate it, or we could add a separate command (like hyprmon install).

I could try to do/contribute to any of the variants, as I have lost of free time and I personally would love this feature too.

martinpetrdev avatar Aug 01 '26 20:08 martinpetrdev

Figured I'll create myself a workaround solution till this feature is implemented. For anyone following this issue, or reading up on it later, you can check my script out here: https://gist.github.com/flloschy/c09dabd095627964b85eb6223094eede It automatically reads your Hyprmon profiles config and applies the profile which includes all currently connected monitors (tracked by serial number & fallbacks). Haven't tested this much as of now, only on one setup by connecting/disconnecting the second screen. Might be a bit buggy out in the wild.

flloschy avatar Sep 07 '26 08:09 flloschy