Comments (14)
Found a very effective solution, that may not prove as temorary as expected (hear: It could become the official solution).
exec_always pkill kanshi; exec kanshi
It ensures a full restart (reload) of kanshi on every sway reload. The second exec is to avoid a leftover sh -c
invocation. It is not a sway command but part of the pkill kanshi; exec kanshi
shell script.
✨ Expect some flickering ✨
from kanshi.
Using kanshi + sway relaod is broken. You can call kanshi (and kill it afterward ) after each sway reload to force update it's config.
Seems like a good fix would make sway keep outputs config on reload (but sway has output directives that could have changed and need to be re-applied).
from kanshi.
This is kind of a sway bug. It should keep the configuration on reload. Or request that kanshi sends the configuration again? I'm not sure how it could do this.
from kanshi.
Hi,
I have investigated this and it appears that sway sends the right information, but kanshi does not react to that, because of the check below. Removing that check makes kanshi react to the done() event after the changes induced by the reload have been sent.
This happens because kanshi never changes its current profile pointer. The struct is updated in place, and the check fails.
diff --git a/main.c b/main.c
index c25e2bb..768e381 100644
--- a/main.c
+++ b/main.c
@@ -118,9 +133,7 @@ static struct kanshi_mode *match_mode(struct kanshi_head *head,
static void apply_profile(struct kanshi_state *state,
struct kanshi_profile *profile,
struct kanshi_profile_output **matches) {
- if (state->current_profile == profile) {
- return;
- }
+ // TODO: Skip if nothing changed.
struct kanshi_pending_profile *pending = calloc(1, sizeof(*pending));
pending->state = state;
from kanshi.
Well, I guess it depends on what we want. Do we want kanshi to apply configs only when a new config matches, or do we want it to enforce the given config all the time ?
If we are to solve this in sway (keep the current config), then why is sway not able to collect it from the state of the monitor themselves ?
from kanshi.
This issue seems to break my current configuration. Right now I have the following in my sway config
exec kanshi
as soon as I reload sway as mentioned above - the wrong configuration seems to be picked up. Is there a workaround for this or is reloading sway's config currently broken?
from kanshi.
The same technique can be used to launch swayidle (in case of parameters change) and waybar (if you use it).
from kanshi.
@layus when i reload and if I have an external display connected, all my windows close. do you experience this as well? if i dont have an external display connected, it works fine
from kanshi.
@itapai I have also experienced this issue several times. I've had to stop using kanshi until I can figure a way to work round it / fix the issue
from kanshi.
when i reload and if I have an external display connected, all my windows close
This should fix it: swaywm/wlroots#1765
from kanshi.
Sway could destroy all output-management heads and re-add them to ask clients to configure them again.
from kanshi.
Is the best solution to this still exec_always pkill kanshi; exec kanshi
?
from kanshi.
@fourstepper I just very successfully applied that sway line from @layus and can't find a better answer elsewhere. I wonder if this line should be put in some kind of doc? I had a hard time finding out how to integrate kanshi with sway due to the reload issue. Particularly I think pywal was causing a reload of sway config right away so kanshi wouldn't work with a simple exec in sway config even on startup. With the exec_always kanshi survives the sway reconfig that pywal causes when loaded in sway config at startup.
Thanks!
from kanshi.
If you use systemd to run kanshi as a user service, you can do:
exec_always "systemctl --user restart kanshi.service"
from kanshi.
Related Issues (20)
- kanshi exits when undocking laptop from two external monitors HOT 2
- Support adaptive_sync HOT 1
- Secondary display only shows pointer HOT 1
- Migration to sr.ht HOT 1
- Kanshi doesn't apply display position configuration after disabling display HOT 3
- Error out on duplicate profile
- Feature request: Use regex in output name HOT 8
- Syntax to specify profile names can become ambiguous
- Sample configuration does not work HOT 2
- Feature Request: Variables/workspace support HOT 2
- Zombie processes HOT 4
- Profile not matched HOT 3
- Add support for matching make/model/serial
- Apply or select a given profile HOT 2
- Any particular reason why the sway-output syntax is different? HOT 2
- Sometimes kanshi does not restore display config when re-docking HOT 1
- allow storing profiles in separate files HOT 5
- Scale factor applied to output is different from the provided in the config file HOT 1
- Monitor disconnections not detected HOT 2
- invalid arguments for [email protected]_head HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kanshi.