Various dotfile changes. Emacs, mail, music, etc.

This commit is contained in:
2016-11-16 11:29:07 -05:00
parent 9eceac229e
commit bb5320b9d2
9 changed files with 120 additions and 41 deletions

34
bitbar/mu_count.5s.js Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env /usr/local/bin/node
const bitbar = require('bitbar');
const exec = require('child_process').exec;
let cmd = `/usr/local/bin/mu find flag:unread AND NOT flag:trashed AND \\(maildir:/Fastmail/INBOX OR maildir:/IOCOM/INBOX\\) --fields \"l f s\"`;
exec(cmd, function(error, stdout, stderr) {
let mails = stderr.match(/no matches/)
? []
: stdout.trim().split("\n").map(parseMailString);
bitbar([
':envelope:' + mails.length || "",
bitbar.sep,
...mails
]);
});
function parseMailString(m) {
const MAX = 80;
let matches = m.match(/([^\s]+)\s(.*)/);
let filename = matches[1];
let text = matches[2].substring(0, MAX) + (matches[2].length > MAX ? "..." : "");
return {
text,
bash: "/usr/local/bin/emacsclient -n " + filename,
terminal: false
}
}