URI:
       Rearrange list of qubes by label - qmenu - manage qubes os via dmenu (drkhsh fork)
  HTML git clone git://git.drkhsh.at/qmenu.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit d2386cef925dd5b7da50ebe4fb7bb1c9bb5fbc96
   DIR parent 4539452bd22e506915afac89e6c5c4c356b718cc
  HTML Author: sine3o14nnae <3o14@pm.me>
       Date:   Fri, 16 Aug 2019 17:08:31 +0200
       
       Rearrange list of qubes by label
       
       Diffstat:
         M qmenu-usb                           |      39 ++++++++++++++++++++++++++++---
       
       1 file changed, 36 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/qmenu-usb b/qmenu-usb
       @@ -1,8 +1,39 @@
        #!/bin/bash
        
       +rearrange_qube_list() {
       + 
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "purple"')"`
       +
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "blue"')"`
       + 
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "gray"')"`
       +   
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "green"')"`
       +
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "yellow"')"`
       +
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "orange"')"`
       +
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "red"')"`
       +
       + local QUBE_LIST_REARRANGED+=`echo "\n$(echo "\n$qube_list" |\
       +   awk '$2 == "black"')"`
       +
       + # Remove blank lines 
       + qube_list=`echo -e "$QUBE_LIST_REARRANGED" | sed "{/^$/d;}"`
       +}
       +
       +
        get_qube_label() {
        
       - qube_label=`echo "$vm_list" | grep -w $target_qube | awk '{ print $2 }'`
       + qube_label=`echo "$qube_list" | grep -w $target_qube | awk '{ print $2 }'`
         
         # Change black, yellow and green to a more readable color if needed 
         if [ "$qube_label" = "black" ]; then
       @@ -36,7 +67,9 @@ fi
        
        usb_list=`qvm-usb`
        
       -vm_list=`qvm-ls --no-spinner --running -O NAME,LABEL`
       +qube_list=`qvm-ls --no-spinner --running -O NAME,LABEL`
       +
       +rearrange_qube_list
        
        device=`echo "$usb_list" | dmenu -l 16 -f -m 0 -nb $theme_0\
          -nf $theme_1 -sb $theme_1 -sf $theme_0`
       @@ -51,7 +84,7 @@ if [ -n "$device" ]; then
        
          if [ -z "$target_qube" ]; then
            
       -    target_qube=`echo "$vm_list" | grep -v -w dom0 |\
       +    target_qube=`echo "$qube_list" | grep -v -w dom0 |\
              sed '1d' | dmenu -p "attach to:" -l 32 -f -m 0\
              -nb $theme_0 -nf $theme_1 -sb $theme_1 -sf $theme_0 |\
              awk '{ print $1 }'`