1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-10-22 20:41:22 +00:00

minor fixes + freedesktop menu added

This commit is contained in:
luke bonham 2013-08-04 23:39:49 +02:00
parent 32a3e10f36
commit 17d50faff8
13 changed files with 620 additions and 247 deletions

View file

@ -25,6 +25,7 @@ Notable features:
- No borders when there's only one visible client - No borders when there's only one visible client
- Powerful volume bar - Powerful volume bar
- Custom layouts - Custom layouts
- Freedesktop menu
They're scattered all over the set, so try each theme and choose the one you enjoy the most. They're scattered all over the set, so try each theme and choose the one you enjoy the most.
@ -83,6 +84,8 @@ Blackburn and Holo use png topbars, supported screen width sizes are:
if your screen don't match one of these widths, then you have to create a proper topbar, and put it into ``themes/*chosentheme*/icons/topbar``. if your screen don't match one of these widths, then you have to create a proper topbar, and put it into ``themes/*chosentheme*/icons/topbar``.
Freedesktop menu in use is just an example: feel free to modify ``freedesktop/freedesktop.lua``.
**Have any suggestions?** Did you see some great stuff and you want me to put my paws on it? Feel free to email me, it might just be the next copycat! **Have any suggestions?** Did you see some great stuff and you want me to put my paws on it? Feel free to email me, it might just be the next copycat!
Author Author

127
freedesktop/desktop.lua Normal file
View file

@ -0,0 +1,127 @@
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")
local wibox = require("wibox")
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 = wibox.widget.textbox()
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

View file

@ -0,0 +1,38 @@
-- This is an usage example
-- Modify according to your preferences
-- If you are a Debian user, you can also uncomment the two lines that insert
-- the Debian menu together with the rest of the items.
local awful = require("awful")
local beautiful = require("beautiful")
require('freedesktop.utils')
require('freedesktop.menu')
require('freedesktop.desktop')
-- require("debian.menu")
freedesktop.utils.terminal = terminal
freedesktop.utils.icon_theme = 'gnome' -- look inside /usr/share/icons/, default: nil (don't use icon theme)
menu_items = freedesktop.menu.new()
myawesomemenu = {
{ "manual", terminal .. " -e man awesome", freedesktop.utils.lookup_icon({ icon = 'help' }) },
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua", freedesktop.utils.lookup_icon({ icon = 'package_settings' }) },
{ "restart", awesome.restart, freedesktop.utils.lookup_icon({ icon = 'gtk-refresh' }) },
{ "quit", awesome.quit, freedesktop.utils.lookup_icon({ icon = 'gtk-quit' }) }
}
for s = 1, screen.count() do
freedesktop.desktop.add_applications_icons({screen = s, showlabels = true})
freedesktop.desktop.add_dirs_and_files_icons({screen = s, showlabels = true})
end
table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon })
table.insert(menu_items, { "open terminal", terminal, freedesktop.utils.lookup_icon({icon = 'terminal'}) })
-- table.insert(menu_items, { "Debian", debian.menu.Debian_menu.Debian, freedesktop.utils.lookup_icon({ icon = 'debian-logo' }) })
mymainmenu = awful.menu.new({ items = menu_items, width = 200 })
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })

5
freedesktop/init.lua Normal file
View file

@ -0,0 +1,5 @@
require("freedesktop.utils")
require("freedesktop.desktop")
require("freedesktop.menu")
module("freedesktop")

97
freedesktop/menu.lua Normal file
View file

@ -0,0 +1,97 @@
-- 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

255
freedesktop/utils.lua Normal file
View file

@ -0,0 +1,255 @@
-- Grab environment
local io = io
local os = os
local table = table
local type = type
local ipairs = ipairs
local pairs = pairs
module("freedesktop.utils")
terminal = 'xterm'
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

View file

@ -129,35 +129,11 @@ end
-- }}} -- }}}
-- {{{ Menu -- {{{ Freedesktop Menu
myaccessories = {
{ "archives", "7zFM" }, require("freedesktop/freedesktop")
{ "charmap", "gucharmap" },
{ "gbdfed", "gbdfed" }, -- }}}
{ "gimp", "gimp" },
{ "text editor", gui_editor },
}
myinternet = {
{ "torrent" , "transmission-gtk" },
{ "torrent search" , "torrent-search" }
}
myoffice = {
{ "writer" , "lowriter" },
{ "impress" , "loimpress" },
}
mysystem = {
{ "appearance" , "lxappearance" },
{ "cleaning" , "bleachbit" },
{ "powertop" , terminal .. " -e sudo powertop " },
}
mymainmenu = awful.menu({ items = {
{ "accessories" , myaccessories },
{ "internet" , myinternet },
{ "office" , myoffice },
{ "system" , mysystem },
}
})
mylauncher = awful.widget.launcher({ menu = mymainmenu })
-- }}} -- }}}

View file

@ -6,7 +6,7 @@
--[[ ]]-- --[[ ]]--
-- Required Libraries -- {{{ Required Libraries
local gears = require("gears") local gears = require("gears")
local awful = require("awful") local awful = require("awful")
@ -20,7 +20,9 @@ local scratch = require("scratch")
local yawn = require("yawn") local yawn = require("yawn")
local layouts = require("layouts") local layouts = require("layouts")
-- Run once function -- }}}
-- {{{ Autostart programs
function run_once(cmd) function run_once(cmd)
findme = cmd findme = cmd
@ -31,17 +33,19 @@ function run_once(cmd)
awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")") awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
end end
-- autostart applications
run_once("urxvtd") run_once("urxvtd")
run_once("unclutter -idle 10") run_once("unclutter -idle 10")
run_once("compton") run_once("compton")
-- Localization -- }}}
-- {{{ Localization
os.setlocale(os.getenv("LANG")) os.setlocale(os.getenv("LANG"))
-- }}}
-- Error Handling -- {{{ Error Handling
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) -- another config (This code will only ever execute for the fallback config)
@ -66,8 +70,9 @@ do
end) end)
end end
-- }}}
-- Global variables -- {{{ Global variables
home = os.getenv("HOME") home = os.getenv("HOME")
confdir = home .. "/.config/awesome" confdir = home .. "/.config/awesome"
@ -102,8 +107,9 @@ layouts =
layouts.tilegaps, -- 6 layouts.tilegaps, -- 6
} }
-- }}}
-- Wallpaper -- {{{ Wallpaper
if beautiful.wallpaper then if beautiful.wallpaper then
for s = 1, screen.count() do for s = 1, screen.count() do
@ -111,7 +117,9 @@ if beautiful.wallpaper then
end end
end end
-- Tags -- }}}
-- {{{ Tags
tags = { tags = {
names = { "ƀ", "Ƅ", "Ɗ", "ƈ", "ƙ" }, names = { "ƀ", "Ƅ", "Ɗ", "ƈ", "ƙ" },
@ -121,38 +129,15 @@ for s = 1, screen.count() do
tags[s] = awful.tag(tags.names, s, tags.layout) tags[s] = awful.tag(tags.names, s, tags.layout)
end end
-- Menu -- }}}
myaccessories = {
{ "archives", "7zFM" },
{ "charmap", "gucharmap" },
{ "gbdfed", "gbdfed" },
{ "gimp", "gimp" },
{ "text editor", gui_editor },
}
myinternet = {
{ "torrent" , "transmission-gtk" },
{ "torrent search" , "torrent-search" }
}
myoffice = {
{ "writer" , "lowriter" },
{ "impress" , "loimpress" },
}
mysystem = {
{ "appearance" , "lxappearance" },
{ "cleaning" , "bleachbit" },
{ "powertop" , terminal .. " -e sudo powertop " },
}
mymainmenu = awful.menu({ items = {
{ "accessories" , myaccessories },
{ "internet" , myinternet },
{ "office" , myoffice },
{ "system" , mysystem },
}
})
mylauncher = awful.widget.launcher({ menu = mymainmenu })
-- {{{ Freedesktop menu
-- Wibox require("freedesktop/freedesktop")
-- }}}
-- {{{ Wibox
-- awful.util -- awful.util
local util = awful.util local util = awful.util
@ -468,8 +453,9 @@ arrl_pre:set_image(beautiful.arrl_lr_pre)
arrl_post = wibox.widget.imagebox() arrl_post = wibox.widget.imagebox()
arrl_post:set_image(beautiful.arrl_lr_post) arrl_post:set_image(beautiful.arrl_lr_post)
-- }}}
-- Layout -- {{{ Layout
-- Create a wibox for each screen and add it -- Create a wibox for each screen and add it
mywibox = {} mywibox = {}
@ -576,7 +562,9 @@ for s = 1, screen.count() do
end end
-- Mouse Bindings -- }}}
-- {{{ Mouse Bindings
root.buttons(awful.util.table.join( root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 3, function () mymainmenu:toggle() end),
@ -584,8 +572,9 @@ root.buttons(awful.util.table.join(
awful.button({ }, 5, awful.tag.viewprev) awful.button({ }, 5, awful.tag.viewprev)
)) ))
-- }}}
-- Key bindings -- {{{ Key bindings
globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(
-- Capture a screenshot -- Capture a screenshot
@ -733,7 +722,6 @@ clientkeys = awful.util.table.join(
end) end)
) )
-- Compute the maximum number of digit we need, limited to 9 -- Compute the maximum number of digit we need, limited to 9
keynumber = 0 keynumber = 0
for s = 1, screen.count() do for s = 1, screen.count() do
@ -781,8 +769,9 @@ clientbuttons = awful.util.table.join(
-- Set keys -- Set keys
root.keys(globalkeys) root.keys(globalkeys)
-- }}}
-- Rules -- {{{ Rules
awful.rules.rules = { awful.rules.rules = {
-- All clients will match this rule. -- All clients will match this rule.
@ -819,8 +808,9 @@ awful.rules.rules = {
properties = { tag = tags[1][5] } }, properties = { tag = tags[1][5] } },
} }
-- }}}
-- Signals -- {{{ Signals
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c, startup) client.connect_signal("manage", function (c, startup)
@ -892,3 +882,5 @@ end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus 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) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}

View file

@ -129,36 +129,9 @@ end
-- }}} -- }}}
-- {{{ Menu -- {{{ Freedesktop menu
myaccessories = { require("freedesktop/freedesktop")
{ "archives", "7zFM" },
{ "charmap", "gucharmap" },
{ "gbdfed", "gbdfed" },
{ "gimp", "gimp" },
{ "text editor", gui_editor },
}
myinternet = {
{ "torrent" , "transmission-gtk" },
{ "torrent search" , "torrent-search" }
}
myoffice = {
{ "writer" , "lowriter" },
{ "impress" , "loimpress" },
}
mysystem = {
{ "appearance" , "lxappearance" },
{ "cleaning" , "bleachbit" },
{ "powertop" , terminal .. " -e sudo powertop " },
}
mymainmenu = awful.menu({ items = {
{ "accessories" , myaccessories },
{ "internet" , myinternet },
{ "office" , myoffice },
{ "system" , mysystem },
}
})
mylauncher = awful.widget.launcher({ menu = mymainmenu })
-- }}} -- }}}

View file

@ -139,52 +139,13 @@ for s = 1, screen.count() do
-- Each screen has its own tag table. -- Each screen has its own tag table.
tags[s] = awful.tag(tags.names, s, tags.layout) tags[s] = awful.tag(tags.names, s, tags.layout)
end end
-- }}} -- }}}
-- {{{ Menu -- {{{ Freedesktop Menu
myaccessories = {
{ "archives", "7zFM" }, require("freedesktop/freedesktop")
{ "file manager", "spacefm" },
{ "editor", gui_editor },
}
myinternet = {
{ "browser", browser },
{ "irc client" , chat },
{ "torrent" , "rtorrent" },
{ "torrtux" , terminal .. " -e torrtux " },
{ "torrent search" , "torrent-search" }
}
mygames = {
{ "NES", "fceux" },
{ "Super NES", "zsnes" },
}
mygraphics = {
{ "gimp" , "gimp" },
{ "inkscape", "inkscape" },
{ "dia", "dia" },
{ "image viewer" , "viewnior" }
}
myoffice = {
{ "writer" , "lowriter" },
{ "impress" , "loimpress" }
}
mysystem = {
{ "appearance" , "lxappearance" },
{ "cleaning" , "bleachbit" },
{ "powertop" , terminal .. " -e sudo powertop " },
{ "task manager" , tasks }
}
mymainmenu = awful.menu({ items = {
{ "accessories" , myaccessories },
{ "graphics" , mygraphics },
{ "internet" , myinternet },
{ "games" , mygames },
{ "office" , myoffice },
{ "system" , mysystem },
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- }}} -- }}}
-- {{{ Wibox -- {{{ Wibox
@ -694,6 +655,7 @@ end
-- {{{ Mouse Bindings -- {{{ Mouse Bindings
root.buttons(awful.util.table.join( root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) awful.button({ }, 5, awful.tag.viewprev)
)) ))
@ -701,6 +663,7 @@ root.buttons(awful.util.table.join(
-- }}} -- }}}
-- {{{ Key bindings -- {{{ Key bindings
globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(
-- Capture a screenshot -- Capture a screenshot

View file

@ -143,52 +143,13 @@ for s = 1, screen.count() do
-- Each screen has its own tag table. -- Each screen has its own tag table.
tags[s] = awful.tag(tags.names, s, tags.layout) tags[s] = awful.tag(tags.names, s, tags.layout)
end end
-- }}} -- }}}
-- {{{ Menu -- {{{ Freedesktop menu
myaccessories = {
{ "archives", "7zFM" }, require("freedesktop/freedesktop")
{ "file manager", "spacefm" },
{ "editor", gui_editor },
}
myinternet = {
{ "browser", browser },
{ "irc client" , chat },
{ "torrent" , "rtorrent" },
{ "torrtux" , terminal .. " -e torrtux " },
{ "torrent search" , "torrent-search" }
}
mygames = {
{ "NES", "fceux" },
{ "Super NES", "zsnes" },
}
mygraphics = {
{ "gimp" , "gimp" },
{ "inkscape", "inkscape" },
{ "dia", "dia" },
{ "image viewer" , "viewnior" }
}
myoffice = {
{ "writer" , "lowriter" },
{ "impress" , "loimpress" },
}
mysystem = {
{ "appearance" , "lxappearance" },
{ "cleaning" , "bleachbit" },
{ "powertop" , terminal .. " -e sudo powertop " },
{ "task manager" , tasks }
}
mymainmenu = awful.menu({ items = {
{ "accessories" , myaccessories },
{ "graphics" , mygraphics },
{ "internet" , myinternet },
{ "games" , mygames },
{ "office" , myoffice },
{ "system" , mysystem },
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- }}} -- }}}
-- {{{ Wibox -- {{{ Wibox
@ -665,6 +626,7 @@ end
-- {{{ Mouse Bindings -- {{{ Mouse Bindings
root.buttons(awful.util.table.join( root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) awful.button({ }, 5, awful.tag.viewprev)
)) ))
@ -672,6 +634,7 @@ root.buttons(awful.util.table.join(
-- }}} -- }}}
-- {{{ Key bindings -- {{{ Key bindings
globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(
-- Capture a screenshot -- Capture a screenshot
@ -990,3 +953,4 @@ client.connect_signal("focus", function(c) c.border_color = beautiful.border_foc
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}} -- }}}

View file

@ -135,6 +135,7 @@ end
-- {{{ Menu -- {{{ Menu
-- my current menu
myaccessories = { myaccessories = {
{ "archives", "7zFM" }, { "archives", "7zFM" },
{ "charmap", "gucharmap" }, { "charmap", "gucharmap" },
@ -164,6 +165,9 @@ mymainmenu = awful.menu({ items = {
}) })
mylauncher = awful.widget.launcher({ menu = mymainmenu }) mylauncher = awful.widget.launcher({ menu = mymainmenu })
-- if you prefer freedesktop, uncomment the following line
require("freedesktop/freedesktop")
-- }}} -- }}}
-- {{{ Wibox -- {{{ Wibox

View file

@ -6,7 +6,7 @@
--[[ ]]-- --[[ ]]--
-- Required Libraries -- {{{ Required Libraries
gears = require("gears") gears = require("gears")
awful = require("awful") awful = require("awful")
@ -19,8 +19,9 @@ vicious = require("vicious")
scratch = require("scratch") scratch = require("scratch")
layouts = require("layouts") layouts = require("layouts")
-- }}}
-- Run once function -- {{{ Autostart applications
function run_once(cmd) function run_once(cmd)
findme = cmd findme = cmd
@ -31,17 +32,18 @@ function run_once(cmd)
awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")") awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
end end
-- autostart applications
run_once("urxvtd") run_once("urxvtd")
run_once("unclutter -idle 10") run_once("unclutter -idle 10")
-- }}}
-- Localization -- {{{ Localization
os.setlocale(os.getenv("LANG")) os.setlocale(os.getenv("LANG"))
-- }}}
-- Error Handling -- {{{ Error Handling
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) -- another config (This code will only ever execute for the fallback config)
@ -66,8 +68,9 @@ do
end) end)
end end
-- }}}
-- Variable Definitions -- {{{ Variable Definitions
home = os.getenv("HOME") home = os.getenv("HOME")
confdir = home .. "/.config/awesome" confdir = home .. "/.config/awesome"
@ -109,8 +112,9 @@ layouts =
layouts.tilegaps, -- 13 layouts.tilegaps, -- 13
} }
-- }}}
-- Wallpaper -- {{{ Wallpaper
if beautiful.wallpaper then if beautiful.wallpaper then
for s = 1, screen.count() do for s = 1, screen.count() do
@ -118,7 +122,9 @@ if beautiful.wallpaper then
end end
end end
-- Tags -- }}}
-- {{{ Tags
tags = { tags = {
names = { "web", "term", "docs", "media", "down"}, names = { "web", "term", "docs", "media", "down"},
@ -128,53 +134,15 @@ for s = 1, screen.count() do
tags[s] = awful.tag(tags.names, s, tags.layout) tags[s] = awful.tag(tags.names, s, tags.layout)
end end
-- Menu -- }}}
myaccessories = {
{ "archives", "7zFM" },
{ "file manager", "spacefm" },
{ "editor", gui_editor },
}
myinternet = {
{ "browser", browser },
{ "irc client" , chat },
{ "torrent" , "rtorrent" },
{ "torrtux" , terminal .. " -e torrtux " },
{ "torrent search" , "torrent-search" }
}
mygames = {
{ "NES", "fceux" },
{ "Super NES", "zsnes" },
}
mygraphics = {
{ "gimp" , "gimp" },
{ "inkscape", "inkscape" },
{ "dia", "dia" },
{ "image viewer" , "viewnior" }
}
myoffice = {
{ "writer" , "lowriter" },
{ "impress" , "loimpress" },
}
mysystem = {
{ "appearance" , "lxappearance" },
{ "cleaning" , "bleachbit" },
{ "powertop" , terminal .. " -e sudo powertop " },
{ "task manager" , tasks }
}
mymainmenu = awful.menu({ items = {
{ "accessories" , myaccessories },
{ "graphics" , mygraphics },
{ "internet" , myinternet },
{ "games" , mygames },
{ "office" , myoffice },
{ "system" , mysystem },
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- {{{ Freedesktop menu
-- Wibox require("freedesktop/freedesktop")
-- }}}
-- {{{ Wibox
-- Colours -- Colours
coldef = "</span>" coldef = "</span>"
@ -509,8 +477,9 @@ spr = wibox.widget.textbox(' ')
leftbr = wibox.widget.textbox(' [') leftbr = wibox.widget.textbox(' [')
rightbr = wibox.widget.textbox('] ') rightbr = wibox.widget.textbox('] ')
-- }}}
-- Layout -- {{{ Layout
-- Create a wibox for each screen and add it -- Create a wibox for each screen and add it
mywibox = {} mywibox = {}
@ -627,7 +596,9 @@ for s = 1, screen.count() do
end end
-- Mouse Bindings -- }}}
-- {{{ Mouse Bindings
root.buttons(awful.util.table.join( root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 3, function () mymainmenu:toggle() end),
@ -635,8 +606,10 @@ root.buttons(awful.util.table.join(
awful.button({ }, 5, awful.tag.viewprev) awful.button({ }, 5, awful.tag.viewprev)
)) ))
-- }}}
-- {{{ Key bindings
-- Key bindings
globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(
-- Capture a screenshot -- Capture a screenshot
@ -828,8 +801,9 @@ clientbuttons = awful.util.table.join(
-- Set keys -- Set keys
root.keys(globalkeys) root.keys(globalkeys)
-- }}}
-- Rules -- {{{ Rules
awful.rules.rules = { awful.rules.rules = {
-- All clients will match this rule. -- All clients will match this rule.
@ -951,3 +925,5 @@ end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus 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) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}