From 70f1b604052ee190eb529926f2e7bdf1760881d2 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Wed, 5 Jun 2013 17:19:25 +0200 Subject: [PATCH] remove dwinpick, reader_client, not used ever --- awesome/rc.lua | 75 -------------------------- bin/dwinpick.sh | 7 --- bin/reader_client.js | 123 ------------------------------------------- 3 files changed, 205 deletions(-) delete mode 100755 bin/dwinpick.sh delete mode 100755 bin/reader_client.js diff --git a/awesome/rc.lua b/awesome/rc.lua index 19d979e..a74be65 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -164,80 +164,6 @@ clock_day = awful.widget.textclock('%a %d/%m') clock_icon = wibox.widget.imagebox() clock_icon:set_image(icon_dir .. "/clock.png") - --- google reader --- google_reader_widget = wibox.widget.textbox() --- google_reader_label = wibox.widget.textbox() --- google_reader_label:set_markup("RSS ") --- do --- google_reader_widget:set_markup("loading") --- local greader_timer = timer({ timeout = 315 }) -- 5:15 minutes --- local greader_info = "loading" --- local loading_widget = false --- function update_google_reader() --- -- protect against loading multiple times --- if loading_widget then --- return --- end --- loading_widget = true --- run_background("~/dotfiles/bin/reader_client.js totalunread", function (output) --- loading_widget = false --- greader_info = output:match( "(.-)%s*$") -- removed trailing whitespace --- google_reader_widget:set_markup("".. greader_info .."") --- end) --- end --- greader_timer:connect_signal("timeout", update_google_reader) --- greader_timer:start() --- update_google_reader() - --- -- tooltip stuff --- local greader_tooltip --- local greader_info_details = "loading" - --- function remove_greader() --- if greader_tooltip~= nil then --- naughty.destroy(greader_tooltip) --- greader_tooltip = nil --- end --- end - --- local loading_tooltip = false --- function update_greader_tooltip() --- if loading_tooltip then --- return --- end --- loading_tooltip = true --- run_background("~/dotfiles/bin/reader_client.js unreadlist", function (output) --- loading_tooltip = false --- greader_info_details = string.gsub(output, "%$(%w+)", "%1") --- greader_info_details = greader_info_details:match( "(.-)%s*$") -- removed trailing whitespace --- end) --- end - --- function add_greader() --- remove_greader() --- greader_tooltip = naughty.notify({ --- title = "google reader ("..greader_info.." new)", --- text = greader_info_details, --- timeout = 0, --- screen = mouse.screen --- }) --- end - --- update_greader_tooltip() --- greader_timer:connect_signal("timeout", update_greader_tooltip) - --- google_reader_widget:connect_signal("mouse::enter", add_greader) --- google_reader_widget:connect_signal("mouse::leave", remove_greader) --- google_reader_widget:buttons(awful.util.table.join( --- awful.button({ }, 1, function () awful.util.spawn("firefox reader.google.com", false) end), --- awful.button({ }, 2, function () --- update_greader_tooltip() --- update_google_reader() --- end))) - --- end - -- battery battery_widget = wibox.widget.textbox() battery_icon = wibox.widget.imagebox() @@ -482,7 +408,6 @@ globalkeys = awful.util.table.join( -- dmenu launcher awful.key({ modkey }, "e", function () awful.util.spawn("/home/yorick/dotfiles/bin/dlaunch.sh") end), awful.key({ modkey }, "=", function () awful.util.spawn("/home/yorick/dotfiles/bin/dcalc.sh") end), - awful.key({ modkey }, "z", function () awful.util.spawn("/home/yorick/dotfiles/bin/dwinpick.sh") end), awful.key({ modkey }, "x", function () diff --git a/bin/dwinpick.sh b/bin/dwinpick.sh deleted file mode 100755 index 85d19f5..0000000 --- a/bin/dwinpick.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -dmenu_args="-fn -*-termsyn-medium-*-*-*-12-*-*-*-*-*-*-* -nb #1D1E24 -nf #8DA893 -sb #1D1E24 -sf #C18E44 $@" -winlist=`echo "local q = \"\"; for i,c in ipairs(client.get()) do q=q..c.name..\"\\n\" end; return q" | awesome-client | tail -c +12 | head -c -2` -choice=`echo "$winlist" | dmenu -i -l 7 $dmenu_args` -if [ -n "$choice" ]; then - wmctrl -a "$choice" -fi diff --git a/bin/reader_client.js b/bin/reader_client.js deleted file mode 100755 index 6b92c94..0000000 --- a/bin/reader_client.js +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env node - -var creds = require('/home/yorick/.config/googlecl/creds.json') - -var https = require('https') -var querystring = require('querystring') -var GoogleClientLogin = require('googleclientlogin').GoogleClientLogin; -var googleAuth = new GoogleClientLogin({ - email: creds.user, - password: creds.password, - service: 'reader', - accountType: creds.type -}); - - -// thanks to http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI -function queryGoogleAPI(auth, apiname, method, parameters, cb) { - var path = '/reader/api/0/' + apiname - parameters.client = "yorickvp_reader_script/0.0.1" - if (method == "GET") - path += "?" + querystring.stringify(parameters) - var request = https.request( - { host: 'www.google.com' - , path: path - , headers: - { "Authorization": 'GoogleLogin auth=' + auth.getAuthId() }} - , cb) - if (method == "POST") - request.end(querystring.stringify(parameters)) - else request.end() } - -function getUnreadCounts(auth, cb) { - queryGoogleAPI(auth, 'unread-count', "GET", {all: "false", output: 'json'}, function(res) { - res.setEncoding('utf8') - var dataAcc = "" - res.on('data', function(d) { - dataAcc += d }) - res.on('end', function() { - cb(JSON.parse(dataAcc)) })})} - -function getTotalUnread(unreadcounts) { - var uc = unreadcounts.unreadcounts - if (!uc) return null - var idre = /user\/[0-9]+\/state\/com\.google\/reading-list/ - for (var i = 0; i < uc.length; i++) - if (idre.test(uc[i].id)) - return uc[i].count - return 0 } - -function getSubscriptions(auth, cb) { - queryGoogleAPI(auth, 'subscription/list', "GET", {output: 'json'}, function(res) { - res.setEncoding('utf8') - var dataAcc = "" - res.on('data', function(d) { - dataAcc += d }) - res.on('end', function() { - cb(JSON.parse(dataAcc)) })})} - -googleAuth.on('error', function(e) { - console.log('error:', e) }) - -function usage() { - console.log("usage: reader_client.js [totalunread | unreadlist]") - process.exit() } - -function cmd_total_unread() { - googleAuth.login() - googleAuth.once('login', function() { - getUnreadCounts(googleAuth, function(ucs) { - process.stdout.write(getTotalUnread(ucs)+"\n") })})} - -function strLimit(str, max) { - return str.length > max ? str.slice(0, max - 2) + ".." : str } - -function formatUnreadCountsNicely(ucs) { - var res = "" - return ucs - .map(function(uc) { - var maxlen = 25 - if (!uc.title) return - var firstPart = strLimit(uc.title, maxlen - 4) + ":" - var lastPart = uc.count + "" - var spaces = Array(maxlen - firstPart.length - lastPart.length).join(" ") - return firstPart + spaces + lastPart }) - .filter(function(ucstr) { - return ucstr != undefined }) - .join("\n") -} - -function cmd_unread_list() { - googleAuth.login() - googleAuth.once('login', function() { - // we need the subscriptions to find the titles - getSubscriptions(googleAuth, function(subs) { - var sub_table = {} - subs.subscriptions.forEach(function(sub) { - sub_table[sub.id] = sub }) - getUnreadCounts(googleAuth, function(ucs) { - ucs = ucs.unreadcounts - var labelre = /user\/[0-9]+\/label\/(.+)/ - ucs.forEach(function(uc) { - var sub = sub_table[uc.id] - if (sub) uc.title = sub.title - else { - var m = uc.id.match(labelre) - if (m) uc.title = m[1] }}) - process.stdout.write(formatUnreadCountsNicely(ucs) + "\n") - }) - }) - }) -} - -if (process.argv.length != 3) usage() -switch (process.argv[2]) { - case "totalunread": - cmd_total_unread() - break - case "unreadlist": - cmd_unread_list() - break - default: - usage() -}