From 5699e529197a106b365a2c20950a5d17a5e07bcc Mon Sep 17 00:00:00 2001 From: candifloss Date: Thu, 12 Dec 2024 19:26:26 +0530 Subject: [PATCH] Simplified Leftwm workspace yuck code --- yuck/panel/panel_sections/panel_widg_cen.yuck | 6 ++-- yuck/panel/panel_workspaces/leftwm_ws.yuck | 32 +++++++++++++++++++ .../panel_workspaces/panel_workspaces.yuck | 20 ------------ yuck/panel/panel_workspaces/panel_ws_ico.yuck | 14 -------- yuck/vars/vars.yuck | 1 - 5 files changed, 35 insertions(+), 38 deletions(-) create mode 100644 yuck/panel/panel_workspaces/leftwm_ws.yuck delete mode 100644 yuck/panel/panel_workspaces/panel_workspaces.yuck delete mode 100644 yuck/panel/panel_workspaces/panel_ws_ico.yuck diff --git a/yuck/panel/panel_sections/panel_widg_cen.yuck b/yuck/panel/panel_sections/panel_widg_cen.yuck index 1e61346..9d08318 100644 --- a/yuck/panel/panel_sections/panel_widg_cen.yuck +++ b/yuck/panel/panel_sections/panel_widg_cen.yuck @@ -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] (box :class "panel_side panel_cen" :halign "center" - :height 28 + :height "${h}" :width 300 :active true - (panel_workspaces :h "${h}") + (panel_ws_leftwm :h "${h}") ; LeftWM workspaces ) ) \ No newline at end of file diff --git a/yuck/panel/panel_workspaces/leftwm_ws.yuck b/yuck/panel/panel_workspaces/leftwm_ws.yuck new file mode 100644 index 0000000..7fb15bc --- /dev/null +++ b/yuck/panel/panel_workspaces/leftwm_ws.yuck @@ -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} + ) + ) + ) +) \ No newline at end of file diff --git a/yuck/panel/panel_workspaces/panel_workspaces.yuck b/yuck/panel/panel_workspaces/panel_workspaces.yuck deleted file mode 100644 index fb6740a..0000000 --- a/yuck/panel/panel_workspaces/panel_workspaces.yuck +++ /dev/null @@ -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}" - ) - ) - ) -) \ No newline at end of file diff --git a/yuck/panel/panel_workspaces/panel_ws_ico.yuck b/yuck/panel/panel_workspaces/panel_ws_ico.yuck deleted file mode 100644 index 4846744..0000000 --- a/yuck/panel/panel_workspaces/panel_ws_ico.yuck +++ /dev/null @@ -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' ? '' : ''} - ) -) \ No newline at end of file diff --git a/yuck/vars/vars.yuck b/yuck/vars/vars.yuck index 592dcdd..6909843 100644 --- a/yuck/vars/vars.yuck +++ b/yuck/vars/vars.yuck @@ -42,7 +42,6 @@ ;WIndow managers (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}]}]}" `leftwm state` ) \ No newline at end of file