Clean the config code.

This commit is contained in:
Kolan Sh 2014-08-15 22:13:46 +04:00
parent 47bb829b7b
commit 1bdc6f55fc
7 changed files with 0 additions and 486 deletions

View File

@ -1,33 +0,0 @@
-- {{{ init environment
local wakka = {}
local capi = {
mouse = mouse,
screen = screen
}
-- {{{ display
-- formats the lines for the notify
local function display()
local lines = "<u>AUR Updates:</u>\n"
local f = io.popen("cower -u", "r")
local s = f:read('*all')
line = lines .. "\n" .. s .. "\n"
f:close()
return line
end
-- }}}
-- }}}
function wakka.addToWidget(mywidget)
mywidget:add_signal('mouse::enter', function ()
usage = naughty.notify({
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
timeout = 0,
hover_timeout = 0.5,
screen = capi.mouse.screen
})
end)
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
end
return wakka

View File

@ -1,33 +0,0 @@
-- {{{ init environment
local wakka = {}
local capi = {
mouse = mouse,
screen = screen
}
-- {{{ display
-- formats the lines for the notify
local function display()
local lines = "<u>GFX Temp:</u>\n"
local f = io.popen("ssh setkeh@192.168.1.8 /opt/bin/aticonfig --odgt | grep Temperature | cut -c 43-52", "r")
local s = f:read('*all')
line = lines .. "\n" .. s .. "\n"
f:close()
return line
end
-- }}}
-- }}}
function wakka.addToWidget(mywidget)
mywidget:add_signal('mouse::enter', function ()
usage = naughty.notify({
text = string.format('<span font_desc="%s">%s</span>', "monospace", display()),
timeout = 0,
hover_timeout = 0.5,
screen = capi.mouse.screen
})
end)
mywidget:add_signal('mouse::leave', function () naughty.destroy(usage) end)
end
return wakka

View File

@ -1,47 +0,0 @@
## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky
# ======================================================================
# Copyright (C) 2006 Baishampayan Ghose <b.ghose@ubuntu.com>
# Modified 2008 Hunter Loftis <hbloftis@uncc.edu>
# Time-stamp: Mon Jul 31, 2006 20:45+0530
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
# ======================================================================
import sys
import urllib # For BasicHTTPAuthentication
import feedparser # For parsing the feed
from textwrap import wrap
_URL = "https://mail.google.com/gmail/feed/atom"
uname = sys.argv[1]
password = sys.argv[2]
maxlen = sys.argv[3]
urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password)
def auth():
'''The method to do HTTPBasicAuthentication'''
opener = urllib.FancyURLopener()
f = opener.open(_URL)
feed = f.read()
return feed
def readmail(feed, maxlen):
'''Parse the Atom feed and print a summary'''
atom = feedparser.parse(feed)
print '${color1} %s new email(s)\n' % (len(atom.entries))
for i in range(min(len(atom.entries), maxlen)):
print ' ${color2}%s' % atom.entries[i].title
#uncomment the following line if you want to show the name of the sender
# print ' ${color2}%s' % atom.entries[i].author
if len(atom.entries) > maxlen:
print ' ${color}more...'
if __name__ == "__main__":
f = auth() # Do auth and then get the feed
readmail(f, int(maxlen)) # Let the feed be chewed by feedparser

View File

@ -1,95 +0,0 @@
function HTML_ToText (text)
-- Declare variables, load the file. Make tags lowercase.
text = string.gsub (text,"(%b<>)",
function (tag)
return tag:lower()
end)
--[[
First we kill the developer formatting (tabs, CR, LF)
and produce a long string with no newlines and tabs.
We also kill repeated spaces as browsers ignore them anyway.
]]
local devkill=
{
["("..string.char(10)..")"] = " ",
["("..string.char(13)..")"] = " ",
["("..string.char(15)..")"] = "",
["(%s%s+)"]=" ",
}
for pat, res in pairs (devkill) do
text = string.gsub (text, pat, res)
end
-- Then we remove the header. We do this by stripping it first.
text = string.gsub (text, "(<%s*head[^>]*>)", "<head>")
text = string.gsub (text, "(<%s*%/%s*head%s*>)", "</head>")
text = string.gsub (text, "(<head>,*<%/head>)", "")
-- Kill all scripts. First we nuke their attribs.
text = string.gsub (text, "(<%s*script[^>]*>)", "<script>")
text = string.gsub (text, "(<%s*%/%s*script%s*>)", "</script>")
text = string.gsub (text, "(<script>,*<%/script>)", "")
-- Ok, same for styles.
text = string.gsub (text, "(<%s*style[^>]*>)", "<style>")
text = string.gsub (text, "(<%s*%/%s*style%s*>)", "</style>")
text = string.gsub (text, "(<style>.*<%/style>)", "")
-- Replace <td> with tabulators.
text = string.gsub (text, "(<%s*td[^>]*>)","\t")
-- Replace <br> with linebreaks.
text = string.gsub (text, "(<%s*br%s*%/%s*>)","\n")
-- Replace <li> with an asterisk surrounded by 2 spaces.
-- Replace </li> with a newline.
text = string.gsub (text, "(<%s*li%s*%s*>)"," * ")
text = string.gsub (text, "(<%s*/%s*li%s*%s*>)","\n")
-- <p>, <div>, <tr>, <ul> will be replaced to a double newline.
text = string.gsub (text, "(<%s*div[^>]*>)", "\n\n")
text = string.gsub (text, "(<%s*p[^>]*>)", "\n\n")
text = string.gsub (text, "(<%s*tr[^>]*>)", "\n\n")
text = string.gsub (text, "(<%s*%/*%s*ul[^>]*>)", "\n\n")
--
-- Nuke all other tags now.
text = string.gsub (text, "(%b<>)","")
-- Replace entities to their correspondant stuff where applicable.
-- C# is owned badly here by using a table. :-P
-- A metatable secures entities, so you can add them natively as keys.
-- Enclosing brackets also get added automatically (capture!)
local entities = {}
setmetatable (entities,
{
__newindex = function (tbl, key, value)
key = string.gsub (key, "(%#)" , "%%#")
key = string.gsub (key, "(%&)" , "%%&")
key = string.gsub (key, "(%;)" , "%%;")
key = string.gsub (key, "(.+)" , "("..key..")")
rawset (tbl, key, value)
end
})
entities =
{
["&nbsp;"] = " ",
["&bull;"] = " * ",
[""] = "<",
[""] = ">",
["&trade;"] = "(tm)",
["&frasl;"] = "/",
["<"] = "<",
[">"] = ">",
["&copy;"] = "(c)",
["&reg;"] = "(r)",
-- Then kill all others.
-- You can customize this table if you would like to,
-- I just got bored of copypasting. :-)
-- http://hotwired.lycos.com/webmonkey/reference/special_characters/
["%&.+%;"] = "",
}
for entity, repl in pairs (entities) do
text = string.gsub (text, entity, repl)
end
return text
end

View File

@ -1,119 +0,0 @@
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- beautiful.init("/home/kolan/.config/awesome/themes/default/theme.lua")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
--FreeDesktop
require('freedesktop.utils')
require('freedesktop.menu')
freedesktop.utils.icon_theme = 'gnome'
--Vicious + Widgets
vicious = require("vicious")
globalkeys = {}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({ }, "Print", function () awful.util.spawn("upload_screens scr") end),
awful.key({ }, "XF86AudioRaiseVolume", function () volumecfg.up(0) end),
awful.key({ }, "XF86AudioLowerVolume", function () volumecfg.down(0) end),
awful.key({ }, "XF86AudioMute", function () volumecfg.toggle() end),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
awful.key({ modkey, }, "w", function () awful.util.spawn("luakit") end, "Start Luakit Web Browser"),
awful.key({ modkey, "Control" }, "n", awful.client.restore),
-- Prompt
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
awful.key({ modkey }, "x",
function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval")
end),
-- Menubar
awful.key({ modkey }, "p", function() menubar.show() end)
)
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end),
awful.key({ modkey, }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
)
-- Set keys
root.keys(globalkeys)
-- }}}

View File

@ -1,123 +0,0 @@
-- Document key bindings
local awful = require("awful")
local table = table
local ipairs = ipairs
local pairs = pairs
local math = math
local string = string
local type = type
local modkey = "Mod4"
local beautiful = require("beautiful")
local naughty = require("naughty")
local capi = {
root = root,
client = client
}
module("keydoc")
local doc = { }
local currentgroup = "Misc"
local orig = awful.key.new
-- Replacement for awful.key.new
local function new(mod, key, press, release, docstring)
-- Usually, there is no use of release, let's just use it for doc
-- if it's a string.
if press and release and not docstring and type(release) == "string" then
docstring = release
release = nil
end
local k = orig(mod, key, press, release)
-- Remember documentation for this key (we take the first one)
if k and #k > 0 and docstring then
doc[k[1]] = { help = docstring,
group = currentgroup }
end
return k
end
awful.key.new = new -- monkey patch
-- Turn a key to a string
local function key2str(key)
local sym = key.key or key.keysym
local translate = {
["#14"] = "#",
[" "] = "Space",
}
sym = translate[sym] or sym
if not key.modifiers or #key.modifiers == 0 then return sym end
local result = ""
local translate = {
[modkey] = "",
Shift = "",
Control = "Ctrl",
}
for _, mod in pairs(key.modifiers) do
mod = translate[mod] or mod
result = result .. mod .. " + "
end
return result .. sym
end
-- Unicode "aware" length function (well, UTF8 aware)
-- See: http://lua-users.org/wiki/LuaUnicode
local function unilen(str)
local _, count = string.gsub(str, "[^\128-\193]", "")
return count
end
-- Start a new group
function group(name)
currentgroup = name
return {}
end
local function markup(keys)
local result = {}
-- Compute longest key combination
local longest = 0
for _, key in ipairs(keys) do
if doc[key] then
longest = math.max(longest, unilen(key2str(key)))
end
end
local curgroup = nil
for _, key in ipairs(keys) do
if doc[key] then
local help, group = doc[key].help, doc[key].group
local skey = key2str(key)
result[group] = (result[group] or "") ..
'<span font="DejaVu Sans Mono 10" color="' .. beautiful.fg_widget_clock .. '"> ' ..
string.format("%" .. (longest - unilen(skey)) .. "s ", "") .. skey ..
'</span> <span color="' .. beautiful.fg_widget_value .. '">' ..
help .. '</span>\n'
end
end
return result
end
-- Display help in a naughty notification
local nid = nil
function display()
local strings = awful.util.table.join(
markup(capi.root.keys()),
capi.client.focus and markup(capi.client.focus:keys()) or {})
local result = ""
for group, res in pairs(strings) do
if #result > 0 then result = result .. "\n" end
result = result ..
'<span weight="bold" color="' .. beautiful.fg_widget_value_important .. '">' ..
group .. "</span>\n" .. res
end
nid = naughty.notify({ text = result,
replaces_id = nid,
hover_timeout = 0.1,
timeout = 30 }).id
end

View File

@ -1,36 +0,0 @@
function table.val_to_str ( v )
if "string" == type( v ) then
v = string.gsub( v, "\n", "\\n" )
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
return "'" .. v .. "'"
end
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
else
return "table" == type( v ) and table.tostring( v ) or
tostring( v )
end
end
function table.key_to_str ( k )
if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then
return k
else
return "[" .. table.val_to_str( k ) .. "]"
end
end
function table.tostring( tbl )
local result, done = {}, {}
for k, v in ipairs( tbl ) do
table.insert( result, table.val_to_str( v ) )
done[ k ] = true
end
for k, v in pairs( tbl ) do
if not done[ k ] then
table.insert( result,
table.key_to_str( k ) .. "=" .. table.val_to_str( v ) )
end
end
return "{" .. table.concat( result, "," ) .. "}"
end