Advertisement
Guest User

Untitled

a guest
Aug 19th, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.01 KB | None | 0 0
  1. #!/bin/bash
  2. # lemonbar dock script
  3.  
  4. dock() { # print list of icons
  5.     message=$(i3-msg -t get_workspaces)
  6.     len=$(echo $message | jq '.[].num' | wc -l)
  7.     len=$((len - 1))
  8.  
  9.     output=""
  10.     for i in {0..$len} ; do
  11.         num=$(echo $message | jq ".[$i].num")
  12.         if [[ $num -eq 1 ]] ; then
  13.             ico="ONE"
  14.         elif [[ $num -eq 2 ]] ; then
  15.             ico="TWO"
  16.         elif [[ $num -eq 3 ]] ; then
  17.             ico="THREE"
  18.         elif [[ $num -eq 4 ]] ; then
  19.             ico="FOUR"
  20.         elif [[ $num -eq 5 ]] ; then
  21.             ico="FIVE"
  22.         elif [[ $num -eq 6 ]] ; then
  23.             ico="SIX"
  24.         elif [[ $num -eq 7 ]] ; then
  25.             ico="SEVEN"
  26.         elif [[ $num -eq 8 ]] ; then
  27.             ico="EIGHT"
  28.         elif [[ $num -eq 9 ]] ; then
  29.             ico="NINE"
  30.         elif [[ $num -eq 10 ]] ; then
  31.             ico="TEN"
  32.         fi
  33.  
  34.         if [ $(echo $message | jq ".[$i].focused") = "true" ] ; then
  35.             output="$output%{F#4F99D3} $ico "
  36.         else
  37.             output="$output%{F#545A60} $ico "
  38.         fi
  39.        
  40.         if [ $i -lt $len ] ; then
  41.             output="$output%{O5}"
  42.         fi
  43.     done
  44.  
  45.     echo $output
  46. }
  47.  
  48. echo "%{c}$(dock)" >> ~/.scripts/lemonbar/dockcontents
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement