Remove awesome configs
@ -1,126 +0,0 @@
|
||||
local wibox = wibox
|
||||
local widget = widget
|
||||
local screen = screen
|
||||
local image = image
|
||||
local button = button
|
||||
local table = table
|
||||
local ipairs = ipairs
|
||||
local awful = require("awful")
|
||||
local utils = require("freedesktop.utils")
|
||||
|
||||
module("freedesktop.desktop")
|
||||
|
||||
local current_pos = {}
|
||||
local iconsize = { width = 48, height = 48 }
|
||||
local labelsize = { width = 130, height = 20 }
|
||||
local margin = { x = 20, y = 20 }
|
||||
|
||||
function add_icon(settings)
|
||||
|
||||
local s = settings.screen
|
||||
|
||||
if not current_pos[s] then
|
||||
current_pos[s] = { x = (screen[s].geometry.width - iconsize.width - margin.x), y = 40 }
|
||||
end
|
||||
|
||||
local totheight = (settings.icon and iconsize.height or 0) + (settings.label and labelsize.height or 0)
|
||||
if totheight == 0 then return end
|
||||
|
||||
if current_pos[s].y + totheight > screen[s].geometry.height - 40 then
|
||||
current_pos[s].x = current_pos[s].x - labelsize.width - iconsize.width - margin.x
|
||||
current_pos[s].y = 40
|
||||
end
|
||||
|
||||
if (settings.icon) then
|
||||
icon = awful.widget.button({ image = settings.icon })
|
||||
local newbuttons = icon:buttons()
|
||||
table.insert(newbuttons, button({}, 1, nil, settings.click));
|
||||
icon:buttons(newbuttons)
|
||||
|
||||
icon_container = wibox({ position = "floating", screen = s, bg = "#00000000" })
|
||||
icon_container.widgets = { icon }
|
||||
icon_container:geometry({
|
||||
width = iconsize.width,
|
||||
height = iconsize.height,
|
||||
y = current_pos[s].y,
|
||||
x = current_pos[s].x
|
||||
})
|
||||
icon_container.screen = s
|
||||
|
||||
current_pos[s].y = current_pos[s].y + iconsize.height + 5
|
||||
end
|
||||
|
||||
if (settings.label) then
|
||||
caption = widget({ type="textbox", align="right", width=labelsize.width })
|
||||
caption.ellipsize = "middle"
|
||||
caption.text = settings.label
|
||||
caption:buttons({
|
||||
button({ }, 1, settings.click)
|
||||
})
|
||||
|
||||
caption_container = wibox({ position = "floating", screen = s, bg = "#00000000" })
|
||||
caption_container.widgets = { caption }
|
||||
caption_container:geometry({
|
||||
width = labelsize.width,
|
||||
height = labelsize.height,
|
||||
y = current_pos[s].y,
|
||||
x = current_pos[s].x - labelsize.width + iconsize.width
|
||||
})
|
||||
caption_container.screen = s
|
||||
end
|
||||
|
||||
current_pos[s].y = current_pos[s].y + labelsize.height + margin.y
|
||||
end
|
||||
|
||||
--- Adds subdirs and files icons to the desktop
|
||||
-- @param dir The directory to parse, (default is ~/Desktop)
|
||||
-- @param showlabels Shows icon captions (default is false)
|
||||
function add_applications_icons(arg)
|
||||
for i, program in ipairs(utils.parse_desktop_files({
|
||||
dir = arg.dir or '~/Desktop/',
|
||||
icon_sizes = {
|
||||
iconsize.width .. "x" .. iconsize.height,
|
||||
"128x128", "96x96", "72x72", "64x64", "48x48",
|
||||
"36x36", "32x32", "24x24", "22x22", "16x6"
|
||||
}
|
||||
})) do
|
||||
if program.show then
|
||||
add_icon({
|
||||
label = arg.showlabels and program.Name or nil,
|
||||
icon = program.icon_path,
|
||||
screen = arg.screen,
|
||||
click = function () awful.util.spawn(program.cmdline) end
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Adds subdirs and files icons to the desktop
|
||||
-- @param dir The directory to parse
|
||||
-- @param showlabels Shows icon captions
|
||||
-- @param open_with The program to use to open clicked files and dirs (i.e. xdg_open, thunar, etc.)
|
||||
function add_dirs_and_files_icons(arg)
|
||||
arg.open_with = arg.open_width or 'thunar'
|
||||
for i, file in ipairs(utils.parse_dirs_and_files({
|
||||
dir = arg.dir or '~/Desktop/',
|
||||
icon_sizes = {
|
||||
iconsize.width .. "x" .. iconsize.height,
|
||||
"128x128", "96x96", "72x72", "64x64", "48x48",
|
||||
"36x36", "32x32", "24x24", "22x22", "16x6"
|
||||
}
|
||||
})) do
|
||||
if file.show then
|
||||
add_icon({
|
||||
label = arg.showlabels and file.filename or nil,
|
||||
icon = file.icon,
|
||||
screen = arg.screen,
|
||||
click = function () awful.util.spawn(arg.open_with .. ' ' .. file.path) end
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function add_desktop_icons(args)
|
||||
add_applications_icons(args)
|
||||
add_dirs_and_files_icons(args)
|
||||
end
|
@ -1,97 +0,0 @@
|
||||
-- Grab environment
|
||||
local utils = require("freedesktop.utils")
|
||||
local io = io
|
||||
local string = string
|
||||
local table = table
|
||||
local os = os
|
||||
local ipairs = ipairs
|
||||
local pairs = pairs
|
||||
|
||||
module("freedesktop.menu")
|
||||
|
||||
all_menu_dirs = {
|
||||
'/usr/share/applications/',
|
||||
'/usr/local/share/applications/',
|
||||
'~/.local/share/applications/'
|
||||
}
|
||||
|
||||
show_generic_name = false
|
||||
|
||||
--- Create menus for applications
|
||||
-- @param menu_dirs A list of application directories (optional).
|
||||
-- @return A prepared menu w/ categories
|
||||
function new(arg)
|
||||
-- the categories and their synonyms where shamelessly copied from lxpanel
|
||||
-- source code.
|
||||
local programs = {}
|
||||
local config = arg or {}
|
||||
|
||||
programs['AudioVideo'] = {}
|
||||
programs['Development'] = {}
|
||||
programs['Education'] = {}
|
||||
programs['Game'] = {}
|
||||
programs['Graphics'] = {}
|
||||
programs['Network'] = {}
|
||||
programs['Office'] = {}
|
||||
programs['Settings'] = {}
|
||||
programs['System'] = {}
|
||||
programs['Utility'] = {}
|
||||
programs['Other'] = {}
|
||||
|
||||
for i, dir in ipairs(config.menu_dirs or all_menu_dirs) do
|
||||
local entries = utils.parse_desktop_files({dir = dir})
|
||||
for j, program in ipairs(entries) do
|
||||
-- check whether to include in the menu
|
||||
if program.show and program.Name and program.cmdline then
|
||||
if show_generic_name and program.GenericName then
|
||||
program.Name = program.Name .. ' (' .. program.GenericName .. ')'
|
||||
end
|
||||
local target_category = nil
|
||||
if program.categories then
|
||||
for _, category in ipairs(program.categories) do
|
||||
if programs[category] then
|
||||
target_category = category
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not target_category then
|
||||
target_category = 'Other'
|
||||
end
|
||||
if target_category then
|
||||
table.insert(programs[target_category], { program.Name, program.cmdline, program.icon_path })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- sort each submenu alphabetically case insensitive
|
||||
for k, v in pairs(programs) do
|
||||
table.sort(v, function(a, b) return a[1]:lower() < b[1]:lower() end)
|
||||
end
|
||||
|
||||
local menu = {
|
||||
{ "Accessories", programs["Utility"], utils.lookup_icon({ icon = 'applications-accessories.png' }) },
|
||||
{ "Development", programs["Development"], utils.lookup_icon({ icon = 'applications-development.png' }) },
|
||||
{ "Education", programs["Education"], utils.lookup_icon({ icon = 'applications-science.png' }) },
|
||||
{ "Games", programs["Game"], utils.lookup_icon({ icon = 'applications-games.png' }) },
|
||||
{ "Graphics", programs["Graphics"], utils.lookup_icon({ icon = 'applications-graphics.png' }) },
|
||||
{ "Internet", programs["Network"], utils.lookup_icon({ icon = 'applications-internet.png' }) },
|
||||
{ "Multimedia", programs["AudioVideo"], utils.lookup_icon({ icon = 'applications-multimedia.png' }) },
|
||||
{ "Office", programs["Office"], utils.lookup_icon({ icon = 'applications-office.png' }) },
|
||||
{ "Other", programs["Other"], utils.lookup_icon({ icon = 'applications-other.png' }) },
|
||||
{ "Settings", programs["Settings"], utils.lookup_icon({ icon = 'preferences-desktop.png' }) },
|
||||
{ "System Tools", programs["System"], utils.lookup_icon({ icon = 'applications-system.png' }) },
|
||||
}
|
||||
|
||||
-- Removing empty entries from menu
|
||||
local cleanedMenu = {}
|
||||
for index, item in ipairs(menu) do
|
||||
itemTester = item[2]
|
||||
if itemTester[1] then
|
||||
table.insert(cleanedMenu, item)
|
||||
end
|
||||
end
|
||||
|
||||
return cleanedMenu
|
||||
end
|
@ -1,254 +0,0 @@
|
||||
-- Grab environment
|
||||
|
||||
local io = io
|
||||
local os = os
|
||||
local table = table
|
||||
local type = type
|
||||
local ipairs = ipairs
|
||||
local pairs = pairs
|
||||
|
||||
module("freedesktop.utils")
|
||||
|
||||
terminal = 'termite'
|
||||
|
||||
icon_theme = nil
|
||||
|
||||
all_icon_sizes = {
|
||||
'128x128',
|
||||
'96x96',
|
||||
'72x72',
|
||||
'64x64',
|
||||
'48x48',
|
||||
'36x36',
|
||||
'32x32',
|
||||
'24x24',
|
||||
'22x22',
|
||||
'16x16'
|
||||
}
|
||||
all_icon_types = {
|
||||
'apps',
|
||||
'actions',
|
||||
'devices',
|
||||
'places',
|
||||
'categories',
|
||||
'status',
|
||||
'mimetypes'
|
||||
}
|
||||
all_icon_paths = { os.getenv("HOME") .. '/.icons/', '/usr/share/icons/' }
|
||||
|
||||
icon_sizes = {}
|
||||
|
||||
local mime_types = {}
|
||||
|
||||
function get_lines(...)
|
||||
local f = io.popen(...)
|
||||
return function () -- iterator
|
||||
local data = f:read()
|
||||
if data == nil then f:close() end
|
||||
return data
|
||||
end
|
||||
end
|
||||
|
||||
function file_exists(filename)
|
||||
local file = io.open(filename, 'r')
|
||||
local result = (file ~= nil)
|
||||
if result then
|
||||
file:close()
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function lookup_icon(arg)
|
||||
if arg.icon:sub(1, 1) == '/' and (arg.icon:find('.+%.png') or arg.icon:find('.+%.xpm')) then
|
||||
-- icons with absolute path and supported (AFAICT) formats
|
||||
return arg.icon
|
||||
else
|
||||
local icon_path = {}
|
||||
local icon_themes = {}
|
||||
local icon_theme_paths = {}
|
||||
if icon_theme and type(icon_theme) == 'table' then
|
||||
icon_themes = icon_theme
|
||||
elseif icon_theme then
|
||||
icon_themes = { icon_theme }
|
||||
end
|
||||
for i, theme in ipairs(icon_themes) do
|
||||
for j, path in ipairs(all_icon_paths) do
|
||||
table.insert(icon_theme_paths, path .. theme .. '/')
|
||||
end
|
||||
-- TODO also look in parent icon themes, as in freedesktop.org specification
|
||||
end
|
||||
table.insert(icon_theme_paths, '/usr/share/icons/hicolor/') -- fallback theme cf spec
|
||||
|
||||
local isizes = icon_sizes
|
||||
for i, sz in ipairs(all_icon_sizes) do
|
||||
table.insert(isizes, sz)
|
||||
end
|
||||
|
||||
for i, icon_theme_directory in ipairs(icon_theme_paths) do
|
||||
for j, size in ipairs(arg.icon_sizes or isizes) do
|
||||
for k, icon_type in ipairs(all_icon_types) do
|
||||
table.insert(icon_path, icon_theme_directory .. size .. '/' .. icon_type .. '/')
|
||||
end
|
||||
end
|
||||
end
|
||||
-- lowest priority fallbacks
|
||||
table.insert(icon_path, '/usr/share/pixmaps/')
|
||||
table.insert(icon_path, '/usr/share/icons/')
|
||||
table.insert(icon_path, '/usr/share/app-install/icons/')
|
||||
|
||||
for i, directory in ipairs(icon_path) do
|
||||
if (arg.icon:find('.+%.png') or arg.icon:find('.+%.xpm')) and file_exists(directory .. arg.icon) then
|
||||
return directory .. arg.icon
|
||||
elseif file_exists(directory .. arg.icon .. '.png') then
|
||||
return directory .. arg.icon .. '.png'
|
||||
elseif file_exists(directory .. arg.icon .. '.xpm') then
|
||||
return directory .. arg.icon .. '.xpm'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function lookup_file_icon(arg)
|
||||
load_mime_types()
|
||||
|
||||
local extension = arg.filename:match('%a+$')
|
||||
local mime = mime_types[extension] or ''
|
||||
local mime_family = mime:match('^%a+') or ''
|
||||
|
||||
-- possible icons in a typical gnome theme (i.e. Tango icons)
|
||||
local possible_filenames = {
|
||||
mime,
|
||||
'gnome-mime-' .. mime,
|
||||
mime_family,
|
||||
'gnome-mime-' .. mime_family,
|
||||
extension
|
||||
}
|
||||
|
||||
for i, filename in ipairs(possible_filenames) do
|
||||
local icon = lookup_icon({icon = filename, icon_sizes = (arg.icon_sizes or all_icon_sizes)})
|
||||
if icon then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
|
||||
-- If we don't find ad icon, then pretend is a plain text file
|
||||
return lookup_icon({ icon = 'txt', icon_sizes = arg.icon_sizes or all_icon_sizes })
|
||||
end
|
||||
|
||||
--- Load system MIME types
|
||||
-- @return A table with file extension <--> MIME type mapping
|
||||
function load_mime_types()
|
||||
if #mime_types == 0 then
|
||||
for line in io.lines('/etc/mime.types') do
|
||||
if not line:find('^#') then
|
||||
local parsed = {}
|
||||
for w in line:gmatch('[^%s]+') do
|
||||
table.insert(parsed, w)
|
||||
end
|
||||
if #parsed > 1 then
|
||||
for i = 2, #parsed do
|
||||
mime_types[parsed[i]] = parsed[1]:gsub('/', '-')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Parse a .desktop file
|
||||
-- @param file The .desktop file
|
||||
-- @param requested_icon_sizes A list of icon sizes (optional). If this list is given, it will be used as a priority list for icon sizes when looking up for icons. If you want large icons, for example, you can put '128x128' as the first item in the list.
|
||||
-- @return A table with file entries.
|
||||
function parse_desktop_file(arg)
|
||||
local program = { show = true, file = arg.file }
|
||||
for line in io.lines(arg.file) do
|
||||
for key, value in line:gmatch("(%w+)=(.+)") do
|
||||
program[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
-- Don't show the program if NoDisplay is true
|
||||
-- Only show the program if there is not OnlyShowIn attribute
|
||||
-- or if it's equal to 'awesome'
|
||||
if program.NoDisplay == "true" or program.OnlyShowIn ~= nil and program.OnlyShowIn ~= "awesome" then
|
||||
program.show = false
|
||||
end
|
||||
|
||||
-- Look up for a icon.
|
||||
if program.Icon then
|
||||
program.icon_path = lookup_icon({ icon = program.Icon, icon_sizes = (arg.icon_sizes or all_icon_sizes) })
|
||||
if program.icon_path ~= nil and not file_exists(program.icon_path) then
|
||||
program.icon_path = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Split categories into a table.
|
||||
if program.Categories then
|
||||
program.categories = {}
|
||||
for category in program.Categories:gmatch('[^;]+') do
|
||||
table.insert(program.categories, category)
|
||||
end
|
||||
end
|
||||
|
||||
if program.Exec then
|
||||
local cmdline = program.Exec:gsub('%%c', program.Name)
|
||||
cmdline = cmdline:gsub('%%[fmuFMU]', '')
|
||||
cmdline = cmdline:gsub('%%k', program.file)
|
||||
if program.icon_path then
|
||||
cmdline = cmdline:gsub('%%i', '--icon ' .. program.icon_path)
|
||||
else
|
||||
cmdline = cmdline:gsub('%%i', '')
|
||||
end
|
||||
if program.Terminal == "true" then
|
||||
cmdline = terminal .. ' -e ' .. cmdline
|
||||
end
|
||||
program.cmdline = cmdline
|
||||
end
|
||||
|
||||
return program
|
||||
end
|
||||
|
||||
--- Parse a directory with .desktop files
|
||||
-- @param dir The directory.
|
||||
-- @param icons_size, The icons sizes, optional.
|
||||
-- @return A table with all .desktop entries.
|
||||
function parse_desktop_files(arg)
|
||||
local programs = {}
|
||||
local files = get_lines('find '.. arg.dir ..' -name "*.desktop" 2>/dev/null')
|
||||
for file in files do
|
||||
arg.file = file
|
||||
table.insert(programs, parse_desktop_file(arg))
|
||||
end
|
||||
return programs
|
||||
end
|
||||
|
||||
--- Parse a directory files and subdirs
|
||||
-- @param dir The directory.
|
||||
-- @param icons_size, The icons sizes, optional.
|
||||
-- @return A table with all .desktop entries.
|
||||
function parse_dirs_and_files(arg)
|
||||
local files = {}
|
||||
local paths = get_lines('find '..arg.dir..' -maxdepth 1 -type d')
|
||||
for path in paths do
|
||||
if path:match("[^/]+$") then
|
||||
local file = {}
|
||||
file.filename = path:match("[^/]+$")
|
||||
file.path = path
|
||||
file.show = true
|
||||
file.icon = lookup_icon({ icon = "folder", icon_sizes = (arg.icon_sizes or all_icon_sizes) })
|
||||
table.insert(files, file)
|
||||
end
|
||||
end
|
||||
local paths = get_lines('find '..arg.dir..' -maxdepth 1 -type f')
|
||||
for path in paths do
|
||||
if not path:find("%.desktop$") then
|
||||
local file = {}
|
||||
file.filename = path:match("[^/]+$")
|
||||
file.path = path
|
||||
file.show = true
|
||||
file.icon = lookup_file_icon({ filename = file.filename, icon_sizes = (arg.icon_sizes or all_icon_sizes) })
|
||||
table.insert(files, file)
|
||||
end
|
||||
end
|
||||
return files
|
||||
end
|
@ -1,548 +0,0 @@
|
||||
--Configure home path so you dont have too
|
||||
home_path = os.getenv('HOME') .. '/'
|
||||
|
||||
-- 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( awful.util.getdir("config") .. "/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")
|
||||
local wi = require("wi")
|
||||
|
||||
-- {{{ Error handling
|
||||
-- Check if awesome encountered an error during startup and fell back to
|
||||
-- another config (This code will only ever execute for the fallback config)
|
||||
if awesome.startup_errors then
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, there were errors during startup!",
|
||||
text = awesome.startup_errors })
|
||||
end
|
||||
|
||||
-- Handle runtime errors after startup
|
||||
do
|
||||
local in_error = false
|
||||
awesome.connect_signal("debug::error", function (err)
|
||||
-- Make sure we don't go into an endless error loop
|
||||
if in_error then
|
||||
return
|
||||
end
|
||||
in_error = true
|
||||
naughty.notify({ preset = naughty.config.presets.critical, title = "Oops, an error happened!", text = err })
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- This is used later as the default terminal and editor to run.
|
||||
terminal = "termite"
|
||||
editor = os.getenv("EDITOR") or "vim"
|
||||
editor_cmd = terminal .. " -e " .. editor
|
||||
rmenu = "rofr.sh"
|
||||
browser = "firefox"
|
||||
filemgr = "thunar"
|
||||
txteditor = "geany"
|
||||
volumeup = "pamixer -i 2"
|
||||
volumedown = "pamixer -d 2"
|
||||
volumemute = "pamixer -t"
|
||||
art = "gimp"
|
||||
|
||||
-- Default modkey.
|
||||
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
||||
-- If you do not like this or do not have such a key,
|
||||
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
|
||||
-- However, you can use another modifier like Mod1, but it may interact with others.
|
||||
modkey = "Mod4"
|
||||
|
||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
local layouts =
|
||||
{
|
||||
awful.layout.suit.floating,
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.left,
|
||||
awful.layout.suit.tile.bottom,
|
||||
awful.layout.suit.tile.top,
|
||||
awful.layout.suit.fair,
|
||||
awful.layout.suit.fair.horizontal,
|
||||
awful.layout.suit.spiral,
|
||||
awful.layout.suit.spiral.dwindle,
|
||||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
awful.layout.suit.magnifier
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ Naughty presets
|
||||
naughty.config.defaults.timeout = 5
|
||||
naughty.config.defaults.screen = 1
|
||||
naughty.config.defaults.position = "top_right"
|
||||
naughty.config.defaults.margin = 8
|
||||
naughty.config.defaults.gap = 1
|
||||
naughty.config.defaults.ontop = true
|
||||
naughty.config.defaults.font = "Ubuntu 10"
|
||||
naughty.config.defaults.icon = nil
|
||||
naughty.config.defaults.icon_size = 256
|
||||
naughty.config.defaults.fg = beautiful.fg_tooltip
|
||||
naughty.config.defaults.bg = beautiful.bg_tooltip
|
||||
naughty.config.defaults.border_color = beautiful.border_tooltip
|
||||
naughty.config.defaults.border_width = 2
|
||||
naughty.config.defaults.hover_timeout = nil
|
||||
-- -- }}}
|
||||
|
||||
-- {{{ Wallpaper
|
||||
if beautiful.wallpaper then
|
||||
for s = 1, screen.count() do
|
||||
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
-- Define a tag table which hold all screen tags.
|
||||
tags = {
|
||||
names = {
|
||||
':1',
|
||||
':2',
|
||||
':3',
|
||||
':4',
|
||||
':5',
|
||||
':6',
|
||||
':7',
|
||||
':8',
|
||||
':9',
|
||||
},
|
||||
layout = {
|
||||
layouts[5], -- 1:1
|
||||
layouts[10], -- 2:2
|
||||
layouts[10], -- 3:3
|
||||
layouts[12], -- 4:4
|
||||
layouts[2], -- 5:5
|
||||
layouts[10], -- 6:6
|
||||
layouts[10], -- 7:7
|
||||
layouts[2], -- 8:8
|
||||
layouts[10], -- 9:9
|
||||
}
|
||||
}
|
||||
for s = 1, screen.count() do
|
||||
-- Each screen has its own tag table.
|
||||
tags[s] = awful.tag(tags.names, s, tags.layout)
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- Wallpaper Changer Based On
|
||||
-- menu icon menu pdq 07-02-2012
|
||||
local wallmenu = {}
|
||||
local function wall_load(wall)
|
||||
local f = io.popen('ln -sfn ' .. '/usr/share/backgrounds/archlabs/' .. wall .. ' ' .. home_path .. '.config/awesome/themes/default/bg.png')
|
||||
awesome.restart()
|
||||
end
|
||||
local function wall_menu()
|
||||
local f = io.popen('ls -1 ' .. '/usr/share/backgrounds/archlabs/')
|
||||
for l in f:lines() do
|
||||
local item = { l, function () wall_load(l) end }
|
||||
table.insert(wallmenu, item)
|
||||
end
|
||||
f:close()
|
||||
end
|
||||
wall_menu()
|
||||
|
||||
-- Widgets
|
||||
|
||||
spacer = wibox.widget.textbox()
|
||||
spacer:set_text(' | ')
|
||||
|
||||
--Weather Widget
|
||||
weather = wibox.widget.textbox()
|
||||
vicious.register(weather, vicious.widgets.weather, "Weather: ${city}. Sky: ${sky}. Temp: ${tempc}c Humid: ${humid}%. Wind: ${windkmh} KM/h", 1200, "YMML")
|
||||
|
||||
--Battery Widget
|
||||
batt = wibox.widget.textbox()
|
||||
vicious.register(batt, vicious.widgets.bat, "Batt: $2% Rem: $3", 61, "BAT1")
|
||||
|
||||
|
||||
-- {{{ Menu
|
||||
-- Create a laucher widget and a main menu
|
||||
|
||||
menu_items = freedesktop.menu.new()
|
||||
myawesomemenu = {
|
||||
{ "manual", terminal .. " -e man awesome", freedesktop.utils.lookup_icon({ icon = 'help' }) },
|
||||
{ "restart", awesome.restart, freedesktop.utils.lookup_icon({ icon = 'system-shutdown' }) },
|
||||
{ "quit", awesome.quit, freedesktop.utils.lookup_icon({ icon = 'system-shutdown' }) }
|
||||
}
|
||||
|
||||
table.insert(menu_items, { "Awesome", myawesomemenu, beautiful.awesome_icon })
|
||||
table.insert(menu_items, { "Wallpaper", wallmenu, freedesktop.utils.lookup_icon({ icon = 'gnome-settings-background' })})
|
||||
|
||||
mymainmenu = awful.menu({ items = menu_items, width = 200 })
|
||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
|
||||
|
||||
-- Menubar configuration
|
||||
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||
-- }}}
|
||||
|
||||
-- {{{ Wibox
|
||||
-- Create a textclock widget
|
||||
mytextclock = awful.widget.textclock()
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
mywibox = {}
|
||||
myinfowibox = {}
|
||||
mypromptbox = {}
|
||||
mylayoutbox = {}
|
||||
mytaglist = {}
|
||||
mytaglist.buttons = awful.util.table.join(
|
||||
awful.button({ }, 1, awful.tag.viewonly),
|
||||
awful.button({ modkey }, 1, awful.client.movetotag),
|
||||
awful.button({ }, 3, awful.tag.viewtoggle),
|
||||
awful.button({ modkey }, 3, awful.client.toggletag),
|
||||
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
|
||||
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
|
||||
)
|
||||
mytasklist = {}
|
||||
mytasklist.buttons = awful.util.table.join(
|
||||
awful.button({ }, 1, function (c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
-- Without this, the following
|
||||
-- :isvisible() makes no sense
|
||||
c.minimized = false
|
||||
if not c:isvisible() then
|
||||
awful.tag.viewonly(c:tags()[1])
|
||||
end
|
||||
-- This will also un-minimize
|
||||
-- the client, if needed
|
||||
client.focus = c
|
||||
c:raise()
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, function ()
|
||||
if instance then
|
||||
instance:hide()
|
||||
instance = nil
|
||||
else
|
||||
instance = awful.menu.clients({ width=200 })
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 4, function ()
|
||||
awful.client.focus.byidx(1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end),
|
||||
awful.button({ }, 5, function ()
|
||||
awful.client.focus.byidx(-1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end)
|
||||
)
|
||||
|
||||
for s = 1, screen.count() do
|
||||
-- Create a promptbox for each screen
|
||||
mypromptbox[s] = awful.widget.prompt()
|
||||
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
|
||||
-- We need one layoutbox per screen.
|
||||
mylayoutbox[s] = awful.widget.layoutbox(s)
|
||||
mylayoutbox[s]:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
|
||||
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
|
||||
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
|
||||
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
|
||||
-- Create a taglist widget
|
||||
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
|
||||
|
||||
-- Create a tasklist widget
|
||||
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
||||
|
||||
-- Create the wibox
|
||||
mywibox[s] = awful.wibox({ position = "top", screen = s })
|
||||
|
||||
-- Widgets that are aligned to the left
|
||||
local left_layout = wibox.layout.fixed.horizontal()
|
||||
left_layout:add(mylauncher)
|
||||
left_layout:add(mytaglist[s])
|
||||
left_layout:add(mypromptbox[s])
|
||||
|
||||
-- Widgets that are aligned to the right
|
||||
local right_layout = wibox.layout.fixed.horizontal()
|
||||
if s == 1 then right_layout:add(wibox.widget.systray()) end
|
||||
right_layout:add(spacer)
|
||||
right_layout:add(spacer)
|
||||
right_layout:add(baticon)
|
||||
right_layout:add(batpct)
|
||||
right_layout:add(spacer)
|
||||
right_layout:add(pacicon)
|
||||
right_layout:add(pacwidget)
|
||||
right_layout:add(spacer)
|
||||
right_layout:add(volicon)
|
||||
right_layout:add(volpct)
|
||||
right_layout:add(volspace)
|
||||
right_layout:add(spacer)
|
||||
right_layout:add(mytextclock)
|
||||
right_layout:add(mylayoutbox[s])
|
||||
|
||||
-- Now bring it all together (with the tasklist in the middle)
|
||||
local layout = wibox.layout.align.horizontal()
|
||||
layout:set_left(left_layout)
|
||||
layout:set_middle(mytasklist[s])
|
||||
layout:set_right(right_layout)
|
||||
|
||||
mywibox[s]:set_widget(layout)
|
||||
|
||||
-- Create the bottom wibox
|
||||
myinfowibox[s] = awful.wibox({ position = "bottom", screen = s })
|
||||
-- Widgets that are aligned to the bottom
|
||||
local bottom_layout = wibox.layout.fixed.horizontal()
|
||||
bottom_layout:add(cpuicon)
|
||||
bottom_layout:add(cpu)
|
||||
bottom_layout:add(spacer)
|
||||
bottom_layout:add(memicon)
|
||||
bottom_layout:add(mem)
|
||||
bottom_layout:add(spacer)
|
||||
bottom_layout:add(wifiicon)
|
||||
bottom_layout:add(wifi)
|
||||
bottom_layout:add(spacer)
|
||||
bottom_layout:add(weather)
|
||||
bottom_layout:add(spacer)
|
||||
|
||||
-- Now bring it all together
|
||||
--local layout = wibox.layout.align.horizontal()
|
||||
--layout:set_bottom(bottom_layout)
|
||||
|
||||
myinfowibox[s]:set_widget(bottom_layout)
|
||||
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Mouse bindings
|
||||
root.buttons(awful.util.table.join(
|
||||
awful.button({ }, 3, function () mymainmenu:toggle() end),
|
||||
awful.button({ }, 4, awful.tag.viewnext),
|
||||
awful.button({ }, 5, awful.tag.viewprev)
|
||||
))
|
||||
-- }}}
|
||||
|
||||
-- {{{ 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),
|
||||
|
||||
-- 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, }, "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, "Control" }, "space", function () awful.layout.inc(layouts, -1) end),
|
||||
awful.key({ modkey, }, "w", function () awful.util.spawn(browser) end),
|
||||
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
|
||||
awful.key({ modkey }, "t", function () awful.util.spawn(terminal) end),
|
||||
awful.key({ modkey }, "e", function () awful.util.spawn(txteditor) end),
|
||||
awful.key({ modkey }, "f", function () awful.util.spawn(filemgr) end),
|
||||
awful.key({ modkey }, "r", function () awful.util.spawn(rmenu) end),
|
||||
awful.key({ modkey }, "space", function () awful.util.spawn(rmenu) end),
|
||||
awful.key({ modkey, "Shift" }, "r", awesome.restart),
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
awful.key({ modkey, "Control" }, "n", awful.client.restore),
|
||||
-- Menubar
|
||||
awful.key({ modkey }, "b", function() menubar.show() end)
|
||||
)
|
||||
|
||||
clientkeys = awful.util.table.join(
|
||||
awful.key({ modkey, "Shift" }, "f", function (c) c.fullscreen = not c.fullscreen end),
|
||||
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
|
||||
awful.key({ modkey, "Shift" }, "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, "Shift" }, "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)
|
||||
)
|
||||
|
||||
-- Compute the maximum number of digit we need, limited to 9
|
||||
keynumber = 0
|
||||
for s = 1, screen.count() do
|
||||
keynumber = math.min(9, math.max(#tags[s], keynumber))
|
||||
end
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it works on any keyboard layout.
|
||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||
for i = 1, keynumber do
|
||||
globalkeys = awful.util.table.join(globalkeys,
|
||||
awful.key({ modkey }, "#" .. i + 9,
|
||||
function ()
|
||||
local screen = mouse.screen
|
||||
if tags[screen][i] then
|
||||
awful.tag.viewonly(tags[screen][i])
|
||||
end
|
||||
end),
|
||||
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
||||
function ()
|
||||
local screen = mouse.screen
|
||||
if tags[screen][i] then
|
||||
awful.tag.viewtoggle(tags[screen][i])
|
||||
end
|
||||
end),
|
||||
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
||||
function ()
|
||||
if client.focus and tags[client.focus.screen][i] then
|
||||
awful.client.movetotag(tags[client.focus.screen][i])
|
||||
end
|
||||
end),
|
||||
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||
function ()
|
||||
if client.focus and tags[client.focus.screen][i] then
|
||||
awful.client.toggletag(tags[client.focus.screen][i])
|
||||
end
|
||||
end))
|
||||
end
|
||||
|
||||
clientbuttons = awful.util.table.join(
|
||||
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
|
||||
awful.button({ modkey }, 1, awful.mouse.client.move),
|
||||
awful.button({ modkey }, 3, awful.mouse.client.resize))
|
||||
|
||||
-- Set keys
|
||||
root.keys(globalkeys)
|
||||
-- }}}
|
||||
|
||||
-- {{{ Rules
|
||||
awful.rules.rules = {
|
||||
-- All clients will match this rule.
|
||||
{ rule = { },
|
||||
properties = { border_width = beautiful.border_width,
|
||||
border_color = beautiful.border_normal,
|
||||
focus = awful.client.focus.filter,
|
||||
keys = clientkeys,
|
||||
buttons = clientbuttons } },
|
||||
{ rule = { class = "mpv" },
|
||||
properties = { floating = true } },
|
||||
{ rule = { class = "pinentry" },
|
||||
properties = { floating = true } },
|
||||
{ rule = { class = "gimp" },
|
||||
properties = { floating = true } },
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][3] } },
|
||||
{ rule = { class = "VirtualBox" },
|
||||
properties = { tag = tags[1][5] } },
|
||||
{ rule = { class = "Gns3" },
|
||||
properties = { tag = tags[1][5] } },
|
||||
-- Set Firefox to always map on tags number 2 of screen 1.
|
||||
-- { rule = { class = "Firefox" },
|
||||
-- properties = { tag = tags[1][2] } },
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ Signals
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.connect_signal("manage", function (c, startup)
|
||||
-- Enable sloppy focus
|
||||
c:connect_signal("mouse::enter", function(c)
|
||||
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||
and awful.client.focus.filter(c) then
|
||||
client.focus = c
|
||||
end
|
||||
end)
|
||||
|
||||
if not startup then
|
||||
-- Set the windows at the slave,
|
||||
-- i.e. put it at the end of others instead of setting it master.
|
||||
-- awful.client.setslave(c)
|
||||
|
||||
-- Put windows in a smart way, only if they does not set an initial position.
|
||||
if not c.size_hints.user_position and not c.size_hints.program_position then
|
||||
awful.placement.no_overlap(c)
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
end
|
||||
|
||||
local titlebars_enabled = false
|
||||
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
|
||||
-- Widgets that are aligned to the left
|
||||
local left_layout = wibox.layout.fixed.horizontal()
|
||||
left_layout:add(awful.titlebar.widget.iconwidget(c))
|
||||
|
||||
-- Widgets that are aligned to the right
|
||||
local right_layout = wibox.layout.fixed.horizontal()
|
||||
right_layout:add(awful.titlebar.widget.floatingbutton(c))
|
||||
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
|
||||
right_layout:add(awful.titlebar.widget.stickybutton(c))
|
||||
right_layout:add(awful.titlebar.widget.ontopbutton(c))
|
||||
right_layout:add(awful.titlebar.widget.closebutton(c))
|
||||
|
||||
-- The title goes in the middle
|
||||
local title = awful.titlebar.widget.titlewidget(c)
|
||||
title:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function()
|
||||
client.focus = c
|
||||
c:raise()
|
||||
awful.mouse.client.move(c)
|
||||
end),
|
||||
awful.button({ }, 3, function()
|
||||
client.focus = c
|
||||
c:raise()
|
||||
awful.mouse.client.resize(c)
|
||||
end)
|
||||
))
|
||||
|
||||
-- Now bring it all together
|
||||
local layout = wibox.layout.align.horizontal()
|
||||
layout:set_left(left_layout)
|
||||
layout:set_right(right_layout)
|
||||
layout:set_middle(title)
|
||||
|
||||
awful.titlebar(c):set_widget(layout)
|
||||
end
|
||||
end)
|
||||
|
||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||
-- }}}
|
Before Width: | Height: | Size: 220 KiB |
Before Width: | Height: | Size: 265 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 967 B |
Before Width: | Height: | Size: 997 B |
Before Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 388 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 334 B |
@ -1,143 +0,0 @@
|
||||
---------------------------
|
||||
-- Default ArchLabs theme --
|
||||
---------------------------
|
||||
|
||||
local awful = require("awful")
|
||||
|
||||
--Configure home path so you dont have too
|
||||
home_path = os.getenv('HOME') .. '/'
|
||||
|
||||
theme = {}
|
||||
theme.wallpaper_cmd = { "awsetbg /usr/share/backgrounds/archlabs/archlabs.png" }
|
||||
theme.font = "Ubuntu 10"
|
||||
|
||||
theme.bg_normal = "#222222"
|
||||
theme.bg_focus = "#535d6c"
|
||||
theme.bg_urgent = "#ff0000"
|
||||
theme.bg_minimize = "#444444"
|
||||
theme.bg_tooltip = "#d6d6d6"
|
||||
theme.bg_em = "#5a5a5a"
|
||||
theme.bg_systray = theme.bg_normal
|
||||
|
||||
theme.fg_normal = "#aaaaaa"
|
||||
theme.fg_focus = "#ffffff"
|
||||
theme.fg_urgent = "#ffffff"
|
||||
theme.fg_minimize = "#ffffff"
|
||||
theme.fg_tooltip = "#1a1a1a"
|
||||
theme.fg_em = "#d6d6d6"
|
||||
|
||||
theme.border_width = "1"
|
||||
theme.border_normal = "#000000"
|
||||
theme.border_focus = "#535d6c"
|
||||
theme.border_marked = "#91231c"
|
||||
theme.fg_widget_value = "#aaaaaa"
|
||||
theme.fg_widget_clock = "#aaaaaa"
|
||||
theme.fg_widget_value_important = "#aaaaaa"
|
||||
theme.fg_widget = "#908884"
|
||||
theme.fg_center_widget = "#636363"
|
||||
theme.fg_end_widget = "#1a1a1a"
|
||||
theme.bg_widget = "#2a2a2a"
|
||||
theme.border_widget = "#3F3F3F"
|
||||
|
||||
-- There are other variable sets
|
||||
-- overriding the default one when
|
||||
-- defined, the sets are:
|
||||
-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
|
||||
-- titlebar_[bg|fg]_[normal|focus]
|
||||
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
|
||||
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
|
||||
-- Example:
|
||||
--theme.taglist_bg_focus = "#ff0000"
|
||||
|
||||
-- Display the taglist squares
|
||||
theme.taglist_squares_sel = home_path .. '.config/awesome/themes/default/taglist/squarefw.png'
|
||||
theme.taglist_squares_unsel = home_path .. '.config/awesome/themes/default/taglist/squarew.png'
|
||||
|
||||
theme.tasklist_floating_icon = home_path .. '.config/awesome/themes/default/tasklist/floatingw.png'
|
||||
|
||||
-- Variables set for theming the menu:
|
||||
-- menu_[bg|fg]_[normal|focus]
|
||||
-- menu_[border_color|border_width]
|
||||
theme.menu_submenu_icon = home_path .. '.config/awesome/themes/default/submenu.png'
|
||||
theme.menu_height = "20"
|
||||
theme.menu_width = "150"
|
||||
|
||||
-- You can add as many variables as
|
||||
-- you wish and access them by using
|
||||
-- beautiful.variable in your rc.lua
|
||||
--theme.bg_widget = "#cc0000"
|
||||
|
||||
-- Define the image to load
|
||||
theme.titlebar_close_button_normal = home_path .. '.config/awesome/themes/default/titlebar/close_normal.png'
|
||||
theme.titlebar_close_button_focus = home_path .. '.config/awesome/themes/default/titlebar/close_focus.png'
|
||||
|
||||
theme.titlebar_ontop_button_normal_inactive = home_path .. '.config/awesome/themes/default/titlebar/ontop_normal_inactive.png'
|
||||
theme.titlebar_ontop_button_focus_inactive = home_path .. '.config/awesome/themes/default/titlebar/ontop_focus_inactive.png'
|
||||
theme.titlebar_ontop_button_normal_active = home_path .. '/home/setkeh/.config/awesome/themes/default/titlebar/ontop_normal_active.png'
|
||||
theme.titlebar_ontop_button_focus_active = home_path .. '.config/awesome/themes/default/titlebar/ontop_focus_active.png'
|
||||
|
||||
theme.titlebar_sticky_button_normal_inactive = home_path .. '.config/awesome/themes/default/titlebar/sticky_normal_inactive.png'
|
||||
theme.titlebar_sticky_button_focus_inactive = home_path .. '.config/awesome/themes/default/titlebar/sticky_focus_inactive.png'
|
||||
theme.titlebar_sticky_button_normal_active = home_path .. '.config/awesome/themes/default/titlebar/sticky_normal_active.png'
|
||||
theme.titlebar_sticky_button_focus_active = home_path .. '.config/awesome/themes/default/titlebar/sticky_focus_active.png'
|
||||
|
||||
theme.titlebar_floating_button_normal_inactive = home_path .. '.config/awesome/themes/default/titlebar/floating_normal_inactive.png'
|
||||
theme.titlebar_floating_button_focus_inactive = home_path .. '.config/awesome/themes/default/titlebar/floating_focus_inactive.png'
|
||||
theme.titlebar_floating_button_normal_active = home_path .. '.config/awesome/themes/default/titlebar/floating_normal_active.png'
|
||||
theme.titlebar_floating_button_focus_active = home_path .. '.config/awesome/themes/default/titlebar/floating_focus_active.png'
|
||||
|
||||
theme.titlebar_maximized_button_normal_inactive = home_path .. '.config/awesome/themes/default/titlebar/maximized_normal_inactive.png'
|
||||
theme.titlebar_maximized_button_focus_inactive = home_path .. '.config/awesome/themes/default/titlebar/maximized_focus_inactive.png'
|
||||
theme.titlebar_maximized_button_normal_active = home_path .. '.config/awesome/themes/default/titlebar/maximized_normal_active.png'
|
||||
theme.titlebar_maximized_button_focus_active = home_path .. '.config/awesome/themes/default/titlebar/maximized_focus_active.png'
|
||||
|
||||
-- You can use your own layout icons like this:
|
||||
theme.layout_fairh = home_path .. '.config/awesome/themes/default/layouts/fairhw.png'
|
||||
theme.layout_fairv = home_path .. '.config/awesome/themes/default/layouts/fairvw.png'
|
||||
theme.layout_floating = home_path .. '.config/awesome/themes/default/layouts/floatingw.png'
|
||||
theme.layout_magnifier = home_path .. '.config/awesome/themes/default/layouts/magnifierw.png'
|
||||
theme.layout_max = home_path .. '.config/awesome/themes/default/layouts/maxw.png'
|
||||
theme.layout_fullscreen = home_path .. '.config/awesome/themes/default/layouts/fullscreenw.png'
|
||||
theme.layout_tilebottom = home_path .. '.config/awesome/themes/default/layouts/tilebottomw.png'
|
||||
theme.layout_tileleft = home_path .. '.config/awesome/themes/default/layouts/tileleftw.png'
|
||||
theme.layout_tile = home_path .. '.config/awesome/themes/default/layouts/tilew.png'
|
||||
theme.layout_tiletop = home_path .. '.config/awesome/themes/default/layouts/tiletopw.png'
|
||||
theme.layout_spiral = home_path .. '.config/awesome/themes/default/layouts/spiralw.png'
|
||||
theme.layout_dwindle = home_path .. '.config/awesome/themes/default/layouts/dwindlew.png'
|
||||
|
||||
theme.awesome_icon = home_path .. '.config/awesome/themes/default/icon/awesome-icon.png'
|
||||
theme.arch_icon = home_path .. '.config/awesome/themes/default/icon/ArchLabs.png'
|
||||
|
||||
-- {{{ Widgets
|
||||
theme.widget_disk = awful.util.getdir("config") .. "/themes/default/widgets/disk.png"
|
||||
theme.widget_cpu = awful.util.getdir("config") .. "/themes/default/widgets/cpu.png"
|
||||
theme.widget_ac = awful.util.getdir("config") .. "/themes/default/widgets/ac.png"
|
||||
theme.widget_acblink = awful.util.getdir("config") .. "/themes/default/widgets/acblink.png"
|
||||
theme.widget_blank = awful.util.getdir("config") .. "/themes/default/widgets/blank.png"
|
||||
theme.widget_batfull = awful.util.getdir("config") .. "/themes/default/widgets/batfull.png"
|
||||
theme.widget_batmed = awful.util.getdir("config") .. "/themes/default/widgets/batmed.png"
|
||||
theme.widget_batlow = awful.util.getdir("config") .. "/themes/default/widgets/batlow.png"
|
||||
theme.widget_batempty = awful.util.getdir("config") .. "/themes/default/widgets/batempty.png"
|
||||
theme.widget_vol = awful.util.getdir("config") .. "/themes/default/widgets/vol.png"
|
||||
theme.widget_mute = awful.util.getdir("config") .. "/themes/default/widgets/mute.png"
|
||||
theme.widget_pac = awful.util.getdir("config") .. "/themes/default/widgets/pac.png"
|
||||
theme.widget_pacnew = awful.util.getdir("config") .. "/themes/default/widgets/pacnew.png"
|
||||
theme.widget_temp = awful.util.getdir("config") .. "/themes/default/widgets/temp.png"
|
||||
theme.widget_tempwarn = awful.util.getdir("config") .. "/themes/default/widgets/tempwarm.png"
|
||||
theme.widget_temphot = awful.util.getdir("config") .. "/themes/default/widgets/temphot.png"
|
||||
theme.widget_wifi = awful.util.getdir("config") .. "/themes/default/widgets/wifi.png"
|
||||
theme.widget_nowifi = awful.util.getdir("config") .. "/themes/default/widgets/nowifi.png"
|
||||
theme.widget_mpd = awful.util.getdir("config") .. "/themes/default/widgets/mpd.png"
|
||||
theme.widget_play = awful.util.getdir("config") .. "/themes/default/widgets/play.png"
|
||||
theme.widget_pause = awful.util.getdir("config") .. "/themes/default/widgets/pause.png"
|
||||
theme.widget_ram = awful.util.getdir("config") .. "/themes/default/widgets/ram.png"
|
||||
theme.widget_mem = awful.util.getdir("config") .. "/themes/default/tp/ram.png"
|
||||
theme.widget_swap = awful.util.getdir("config") .. "/themes/default/tp/swap.png"
|
||||
theme.widget_fs = awful.util.getdir("config") .. "/themes/default/tp/fs_01.png"
|
||||
theme.widget_fs2 = awful.util.getdir("config") .. "/themes/default/tp/fs_02.png"
|
||||
theme.widget_up = awful.util.getdir("config") .. "/themes/default/tp/up.png"
|
||||
theme.widget_down = awful.util.getdir("config") .. "/themes/default/tp/down.png"
|
||||
-- }}}
|
||||
|
||||
return theme
|
||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
Before Width: | Height: | Size: 666 B |
Before Width: | Height: | Size: 905 B |
Before Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 876 B |
Before Width: | Height: | Size: 614 B |
Before Width: | Height: | Size: 1013 B |
Before Width: | Height: | Size: 829 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 816 B |
Before Width: | Height: | Size: 774 B |
Before Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 756 B |
Before Width: | Height: | Size: 833 B |
Before Width: | Height: | Size: 663 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 986 B |
Before Width: | Height: | Size: 820 B |
Before Width: | Height: | Size: 740 B |
Before Width: | Height: | Size: 866 B |
Before Width: | Height: | Size: 932 B |
Before Width: | Height: | Size: 917 B |
Before Width: | Height: | Size: 932 B |
Before Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 601 B |
Before Width: | Height: | Size: 727 B |
Before Width: | Height: | Size: 897 B |
Before Width: | Height: | Size: 938 B |
Before Width: | Height: | Size: 783 B |
Before Width: | Height: | Size: 803 B |
Before Width: | Height: | Size: 956 B |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1013 B |
Before Width: | Height: | Size: 731 B |
Before Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 888 B |
Before Width: | Height: | Size: 737 B |
Before Width: | Height: | Size: 899 B |
Before Width: | Height: | Size: 902 B |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 691 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 929 B |
Before Width: | Height: | Size: 959 B |
Before Width: | Height: | Size: 720 B |
@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
@ -1,585 +0,0 @@
|
||||
Vicious
|
||||
-------
|
||||
Vicious is a modular widget library for window managers, but mostly
|
||||
catering to users of the "awesome" window manager. It was derived from
|
||||
the old "Wicked" widget library, and has some of the old Wicked widget
|
||||
types, a few of them rewritten, and a good number of new ones:
|
||||
|
||||
- http://git.sysphere.org/vicious/about/
|
||||
|
||||
Vicious widget types are a framework for creating your own
|
||||
widgets. Vicious contains modules that gather data about your system,
|
||||
and a few "awesome" helper functions that make it easier to register
|
||||
timers, suspend widgets and so on.
|
||||
|
||||
For now Vicious doesn't depend on any third party Lua libraries, to
|
||||
make it easier to install and use. That means some system utilities
|
||||
are used instead, where available:
|
||||
|
||||
- hddtemp for the HDD Temperature widget type
|
||||
- alsa-utils for the Volume widget type
|
||||
- wireless_tools for the Wireless widget type
|
||||
- curl for widget types accessing network resources
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
When provided by an operating system package, or installed from source
|
||||
into the Lua library path Vicious can be used as a regular Lua
|
||||
library, to be used stand-alone or to feed widgets of any window
|
||||
manager (ie. Ion, WMII). It is compatible with both Lua v5.1 and v5.2.
|
||||
|
||||
$ lua
|
||||
> widgets = require("vicious.widgets")
|
||||
> print(widgets.volume(nil, "Master")[1])
|
||||
100
|
||||
|
||||
|
||||
Usage within Awesome
|
||||
--------------------
|
||||
To use Vicious with Awesome, install the package from your operating
|
||||
system provider, or download the source code and move it to your
|
||||
awesome configuration directory in $XDG_CONFIG_HOME (usually ~/.config):
|
||||
|
||||
$ mv vicious $XDG_CONFIG_HOME/awesome/
|
||||
|
||||
Vicious will only load modules for widget types you intend to use in
|
||||
your awesome configuration, to avoid having useless modules sitting in
|
||||
your memory.
|
||||
|
||||
Then add the following to the top of your rc.lua:
|
||||
|
||||
vicious = require("vicious")
|
||||
|
||||
Once you create a widget (a textbox, graph or a progressbar) call
|
||||
vicious.register() to register it with Vicious:
|
||||
|
||||
vicious.register(widget, wtype, format, interval, warg)
|
||||
|
||||
widget
|
||||
- widget created with widget() or awful.widget() (in case of a
|
||||
graph or a progressbar)
|
||||
|
||||
wtype
|
||||
- widget type or a function
|
||||
- any of the available (default, or custom) widget types can
|
||||
be used here, see below for a list of those provided by
|
||||
Vicious
|
||||
- function
|
||||
- custom functions from your own "awesome" configuration can
|
||||
be registered as widget types, see the "Custom widget types"
|
||||
section
|
||||
|
||||
format
|
||||
- string argument or a function
|
||||
- $1, $2, $3... will be replaced by their respective value
|
||||
returned by the widget type, some widget types return tables
|
||||
with string keys, in that case use: ${key}
|
||||
- function
|
||||
- function(widget, args) can be used to manipulate data
|
||||
returned by the widget type, more about this below
|
||||
|
||||
interval
|
||||
- number of seconds between updates of the widget, 2s by
|
||||
default, also read the "Power" section below
|
||||
|
||||
warg
|
||||
- some widget types require an argument to be passed, for example
|
||||
the battery ID
|
||||
|
||||
|
||||
Other functions
|
||||
---------------
|
||||
Unregister a widget:
|
||||
vicious.unregister(widget, keep)
|
||||
|
||||
- if keep is true widget will be suspended, waiting to be
|
||||
activated
|
||||
|
||||
Suspend all widgets:
|
||||
vicious.suspend()
|
||||
|
||||
- example automation script for the "laptop-mode-tools" start-stop
|
||||
module: http://sysphere.org/~anrxc/local/sources/lmt-vicious.sh
|
||||
|
||||
Restart suspended widgets:
|
||||
vicious.activate(widget)
|
||||
|
||||
- if widget is provided only that widget will be activated
|
||||
|
||||
Enable caching of a widget type:
|
||||
vicious.cache(wtype)
|
||||
|
||||
- enable caching of values returned by a widget type
|
||||
|
||||
Force update of widgets:
|
||||
vicious.force({ widget, })
|
||||
|
||||
- widget argument is a table with one or more widgets that will be
|
||||
updated
|
||||
|
||||
|
||||
Widget types
|
||||
------------
|
||||
Widget types consist of worker functions that take the "format"
|
||||
argument given to vicious.register as the first argument, "warg" as
|
||||
the second, and return a table of values to insert in the format
|
||||
string.
|
||||
|
||||
vicious.widgets.cpu
|
||||
- provides CPU usage for all available CPUs/cores
|
||||
- returns 1st value as usage of all CPUs/cores, 2nd as usage of
|
||||
first CPU/core, 3rd as usage of second CPU/core etc.
|
||||
|
||||
vicious.widgets.cpuinf
|
||||
- provides speed and cache information for all available CPUs/cores
|
||||
- returns a table with string keys, using CPU ID as a base:
|
||||
{cpu0 mhz}, {cpu0 ghz}, {cpu0 kb}, {cpu0 mb}, {cpu1 mhz} etc.
|
||||
|
||||
vicious.widgets.cpufreq
|
||||
- provides freq, voltage and governor info for a requested CPU
|
||||
- takes the CPU ID as an argument, i.e. "cpu0"
|
||||
- returns 1st value as frequency of requested CPU in MHz, 2nd in
|
||||
GHz, 3rd as voltage in mV, 4th as voltage in V and 5th as the
|
||||
governor state
|
||||
|
||||
vicious.widgets.thermal
|
||||
- provides temperature levels of ACPI and coretemp thermal zones
|
||||
- takes the thermal zone as an argument, i.e. "thermal_zone0", or a
|
||||
table with 1st field as thermal zone, 2nd as data source -
|
||||
available data sources are "proc", "core" and "sys" (which is the
|
||||
default when only the zone is provided) and 3rd optional argument
|
||||
as a temperature input file to read
|
||||
- returns 1st value as temperature of requested thermal zone
|
||||
|
||||
vicious.widgets.uptime
|
||||
- provides system uptime and load information
|
||||
- returns 1st value as uptime in days, 2nd as uptime in hours, 3rd
|
||||
as uptime in minutes, 4th as load average for past 1 minute, 5th
|
||||
for 5 minutes and 6th for 15 minutes
|
||||
|
||||
vicious.widgets.bat
|
||||
- provides state, charge, remaining time and wear for a requested
|
||||
battery
|
||||
- takes battery ID as an argument, i.e. "BAT0"
|
||||
- returns 1st value as state of requested battery, 2nd as charge
|
||||
level in percent, 3rd as remaining (charging or discharging)
|
||||
time and 4th as the wear level in percent
|
||||
|
||||
vicious.widgets.mem
|
||||
- provides RAM and Swap usage statistics
|
||||
- returns 1st value as memory usage in percent, 2nd as memory usage,
|
||||
3rd as total system memory, 4th as free memory, 5th as swap usage
|
||||
in percent, 6th as swap usage, 7th as total system swap, 8th as
|
||||
free swap and 9th as memory usage with buffers and cache
|
||||
|
||||
vicious.widgets.os
|
||||
- provides operating system information
|
||||
- returns 1st value as the operating system in use, 2nd as the
|
||||
release version, 3rd as your username, 4th the hostname, 5th as
|
||||
available system entropy and 6th value as available entropy in
|
||||
percent
|
||||
|
||||
vicious.widgets.fs
|
||||
- provides file system disk space usage
|
||||
- takes an (optional) argument which, if true, includes remote file
|
||||
systems, only local file systems are included by default
|
||||
- returns a table with string keys, using mount points as a base:
|
||||
{/ size_mb}, {/ size_gb}, {/ used_mb}, {/ used_gb}, {/ used_p},
|
||||
{/ avail_mb}, {/ avail_gb}, {/ avail_p}, {/home size_mb} etc.
|
||||
|
||||
vicious.widgets.dio
|
||||
- provides I/O statistics for all available storage devices
|
||||
- returns a table with string keys: {sda total_s}, {sda total_kb},
|
||||
{sda total_mb}, {sda read_s}, {sda read_kb}, {sda read_mb},
|
||||
{sda write_s}, {sda write_kb}, {sda write_mb}, {sdb1 total_s} etc.
|
||||
|
||||
vicious.widgets.raid
|
||||
- provides state information for a requested RAID array
|
||||
- takes the RAID array ID as an argument
|
||||
- returns 1st value as the number of assigned, and 2nd as active,
|
||||
devices in the array
|
||||
|
||||
vicious.widgets.hddtemp
|
||||
- provides hard drive temperatures using the hddtemp daemon
|
||||
- takes the hddtemp listening port as an argument, or defaults to
|
||||
port 7634
|
||||
- returns a table with string keys, using hard drives as a base:
|
||||
{/dev/sda} and {/dev/sdc} for example
|
||||
|
||||
vicious.widgets.net
|
||||
- provides state and usage statistics of all network interfaces
|
||||
- returns a table with string keys, using net interfaces as a base:
|
||||
{eth0 carrier}, {eth0 rx_b}, {eth0 tx_b}, {eth0 rx_kb}, {eth0 tx_kb},
|
||||
{eth0 rx_mb}, {eth0 tx_mb}, {eth0 rx_gb}, {eth0 tx_gb}, {eth0 down_b},
|
||||
{eth0 up_b}, {eth0 down_kb}, {eth0 up_kb}, {eth0 down_mb},
|
||||
{eth0 up_mb}, {eth0 down_gb}, {eth0 up_gb}, {eth1 rx_b} etc.
|
||||
|
||||
vicious.widgets.wifi
|
||||
- provides wireless information for a requested interface
|
||||
- takes the network interface as an argument, i.e. "wlan0"
|
||||
- returns a table with string keys: {ssid}, {mode}, {chan}, {rate},
|
||||
{link}, {linp} (link quality in percent) and {sign} (signal level)
|
||||
|
||||
vicious.widgets.mbox
|
||||
- provides the subject of last e-mail in a mbox file
|
||||
- takes the full path to the mbox as an argument, or a table with
|
||||
1st field as path, 2nd as maximum length and 3rd (optional) as
|
||||
widget name - if 3rd field is present scrolling will be used (note: the
|
||||
path will be escaped so special variables like ~ will not work, use
|
||||
os.getenv("HOME").."mail" instead to access environment variables)
|
||||
- returns 1st value as the subject of the last e-mail
|
||||
|
||||
vicious.widgets.mboxc
|
||||
- provides the count of total, old and new messages in mbox files
|
||||
- takes a table with full paths to mbox files as an argument
|
||||
- returns 1st value as the total count of messages, 2nd as the count
|
||||
of old messages and 3rd as the count of new messages
|
||||
|
||||
vicious.widgets.mdir
|
||||
- provides the number of new and unread messages in Maildir
|
||||
structures/directories
|
||||
- takes a table with full paths to Maildir structures as an argument
|
||||
- returns 1st value as the count of new messages and 2nd as the
|
||||
count of "old" messages lacking the Seen flag
|
||||
|
||||
vicious.widgets.gmail
|
||||
- provides count of new and subject of last e-mail on Gmail
|
||||
- takes an (optional) argument, if it's a number subject will be
|
||||
truncated, if a table, with 1st field as maximum length and 2nd
|
||||
the widget name (i.e. "gmailwidget"), scrolling will be used
|
||||
- keeps login information in the ~/.netrc file, example:
|
||||
machine mail.google.com login user password pass
|
||||
- returns a table with string keys: {count} and {subject}
|
||||
|
||||
vicious.widgets.org
|
||||
- provides agenda statistics for Emacs org-mode
|
||||
- takes a table with full paths to agenda files, that will be
|
||||
parsed, as an argument
|
||||
- returns 1st value as count of tasks you forgot to do, 2nd as count
|
||||
of tasks for today, 3rd as count of tasks for the next 3 days and
|
||||
4th as count of tasks to do in the week
|
||||
|
||||
vicious.widgets.pkg
|
||||
- provides number of pending updates on UNIX systems
|
||||
- takes the distribution name as an argument, i.e. "Arch"
|
||||
- returns 1st value as the count of available updates
|
||||
|
||||
vicious.widgets.mpd
|
||||
- provides Music Player Daemon information
|
||||
- takes a table as an argument, 1st field should be the password (or
|
||||
nil), 2nd the hostname (or nil) and 3rd port (or nil) - if no
|
||||
argument is provided connection attempt will be made to localhost
|
||||
port 6600 with no password
|
||||
- returns a table with string keys: {volume}, {state}, {Artist},
|
||||
{Title}, {Album}, {Genre} and optionally {Name} and {file}
|
||||
|
||||
vicious.widgets.volume
|
||||
- provides volume levels and state of requested ALSA mixers
|
||||
- takes the ALSA mixer control as an argument, i.e. "Master",
|
||||
optionally append the card ID or other options, i.e. "PCM -c 0"
|
||||
- returns 1st value as the volume level and 2nd as the mute state of
|
||||
the requested channel
|
||||
|
||||
vicious.widgets.weather
|
||||
- provides weather information for a requested station
|
||||
- takes the ICAO station code as an argument, i.e. "LDRI"
|
||||
- returns a table with string keys: {city}, {wind}, {windmph},
|
||||
{windkmh}, {sky}, {weather}, {tempf}, {tempc}, {humid}, {dewf},
|
||||
{dewc}, {press}
|
||||
|
||||
vicious.widgets.date
|
||||
- provides access to os.date, with optional time formatting provided
|
||||
as the format string - using regular date sequences
|
||||
- takes optional time offset, in seconds, as an argument for example
|
||||
to calculate time zone differences, otherwise current time is
|
||||
formatted
|
||||
- returns the output of os.date, formatted by provided sequences
|
||||
|
||||
|
||||
Custom widget types
|
||||
-------------------
|
||||
Use any of the existing widget types as a starting point for your
|
||||
own. Write a quick worker function that does the work and plug it
|
||||
in. How data will be formatted, will it be red or blue, should be
|
||||
defined in rc.lua (or somewhere else, outside the actual module).
|
||||
|
||||
Before writing a widget type you should check if there is already one
|
||||
in the contrib directory of Vicious. The contrib directory contains
|
||||
extra widgets you can use. Some are for less common hardware, and
|
||||
other were contributed by Vicious users. The contrib directory also
|
||||
holds widget types that were obsoleted or rewritten. Contrib widgets
|
||||
will not be imported by init unless you explicitly enable it, or load
|
||||
them in your rc.lua.
|
||||
|
||||
Rudi Siegel, a FreeBSD user, published his FreeBSD branch. If you are
|
||||
also a BSD user you can find his work here:
|
||||
|
||||
- https://bitbucket.org/mutluyum/vicious_bsd/
|
||||
|
||||
Some users would like to avoid writing new modules. For them Vicious
|
||||
kept the old Wicked functionality, possibility to register their own
|
||||
functions as widget types. By providing them as the second argument to
|
||||
vicious.register. Your function can accept "format" and "warg"
|
||||
arguments, just like workers.
|
||||
|
||||
|
||||
Power and Caching
|
||||
-----------------
|
||||
When a lot of widgets are in use they, and awesome, can generate a lot
|
||||
of wake-ups and also be very expensive for system resources. This is
|
||||
especially important when running on battery power. It was a big
|
||||
problem with awesome v2 and widgets that used shell scripts to gather
|
||||
data, and with widget libraries written in languages like Ruby.
|
||||
|
||||
Lua is an extremely fast and efficient programming language, and
|
||||
Vicious takes advantage of that. But suspending Vicious widgets is one
|
||||
way to prevent them from draining your battery, despite that.
|
||||
|
||||
Update intervals also play a big role, and you can save a lot of power
|
||||
with a smart approach. Don't use intervals like: 5, 10, 30, 60... to
|
||||
avoid harmonics. If you take the 60-second mark as an example, all of
|
||||
your widgets would be executed at that point. Instead think about
|
||||
using only prime numbers, in that case you will have only a few
|
||||
widgets executed at any given time interval. When choosing intervals
|
||||
also consider what a widget actually does. Some widget types read
|
||||
files that reside in memory, others call external utilities and some,
|
||||
like the mbox widget, read big files.
|
||||
|
||||
Vicious can also cache values returned by widget types. Caching
|
||||
enables you to have multiple widgets using the same widget type. With
|
||||
caching its worker function gets executed only once - which is also
|
||||
great for saving power.
|
||||
|
||||
- Some widget types keep internal data and if you call one multiple
|
||||
times without caching, the widget that executes it first would
|
||||
modify stored values. This can lead to problems and give you
|
||||
inconsistent data. Remember it for widget types like CPU and
|
||||
Network usage, which compare the old set of data with the new one
|
||||
to calculate current usage.
|
||||
|
||||
- Widget types that require a widget argument to be passed should be
|
||||
handled carefully. If you are requesting information for different
|
||||
devices then caching should not be used, because you could get
|
||||
inconsistent data.
|
||||
|
||||
|
||||
Security
|
||||
--------
|
||||
At the moment only one widget type (Gmail) requires auth. information
|
||||
in order to get to the data. In the future there could be more, and
|
||||
you should give some thought to the issue of protecting your data. The
|
||||
Gmail widget type by default stores login information in the ~/.netrc
|
||||
file, and you are advised to make sure that file is only readable by
|
||||
the owner. Other than that we can not force all users to conform to
|
||||
one standard, one way of keeping it secure, like in some keyring.
|
||||
|
||||
First let's clear why we simply don't encrypt the login information
|
||||
and store it in ciphertext. By exposing the algorithm anyone can
|
||||
reverse the encryption steps. Some claim even that's better than
|
||||
plaintext but it's just security trough obscurity.
|
||||
|
||||
Here are some ideas actually worth your time. Users that have KDE (or
|
||||
parts of it) installed could store their login information into the
|
||||
Kwallet service and request it via DBus from the widget type. It can
|
||||
be done with tools like "dbus-send" and "qdbus". The Gnome keyring
|
||||
should support the same, so those with parts of Gnome installed could
|
||||
use that keyring.
|
||||
|
||||
Users of GnuPG (and its agent) could consider encrypting the netrc
|
||||
file with their GPG key. Trough the GPG Passphrase Agent they could
|
||||
then decrypt the file transparently while their session is active.
|
||||
|
||||
|
||||
Usage examples
|
||||
---------------------------------
|
||||
Start with a simple widget, like date. Then build your setup from
|
||||
there, one widget at a time. Also remember that besides creating and
|
||||
registering widgets you have to add them to a wibox (statusbar) in
|
||||
order to actually display them.
|
||||
|
||||
Date widget
|
||||
datewidget = wibox.widget.textbox()
|
||||
vicious.register(datewidget, vicious.widgets.date, "%b %d, %R")
|
||||
|
||||
- updated every 2 seconds (the default interval), uses standard
|
||||
date sequences as the format string
|
||||
|
||||
Memory widget
|
||||
memwidget = wibox.widget.textbox()
|
||||
vicious.cache(vicious.widgets.mem)
|
||||
vicious.register(memwidget, vicious.widgets.mem, "$1 ($2MB/$3MB)", 13)
|
||||
|
||||
- updated every 13 seconds, appends "MB" to 2nd and 3rd returned
|
||||
values and enables caching of this widget type
|
||||
|
||||
HDD temperature widget
|
||||
hddtempwidget = wibox.widget.textbox()
|
||||
vicious.register(hddtempwidget, vicious.widgets.hddtemp, "${/dev/sda} °C", 19)
|
||||
|
||||
- updated every 19 seconds, requests the temperature level of the
|
||||
{/dev/sda} key/disk and appends "°C" to the returned value, does
|
||||
not provide the port argument so default port is used
|
||||
|
||||
Mbox widget
|
||||
mboxwidget = wibox.widget.textbox()
|
||||
vicious.register(mboxwidget, vicious.widgets.mbox, "$1", 5, "/home/user/mail/Inbox")
|
||||
|
||||
- updated every 5 seconds, provides full path to the mbox as an
|
||||
argument
|
||||
|
||||
Battery widget
|
||||
batwidget = awful.widget.progressbar()
|
||||
batwidget:set_width(8)
|
||||
batwidget:set_height(10)
|
||||
batwidget:set_vertical(true)
|
||||
batwidget:set_background_color("#494B4F")
|
||||
batwidget:set_border_color(nil)
|
||||
batwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 0, 10 },
|
||||
stops = { { 0, "#AECF96" }, { 0.5, "#88A175" }, { 1, "#FF5656" }})
|
||||
vicious.register(batwidget, vicious.widgets.bat, "$2", 61, "BAT0")
|
||||
|
||||
- updated every 61 seconds, requests the current battery charge
|
||||
level and displays a progressbar, provides "BAT0" battery ID as an
|
||||
argument
|
||||
|
||||
CPU usage widget
|
||||
cpuwidget = awful.widget.graph()
|
||||
cpuwidget:set_width(50)
|
||||
cpuwidget:set_background_color("#494B4F")
|
||||
cpuwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 50, 0 },
|
||||
stops = { { 0, "#FF5656" }, { 0.5, "#88A175" }, { 1, "#AECF96" }})
|
||||
vicious.cache(vicious.widgets.cpu)
|
||||
vicious.register(cpuwidget, vicious.widgets.cpu, "$1", 3)
|
||||
|
||||
- updated every 3 seconds, feeds the graph with total usage
|
||||
percentage of all CPUs/cores and enable caching of this widget
|
||||
type
|
||||
|
||||
|
||||
Format functions
|
||||
----------------
|
||||
You can use a function instead of a string as the format parameter.
|
||||
Then you are able to check the value returned by the widget type and
|
||||
change it or perform some action. You can change the color of the
|
||||
battery widget when it goes below a certain point, hide widgets when
|
||||
they return a certain value or maybe use string.format for padding.
|
||||
|
||||
- Do not confuse this with just coloring the widget, in those cases
|
||||
standard pango markup can be inserted into the format string.
|
||||
|
||||
The format function will get the widget as its first argument, table
|
||||
with the values otherwise inserted into the format string as its
|
||||
second argument, and will return the text/data to be used for the
|
||||
widget.
|
||||
|
||||
Example
|
||||
mpdwidget = wibox.widget.textbox()
|
||||
vicious.register(mpdwidget, vicious.widgets.mpd,
|
||||
function (widget, args)
|
||||
if args["{state}"] == "Stop" then return ""
|
||||
else return '<span color="white">MPD:</span> '..
|
||||
args["{Artist}"]..' - '.. args["{Title}"]
|
||||
end
|
||||
end)
|
||||
|
||||
- hides the mpd widget when no song is playing, updated every 2
|
||||
seconds (the default interval)
|
||||
|
||||
Example
|
||||
uptimewidget = wibox.widget.textbox()
|
||||
vicious.register(uptimewidget, vicious.widgets.uptime,
|
||||
function (widget, args)
|
||||
return string.format("Uptime: %2dd %02d:%02d ", args[1], args[2], args[3])
|
||||
end, 61)
|
||||
|
||||
- uses string.format for padding uptime values to a minimum amount
|
||||
of digits, updated every 61 seconds
|
||||
|
||||
When it comes to padding it is also useful to mention how a widget can
|
||||
be configured to have a fixed width. You can set a fixed width on your
|
||||
textbox widgets by changing their .width field (by default width is
|
||||
automatically adapted to text width).
|
||||
|
||||
Example
|
||||
uptimewidget = wibox.widget.textbox()
|
||||
uptimewidget:set_align("right")
|
||||
vicious.register(uptimewidget, vicious.widgets.uptime, "$1 $2:$3", 61)
|
||||
uptimewidget = wibox.layout.constraint(uptimewidget, "exact", 50, nil)
|
||||
|
||||
- forces a fixed width of 50px to the uptime widget, and aligns its
|
||||
text to the right
|
||||
|
||||
Another use case are stacked graphs (aka multigraphs) which Vicious
|
||||
does not handle on its own at the moment, as it's hard to pass on
|
||||
color index arguments elegantly. But they are not unusable, far from
|
||||
it.
|
||||
|
||||
Example
|
||||
ctext = wibox.widget.textbox()
|
||||
cgraph = awful.widget.graph()
|
||||
cgraph:set_width(100):set_height(20)
|
||||
cgraph:set_stack(true):set_max_value(100)
|
||||
cgraph:set_background_color("#494B4F")
|
||||
cgraph:set_stack_colors({ "#FF5656", "#88A175", "#AECF96" })
|
||||
vicious.register(ctext, vicious.widgets.cpu,
|
||||
function (widget, args)
|
||||
cgraph:add_value(args[2], 1) -- Core 1, color 1
|
||||
cgraph:add_value(args[3], 2) -- Core 2, color 2
|
||||
cgraph:add_value(args[4], 3) -- Core 3, color 3
|
||||
end, 3)
|
||||
|
||||
- enables graph stacking/multigraph and plots usage of all three CPU
|
||||
cores on a single graph, the textbox "ctext" is just an empty
|
||||
placeholder, graph is updated every 3 seconds
|
||||
|
||||
A lot of users are not happy with default symbols used in volume,
|
||||
battery, cpufreq and other widget types. You can use your own symbols
|
||||
without any need to modify modules.
|
||||
|
||||
volumewidget = wibox.widget.textbox()
|
||||
vicious.register(volumewidget, vicious.widgets.volume,
|
||||
function(widget, args)
|
||||
local label = { ["♫"] = "O", ["♩"] = "M" }
|
||||
return "Volume: " .. args[1] .. "% State: " .. label[args[2]]
|
||||
end, 2, "PCM")
|
||||
|
||||
- uses a custom table map to modify symbols representing the mixer
|
||||
state; on or off/mute
|
||||
|
||||
|
||||
Other
|
||||
-----
|
||||
Read "awesome" manual pages:
|
||||
|
||||
- awesome(1) awesomerc(5)
|
||||
|
||||
Awesome widgets explained:
|
||||
|
||||
- http://awesome.naquadah.org/wiki/Widgets_in_awesome
|
||||
|
||||
Example "awesome" configuration:
|
||||
|
||||
- http://git.sysphere.org/awesome-configs/
|
||||
|
||||
|
||||
Authors
|
||||
-------
|
||||
Wicked written by:
|
||||
- Lucas de Vries <lucas glacicle.com>
|
||||
|
||||
Vicious written by:
|
||||
- Adrian C. (anrxc) <anrxc sysphere.org>
|
||||
|
||||
Vicious major contributors:
|
||||
- Benedikt Sauer <filmor gmail.com>
|
||||
- Greg D. <jabbas jabbas.pl>
|
||||
- Henning Glawe <glaweh debian.org>
|
||||
- Rémy C. <shikamaru mandriva.org>
|
||||
- Hiltjo Posthuma <hiltjo codemadness.org>
|
||||
- Hagen Schink <troja84 googlemail.com>
|
||||
- Jörg Thalheim <jthalheim gmail.com>
|
||||
- Arvydas Sidorenko <asido4 gmail.com>
|
||||
- Dodo The Last <dodo.the.last gmail.com>
|
||||
- ...
|
||||
- Consult git log for a complete list of contributors
|
@ -1,132 +0,0 @@
|
||||
Contrib
|
||||
-------
|
||||
Contrib libraries, or widget types, are extra snippets of code you can
|
||||
use. Some are for less common hardware, and other were contributed by
|
||||
Vicious users. The contrib directory also holds widget types that were
|
||||
obsoleted or rewritten. Contrib widgets will not be imported by init
|
||||
unless you explicitly enable it, or load them in your rc.lua.
|
||||
|
||||
|
||||
Usage within Awesome
|
||||
--------------------
|
||||
To use contrib widgets uncomment the line that loads them in
|
||||
init.lua. Or you can load them in your rc.lua after you require
|
||||
Vicious:
|
||||
|
||||
vicious = require("vicious")
|
||||
vicious.contrib = require("vicious.contrib")
|
||||
|
||||
|
||||
Widget types
|
||||
------------
|
||||
Most widget types consist of worker functions that take the "format"
|
||||
argument given to vicious.register as the first argument, "warg" as
|
||||
the second, and return a table of values to insert in the format
|
||||
string. But we have not insisted on this coding style in contrib. So
|
||||
widgets like PulseAudio have emerged that are different. These widgets
|
||||
could also depend on Lua libraries that are not distributed with the
|
||||
core Lua distribution. Ease of installation and use does not
|
||||
necessarily have to apply to contributed widgets.
|
||||
|
||||
vicious.contrib.ati
|
||||
- provides various info about ATI GPU status
|
||||
- takes card ID as an argument, i.e. "card0" (and where possible,
|
||||
uses debugfs to gather data on radeon power management)
|
||||
- returns a table with string keys: {method}, {dpm_state},
|
||||
{dpm_perf_level}, {profile}, {engine_clock mhz}, {engine_clock khz},
|
||||
{memory_clock mhz}, {memory_clock khz}, {voltage v}, {voltage mv}
|
||||
|
||||
vicious.contrib.batacpi
|
||||
-
|
||||
|
||||
vicious.contrib.batpmu
|
||||
-
|
||||
|
||||
vicious.contrib.batproc
|
||||
-
|
||||
|
||||
vicious.contrib.dio
|
||||
- provides I/O statistics for requested storage devices
|
||||
- takes the disk as an argument, i.e. "sda" (or a specific
|
||||
partition, i.e. "sda/sda2")
|
||||
- returns a table with string keys: {total_s}, {total_kb}, {total_mb},
|
||||
{read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb}, {write_mb}
|
||||
and {sched}
|
||||
|
||||
vicious.contrib.mpc
|
||||
-
|
||||
|
||||
vicious.contrib.netcfg
|
||||
-
|
||||
|
||||
vicious.contrib.net
|
||||
-
|
||||
|
||||
vicious.contrib.openweather
|
||||
- provides weather information for a requested city
|
||||
- takes OpenWeatherMap city ID as an argument, i.e. "1275339"
|
||||
- returns a table with string keys: {city}, {wind deg}, {wind aim},
|
||||
{wind kmh}, {wind mps}, {sky}, {weather}, {temp c}, {humid}, {press}
|
||||
|
||||
vicious.contrib.nvsmi
|
||||
- provides (very basic) information about Nvidia GPU status from SMI
|
||||
- takes optional card ID as an argument, i.e. "1", or defaults to ID 0
|
||||
- returns 1st value as temperature of requested graphics device
|
||||
|
||||
vicious.contrib.ossvol
|
||||
-
|
||||
|
||||
vicious.contrib.pop
|
||||
-
|
||||
|
||||
vicious.contrib.pulse
|
||||
- provides volume levels of requested pulseaudio sinks and
|
||||
functions to manipulate them
|
||||
- takes the name of a sink as an optional argument. a number will
|
||||
be interpret as an index, if no argument is given, it will take
|
||||
the first-best
|
||||
- to get a list of available sinks use the command: pacmd
|
||||
list-sinks | grep 'name:'
|
||||
- returns 1st value as the volume level
|
||||
- vicious.contrib.pulse.add(percent, sink)
|
||||
- @percent is a number, which increments or decrements the volume
|
||||
level by its value in percent
|
||||
- @sink optional, same usage as in vicious.contrib.pulse
|
||||
- returns the exit status of pacmd
|
||||
- vicious.contrib.pulse.toggle(sink)
|
||||
- inverts the volume state (mute -> unmute; unmute -> mute)
|
||||
- @sink optional, same usage as in vicious.contrib.pulse
|
||||
- returns the exit status of pacmd
|
||||
|
||||
vicious.contrib.rss
|
||||
-
|
||||
|
||||
vicious.contrib.sensors
|
||||
-
|
||||
|
||||
vicious.contrib.buildbot
|
||||
- provides last build status for configured buildbot builders (http://trac.buildbot.net/)
|
||||
- returns build status in the format: [<builderName>.<currentBuildNumber>.<lastSuccessfulBuildNumber>]
|
||||
- if <currentBuildNumber> is the same as <lastSuccessfulBuildNumber> only one number is displayed
|
||||
- <buildNumber> colors: red - failed, green - successful, yellow - in progress
|
||||
- it depends on lua json parser (e.g. liblua5.1-json on Ubuntu 12.04)
|
||||
|
||||
|
||||
Usage examples
|
||||
---------------------------------
|
||||
Pulse Audio widget
|
||||
vol = wibox.widget.textbox()
|
||||
vicious.register(vol, vicious.contrib.pulse, " $1%", 2, "alsa_output.pci-0000_00_1b.0.analog-stereo")
|
||||
vol:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function () awful.util.spawn("pavucontrol") end),
|
||||
awful.button({ }, 4, function () vicious.contrib.pulse.add(5,"alsa_output.pci-0000_00_1b.0.analog-stereo") end),
|
||||
awful.button({ }, 5, function () vicious.contrib.pulse.add(-5,"alsa_output.pci-0000_00_1b.0.analog-stereo") end)
|
||||
))
|
||||
|
||||
Buildbot widget
|
||||
buildbotwidget = wibox.widget.textbox()
|
||||
local buildbotwidget_warg = {
|
||||
{builder="coverage", url="http://buildbot.buildbot.net"},
|
||||
{builder="tarball-slave", url="http://buildbot.buildbot.net"}
|
||||
}
|
||||
vicious.register(buildbotwidget, vicious.contrib.buildbot, "$1,", 3600, buildbotwidget_warg)
|
@ -1,79 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2013, NormalRa <normalrawr gmail com>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Grab environment
|
||||
local tonumber = tonumber
|
||||
local io = { open = io.open }
|
||||
local setmetatable = setmetatable
|
||||
local helpers = require("vicious.helpers")
|
||||
local string = {
|
||||
sub = string.sub,
|
||||
match = string.match,
|
||||
gmatch = string.gmatch
|
||||
}
|
||||
-- }}}
|
||||
|
||||
|
||||
-- ATI: provides various info about ATI GPU status
|
||||
-- vicious.widgets.ati
|
||||
local ati = {}
|
||||
|
||||
|
||||
-- {{{ Define variables
|
||||
local _units = { clock = { ["khz"] = 1, ["mhz"] = 1000 },
|
||||
voltage = { ["v"] = 1, ["mv"] = 1000 } }
|
||||
local _reps = {
|
||||
["sclk"] = { name = "engine_clock", units = _units.clock, mul = 10 },
|
||||
["mclk"] = { name = "memory_clock", units = _units.clock, mul = 10 },
|
||||
["vddc"] = { name = "voltage", units = _units.voltage },
|
||||
["voltage"] = { name = "voltage", units = _units.voltage },
|
||||
["current engine clock"] = { name = "engine_clock", units = _units.clock },
|
||||
["current memory clock"] = { name = "memory_clock", units = _units.clock }
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ ATI widget type
|
||||
local function worker(format, warg)
|
||||
if not warg then return end
|
||||
|
||||
local pm = helpers.pathtotable("/sys/class/drm/"..warg.."/device")
|
||||
local _data = {}
|
||||
|
||||
-- Get power info
|
||||
_data["{method}"] =
|
||||
pm.power_method and string.sub(pm.power_method, 1, -2) or "N/A"
|
||||
_data["{dpm_state}"] =
|
||||
pm.power_dpm_state and string.sub(pm.power_dpm_state, 1, -2) or "N/A"
|
||||
_data["{dpm_perf_level}"] =
|
||||
pm.power_dpm_force_performance_level and
|
||||
string.sub(pm.power_dpm_force_performance_level, 1, -2) or "N/A"
|
||||
_data["{profile}"] =
|
||||
pm.power_profile and string.sub(pm.power_profile, 1, -2) or "N/A"
|
||||
|
||||
local f = io.open("/sys/kernel/debug/dri/64/radeon_pm_info", "r")
|
||||
if f then -- Get ATI info from the debug filesystem
|
||||
for line in f:lines() do
|
||||
for k, unit in string.gmatch(line, "(%a+[%a%s]*):[%s]+([%d]+)") do
|
||||
unit = tonumber(unit)
|
||||
|
||||
_data["{dpm_power_level}"] = -- DPM active?
|
||||
tonumber(string.match(line, "power level ([%d])")) or "N/A"
|
||||
|
||||
if _reps[k] then
|
||||
for u, v in pairs(_reps[k].units) do
|
||||
_data["{".._reps[k].name.." "..u.."}"] =
|
||||
(unit * (_reps[k].mul or 1)) / v
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
f:close()
|
||||
end
|
||||
|
||||
return _data
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return setmetatable(ati, { __call = function(_, ...) return worker(...) end })
|
@ -1,52 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Grab environment
|
||||
local tonumber = tonumber
|
||||
local io = { popen = io.popen }
|
||||
local setmetatable = setmetatable
|
||||
local table = { insert = table.insert }
|
||||
local string = { match = string.match }
|
||||
-- }}}
|
||||
|
||||
|
||||
-- Batacpi: provides state, charge, and remaining time for all batteries using acpitool
|
||||
-- vicious.contrib.batacpi
|
||||
local batacpi = {}
|
||||
|
||||
|
||||
-- {{{ Battery widget type
|
||||
local function worker(format)
|
||||
local battery_info = {}
|
||||
local battery_state = {
|
||||
["full"] = "↯",
|
||||
["unknown"] = "⌁",
|
||||
["charged"] = "↯",
|
||||
["charging"] = "+",
|
||||
["discharging"] = "-"
|
||||
}
|
||||
|
||||
-- Get data from acpitool
|
||||
local f = io.popen("acpitool -b")
|
||||
|
||||
for line in f:lines() do
|
||||
-- Check if the battery is present
|
||||
if string.match(line, "^[%s]+Battery.*") then
|
||||
-- Store state and charge information
|
||||
table.insert(battery_info, (battery_state[string.match(line, "([%a]*),") or "unknown"]))
|
||||
table.insert(battery_info, (tonumber(string.match(line, "([%d]?[%d]?[%d])%.")) or 0))
|
||||
-- Store remaining time information
|
||||
table.insert(battery_info, (string.match(line, "%%,%s(.*)") or "N/A"))
|
||||
else
|
||||
return {battery_state["unknown"], 0, "N/A"}
|
||||
end
|
||||
end
|
||||
f:close()
|
||||
|
||||
return battery_info
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return setmetatable(batacpi, { __call = function(_, ...) return worker(...) end })
|
@ -1,79 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Grab environment
|
||||
local tonumber = tonumber
|
||||
local io = { open = io.open }
|
||||
local setmetatable = setmetatable
|
||||
local math = {
|
||||
min = math.min,
|
||||
floor = math.floor
|
||||
}
|
||||
local string = {
|
||||
find = string.find,
|
||||
match = string.match,
|
||||
format = string.format
|
||||
}
|
||||
-- }}}
|
||||
|
||||
|
||||
-- Batpmu: provides state, charge and remaining time for a requested battery using PMU
|
||||
-- vicious.contrib.batpmu
|
||||
local batpmu = {}
|
||||
|
||||
|
||||
-- {{{ Battery widget type
|
||||
local function worker(format, batid)
|
||||
local battery_state = {
|
||||
["full"] = "↯",
|
||||
["unknown"] = "⌁",
|
||||
["00000013"] = "+",
|
||||
["00000011"] = "-"
|
||||
}
|
||||
|
||||
-- Get /proc/pmu/battery* state
|
||||
local f = io.open("/proc/pmu/" .. batid)
|
||||
-- Handler for incompetent users
|
||||
if not f then return {battery_state["unknown"], 0, "N/A"} end
|
||||
local statefile = f:read("*all")
|
||||
f:close()
|
||||
|
||||
-- Get /proc/pmu/info data
|
||||
local f = io.open("/proc/pmu/info")
|
||||
local infofile = f:read("*all")
|
||||
f:close()
|
||||
|
||||
-- Check if the battery is present
|
||||
if infofile == nil or string.find(infofile, "Battery count[%s]+:[%s]0") then
|
||||
return {battery_state["unknown"], 0, "N/A"}
|
||||
end
|
||||
|
||||
|
||||
-- Get capacity and charge information
|
||||
local capacity = string.match(statefile, "max_charge[%s]+:[%s]([%d]+).*")
|
||||
local remaining = string.match(statefile, "charge[%s]+:[%s]([%d]+).*")
|
||||
|
||||
-- Calculate percentage
|
||||
local percent = math.min(math.floor(remaining / capacity * 100), 100)
|
||||
|
||||
|
||||
-- Get timer information
|
||||
local timer = string.match(statefile, "time rem%.[%s]+:[%s]([%d]+).*")
|
||||
if timer == "0" then return {battery_state["full"], percent, "N/A"} end
|
||||
|
||||
-- Get state information
|
||||
local state = string.match(statefile, "flags[%s]+:[%s]([%d]+).*")
|
||||
local state = battery_state[state] or battery_state["unknown"]
|
||||
|
||||
-- Calculate remaining (charging or discharging) time
|
||||
local hoursleft = math.floor(tonumber(timer) / 3600)
|
||||
local minutesleft = math.floor((tonumber(timer) / 60) % 60)
|
||||
local time = string.format("%02d:%02d", hoursleft, minutesleft)
|
||||
|
||||
return {state, percent, time}
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return setmetatable(batpmu, { __call = function(_, ...) return worker(...) end })
|
@ -1,86 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Grab environment
|
||||
local tonumber = tonumber
|
||||
local io = { open = io.open }
|
||||
local setmetatable = setmetatable
|
||||
local math = {
|
||||
min = math.min,
|
||||
floor = math.floor
|
||||
}
|
||||
local string = {
|
||||
find = string.find,
|
||||
match = string.match,
|
||||
format = string.format
|
||||
}
|
||||
-- }}}
|
||||
|
||||
|
||||
-- Batproc: provides state, charge, and remaining time for a requested battery using procfs
|
||||
-- vicious.contrib.batproc
|
||||
local batproc = {}
|
||||
|
||||
|
||||
-- {{{ Battery widget type
|
||||
local function worker(format, batid)
|
||||
local battery_state = {
|
||||
["full"] = "↯",
|
||||
["unknown"] = "⌁",
|
||||
["charged"] = "↯",
|
||||
["charging"] = "+",
|
||||
["discharging"] = "-"
|
||||
}
|
||||
|
||||
-- Get /proc/acpi/battery info
|
||||
local f = io.open("/proc/acpi/battery/"..batid.."/info")
|
||||
-- Handler for incompetent users
|
||||
if not f then return {battery_state["unknown"], 0, "N/A"} end
|
||||
local infofile = f:read("*all")
|
||||
f:close()
|
||||
|
||||
-- Check if the battery is present
|
||||
if infofile == nil or string.find(infofile, "present:[%s]+no") then
|
||||
return {battery_state["unknown"], 0, "N/A"}
|
||||
end
|
||||
|
||||
-- Get capacity information
|
||||
local capacity = string.match(infofile, "last full capacity:[%s]+([%d]+).*")
|
||||
|
||||
|
||||
-- Get /proc/acpi/battery state
|
||||
local f = io.open("/proc/acpi/battery/"..batid.."/state")
|
||||
local statefile = f:read("*all")
|
||||
f:close()
|
||||
|
||||
-- Get state information
|
||||
local state = string.match(statefile, "charging state:[%s]+([%a]+).*")
|
||||
local state = battery_state[state] or battery_state["unknown"]
|
||||
|
||||
-- Get charge information
|
||||
local rate = string.match(statefile, "present rate:[%s]+([%d]+).*")
|
||||
local remaining = string.match(statefile, "remaining capacity:[%s]+([%d]+).*")
|
||||
|
||||
|
||||
-- Calculate percentage (but work around broken BAT/ACPI implementations)
|
||||
local percent = math.min(math.floor(remaining / capacity * 100), 100)
|
||||
|
||||
-- Calculate remaining (charging or discharging) time
|
||||
if state == "+" then
|
||||
timeleft = (tonumber(capacity) - tonumber(remaining)) / tonumber(rate)
|
||||
elseif state == "-" then
|
||||
timeleft = tonumber(remaining) / tonumber(rate)
|
||||
else
|
||||
return {state, percent, "N/A"}
|
||||
end
|
||||
local hoursleft = math.floor(timeleft)
|
||||
local minutesleft = math.floor((timeleft - hoursleft) * 60 )
|
||||
local time = string.format("%02d:%02d", hoursleft, minutesleft)
|
||||
|
||||
return {state, percent, time}
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return setmetatable(batproc, { __call = function(_, ...) return worker(...) end })
|
@ -1,185 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2012, Andrzje Bieniek <andyhelp@gmail.com>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Grab environment
|
||||
local setmetatable = setmetatable
|
||||
local pcall = pcall
|
||||
local json_status, json = pcall(require, "json")
|
||||
local io = { popen = io.popen }
|
||||
local pairs = pairs
|
||||
local assert = assert
|
||||
-- }}}
|
||||
|
||||
local bb = {} --list of all buildbot builders
|
||||
|
||||
local bs = {OK=1, FAILED=2, RUNNING=3}
|
||||
local bc = {"green", "red", "yellow"}
|
||||
|
||||
module("vicious.contrib.buildbot")
|
||||
|
||||
|
||||
|
||||
|
||||
BB = {}
|
||||
BB.__index = BB
|
||||
|
||||
function BB.create(url, builder)
|
||||
local b = {}
|
||||
setmetatable(b,BB)
|
||||
b.url = url -- buildbot url
|
||||
b.builder = builder -- builder name
|
||||
b.lastChecked = 0 -- last checked build number
|
||||
b.lastSuccessful = 0 -- last successful build number
|
||||
b.lastResult = nil -- last json parsed result
|
||||
b.lastError = nil -- last error string or nil if no error
|
||||
return b
|
||||
end
|
||||
|
||||
function BB:_queryBuildbot(build_number)
|
||||
local f = io.popen("curl --connect-timeout 1 "..self.url.."/json/builders/"..self.builder.."/builds/"..build_number)
|
||||
local jsbuilder = f:read("*all")
|
||||
f:close()
|
||||
if #jsbuilder == 0 then
|
||||
return false, "can't read from url"
|
||||
end
|
||||
|
||||
local result_status, result = pcall(json.decode, jsbuilder, false)
|
||||
if not result_status then
|
||||
return false, "can't parse json data"
|
||||
end
|
||||
return true, result
|
||||
end
|
||||
|
||||
function BB:_getBuildStatus(result)
|
||||
if #result['text'] > 0 then
|
||||
local text = result['text']
|
||||
if text[1] == "build" and text[2] == "successful" and #text == 2 then
|
||||
--successful
|
||||
return bs.OK
|
||||
else
|
||||
--failed
|
||||
return bs.FAILED
|
||||
end
|
||||
else
|
||||
--in progress
|
||||
return bs.RUNNING
|
||||
end
|
||||
end
|
||||
|
||||
-- Function queries buildbot to refresh builds status.
|
||||
-- * if build is successful or failed it will not be queried again, number is stored in lasteChecked
|
||||
-- * up to 10 last builds will be checked to find last successful build
|
||||
function BB:refresh()
|
||||
local last_pass_fail = 0
|
||||
local nr = -1
|
||||
local last_result
|
||||
local iter_counter = 0
|
||||
|
||||
self.lastError = nil
|
||||
self.lastResult = nil
|
||||
--- there is a gap to fill in, iterate all not checked builds starting from latest
|
||||
while nr > self.lastChecked or nr == -1 do
|
||||
local r_status, r = self:_queryBuildbot(nr)
|
||||
local s
|
||||
|
||||
if not r_status then
|
||||
self.lastError = r
|
||||
return
|
||||
end
|
||||
|
||||
s = self:_getBuildStatus(r)
|
||||
if not last_result then
|
||||
last_result = r
|
||||
end
|
||||
nr = r['number']
|
||||
assert(nr > 0)
|
||||
if last_pass_fail == 0 and (s == bs.OK or s == bs.FAILED) then
|
||||
last_pass_fail = nr
|
||||
end
|
||||
if s == bs.OK then --successful
|
||||
self.lastSuccessful = nr
|
||||
break;
|
||||
end
|
||||
nr = nr - 1
|
||||
iter_counter = iter_counter + 1
|
||||
if iter_counter > 10 then --check max last 10 builds when searching for successful build
|
||||
break;
|
||||
end
|
||||
end
|
||||
if last_pass_fail ~= 0 then
|
||||
self.lastChecked = last_pass_fail
|
||||
end
|
||||
if last_result then
|
||||
self.lastResult = last_result
|
||||
end
|
||||
end
|
||||
|
||||
function BB:getLastSuccessful()
|
||||
return self.lastSuccessful
|
||||
end
|
||||
|
||||
function BB:getCurrent()
|
||||
return self.lastResult['number']
|
||||
end
|
||||
|
||||
function BB:getCurrentStatus()
|
||||
return self:_getBuildStatus(self.lastResult)
|
||||
end
|
||||
|
||||
function BB:getBuilder()
|
||||
return self.builder
|
||||
end
|
||||
|
||||
function BB:getError()
|
||||
return self.lastError
|
||||
end
|
||||
|
||||
|
||||
local function getBuilderStatus(b)
|
||||
local s = "[" .. b:getBuilder()
|
||||
--check if json library was loaded correctly
|
||||
if not json_status then
|
||||
return s .. ".<span color=\"orange\">can't find libluaX.X-json</span>]"
|
||||
end
|
||||
|
||||
local err = b:getError()
|
||||
if err then
|
||||
return s .. ".<span color=\"orange\">" .. err .. "</span>]"
|
||||
end
|
||||
|
||||
if b:getLastSuccessful() ~= 0 then
|
||||
success_build_nr_str = "<span color=\"green\">".. b:getLastSuccessful() .."</span>"
|
||||
else
|
||||
success_build_nr_str = "-"
|
||||
end
|
||||
|
||||
local current_build_color = bc[b:getCurrentStatus()]
|
||||
current_build_nr_str = "<span color=\""..current_build_color.."\">"..b:getCurrent().."</span>"
|
||||
|
||||
if current_build_color ~= "green" then
|
||||
s = s .. "." .. current_build_nr_str
|
||||
end
|
||||
return s .. "." .. success_build_nr_str .. "]"
|
||||
end
|
||||
|
||||
|
||||
-- {{{ Buildbot widget type
|
||||
local function worker(format, warg)
|
||||
if #bb == 0 then --fill up bb with builders when worker function is run for the first time
|
||||
for i,v in pairs(warg) do
|
||||
bb[#bb+1] = BB.create(v["url"], v["builder"])
|
||||
end
|
||||
end
|
||||
|
||||
local str = ""
|
||||
for i,v in pairs(bb) do
|
||||
v:refresh()
|
||||
str = str .. " " .. getBuilderStatus(v)
|
||||
end
|
||||
return {str .. " "}
|
||||
end
|
||||
-- }}}
|
||||
|
||||
setmetatable(_M, { __call = function(_, ...) return worker(...) end })
|
@ -1,73 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Grab environment
|
||||
local ipairs = ipairs
|
||||
local setmetatable = setmetatable
|
||||
local table = { insert = table.insert }
|
||||
local string = { gmatch = string.gmatch }
|
||||
local helpers = require("vicious.helpers")
|
||||
-- }}}
|
||||
|
||||
|
||||
-- Disk I/O: provides I/O statistics for requested storage devices
|
||||
-- vicious.contrib.dio
|
||||
local dio = {}
|
||||
|
||||
|
||||
-- Initialize function tables
|
||||
local disk_usage = {}
|
||||
local disk_total = {}
|
||||
-- Variable definitions
|
||||
local unit = { ["s"] = 1, ["kb"] = 2, ["mb"] = 2048 }
|
||||
|
||||
-- {{{ Disk I/O widget type
|
||||
local function worker(format, disk)
|
||||
if not disk then return end
|
||||
|
||||
local disk_lines = { [disk] = {} }
|
||||
local disk_stats = helpers.pathtotable("/sys/block/" .. disk)
|
||||
|
||||
if disk_stats.stat then
|
||||
local match = string.gmatch(disk_stats.stat, "[%s]+([%d]+)")
|
||||
for i = 1, 11 do -- Store disk stats
|
||||
table.insert(disk_lines[disk], match())
|
||||
end
|
||||
end
|
||||
|
||||
-- Ensure tables are initialized correctly
|
||||
local diff_total = { [disk] = {} }
|
||||
if not disk_total[disk] then
|
||||
disk_usage[disk] = {}
|
||||
disk_total[disk] = {}
|
||||
|
||||
while #disk_total[disk] < #disk_lines[disk] do
|
||||
table.insert(disk_total[disk], 0)
|
||||
end
|
||||
end
|
||||
|
||||
for i, v in ipairs(disk_lines[disk]) do
|
||||
-- Diskstats are absolute, substract our last reading
|
||||
diff_total[disk][i] = v - disk_total[disk][i]
|
||||
|
||||
-- Store totals
|
||||
disk_total[disk][i] = v
|
||||
end
|
||||
|
||||
-- Calculate and store I/O
|
||||
helpers.uformat(disk_usage[disk], "read", diff_total[disk][3], unit)
|
||||
helpers.uformat(disk_usage[disk], "write", diff_total[disk][7], unit)
|
||||
helpers.uformat(disk_usage[disk], "total", diff_total[disk][7] + diff_total[disk][3], unit)
|
||||
|
||||
-- Store I/O scheduler
|
||||
if disk_stats.queue and disk_stats.queue.scheduler then
|
||||
disk_usage[disk]["{sched}"] = string.gmatch(disk_stats.queue.scheduler, "%[([%a]+)%]")
|
||||
end
|
||||
|
||||
return disk_usage[disk]
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return setmetatable(dio, { __call = function(_, ...) return worker(...) end })
|
@ -1,18 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Vicious widgets for the awesome window manager
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Setup environment
|
||||
local setmetatable = setmetatable
|
||||
local wrequire = require("vicious.helpers").wrequire
|
||||
|
||||
-- Vicious: widgets for the awesome window manager
|
||||
-- vicious.contrib
|
||||
local contrib = { _NAME = "vicious.contrib" }
|
||||
-- }}}
|
||||
|
||||
-- Load modules at runtime as needed
|
||||
return setmetatable(contrib, { __index = wrequire })
|
@ -1,48 +0,0 @@
|
||||
---------------------------------------------------
|
||||
-- Licensed under the GNU General Public License v2
|
||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||
-- * (c) 2009, Lucas de Vries <lucas@glacicle.com>
|
||||
---------------------------------------------------
|
||||
|
||||
-- {{{ Grab environment
|
||||
local type = type
|
||||
local io = { popen = io.popen }
|
||||
local setmetatable = setmetatable
|
||||
local string = { find = string.find }
|
||||
local helpers = require("vicious.helpers")
|
||||
-- }}}
|
||||
|
||||
|
||||
-- Mpc: provides the currently playing song in MPD
|
||||
-- vicious.contrib.mpc
|
||||
local mpc = {}
|
||||
|
||||
|
||||
-- {{{ MPC widget type
|
||||
local function worker(format, warg)
|
||||
-- Get data from mpd
|
||||
local f = io.popen("mpc")
|
||||
local np = f:read("*line")
|
||||
f:close()
|
||||
|
||||
-- Not installed,
|
||||
if np == nil or -- off or stoppped.
|
||||
(string.find(np, "MPD_HOST") or string.find(np, "volume:"))
|
||||
then
|
||||
return {"Stopped"}
|
||||
end
|
||||
|
||||
-- Check if we should scroll, or maybe truncate
|
||||
if warg then
|
||||
if type(warg) == "table" then
|
||||
np = helpers.scroll(np, warg[1], warg[2])
|
||||
else
|
||||
np = helpers.truncate(np, warg)
|
||||
end
|
||||
end
|
||||
|
||||
return {helpers.escape(np)}
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return setmetatable(mpc, { __call = function(_, ...) return worker(...) end })
|