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] Be able to get a signal in another process when eww reloads #1021

Open
RobinRamael opened this issue Feb 2, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@RobinRamael
Copy link

Description of the requested feature

I'm working with a lot of eww variables set from eww update command only. It would be nice to have a way to know from a different process when eww reloads so i can reset the variables to their desired state again. A simple ipc signal perhaps? Or is there already something like that?

Proposed configuration syntax

No response

Additional context

No response

@RobinRamael RobinRamael added the enhancement New feature or request label Feb 2, 2024
@catbrained
Copy link

I can think of two workarounds for this:

1. Follow the eww log file and watch for the reload message

2. Use a deflisten variable to run a script that notifies your process

When eww reloads, deflisten variables are refreshed by restarting their associated scripts. You could write a script that sends a signal to some process.

Example:

;; test
(deflisten test
  :initial ""
  ;; Replace this command with something that sends a signal to your process
  "notify-send -e -t 1000 'Test' 'This is a test.'"
)

;; If you test this you will notice that the notify script only gets run once the window is opened.
;; That is why we need some window to reference our deflisten variable.
(defwindow test
  :monitor 0
  :geometry (geometry
      :x "40%"
      :y "40%"
      :width "20%"
      :height "20%"
      :anchor "top left"
    )
  :stacking "fg"
  :exclusive false
  :focusable true
  :namespace "eww-test-window"
  ;; An invisible label is one way to reference the variable.
  ;; I have not tested if this affects the layout.
  (label :visible false :text "${test}")
)

As you can see this is a bit fragile. If you really needs this to be an external process that doesn't get started by eww, then I'd favor the first approach (watching the eww logs). Otherwise consider starting your process via eww deflisten variable directly, and skip the whole signalling business. Eww will restart your process when it reloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants