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

sxhkd: stop scope before creating #2086

Merged
merged 1 commit into from
Jun 15, 2021
Merged

Conversation

0xKDI
Copy link
Contributor

@0xKDI 0xKDI commented Jun 8, 2021

Description

This allows relogging into graphical session.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

    • Added myself and the module files to .github/CODEOWNERS.

@0xKDI 0xKDI requested a review from rycee as a code owner June 8, 2021 21:37
@0xKDI 0xKDI mentioned this pull request Jun 8, 2021
7 tasks
@@ -73,6 +73,7 @@ in
];

xsession.initExtra = ''
systemctl --user stop sxhkd.scope
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
systemctl --user stop sxhkd.scope
systemctl --user stop sxhkd.scope || true

If an error occurs, is the script evaluation aborted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just throw an error to journal. I added check if scope is active.

@0xKDI 0xKDI force-pushed the sxhkd-fix branch 4 times, most recently from 3f019b6 to fcd077b Compare June 9, 2021 21:57
Comment on lines 76 to 77
[[ $(systemctl is-active --user sxhkd.scope) == active ]] \
&& systemctl --user stop sxhkd.scope
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[[ $(systemctl is-active --user sxhkd.scope) == active ]] \
&& systemctl --user stop sxhkd.scope
systemctl --user stop sxhkd.scope 2> /dev/null || true

This runs into a race condition where the scope is stopped between the two systemctl calls.

Don't check, handle failure.

@0xKDI 0xKDI requested a review from berbiche June 11, 2021 13:35
Copy link
Member

@berbiche berbiche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@berbiche berbiche merged commit 9b39fd7 into nix-community:master Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants