rhoconlinux
8/17/2014 - 11:04 AM

hack window show de sublime

hack window show de sublime

#!/bin/bash

#getting sublime window
	wmctrl -l -p | grep -e "- Sublime" > .hacking-sublime-pre.txt;
		raw=$(cat .hacking-sublime-pre.txt)

#getting the sublime app code to identify simultaneous windows
	echo $raw | sed 's/[^ ]* //'  | sed 's/[^ ]* //' | sed 's/\s.*$//'  > .hacking-sublime-apcode.txt;
		apcode=$(cat .hacking-sublime-apcode.txt)
		echo $apcode

#getting the window that is not the main sublime window
#esto es si está la ventanita. Excluye la linea buena que refiere e sublime
	wmctrl -l -p | grep $apcode | grep Sublime;
	wmctrl -l -p | grep $apcode | grep -v Sublime > .hacking-sublime.txt;

#closing the app with the PID 
a=$(cat .hacking-sublime.txt)
echo $a

echo "cleaning the output"
echo $a | sed 's/\s.*$//';
echo $a | sed 's/\s.*$//'  > .hacking-sublime-pid.txt;
cat  .hacking-sublime-pid.txt;
pid=$(cat .hacking-sublime-pid.txt)
wmctrl -i -c $pid &