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

[BUG] Listeners aren't function properly (I think?) #1072

Open
3 tasks done
Zambieslar opened this issue Apr 17, 2024 · 0 comments
Open
3 tasks done

[BUG] Listeners aren't function properly (I think?) #1072

Zambieslar opened this issue Apr 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Zambieslar
Copy link

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

Noticed this on a couple of occasions. Not sure if it's my configuration or a bug, but it doesn't seem very intention. I'm using Socat to connect to hyprland's unix socket for receiving messages. I'm then defining a listener to get the messages when they are emitted from the socket.

Reproducing the issue

Use socat -U - UNIX-CONNECT:/tmp/hypr/e93fbd7c4f991cb8ef03e433ccc4d43587923e15_1713287664/.socket2.sock | rg -o --pcre2 "(?<=DP-\d,)\d{1,2}" to open a connection with the unix socket.

Define a listener (this is my configuration):

(deflisten workspace :initial "" "~/.config/hypr/scripts/currentworkspace")

The script contains the command listed above. The command outputs the correct workspace when ran in the terminal. Attempting to use the same script with the configured listen results in the following error:

2024-04-17T01:23:51.003Z ERROR eww::error_handling_ctx   > Failed to send success response from application thread

Caused by:
    channel closed
 2024-04-17T01:23:51.003Z ERROR eww::error_handling_ctx   > Failed to send success response from application thread

Caused by:
    channel closed

Full configuration listed below.

Expected behaviour

I assume the listener is supposed to run a script once and then listen continuously for output base on the documentation located here and then update the output when it receives the message.

Additional context

Full Configuration

Three files in ~/config/eww:

  1. eww.yuck
  2. eww.scss
  3. widgets.yuck
  4. polls.yuck
eww.yuck

(include "./polls.yuck")
(include "./widgets.yuck")

(defwindow bar
  :monitor 0
  :windowtype "dock"
  :exclusive true
  :class "main_bar"
  :geometry (geometry :x "0%"
                      :y "10"
                      :width "99%"
                      :height "10px"
                      :anchor "top center")
  :reserve (struts :side "top" :distance "4%")
  (bar))

widgets.yuck

(defwidget right []
  (box
    :class "right"
    :orientation "h"
    :halign "end"
    :space-evenly false
      (cpu)
      (memory)
      (storage)
      (time :hours hours :minutes minutes :seconds seconds)))

(defwidget cpu []
  (box 
    :class "cpu"
    :orientation "h"
    :halign "end"
    :space-evenly false
    "󰍛 "{round((EWW_CPU.avg),0)}"%"))

(defwidget memory []
  (box
    :class "memory"
    :orientation "h"
    :halign "end"
    :space-evenly false
    "󰘚 "{round((EWW_RAM.used_mem_perc),0)}"%"))

(defwidget storage []
  (box
    :class "storage"
    :orientation "h"
    :halign "end"
    :space-evenly false
    " "{round((EWW_DISK["/"].used_perc),0)}"%"))

(defwidget time [hours minutes seconds]
  (box :orientation "h"
      :space-evenly false
      :halign "end"
      hours
      minutes
      seconds
  (children)))

(defwidget workspaces []
   (box :class "workspaces"
        :orientation "h"
        :space-evenly true
        :halign "center"
        :spacing 5
    (box
        :orientation "h"
        :space-evenly false
        :halign "start"
        (button :onclick "~/.config/hypr/scripts/previousworkspace" "󰥼"))
    (box 
        :class "currentworkspace"
        :orientation "h"
        :space-evenly false
        :halign "center"
        (label :text "${workspace}" :visible true))
    (box
        :orientation "h"
        :space-evenly false
        :halign "end"
          (button :onclick "~/.config/hypr/scripts/nextworkspace" "󰥭"))))



(defwidget currentwindow []
  (box :class "current_window"
    :orientation "h"
    :halign "start"
    {getwindow != "" ? "${getwindow}" : ""}))

(defwidget bar []
  (centerbox :orientation "h"
      (currentwindow)
      (workspaces)
      (right)))

polls.yuck

  (defpoll seconds :interval "1s" :initial "initial-value" :run-while time-visible `date +%S`)
  (defpoll minutes :interval "60s" :initial "initial-value" :run-while time-visible `date +%M:`)
  (defpoll hours :interval "5m" :initial "initial-value" :run-while time-visible `date +%H:`)
  
  (deflisten workspace :initial "0" "~/.config/hypr/scripts/currentworkspace")
  (defpoll getwindow :interval "1s" :initial "~" "hyprctl activewindow | rg -o --pcre2 \"(?<=\-\>).*[^:]\"")

eww.scss

  * {
    all: unset; //Unsets everything so you can style everything from scratch
  }
  
  // Global Styles
  .bar {
    font-family: DejaVu Sans Condensed;
    color: #F3E6BC;
    padding: 3px;
    border-radius: 10px;
    background-color: rgba($color: #1A1B26, $alpha: 1);
  }
  
  .right {
    margin-right: 5px;
  }
  
  .current_window {
    font-family: Iosevka Light;
  }
  
  
  
  // Style classes
  .workspaces button:hover {
    all: unset;
    color: #76C2EF;
  }
  
  .workspaces {
    color: #F3E6BC;
  }
  
  .cpu,
  .storage,
  .memory {
    margin-right: 10px;
  }

@Zambieslar Zambieslar added the bug Something isn't working label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant