Instead of creating a Chrome plugin, I would either start the window title or use HTML5 notifications. Create a simple page that polls your Gmail IMAP for new messages and includes gmail in a large iFrame. If a new message is found, your external window may issue a notification.
HTML5 notifications : http://www.html5rocks.com/en/tutorials/notifications/quick/
Blinking header (adopted from this ):
var newMailBlinker = (function () {
var oldTitle = document.title,
msg = 'New Mail!',
timeoutId,
blink = function() {
document.title = document.title == msg ? ' ' : msg;
},
clear = function() {
clearInterval(timeoutId);
document.title = oldTitle;
window.onmousemove = null;
timeoutId = null;
};
return function () {
if (!timeoutId) {
timeoutId = setInterval(blink, 1000);
window.onmousemove = clear;
}
};
}());
PHP Gmail IMAP poll (adopted from this ):
$t1=time();
$tt=$t1+(60*1);
do{
if(isset($t2)) unset($t2);
$t2=time();
if(imap_num_msg($imap)!=0){
$mc=imap_check($imap);
echo 'New messages available';
}else echo 'No new messagens';
sleep(rand(7,13));
if(!@imap_ping($imap)){
}
}while($tt>$t2);
jQuery AJAX Poll to your IMAP script (adopted from this ):
function ajax_request() {
$.ajax({
url: '/path/to/gmail/imap/checkMessages.php',
dataType: 'json',
error: function(xhr_data) {
},
success: function(xhr_data) {
console.log(xhr_data);
if (xhr_data.status == 'No new messages') {
setTimeout(function() { ajax_request(); }, 15000);
} else {
newMailBlinker();
}
}
contentType: 'application/json'
});
}
, jQuery PHP . , . , , PHP IMAP . .