Skip to content

Rework launching for user-specified commands. - #2289

Open
blueshiftlabs wants to merge 2 commits into
greshake:masterfrom
blueshiftlabs:spawn-pid
Open

Rework launching for user-specified commands.#2289
blueshiftlabs wants to merge 2 commits into
greshake:masterfrom
blueshiftlabs:spawn-pid

Conversation

@blueshiftlabs

Copy link
Copy Markdown
Contributor

For user-specified commands, such as in the custom block, the cmd
parameter of [[block.click]], and the if_command parameter of
[[block]], make two changes for consistency:

  • Always use the user's $SHELL, instead of sh, if it's configured.
  • Pass an environment variable I3STATUS_RS_PID with the PID of the launching i3status-rs process. This allows custom commands to send signals to the bar without needing to use pkill, which may affect other bars running on the system.

The original `sct` program is not available through many package
managers. Its replacement, `xsct`, is more widely available. Since `sct`
and `xsct` have (mostly*) compatible command lines, we can use the same
`HueShiftDriver` for both by simply telling it to run `sct` or `xsct`
respectively.

[*] There is a minor difference with the reset behavior - for `sct`,
running it with an empty command line resets the color temperature,
while for `xsct`, doing so prints usage. Running `[x]sct 0` resets the
color temperature for both, so we use that for the `reset` function.
@blueshiftlabs

Copy link
Copy Markdown
Contributor Author

Note: this PR has already been rebased onto #2288 because that PR fixes an unrelated cargo clippy issue - I'll update this PR after that one is submitted.

For user-specified commands, such as in the `custom` block, the `cmd`
parameter of `[[block.click]]`, and the `if_command` parameter of
`[[block]]`, make two changes for consistency:

- Always use the user's $SHELL, instead of `sh`, if it's configured.
- Pass an environment variable `I3STATUS_RS_PID` with the PID of the
  launching `i3status-rs` process. This allows custom commands to send
  signals to the bar without needing to use `pkill`, which may affect
  other bars running on the system.
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.

1 participant