~emersion/kanshi#54: 
Profile not matched

I have this configuration which works great on my work laptop (thinkpad, intel cpu + nvidia graphics with nouveau) I doesn't work on my personal laptop (amd cpu + gpu)

profile home {
    output HDMI-A-1 mode 1920x1080 position 0,0
    output eDP-1 mode 1920x1080 position 0,1081
    exec swaymsg '[workspace="  "]', move workspace to output HDMI-A-1
}

profile default {
    output eDP-1 mode 1920x1080 position 0,1081
}

Here are the outputs

❯ swaymsg -t get_outputs
Output eDP-1 'Unknown 0xD0ED 0x00000000' (focused)
  Current mode: 1920x1080 @ 120.113998 Hz
  Position: 0,1081
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace:  
  Max render time: off
  Adaptive sync: disabled
  Available modes:
...
    1920x1080 @ 120.113998 Hz

Output HDMI-A-1 'Hewlett Packard HP 22es 3CM74909KZ   '
  Current mode: 1920x1080 @ 60.000000 Hz
  Position: 1920,1081
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1
  Max render time: off
  Adaptive sync: disabled
  Available modes:
...
    1920x1080 @ 60.000000 Hz

Here is kanshi ouput when plugin the HP display :

❯ kanshi
applying profile 'default'
applying profile output 'eDP-1' on connected head 'eDP-1'
running commands for configuration 'default'
configuration for profile 'default' applied
no profile matched
no profile matched

Am I missing something here or is this a bug ?

Status
REPORTED
Submitter
github.com:oknozor (unverified)
Assigned to
No-one
Submitted
4 years ago
Updated
a month ago
Labels
bug

github.com:emersion (unverified) 4 years ago · edit

This sounds like a bug.

github.com:rohan47 (unverified) 4 years ago · edit

I am hitting a similar issue

Outputs:

> swaymsg -t get_outputs
Output eDP-1 'Unknown 0x243D 0x00000000'
  Current mode: 1920x1080 @ 60.030998 Hz
  Position: 1920,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    1920x1080 @ 60.030998 Hz

Output DP-4 'Unknown 27HC1R P 0x00000101' (focused)
  Current mode: 1920x1080 @ 144.001007 Hz
  Position: 0,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2
  Max render time: off
  Adaptive sync: disabled
  Available modes:
...
    1920x1080 @ 144.001007 Hz

Output DP-3 'Goldstar Company Ltd LG HDR 4K 0x00008594' (inactive)
  Available modes:
 ...
    3840x2160 @ 59.997002 Hz

kanshi logs:

> kanshi
applying profile 'dock'
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'DP-3' on connected head 'DP-3'
applying profile output 'DP-4' on connected head 'DP-4'
failed to apply configuration for profile 'dock'

My config file:

> cat ~/.config/kanshi/config
profile dock {
 output eDP-1 enable mode 1920x1080 position 3840,0
 output DP-3 enable mode 3840x2160 position 0,0
 output DP-4 enable mode 1920x1080 position 3840,0
}

The DP-3 monitor is attached

github.com:da-edra (unverified) 3 years ago · edit

I have the exact same issue as @rohan47 , this is the kanshi output I get:

applying profile 'home'
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'DP-5' on connected head 'DP-5'
applying profile output 'DP-7' on connected head 'DP-7'
failed to apply configuration for profile 'home'

Ivan Oleynikov 3 years ago · edit

I have a similar bug with the monitors that are connected through a Thinkpad x250 docking station.

Interestingly, Kanshi recognizes my profile if I start it having the monitors connected, but fails to do so if I reconnect monitors (by undocking and docking back my monitor) while Kanshi is running.

My config file is,

profile builtin {
  output eDP-1 enable position 0,0 scale 1
}
profile docked {
  output "Goldstar Company Ltd LG IPS FULLHD 604NTDV33634" position 0,0
  output "Goldstar Company Ltd LG IPS FULLHD " position 1920,0
  output eDP-1 disable
}

Here's the demonstration of the bug (arrows are my comments),

$ kanshi -c kanshi-config
applying profile 'docked' ← The laptop is docked atm so Kanshi recognizes my profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Goldstar Company Ltd LG IPS FULLHD ' on connected head 'DP-3'
applying profile output 'Goldstar Company Ltd LG IPS FULLHD 604NTDV33634' on connected head 'DP-4'
running commands for configuration 'docked'
configuration for profile 'docked' applied
no profile matched
applying profile 'builtin' ← Here, I undock my laptop, Kanshi sees it and applies the right profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile 'builtin'
applying profile output 'eDP-1' on connected head 'eDP-1'
running commands for configuration 'builtin'
configuration for profile 'builtin' applied
applying profile 'builtin'
configuration for profile 'builtin' cancelled, retrying
no profile matched ← Here, I dock the monitor back, Kanshi doesn't recognize it, external monitors are off
no profile matched
no profile matched
no profile matched
^C ← I kill Kanshi and restart it without changing the monitors connection
io@arch tmp $ kanshi -c kanshi-config
applying profile 'docked' ← It recognizes the profile correctly
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Goldstar Company Ltd LG IPS FULLHD ' on connected head 'DP-3'
applying profile output 'Goldstar Company Ltd LG IPS FULLHD 604NTDV33634' on connected head 'DP-4'




applying profile 'docked'
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Goldstar Company Ltd LG IPS FULLHD ' on connected head 'DP-3'
applying profile output 'Goldstar Company Ltd LG IPS FULLHD 604NTDV33634' on connected head 'DP-4'
running commands for configuration 'docked'
configuration for profile 'docked' applied
running commands for configuration 'docked'
configuration for profile 'docked' applied

Is there a way I can run Kanshi with extra debugging info to get more info on what's happening here?

Ivan

~emersion 2 years ago

There are multiple unrelated issues described here.

  • OP hits an issue resulting in no profile being matches.
  • rohan47 hits an issue resulting in a profile being matched, but fails to apply. Please open a separate issue.
  • Ivan hits an issue where no profile is matched because make/model/serial is used and kanshi mixes up things. They sent a patch to fix it (thanks!). OP isn't using make/model/serial so sounds like a separate issue.

~ph14nix 2 years ago*

I also used to experience rohan47's issue with profile failing to apply. But I can't reproduce it from sometime around commit 5267594b.

Maybe #70 is the right issue for profile failing to apply.

~diaoul 1 year, 9 months ago*

I have the exact same issue. I am using a docking station that adds 2 monitors. When unplugging, kanshi cannot find the profile, yet it can if I trigger a reload with kanshictl reload.

When I plug again, sometimes it works sometimes it does not and I get no profile matched twice (below it worked)

I think there is a timing issue when you plug/unplug more than 1 monitor at the same time.

applying profile 'docked'
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Monitor B' on connected head 'DP-7'
applying profile output 'Monitor A' on connected head 'DP-4'
running commands for configuration 'docked'
configuration for profile 'docked' applied
no profile matched <- dock unplugged
reloading config <- reload triggered
applying profile 'mobile'
applying profile output 'eDP-1' on connected head 'eDP-1'
running commands for configuration 'mobile'
configuration for profile 'mobile' applied
no profile matched <- dock plugged (assuming this is coming from the first monitor)
applying profile 'docked' <- probably second monitor triggered this
applying profile output 'Monitor A' on connected head 'DP-4'
applying profile output 'Monitor B 'DP-7'
applying profile output 'eDP-1' on connected head 'eDP-1'
running commands for configuration 'docked'
configuration for profile 'docked' applied```

~diaoul referenced this from #86 1 year, 9 months ago

~spacefrogg 2 months ago*

I still have this problem in a situation where I connect two monitors with slow startup times via a USB-C/Thunderbolt docking station. Kanshi could need some programmable grace period here, where it detects the change but waits to react on them. In my case the monitors appear shortly, vanish again and appear again. (Likely due to USB-C/Thunderbolt setup shenanigans) Kanshi applies its configuration in the middle of this tumoil ending in any of: one random monitor missing to light up or both monitors lighting up correctly and/or XWayland crashing (due to missing outputs during the "vanish period"). So, I envision the following "grace protocol":

  • detect the change (but don't try to match with a profile) and start the grace counter
  • monitors show up/vanish as they do...
  • after grace period, register the final configuration again and apply profile matching

~ph14nix 2 months ago

I think kanshi is already supposed to do what you're asking. If I understand correctly, it listens to all monitor change events from the WM and applis configuration after each event. It never misses an event.

So if some monitors appear with a delay, it will apply incomplete config first, then find the lagging screen and apply full config. If it's not working for you, this could be either incorrect configuration or a bug.

Ivan

On Thu Dec 5, 2024 at 10:50 AM CET, ~spacefrogg wrote:

I still have this problem with in a situation where I connect two monitors with slow startup times via a USB-C docking station. Kanshi could need some programmable grace period here, where it detects the change but waits to react on them. In my case the monitors appear shortly, vanish again and appear again. Kanshi applies its configuration in the middle of this tumoil ending in any of: one random monitor missing to light up or both monitors lighting up correctly and/or XWayland crashing (due to missing outputs during the "vanish period"). So, I envision the following "grace protocol":

  • detect the change (but don't try to match with a profile) and start the grace counter
  • monitors show up/vanish as they do...
  • after grace period, register the final configuration again and apply profile matching

~spacefrogg a month ago

As I described, it crashes XWayland. I suspect a race condition that triggers XWayland to expand to additional screens just before taking them away again. XWayland complains about unable to draw to the output, because it's gone again. I am sure, that is ultimately the fault of XWayland but had hoped to mitigate the issue in kanshi. Anyway, it seems that Hyprland is announcing the new screens by itself anyhow. So, I am not even sure anymore that a grace period in kanshi would do any good.

Register here or Log in to comment, or comment via email.