Replace fgrep by grep -F

This commit is contained in:
Sayantan Santra 2022-10-31 16:37:26 -05:00
parent 89cd5a812c
commit c3191ac9d1

View file

@ -39,7 +39,7 @@ function placeWindowOnDesktop(){
window=( $window ) window=( $window )
echo -e "Place window ⟪\E[010;92m${window[@]:1}(id=${window[0]})\E[0m⟫ to desktop ⟪\E[010;93m${_desk[@]:1}(id=${_desk[0]})\E[0m⟫" echo -e "Place window ⟪\E[010;92m${window[@]:1}(id=${window[0]})\E[0m⟫ to desktop ⟪\E[010;93m${_desk[@]:1}(id=${_desk[0]})\E[0m⟫"
wmctrl -i -r ${window[0]} -t ${_desk[0]} wmctrl -i -r ${window[0]} -t ${_desk[0]}
done < <( wmctrl -l | fgrep "${1}" | awk '{$2=""; $3=""}1' ) done < <( wmctrl -l | grep -F "${1}" | awk '{$2=""; $3=""}1' )
} }
# $1 - desktop sub-sting name # $1 - desktop sub-sting name
@ -60,20 +60,20 @@ function deskName(){
# Magic function to distribute all Firefox windows by its desktops automatically! # Magic function to distribute all Firefox windows by its desktops automatically!
# This is consider only Firefox windows, and get desktop tag-name from [] square brackets. # This is consider only Firefox windows, and get desktop tag-name from [] square brackets.
# F.e. for windows: # F.e. for windows:
# $ wmctrl -lx | fgrep 'Navigator.Firefox' # $ wmctrl -lx | grep -F 'Navigator.Firefox'
# 0x03a000c5 3 Navigator.Firefox 2.hubbitus.taskdata [Home] bash - Extract string from brackets - Stack Overflow - Mozilla Firefox # 0x03a000c5 3 Navigator.Firefox 2.hubbitus.taskdata [Home] bash - Extract string from brackets - Stack Overflow - Mozilla Firefox
# 0x03a000ad 5 Navigator.Firefox 2.hubbitus.taskdata [RDC] rdc-iac-ansible/cleaning-snapshots.sh at ebf2122335387a66cb043f0480d8f38e6a087d39 · RegDC/rdc-iac-ansible - Mozilla Firefox # 0x03a000ad 5 Navigator.Firefox 2.hubbitus.taskdata [RDC] rdc-iac-ansible/cleaning-snapshots.sh at ebf2122335387a66cb043f0480d8f38e6a087d39 · RegDC/rdc-iac-ansible - Mozilla Firefox
# 0x03a00089 5 Navigator.Firefox 2.hubbitus.taskdata [RDC] How to slice an array in Bash - Stack Overflow - Mozilla Firefox # 0x03a00089 5 Navigator.Firefox 2.hubbitus.taskdata [RDC] How to slice an array in Bash - Stack Overflow - Mozilla Firefox
# 0x03a000b9 0 Navigator.Firefox 2.hubbitus.taskdata [Egais] Firefox desktop placement issue - Mozilla Firefox # 0x03a000b9 0 Navigator.Firefox 2.hubbitus.taskdata [Egais] Firefox desktop placement issue - Mozilla Firefox
# Home, RDC and Egais will be searched in desktop names for place windows on it accordingly! # Home, RDC and Egais will be searched in desktop names for place windows on it accordingly!
function matchAllFirefoxWindowsByDesktops(){ function matchAllFirefoxWindowsByDesktops(){
for word in $( wmctrl -lx | fgrep 'Navigator.firefox' | awk -F"[][]" '{print $2}' | sort -u ); do for word in $( wmctrl -lx | grep -F 'Navigator.firefox' | awk -F"[][]" '{print $2}' | sort -u ); do
placeWindowOnDesktop "[$word]" "$word" placeWindowOnDesktop "[$word]" "$word"
done done
} }
function matchAllNightlyWindowsByDesktops(){ function matchAllNightlyWindowsByDesktops(){
for word in $( wmctrl -lx | fgrep 'Navigator.Nightly' | awk -F"[][]" '{print $2}' | sort -u ); do for word in $( wmctrl -lx | grep -F 'Navigator.Nightly' | awk -F"[][]" '{print $2}' | sort -u ); do
placeWindowOnDesktop "[$word]" "$word" placeWindowOnDesktop "[$word]" "$word"
done done
} }