notusknot / dotfiles-nix

Configuration files for my NixOS machine, declared by home-manager
MIT License
430 stars 28 forks source link

Workspaces.lua not working #12

Closed hyperboly closed 8 months ago

hyperboly commented 8 months ago

I am not using the nix configuration, but I've stolen everything related to hyprland workspaces.

My eww config

(defwidget bar []
    (box
        :orientation "h" 
        :space-evenly false  
        :halign "end"
        :class "bar"

        (workspaces
         :halign "center"
         :hexpand false
         :orientation "h"
         :space-evenly false
        )    
        (bat)
        (bright)
        (volume)
        (wifi)
    )
)

(deflisten workspaces_listen "scripts/workspaces.sh")
(defwidget workspaces []
    (literal :content workspaces_listen)
)

and the scripts I just copy pasted into ~/.config/eww/scripts/. Both workspaces.lua and workspaces.sh

When trying to use the workspaces script, I encounter this error from eww logs

error: Input ended unexpectedly. Check if you have any unclosed delimiters
  ┌─ <literal-content>:1:227        
  │                 
1 │ (box :orientation "h" :spacing 1 :space-evenly "true" (button :class "inactive" :onclick "hyprctl dispatch workspace 1" "")(button :class "in
active" :onclick "hyprctl dispatch workspace 0" "")(button :class "active" :onclick "hyprctl dispatch workspace 
  │                                                                                                                                               
                                                                                    ─

error: Input ended unexpectedly. Check if you have any unclosed delimiters
  ┌─ <literal-content>:1:227                                                                                                                      
  │                    
1 │ (box :orientation "h" :spacing 1 :space-evenly "true" (button :class "inactive" :onclick "hyprctl dispatch workspace 1" "")(button :class "in
active" :onclick "hyprctl dispatch workspace 0" "")(button :class "active" :onclick "hyprctl dispatch workspace
error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " "")(button :class "inactive" :onclick "hyprctl dispatch workspace 2" "")(button :class "active" :onclick "hyprctl dispatch workspace 
  │     ─ Invalid token

error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " "")(button :class "inactive" :onclick "hyprctl dispatch workspace 2" "")(button :class "active" :onclick "hyprctl dispatch workspace 
  │     ─ Invalid token

error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " "")(button :class "inactive" :onclick "hyprctl dispatch workspace 3" "")(button :class "active" :onclick "hyprctl dispatch workspace 
  │     ─ Invalid token

error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " "")(button :class "inactive" :onclick "hyprctl dispatch workspace 3" "")(button :class "active" :onclick "hyprctl dispatch workspace 
  │     ─ Invalid token

error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " "")(button :class "inactive" :onclick "hyprctl dispatch workspace 4" "")(button :class "active" :onclick "hyprctl dispatch workspace 
  │     ─ Invalid token

error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " "")(button :class "inactive" :onclick "hyprctl dispatch workspace 4" "")(button :class "active" :onclick "hyprctl dispatch workspace 
  │     ─ Invalid token

error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " ""))
  │     ─ Invalid token

error: Invalid token
  ┌─ <literal-content>:1:5
  │
1 │  " ""))
  │     ─ Invalid token

I'm not sure if this is an error on my part or the script is outdated, please address. Thanks

hyperboly commented 8 months ago

After testing today, it works for some reason. However, it does not update.

Although the variables workspaces_listen should update every newline, I believe workspaces.lua does not print a new line everytime the window updates. I'm not sure how to fit it into the script.

Edit: the workspaces.lua script breaks on multimonitors, with the error from the first comment in this issue.

hyperboly commented 8 months ago

Closing this issue because after testing with 1 monitor, it works.

There's no multimonitor support for workspaces.lua