hyperfang8

Minimize All aka Show Desktop with exceptions via wmctrl

Aug 14th, 2013
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. #!/bin/bash
  2. #This script should minimize everything except conky and  aterm
  3. #Add/remove entries according to example
  4. #I use this script as alternative to openbox's wincmd which minimizes conky and aterm
  5. #This script uses toggle by default, you could also use "add" to only minimize windows not show back
  6. #Do to do this just change "toggle" to "add"
  7. #Script addapted from  http://crunchbang.org/forums/viewtopic.php?id=12917
  8.  
  9. current="$(wmctrl -d | awk '/\*/ {print $1}')"
  10. currentopen="$(wmctrl -l | awk -v "curr=$current" 'curr==$2')"
  11. opennames="$(echo "$currentopen" | awk '{for (i=4; i <= NF; i++) printf("%s%c", $i, (i==NF)?ORS:OFS)}')"
  12.  
  13. while read -r line; do
  14.     case  $line in
  15.     "aterm")
  16.          echo "Ignoring aterm"
  17.     ;;
  18.     "Conky")
  19.                  echo "Ignoring conky"
  20.         ;;
  21.  
  22.     *)
  23.          wmctrl -r "$line" -b toggle,hidden
  24.  
  25.     ;;
  26.     esac
  27.  
  28.  
  29. done <<< "$opennames"
Advertisement
Add Comment
Please, Sign In to add comment