diff --git a/examples/scripts/dwl-tags.sh b/examples/scripts/dwl-tags.sh new file mode 100755 index 0000000..7e68257 --- /dev/null +++ b/examples/scripts/dwl-tags.sh @@ -0,0 +1,153 @@ +#!/usr/bin/env bash +# +# dwl-tags.sh - display dwl tags +# +# USAGE: dwl-tags.sh 1 +# +# REQUIREMENTS: +# - inotifywait ( 'inotify-tools' on arch ) +# - 2021/02/25 - dwl pull request: +# 'Interface to display tag information on status bar #91' +# https://github.com/djpohly/dwl/pull/91 +# +# TAGS: +# Name Type Return +# ---------------------------------------------------- +# {tag_N} string dwl tags name +# {tag_N_occupied} bool dwl tags state occupied +# {tag_N_focused} bool dwl tags state focused +# {layout} string dwl layout +# {title} string client title +# +# Now the fun part +# +# Exemple configuration: +# +# - 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: tag_0_occupied +# values: +# true: +# map: +# tag: tag_0_focused +# values: +# true: {string: {text: "{tag_0}", <<: *focused}} +# false: {string: {text: "{tag_0}", <<: *occupied}} +# false: +# map: +# tag: tag_0_focused +# values: +# true: {string: {text: "{tag_0}", <<: *focused}} +# false: {string: {text: "{tag_0}", <<: *default}} +# ... +# ... +# ... +# - map: +# margin: 4 +# tag: tag_8_occupied +# values: +# true: +# map: +# tag: tag_8_focused +# values: +# true: {string: {text: "{tag_8}", <<: *focused}} +# false: {string: {text: "{tag_8}", <<: *occupied}} +# false: +# map: +# tag: tag_8_focused +# values: +# true: {string: {text: "{tag_8}", <<: *focused}} +# false: {string: {text: "{tag_8}", <<: *default}} +# - list: +# spacing: 3 +# items: +# - string: {text: "{layout}"} +# - string: {text: "{title}"} + + +# Variables +declare titleline tagline title taginfo isactive ctags mtags layout +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<