exemples/scripts: dwl-tags.sh: fix exemple length

rename yambar tags
This commit is contained in:
novakne 2021-02-25 08:26:10 +01:00
parent db34254677
commit d69ca5a0c9
No known key found for this signature in database
GPG key ID: 327873BEC52A3176

View file

@ -6,18 +6,18 @@
# #
# REQUIREMENTS: # REQUIREMENTS:
# - inotifywait ( 'inotify-tools' on arch ) # - inotifywait ( 'inotify-tools' on arch )
# - 2021/02/22 - dwl pull request: # - 2021/02/25 - dwl pull request:
# 'Interface to display tag information on status bar #91' # 'Interface to display tag information on status bar #91'
# https://github.com/djpohly/dwl/pull/91 # https://github.com/djpohly/dwl/pull/91
# #
# TAGS: # TAGS:
# Name Type Return # Name Type Return
# ---------------------------------------------------- # ----------------------------------------------------
# {dwltag_N} string dwl tags name # {tag_N} string dwl tags name
# {dwltag_N_occupied} bool dwl tags state occupied # {tag_N_occupied} bool dwl tags state occupied
# {dwltag_N_focused} bool dwl tags state focused # {tag_N_focused} bool dwl tags state focused
# {dwl_layout} string dwl layout # {layout} string dwl layout
# {dwl_title} string client title # {title} string client title
# #
# Now the fun part # Now the fun part
# #
@ -33,189 +33,44 @@
# content: # content:
# - map: # - map:
# margin: 4 # margin: 4
# tag: dwltag_0_occupied # tag: tag_0_occupied
# values: # values:
# true: # true:
# map: # map:
# tag: dwltag_0_focused # tag: tag_0_focused
# values: # values:
# true: # true: {string: {text: "{tag_0}", <<: *focused}}
# - string: {text: "{dwltag_0}", <<: *focused} # false: {string: {text: "{tag_0}", <<: *occupied}}
# false:
# - string: {text: "{dwltag_0}", <<: *occupied}
# false: # false:
# map: # map:
# tag: dwltag_0_focused # tag: tag_0_focused
# values: # values:
# true: # true: {string: {text: "{tag_0}", <<: *focused}}
# - string: {text: "{dwltag_0}", <<: *focused} # false: {string: {text: "{tag_0}", <<: *default}}
# false: # ...
# - string: {text: "{dwltag_0}", <<: *default} # ...
# ...
# - map: # - map:
# margin: 4 # margin: 4
# tag: dwltag_1_occupied # tag: tag_8_occupied
# values: # values:
# true: # true:
# map: # map:
# tag: dwltag_1_focused # tag: tag_8_focused
# values: # values:
# true: # true: {string: {text: "{tag_8}", <<: *focused}}
# - string: {text: "{dwltag_1}", <<: *focused} # false: {string: {text: "{tag_8}", <<: *occupied}}
# false:
# - string: {text: "{dwltag_1}", <<: *occupied}
# false: # false:
# map: # map:
# tag: dwltag_1_focused # tag: tag_8_focused
# values: # values:
# true: # true: {string: {text: "{tag_8}", <<: *focused}}
# - string: {text: "{dwltag_1}", <<: *focused} # false: {string: {text: "{tag_8}", <<: *default}}
# 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: # - list:
# spacing: 3 # spacing: 3
# items: # items:
# - string: {text: "{dwl_layout}"} # - string: {text: "{layout}"}
# - string: {text: "{dwl_title}"} # - string: {text: "{title}"}
# Variables # Variables
@ -238,7 +93,7 @@ _cycle() {
for tag in "${!tags[@]}"; do for tag in "${!tags[@]}"; do
mask=$((1<<tag)) mask=$((1<<tag))
tag_name="dwltag" tag_name="tag"
declare "${tag_name}_${tag}" declare "${tag_name}_${tag}"
name[tag]="${name[tag]:-${tags[tag]}}" name[tag]="${name[tag]:-${tags[tag]}}"
@ -254,19 +109,19 @@ _cycle() {
# Focused # Focused
if (( "${mtags}" & mask )); then if (( "${mtags}" & mask )); then
printf -- '%s\n' "${tag_name}_${tag}_focused|bool|true" printf -- '%s\n' "${tag_name}_${tag}_focused|bool|true"
printf -- '%s\n' "dwl_title|string|${title}" printf -- '%s\n' "title|string|${title}"
else else
printf -- '%s\n' "${tag_name}_${tag}_focused|bool|false" printf -- '%s\n' "${tag_name}_${tag}_focused|bool|false"
fi fi
done done
printf -- '%s\n' "dwl_layout|string|${layout}" printf -- '%s\n' "layout|string|${layout}"
printf -- '%s\n' "" printf -- '%s\n' ""
} }
# Call the function here so the tags are displayed at dwl laucnh # Call the function here so the tags are displayed at dwl launch
_cycle _cycle
while true; do while true; do