Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
X11 urgency hint on new notification
Browse files Browse the repository at this point in the history
  • Loading branch information
mkiol committed Mar 28, 2018
1 parent c270272 commit 4f98f83
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
11 changes: 8 additions & 3 deletions source/lib/download_complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,16 @@ function showDownloadCompleteNotification(path) {
}
}];
}

const icon = utils.getIcon();

// Engine 3 - GNotifier + custom command
if (sps.engine === 3)
utils.executeCustomCommand(title, text, icon);

/* eslint-disable no-unused-vars */
id = notifApi.notifyWithActions(utils.getIcon(), title, text,
id = notifApi.notifyWithActions(icon, title, text,
system.name, reason=>{}, actions);
if (id)
return;
/* eslint-enable no-unused-vars */
}

Expand Down
3 changes: 3 additions & 0 deletions source/lib/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ exports.notify = (iconURL, title, text, notifier, closeHandler, clickHandler)=>{
};

exports.notifyWithActions = (iconURL, title, text, notifier, closeHandler, actionsList)=>{
if (sps.urgencyHint)
utils.setUrgencyHint();

// Escape unsupported tags
text = escapeUnsupportedTags(text);

Expand Down
3 changes: 0 additions & 3 deletions source/lib/thunderbird.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ function selectMessage(message) {
function showNotification(title, text, message, agregated = false){
const notifications = require("sdk/notifications");

if (sps.alwaysFocus)
focusWindow(false);

// Current implementation of click action doesn't support SeaMonkey,
// so doing not clickable notification if SeaMonkey
if (system.name === "SeaMonkey") {
Expand Down
10 changes: 6 additions & 4 deletions source/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ exports.getFileExtension = (filename)=>{
exports.executeCustomCommand = (title = "", text = "", imageUrl = "")=>{
let command = sps.command;

console.log("executeCustomCommand1: " + command);

if (command !== "") {
imageUrl = exports.escapeShell(imageUrl);
title = exports.escapeShell(title);
Expand All @@ -221,13 +219,17 @@ exports.executeCustomCommand = (title = "", text = "", imageUrl = "")=>{
command = command.replace("%title",title);
command = command.replace("%text",text);

console.log("executeCustomCommand2: " + command);

exports.execute(command);
}
};

exports.setUrgencyHint = ()=> {
let command = "wmctrl -r '" + system.name + "' -b add,demands_attention";
exports.execute(command);
};

exports.execute = function(command) {
console.log("execute: " + command);
const child_process = require("sdk/system/child_process");
const { env } = require("sdk/system/environment");
let c;
Expand Down
10 changes: 5 additions & 5 deletions source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Joe Simpson <headbangerkenny@gmail.com>",
"Andrew Nagle <kabili@zyrenth.com>"
],
"version": "1.13.1",
"version": "1.13.2",
"title": "GNotifier",
"fullName": "GNotifier",
"id": "jid1-OoNOA6XBjznvLQ@jetpack",
Expand Down Expand Up @@ -368,11 +368,11 @@
"value": ""
},
{
"name": "alwaysFocus",
"title": "New message notification - Set focus on Thunderbird window on new notification",
"description": "When enabled, fucus on Thunderbird window is set when new notification appears.",
"name": "urgencyHint",
"title": "Set urgency hint on new notification (Linux only)",
"description": "When enabled, X11 urgency hint on Thunderbird window is set when new notification appears.",
"type": "bool",
"value": false
"value": true
},
{
"name": "test",
Expand Down
Binary file added xpi/gnotifier-1.13.2-dev.xpi
Binary file not shown.

0 comments on commit 4f98f83

Please sign in to comment.