Simplified Leftwm workspace yuck code

This commit is contained in:
Candifloss 2024-12-12 19:26:26 +05:30
parent 0adeca79a5
commit 5699e52919
5 changed files with 35 additions and 38 deletions

View File

@ -1,13 +1,13 @@
(include "yuck/panel/panel_workspaces/panel_workspaces.yuck") (include "yuck/panel/panel_workspaces/leftwm_ws.yuck") ; For LeftWM
(defwidget panel_cen [h] (defwidget panel_cen [h]
(box (box
:class "panel_side panel_cen" :class "panel_side panel_cen"
:halign "center" :halign "center"
:height 28 :height "${h}"
:width 300 :width 300
:active true :active true
(panel_workspaces :h "${h}") (panel_ws_leftwm :h "${h}") ; LeftWM workspaces
) )
) )

View File

@ -0,0 +1,32 @@
;This widget and code only works for LeftWM
(defwidget panel_leftwm_ws_ico [h tag]
(button
:halign "center"
:valign "center"
:height "${h}"
:width "${h}"
:active true
:class "panel_ws_ico ${tag.mine ? 'panel_ws_ico_cur' : 'panel_ws_ico_notcur'} ${tag.busy ? 'panel_ws_ico_act' : 'panel_ws_ico_inact'}"
:onclick "leftwm-command \"SendWorkspaceToTag 0 ${tag.index}\""
:timeout "1s"
{tag.mine ? '' : tag.busy ? '' : ''}
)
)
(defwidget panel_ws_leftwm [h]
(box
:class "panel_workspaces_widg"
:halign "center"
:valign "center"
:height "${h}"
:active true
(for tag in '${leftwm_state.workspaces[0].tags}'
(panel_leftwm_ws_ico
:h "${h}"
:tag {tag}
)
)
)
)

View File

@ -1,20 +0,0 @@
(include "yuck/panel/panel_workspaces/panel_ws_ico.yuck")
(defwidget panel_workspaces [h]
(box
:class "panel_workspaces_widg"
:halign "center"
:valign "center"
:height "${h}"
:active true
(for tag in '${leftwm_state.workspaces[0].tags}'
(panel_ws_ico
:h "${h}"
:c1 {tag.mine ? "panel_ws_ico_cur" : "panel_ws_ico_notcur"}
:c2 {tag.busy ? "panel_ws_ico_act" : "panel_ws_ico_inact"}
:index "${tag.index}"
)
)
)
)

View File

@ -1,14 +0,0 @@
(defwidget panel_ws_ico [h c1 c2 index]
(button
:halign "center"
:valign "center"
:height "${h}"
:width "${h}"
;active true
:class "panel_ws_ico {c1} {c2}"
;:label {c1 == 'panel_ws_ico_cur' ? '' : c2 == 'panel_ws_ico_act' ? '' : ''}
:onclick "leftwm-command \"SendWorkspaceToTag 0 ${index}\""
:timeout "1s"
{c1 == 'panel_ws_ico_cur' ? '' : c2 == 'panel_ws_ico_act' ? '' : ''}
)
)

View File

@ -42,7 +42,6 @@
;WIndow managers ;WIndow managers
(deflisten leftwm_state (deflisten leftwm_state
:interval "300ms"
:initial "{\"window_title\":\"None\",\"workspaces\":[{\"id\":1,\"output\":\"VGA-1\",\"h\":0,\"w\":0,\"x\":0,\"y\":0,\"layout\":\"Default\",\"index\":0,\"tags\":[{\"name\":\"1\",\"index\":0,\"mine\":false,\"visible\":false,\"focused\":false,\"urgent\":false,\"busy\":false}]}]}" :initial "{\"window_title\":\"None\",\"workspaces\":[{\"id\":1,\"output\":\"VGA-1\",\"h\":0,\"w\":0,\"x\":0,\"y\":0,\"layout\":\"Default\",\"index\":0,\"tags\":[{\"name\":\"1\",\"index\":0,\"mine\":false,\"visible\":false,\"focused\":false,\"urgent\":false,\"busy\":false}]}]}"
`leftwm state` `leftwm state`
) )