Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

configuration applied twice #60

Open
tbm opened this issue Dec 20, 2019 · 8 comments
Open

configuration applied twice #60

tbm opened this issue Dec 20, 2019 · 8 comments

Comments

@tbm
Copy link
Contributor

tbm commented Dec 20, 2019

I don't know if this is a kanshi or sway issue (since I assume kanshi just reacts to information from sway), but I noticed that sometimes the same profile gets applied twice.

When I start sway with an external monitor connected, I get:

applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Samsung Electric Company SyncMaster HVGQ901
399' on connected head 'DP-2'
applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Samsung Electric Company SyncMaster HVGQ901
399' on connected head 'DP-2'
configuration applied
configuration applied

when I disconnect the internal monitor, I get:

applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
configuration applied

i.e. it's applied once.

But then I killed kanshi and started it from the command line and now I get:

applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
configuration applied
configuration applied
applying profile
applying profile output 'Samsung Electric Company SyncMaster HVGQ901399' on connected head 'DP-2'
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile
applying profile output 'Samsung Electric Company SyncMaster HVGQ901399' on connected head 'DP-2'
applying profile output 'eDP-1' on connected head 'eDP-1'
configuration applied
configuration applied

I never noticed this before, but then again I was paying more attention to kanshi's output now.

As far as I can tell, there's only one instance of kanshi running.

@tbm
Copy link
Contributor Author

tbm commented Dec 20, 2019

I just had:

applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
configuration applied
configuration applied

but sway's log only contains it once:

2019-12-20 12:35:35 - [main.c:300] Found config * for output eDP-1 (Unknown 0x5B2D 0x00000000)

@jameswalmsley
Copy link
Contributor

Did you resolve this?

What is your config file?
Which versions of wlroots / sway are you using?

@tbm
Copy link
Contributor Author

tbm commented Jan 13, 2020

Config:

{
	output eDP-1 enable
}

{
	output eDP-1 disable
	output "Samsung Electric Company SyncMaster HVGQ901399" mode 1680x1050 position 0,0
}

sway 1.2 and wlroots 0.7.0

@jameswalmsley
Copy link
Contributor

I'll create a similar setup with my system and see what happens.

@zsugabubus
Copy link

It happens because after applying a profile, the display configuration will potentially change, and whenever the display configuration changes(*), kanshi tries finding a matching profile for the new configuration. But at the second run (hopefully) nothing will change and that's why there is two profile applies.

*: display plugged in/out, resolution, refresh rate...

@simoneruffini
Copy link

simoneruffini commented Oct 21, 2020

What do you mean with ''will potentially change'', I mean what types of change?

I have a similar issue but for me profiles are reapplied 3 times.

In addition to that, at startup, when kanshi starts, sway logs out this:

2020-10-21 20:51:31 - [swaybg-1.0/main.c:299] Found config * for output DP-3 (Dell Inc. DELL U2414H 4VKH665N5TRS)
2020-10-21 20:51:31 - [swaybg-1.0/main.c:299] Found config * for output eDP-1 (Sharp Corporation 0x148D 0x00000000)
00:00:04.790 [ERROR] [backend/drm/drm.c:364] Failed to page-flip output 'DP-3': a page-flip is already pending
2020-10-21 20:51:34 - [swaybg-1.0/main.c:167] Destroying output eDP-1 (Sharp Corporation 0x148D 0x00000000)

@lytedev
Copy link

lytedev commented Nov 2, 2020

In order to work around this issue, I moved my exec calls into a script that sets up a lockfile. Here's my example:

# kanshi config
profile desktop-H  {
  output ...
  output ...
  exec "setup-workspaces.sh"
}

And here's setup-workspaces.sh:

# kanshi will potentially run this more than once
LOCKFILE="/tmp/kanshi-setup-workspaces.lock"
if ! (set -o noclobber; echo > "$LOCKFILE"); then exit 1; fi
touch "$LOCKFILE"
# TODO: some way to ensure the lock file is cleaned up?
# maybe check if the file is older than a minute?

# do your stuff

rm -f "$LOCKFILE"

@Gochkin
Copy link

Gochkin commented Jan 15, 2021

Well I have noticed the same thing when running kanshi. For me any profile applied twice (at least this is what kanshi output suggests).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants