mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-16 07:47:22 +01:00
beautiful: import
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
48d49c085c
commit
2735144b8c
5 changed files with 124 additions and 36 deletions
|
@ -22,13 +22,15 @@ include_directories(
|
|||
${AWESOME_OPTIONAL_INCLUDE_DIRS})
|
||||
|
||||
set(AWE_LUA_FILES
|
||||
${SOURCE_DIR}/lib/tabulous.lua)
|
||||
${SOURCE_DIR}/lib/tabulous.lua
|
||||
${SOURCE_DIR}/lib/beautiful.lua)
|
||||
set(awful_lua ${BUILD_DIR}/lib/awful.lua)
|
||||
|
||||
set(AWE_CONF_FILE_DEFAULT ${BUILD_DIR}/awesomerc.lua)
|
||||
set(AWE_CONF_FILE rc.lua)
|
||||
|
||||
set(AWE_ICON_DIR ${SOURCE_DIR}/icons)
|
||||
set(AWE_THEMES_DIR ${SOURCE_DIR}/themes)
|
||||
|
||||
set(AWE_DOC_FILES
|
||||
${SOURCE_DIR}/AUTHORS
|
||||
|
@ -363,6 +365,7 @@ if(GENERATE_MANPAGES)
|
|||
install(FILES ${AWE_MAN5_FILES} DESTINATION ${AWESOME_MAN_PATH}/man5)
|
||||
endif()
|
||||
install(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_DATA_PATH})
|
||||
install(DIRECTORY ${AWE_THEMES_DIR} DESTINATION ${AWESOME_DATA_PATH})
|
||||
install(FILES ${AWE_DOC_FILES} DESTINATION ${AWESOME_DOC_PATH})
|
||||
if(GENERATE_LUADOC)
|
||||
install(DIRECTORY ${BUILD_DIR}/luadoc DESTINATION ${AWESOME_DOC_PATH})
|
||||
|
|
|
@ -254,6 +254,7 @@ set(AWESOME_DOC_PATH ${PREFIX}/share/doc/${PROJECT_AWE_NAME})
|
|||
set(AWESOME_MAN_PATH ${PREFIX}/share/man)
|
||||
set(AWESOME_LUA_LIB_PATH ${AWESOME_DATA_PATH}/lib)
|
||||
set(AWESOME_ICON_PATH ${AWESOME_DATA_PATH}/icons)
|
||||
set(AWESOME_THEMES_PATH ${AWESOME_DATA_PATH}/themes)
|
||||
# }}}
|
||||
|
||||
# {{{ Configure files
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
-- Include awesome library, with lots of useful function!
|
||||
require("awful")
|
||||
require("tabulous")
|
||||
require("beautiful")
|
||||
|
||||
beautiful.init("@AWESOME_THEMES_PATH@/default")
|
||||
|
||||
-- Uncomment this to activate autotabbing
|
||||
-- tabulous.autotab_start()
|
||||
|
@ -39,28 +42,8 @@ floatings =
|
|||
["pinentry"] = true
|
||||
}
|
||||
|
||||
-- Color & Appearance definitions, we use these later to display things
|
||||
font = "sans 8"
|
||||
border_width = 1
|
||||
|
||||
bg_normal = "#222222"
|
||||
fg_normal = "#aaaaaa"
|
||||
border_normal = "#000000"
|
||||
|
||||
bg_focus = "#535d6c"
|
||||
fg_focus = "#ffffff"
|
||||
border_focus = bg_focus
|
||||
border_marked = "#91231C"
|
||||
|
||||
bg_urgent = "#ff0000"
|
||||
fg_urgent = "#ffffff"
|
||||
|
||||
-- Define if we want to use titlebar on all applications
|
||||
use_titlebar = false
|
||||
|
||||
awesome.font_set(font)
|
||||
awesome.colors_set({ fg = fg_normal, bg = bg_normal })
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -90,14 +73,14 @@ mytaglist:mouse_add(mouse({}, 3, function (object, tag) tag.selected = not tag.s
|
|||
mytaglist:mouse_add(mouse({ modkey }, 3, function (object, tag) awful.client.toggletag(tag) end))
|
||||
mytaglist:mouse_add(mouse({ }, 4, awful.tag.viewnext))
|
||||
mytaglist:mouse_add(mouse({ }, 5, awful.tag.viewprev))
|
||||
function mytaglist.label(t) return awful.widget.taglist.label.all(t, bg_focus, fg_focus, bg_urgent, fg_urgent) end
|
||||
function mytaglist.label(t) return awful.widget.taglist.label.all(t, beautiful.bg_focus, beautiful.fg_focus, beautiful.bg_urgent, beautiful.fg_urgent) end
|
||||
|
||||
-- Create a tasklist widget
|
||||
mytasklist = widget({ type = "tasklist", name = "mytasklist" })
|
||||
mytasklist:mouse_add(mouse({ }, 1, function (object, c) c:focus_set(); c:raise() end))
|
||||
mytasklist:mouse_add(mouse({ }, 4, function () awful.client.focusbyidx(1) end))
|
||||
mytasklist:mouse_add(mouse({ }, 5, function () awful.client.focusbyidx(-1) end))
|
||||
function mytasklist.label(c, screen) return awful.widget.tasklist.label.currenttags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent) end
|
||||
function mytasklist.label(c, screen) return awful.widget.tasklist.label.currenttags(c, screen, beautiful.bg_focus, beautiful.fg_focus, beautiful.bg_urgent, beautiful.fg_urgent) end
|
||||
|
||||
-- Create a textbox widget
|
||||
mytextbox = widget({ type = "textbox", name = "mytextbox", align = "right" })
|
||||
|
@ -128,7 +111,7 @@ end
|
|||
mystatusbar = {}
|
||||
for s = 1, screen.count() do
|
||||
mystatusbar[s] = statusbar({ position = "top", name = "mystatusbar" .. s,
|
||||
fg = fg_normal, bg = bg_normal })
|
||||
fg = beautiful.fg_normal, bg = beautiful.bg_normal })
|
||||
-- Add widgets to the statusbar - order matters
|
||||
mystatusbar[s]:widget_add(mytaglist)
|
||||
mystatusbar[s]:widget_add(myiconbox)
|
||||
|
@ -227,10 +210,10 @@ keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -
|
|||
|
||||
-- Prompt
|
||||
keybinding({ modkey }, "F1", function ()
|
||||
awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash)
|
||||
awful.prompt({ prompt = "Run: ", cursor_fg = beautiful.fg_focus, cursor_bg = beautiful.bg_focus }, mypromptbox, awful.spawn, awful.completion.bash)
|
||||
end):add()
|
||||
keybinding({ modkey }, "F4", function ()
|
||||
awful.prompt({ prompt = "Run Lua code: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.eval)
|
||||
awful.prompt({ prompt = "Run Lua code: ", cursor_fg = beautiful.fg_focus, cursor_bg = beautiful.bg_focus }, mypromptbox, awful.eval)
|
||||
end):add()
|
||||
|
||||
--- Tabulous, tab manipulation
|
||||
|
@ -297,25 +280,25 @@ end
|
|||
-- Hook function to execute when focusing a client.
|
||||
function hook_focus(c)
|
||||
if not awful.client.ismarked(c) then
|
||||
c.border_color = border_focus
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end
|
||||
|
||||
-- Hook function to execute when unfocusing a client.
|
||||
function hook_unfocus(c)
|
||||
if not awful.client.ismarked(c) then
|
||||
c.border_color = border_normal
|
||||
c.border_color = beautiful.border_normal
|
||||
end
|
||||
end
|
||||
|
||||
-- Hook function to execute when marking a client
|
||||
function hook_marked(c)
|
||||
c.border_color = border_marked
|
||||
c.border_color = beautiful.border_marked
|
||||
end
|
||||
|
||||
-- Hook function to execute when unmarking a client
|
||||
function hook_unmarked(c)
|
||||
c.border_color = border_focus
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
|
||||
-- Hook function to execute when the mouse is over a client.
|
||||
|
@ -332,10 +315,10 @@ function hook_manage(c)
|
|||
c.floating_placement = "smart"
|
||||
if use_titlebar then
|
||||
-- Add a titlebar
|
||||
awful.titlebar.add(c, { fg = fg_normal,
|
||||
bg = bg_normal,
|
||||
fg_focus = fg_focus,
|
||||
bg_focus = bg_focus,
|
||||
awful.titlebar.add(c, { fg = beautiful.fg_normal,
|
||||
bg = beautiful.bg_normal,
|
||||
fg_focus = beautiful.fg_focus,
|
||||
bg_focus = beautiful.bg_focus,
|
||||
modkey = modkey })
|
||||
end
|
||||
-- Add mouse bindings
|
||||
|
@ -344,8 +327,8 @@ function hook_manage(c)
|
|||
c:mouse_add(mouse({ modkey }, 3, function (c) c:mouse_resize() end))
|
||||
-- New client may not receive focus
|
||||
-- if they're not focusable, so set border anyway.
|
||||
c.border_width = border_width
|
||||
c.border_color = border_normal
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_normal
|
||||
c:focus_set()
|
||||
if floatings[c.name:lower()] then
|
||||
c.floating = true
|
||||
|
|
75
lib/beautiful.lua
Normal file
75
lib/beautiful.lua
Normal file
|
@ -0,0 +1,75 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- @author Damien Leone <oxmoz@yahoo.fr>
|
||||
-- @author Julien Danjou <julien@danjou.info>
|
||||
-- @copyright 2008 Damien Leone, Julien Danjou
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
-- Grab environment
|
||||
local io = io
|
||||
local print = print
|
||||
local setmetatable = setmetatable
|
||||
local awful = require("awful")
|
||||
local package = package
|
||||
local capi = { awesome = awesome }
|
||||
|
||||
local module_name = "beautiful"
|
||||
|
||||
--- beautiful: theme library
|
||||
module(module_name)
|
||||
|
||||
-- Local data
|
||||
local theme = {}
|
||||
|
||||
--- Split line in two if it contains the '=' character.
|
||||
-- @param line The line to split.
|
||||
-- @return nil if the '=' character is not in the string
|
||||
-- if the string begins with '#' which is a comment
|
||||
local function split_line(line)
|
||||
local values = {}
|
||||
local split_val = line:find('=')
|
||||
|
||||
if split_val and line:sub(1, 1) ~= '#' and line:sub(1, 2) ~= '--' then
|
||||
return line:sub(1, split_val - 1), line:sub(split_val + 1, -1)
|
||||
end
|
||||
end
|
||||
|
||||
--- Get a value directly.
|
||||
-- @param key The key.
|
||||
-- @return The value.
|
||||
function __index(self, key)
|
||||
if theme[key] then
|
||||
return theme[key]
|
||||
end
|
||||
end
|
||||
|
||||
--- Init function, should be runned at the beginning of configuration file.
|
||||
-- @param path The theme file path.
|
||||
function init(path)
|
||||
if path then
|
||||
local f = io.open(path)
|
||||
|
||||
if not f then
|
||||
return print("E: unable to load theme " .. path)
|
||||
end
|
||||
|
||||
for line in f:lines() do
|
||||
local key, value
|
||||
key, value = split_line(line)
|
||||
if key then
|
||||
if key == "wallpaper_cmd" then
|
||||
awful.spawn(value)
|
||||
elseif key == "font" then
|
||||
capi.awesome.font_set(value)
|
||||
elseif key == "fg_normal" then
|
||||
capi.awesome.colors_set({ fg = value })
|
||||
elseif key == "bg_normal" then
|
||||
capi.awesome.colors_set({ bg = value })
|
||||
end
|
||||
-- Store.
|
||||
theme[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
setmetatable(package.loaded[module_name], package.loaded[module_name])
|
26
themes/default
Normal file
26
themes/default
Normal file
|
@ -0,0 +1,26 @@
|
|||
---------------------------
|
||||
-- Default awesome theme --
|
||||
---------------------------
|
||||
|
||||
# Lines beginning with '#' are comments.
|
||||
# You do not need to add quotes.
|
||||
font=sans 8
|
||||
|
||||
bg_normal=#222222
|
||||
bg_focus=#535d6c
|
||||
bg_urgent=#ff0000
|
||||
|
||||
fg_normal=#aaaaaa
|
||||
fg_focus=#ffffff
|
||||
fg_urgent=#ffffff
|
||||
|
||||
border_width=1
|
||||
border_normal=#000000
|
||||
border_focus=#535d6c
|
||||
border_marked=#91231C
|
||||
|
||||
# You can't change that variable name, because beautiful
|
||||
# will check if 'wallpaper_cmd' is defined before setting
|
||||
# the wallpaper.
|
||||
# Don't forget to set your own command here
|
||||
wallpaper_cmd=xsetroot -solid darkgrey
|
Loading…
Reference in a new issue