From db342546778c806833f949cf58e2c9bd69557f13 Mon Sep 17 00:00:00 2001 From: novakne Date: Wed, 24 Feb 2021 19:57:01 +0100 Subject: [PATCH] exemples/scripts: dwl-tags.sh: use yambar capacities --- examples/scripts/dwl-tags.sh | 315 ++++++++++++++++++++++++++++------- 1 file changed, 251 insertions(+), 64 deletions(-) diff --git a/examples/scripts/dwl-tags.sh b/examples/scripts/dwl-tags.sh index 44ade8f..ea1bad6 100755 --- a/examples/scripts/dwl-tags.sh +++ b/examples/scripts/dwl-tags.sh @@ -11,26 +11,266 @@ # https://github.com/djpohly/dwl/pull/91 # # TAGS: -# Name Type Return -# ------------------------------------- -# {dwltag} string dwl tags name/state +# Name Type Return +# ---------------------------------------------------- +# {dwltag_N} string dwl tags name +# {dwltag_N_occupied} bool dwl tags state occupied +# {dwltag_N_focused} bool dwl tags state focused +# {dwl_layout} string dwl layout +# {dwl_title} string client title +# +# Now the fun part # # Exemple configuration: -# - script: -# path: /absolute/path/to/dwl-tags.sh -# args: [1] -# content: {string: {text: "{dwltag}"}} +# +# - script: +# path: /absolute/path/to/dwl-tags.sh +# args: [1] +# anchors: +# - occupied: &occupied {foreground: 57bbf4ff} +# - focused: &focused {foreground: fc65b0ff} +# - default: &default {foreground: d2ccd6ff} +# content: +# - map: +# margin: 4 +# tag: dwltag_0_occupied +# values: +# true: +# map: +# tag: dwltag_0_focused +# values: +# true: +# - string: {text: "{dwltag_0}", <<: *focused} +# false: +# - string: {text: "{dwltag_0}", <<: *occupied} +# false: +# map: +# tag: dwltag_0_focused +# values: +# true: +# - string: {text: "{dwltag_0}", <<: *focused} +# false: +# - string: {text: "{dwltag_0}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_1_occupied +# values: +# true: +# map: +# tag: dwltag_1_focused +# values: +# true: +# - string: {text: "{dwltag_1}", <<: *focused} +# false: +# - string: {text: "{dwltag_1}", <<: *occupied} +# false: +# map: +# tag: dwltag_1_focused +# values: +# true: +# - string: {text: "{dwltag_1}", <<: *focused} +# false: +# - string: {text: "{dwltag_1}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_2_occupied +# values: +# true: +# map: +# tag: dwltag_2_focused +# values: +# true: +# - string: {text: "{dwltag_2}", <<: *focused} +# false: +# - string: {text: "{dwltag_2}", <<: *occupied} +# false: +# map: +# tag: dwltag_2_focused +# values: +# true: +# - string: {text: "{dwltag_2}", <<: *focused} +# false: +# - string: {text: "{dwltag_2}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_3_occupied +# values: +# true: +# map: +# tag: dwltag_3_focused +# values: +# true: +# - string: {text: "{dwltag_3}", <<: *focused} +# false: +# - string: {text: "{dwltag_3}", <<: *occupied} +# false: +# map: +# tag: dwltag_3_focused +# values: +# true: +# - string: {text: "{dwltag_3}", <<: *focused} +# false: +# - string: {text: "{dwltag_3}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_4_occupied +# values: +# true: +# map: +# tag: dwltag_4_focused +# values: +# true: +# - string: {text: "{dwltag_4}", <<: *focused} +# false: +# - string: {text: "{dwltag_4}", <<: *occupied} +# false: +# map: +# tag: dwltag_4_focused +# values: +# true: +# - string: {text: "{dwltag_4}", <<: *focused} +# false: +# - string: {text: "{dwltag_4}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_5_occupied +# values: +# true: +# map: +# tag: dwltag_5_focused +# values: +# true: +# - string: {text: "{dwltag_5}", <<: *focused} +# false: +# - string: {text: "{dwltag_5}", <<: *occupied} +# false: +# map: +# tag: dwltag_5_focused +# values: +# true: +# - string: {text: "{dwltag_5}", <<: *focused} +# false: +# - string: {text: "{dwltag_5}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_6_occupied +# values: +# true: +# map: +# tag: dwltag_6_focused +# values: +# true: +# - string: {text: "{dwltag_6}", <<: *focused} +# false: +# - string: {text: "{dwltag_6}", <<: *occupied} +# false: +# map: +# tag: dwltag_6_focused +# values: +# true: +# - string: {text: "{dwltag_6}", <<: *focused} +# false: +# - string: {text: "{dwltag_6}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_7_occupied +# values: +# true: +# map: +# tag: dwltag_7_focused +# values: +# true: +# - string: {text: "{dwltag_7}", <<: *focused} +# false: +# - string: {text: "{dwltag_7}", <<: *occupied} +# false: +# map: +# tag: dwltag_7_focused +# values: +# true: +# - string: {text: "{dwltag_7}", <<: *focused} +# false: +# - string: {text: "{dwltag_7}", <<: *default} +# - map: +# margin: 4 +# tag: dwltag_8_occupied +# values: +# true: +# map: +# tag: dwltag_8_focused +# values: +# true: +# - string: {text: "{dwltag_8}", <<: *focused} +# false: +# - string: {text: "{dwltag_8}", <<: *occupied} +# false: +# map: +# tag: dwltag_8_focused +# values: +# true: +# - string: {text: "{dwltag_8}", <<: *focused} +# false: +# - string: {text: "{dwltag_8}", <<: *default} +# - list: +# spacing: 3 +# items: +# - string: {text: "{dwl_layout}"} +# - string: {text: "{dwl_title}"} # Variables declare titleline tagline title taginfo isactive ctags mtags layout -declare symbol_occupied_pre symbol_occupied_post symbol_focused_pre symbol_focused_post declare -a tags name readonly fname=/tmp/dwltags-"$WAYLAND_DISPLAY" +_cycle() { + tags=( "1" "2" "3" "4" "5" "6" "7" "8" "9" ) + + # Name of tag (optional) + # If there is no name, number are used + # + # Example: + # name=( "" "" "" "Media" ) + # -> return "" "" "" "Media" 5 6 7 8 9) + name=() + + for tag in "${!tags[@]}"; do + mask=$((1< return "" "" "" "Media" 5 6 7 8 9) - name=() - - # Symbol for occupied tags - # - # Format: "{symbol_occupied_pre}{TAGNAME}{symbol_occupied_post}" - # You can leave one empty if you don't want to surround the TAGNAME - symbol_occupied_pre="" - symbol_occupied_post="." - - # Symbol for the focused tag - # - # Format: "{symbol_focused_pre}{TAGNAME}{symbol_focused_post}" - # You can leave one empty if you don't want to surround the TAGNAME - symbol_focused_pre="[ " - symbol_focused_post=" ]" - - for i in {0..8}; do - mask=$((1<