Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Run shell command on display change detected #65

Open
Tracked by #85
phuhl opened this issue Jan 26, 2023 · 5 comments
Open
Tracked by #85

Feature: Run shell command on display change detected #65

phuhl opened this issue Jan 26, 2023 · 5 comments
Labels
feature New feature or request PR please Pull request would be gratefully appreciated
Milestone

Comments

@phuhl
Copy link

phuhl commented Jan 26, 2023

Hi, thanks for this great tool. It detects when plugging in a display just fine. But I'd like to run a shell script e.g. to setup the desktop background on change. My proposal would be to add to the config a line:

ON_CHANGE_CMD: <shell command here>
@alex-courtis
Copy link
Owner

This would be most useful.

@alex-courtis alex-courtis added the feature New feature or request label Jan 28, 2023
@alex-courtis
Copy link
Owner

We could also dump the state to, say, /tmp/way-displays.1.state.yaml

@phuhl
Copy link
Author

phuhl commented Jan 30, 2023

How would I process the state? I'd have to watch the file then, I guess?

@alex-courtis
Copy link
Owner

How would I process the state? I'd have to watch the file then, I guess?

IPC YAML_SCHEMAS

The command is the important part, state is just Nice To Have.

@alex-courtis
Copy link
Owner

#71 is a better alternative to writing a state file.

This was referenced Apr 4, 2023
@alex-courtis alex-courtis changed the title Feature request: Run shell command on display change detected Feature: Run shell command on display change detected May 15, 2023
@alex-courtis alex-courtis added the PR please Pull request would be gratefully appreciated label May 15, 2023
@alex-courtis alex-courtis added this to the 1.9.0 Roadmap milestone Jun 24, 2023
@alex-courtis alex-courtis modified the milestones: 1.9, 1.10 Sep 4, 2023
@alex-courtis alex-courtis modified the milestones: 1.10, 1.11 Nov 13, 2023
alex-courtis added a commit that referenced this issue Apr 20, 2024
* add spawn_async function

* add ON_CHANGE_CMD config

* spawn on_change_cmd in handle_success

* adapt marshalling tests

* isolate the spawed process a bit more

* ignore adaptive sync changes

Can't think of a use case to run a command when vrr changes

* add a test for the change command

* add ON_CHANGE_CMD to cfg.yaml

* sanitary fixes

* wrap spawn_async and simplify the on_change_cmd test

Now we are not testing if the command actually gets executed.

* fix mem leak due to creating the default config twice

* rename to CHANGE_SUCCESS_CMD

* add cli set and delete for CHANGE_SUCCESS_CMD

* add CHANGE_SUCCESS_CMD to print_cfg and print_cfg_commands

* add cfg merge tests for change_success_cmd

* revision spawn command

- only fork once
- rename from spawn_async to spawn_sh_cmd

* add CHANGE_SUCCESS_CMD to cli usage

* add CHANGE_SUCCESS_CMD to man

* prepare for next minor release

* setup signal handlers in the server to avoid zombie processes

Thanks to dwm :)

* add compound command example, unify man and cfg.yaml

---------

Co-authored-by: Alexander Courtis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request PR please Pull request would be gratefully appreciated
Projects
None yet
Development

No branches or pull requests

2 participants