diff --git a/libs/awmtk2.lua b/libs/awmtk2.lua index 578384d..9f13715 100644 --- a/libs/awmtk2.lua +++ b/libs/awmtk2.lua @@ -6,36 +6,64 @@ local beautiful = require("beautiful") local awmtk = {} -- {{{ Utils -awmtk.create_class = function(name,overrides,style,parent_class) - return setmetatable(overrides,{ +awmtk.create_delta = function(name,instance_delta,class_delta,parent_delta) + -- To save memory, we create proxies for lower layers called "deltas" + -- This function creates that proxy layer using metatables + return setmetatable(instance_delta,{ __index = function(self,k) - -- Per-widget overrides are top priority + -- Per-instance overrides are top priority if rawget(self,k) then return rawget(self,k) - -- Style overrides are second in priority - elseif type(style[name]) == "table" and rawget(style[name],k) then - return rawget(style[name],k) - -- Parent class is fallback - elseif parent_class[k] then - return parent_class[k] + -- Class-wide overrides are second in priority + elseif type(class_delta[name]) == "table" + and rawget(class_delta[name],k) then + return rawget(class_delta[name],k) + -- Parent is fallback + elseif parent_delta[k] then + return parent_delta[k] end end }) end -awmtk.create_style = function(style_name,parent,overrides) +awmtk.create_style = function(name,parent,overrides) + -- A style is essentially a layer of deltas upon the previous (parent) style local new_style = {} for name,parent_class in pairs(parent) do - new_style[name] = awmtk.create_class( + new_style[name] = awmtk.create_delta( name, (overrides and overrides[name]) or {}, - (beautiful[style_name] or {}), + (beautiful.widgets and beautiful.widgets[style_name]) or {}, parent_class ) end return new_style end +awmtk.create_template_lib = function(name,parent,overrides) + -- same thing but beautiful.templates + return awmtk.create_delta( + name, + overrides or {}, + beautiful.templates or {}, + parent + ) +end + +awmtk.build_templates = function(templates,style) + local new_templates = {} + for name,template in pairs(awmtk.templates) do + new_templates[name] = templates[name](style) + end + return new_templates +end + +awmtk.merge = function(base,overrides) + for k,v in pairs(overrides) do + base[k] = v + end + return base +end -- }}} @@ -54,26 +82,185 @@ awmtk.default = { shape_border_color = beautiful.shape_border_color or beautiful.bg_normal, -- } -- { Shapes - inner_margin = beautiful.inner_margin or 5, - rounding = beautiful.rounding or 0, + margins = 5, + spacing = 5, + shape = function(cr, width, height) + return require("gears").shape.rounded_rect(cr,width,height,5) + end, -- } },{__index = beautiful}) } --- Container subclass -awmtk.default.container = awmtk.create_class("container",{ +-- Subclasses +awmtk.default.container = awmtk.create_delta("container",{ },awmtk.default,awmtk.default.base) --- Button subclass -awmtk.default.button = awmtk.create_class("button",{ - inner_margin = 1 +awmtk.default.button = awmtk.create_delta("button",{ + margins = 3 },awmtk.default,awmtk.default.base) --- Icon subclass -awmtk.default.icon = awmtk.create_class("icon",{ - inner_margin = 1 +awmtk.default.icon = awmtk.create_delta("icon",{ + margins = 1 },awmtk.default,awmtk.default.base) +awmtk.default.textbox = awmtk.create_delta("textbox",{ + font = beautiful.font or "sans 8" +}, awmtk.default,awmtk.default.base) + +awmtk.default.separator = awmtk.create_delta("separator",{ + thickness = 1, + color = beautiful.bg_focus, + border_width = 0 +}, awmtk.default,awmtk.default.base) + +awmtk.default.article = awmtk.create_delta("article", { + icon_size = 16, + small_font = beautiful.font or "sans 8", + font_align = "left", + small_font_align = "left" +}, awmtk.default,awmtk.default.base) + +awmtk.default.popup = awmtk.create_delta("popup", { +}, awmtk.default,awmtk.default.base) -- }}} +-- {{{ Generic templates +awmtk.templates = { + -- Templates are built first using the given style, then applied to contents + -- through returned function + container = function(style) + return function(layout,options) + return awmtk.merge({ + { + layout, + margins = (options and options.margins) or style.container.margins, + widget = wibox.container.margin + }, + bg = style.container.bg_normal, + shape = style.container.shape, + widget = wibox.container.background + },options or {}) + end + end, + + button = function(style) + return function(layout,options) + return awmtk.merge({ + { + layout, + margins = (options and options.margins) or style.button.margins, + widget = wibox.container.margin + }, + bg = style.button.bg_normal, + shape = style.button.shape, + widget = wibox.container.background + },options or {}) + end + end, + + + textbox = function(style) + return function(options) + return awmtk.merge({ + font = style.textbox.font, + widget = wibox.widget.textbox + },options or {}) + end + end, + + hseparator = function(style) + return function(options) + awmtk.merge({ + widget = wibox.widget.separator, + orientation = "horizontal", + thickness = style.separator.thickness, + color = style.separator.color, + border_width = style.separator.border_width + },options or {}) + end + end, + + vseparator = function(style) + return function(options) + awmtk.merge({ + widget = wibox.widget.separator, + orientation = "vertical", + thickness = style.separator.thickness, + color = style.separator.color, + border_width = style.separator.border_width + },options or {}) + end + end, + + -- Article is a template that contains an icon, a headline and a + -- short description, side by side. Useful for menus and notifications. + article = function(style) + return function(options) + return awmtk.merge({ + (options.icon and { + { + { + image = options.icon, + resize = options.resize, + widget = wibox.widget.imagebox + }, + strategy = "exact", + height = options.icon_size or + style.article.icon_size, + width = options.icon_size or + style.article.icon_size, + widget = wibox.container.constraint + }, + widget = wibox.container.place, + valign = "center", + halign = "center" + }), + { + { + markup = options.title or "", + widget = wibox.widget.textbox, + font = options.font or style.article.font, + align = options.font_align or + style.article.font_align, + valign = "center" + }, + (options.description and { + markup = options.description, + widget = wibox.widget.textbox, + font = options.small_font or style.article.small_font, + align = options.small_font_align or + style.article.small_font_align, + valign = "center" + }), + spacing = style.article.spacing, + layout = wibox.layout.flex.vertical + }, + spacing = style.article.spacing, + layout = wibox.layout.fixed.horizontal, + bg = style.article.bg_normal, + widget = wibox.container.background + }, options or {}) + end + end, + + popup = function(style) + return function(widget,options) + return awmtk.merge({ + widget = { + { + widget, + margins = (options and options.margins) or style.popup.margins, + widget = wibox.container.margin + }, + bg = style.popup.bg_normal, + widget = wibox.container.background + }, + shape = style.popup.shape, + visible = false, + ontop = true + },options or {}) + end + end +} +-- }}} return awmtk diff --git a/modules/autostart.lua b/modules/autostart.lua new file mode 100644 index 0000000..a4d8a57 --- /dev/null +++ b/modules/autostart.lua @@ -0,0 +1,18 @@ +-- XFCE style autostart system +local awful = require("awful") +local gears = require("gears") +local gfs = gears.filesystem +local menu_utils = require("menubar.utils") +local stdir = "/tmp/.awesome_startup/" +gfs.make_directories(stdir) +awful.spawn.with_line_callback("find "..gfs.get_xdg_config_home().."autostart/ -name *.desktop",{ + stdout = function(line) + local data = menu_utils.parse_desktop_file(line) + if (data.RunHook == "0") or (data.RunHook == nil) then + if not gfs.file_readable(stdir..line:match("[^/]*$")) then + io.open(stdir..line:match("[^/]*$"),"w"):close() + awful.spawn(data.Exec) + end + end + end +}) diff --git a/modules/base.lua b/modules/base.lua index 8b3d1bd..a1986a5 100644 --- a/modules/base.lua +++ b/modules/base.lua @@ -3,7 +3,16 @@ local awful = require("awful") local beautiful = require("beautiful") local gears = require("gears") + +-- Global settings global = {} +global.terminal = "xfce4-terminal" --Mod+Enter (spawn terminal) +global.browser = "prime-run librewolf" --Mod+Shift+Enter (spawn browser) +global.modkey = "Mod4" -- Default modifier key +global.theme = "default" +global.shell = "zsh" + +awful.util.shell = global.shell --error handling if awesome.startup_errors then print("Error during startup: "..awesome.startup_errors) @@ -18,14 +27,14 @@ do end) end ---theme -beautiful.init(gears.filesystem.get_themes_dir().."default/theme.lua") - --screen setup awful.screen.connect_for_each_screen(function(s) + gears.wallpaper.maximized(root_path.."/background.jpg") awful.tag({ "1" }, s, awful.layout.suit.floating) end) +--theme initialization +beautiful.init(root_path.."/themes/"..global.theme.."/theme.lua") --client mouse bindings clientbuttons = gears.table.join( @@ -44,6 +53,8 @@ awful.rules.rules = { keys = clientkeys, buttons = clientbuttons, screen = awful.screen.preferred, + border_width = beautiful.border_width, + border_color = beautiful.border_normal, placement = awful.placement.no_overlap+awful.placement.no_offscreen } } @@ -61,6 +72,13 @@ client.connect_signal("manage", function(c) 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) --screen setup awful.screen.connect_for_each_screen(function(s) awful.tag({ "1", "2", "3", "4" }, s, awful.layout.suit.floating) diff --git a/modules/errorlog.lua b/modules/errorlog.lua index 1e6430f..bb76881 100644 --- a/modules/errorlog.lua +++ b/modules/errorlog.lua @@ -1,7 +1,9 @@ -- Error logging module local loghandler = io.open(os.getenv("HOME").."/.awesome_errors","w") +local naughty = require("naughty") if awesome.startup_errors then loghandler:write("[STARTUP] "..tostring(awesome.startup_errors).."\n") + naughty.notify({title = "ERROR", text = tostring(awesome.startup_errors)}) end do local in_error = false @@ -9,6 +11,7 @@ do if in_error then return end in_error = true loghandler:write("[RUNTIME] "..tostring(err).."\n") + naughty.notify({title = "ERROR", text = tostring(err)}) in_error = false end) end diff --git a/modules/global.lua b/modules/global.lua deleted file mode 100644 index 3b411e6..0000000 --- a/modules/global.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Global settings -global = {} -global.terminal = "xfce4-terminal" --Mod+Enter (spawn terminal) -global.browser = "librewolf" --Mod+Shift+Enter (spawn browser) -global.modkey = "Mod4" -- Default modifier key diff --git a/modules/menu_test.lua b/modules/menu_test.lua new file mode 100644 index 0000000..29070e0 --- /dev/null +++ b/modules/menu_test.lua @@ -0,0 +1,8 @@ +local menu = require("widgets.dismal")({}) +local gears = require("gears") +local awful = require("awful") +root.buttons(gears.table.join( + awful.button({}, 3, function() end), + awful.button({}, 4, awful.tag.viewnext), + awful.button({}, 5, awful.tag.viewprev) +)) diff --git a/modules/temp_crutches.lua b/modules/temp_crutches.lua deleted file mode 100644 index f2761f5..0000000 --- a/modules/temp_crutches.lua +++ /dev/null @@ -1,16 +0,0 @@ -local awful = require("awful") -local gears = require("gears") --- Wallpaper applied from homedir -awful.screen.connect_for_each_screen(function(s) - gears.wallpaper.maximized(root_path.."/background.jpg") -end) - -awful.rules.rules[1].properties.border_width = 2 -awful.rules.rules[1].properties.border_color = "#787B80" -client.connect_signal("focus", function(c) - c.border_color = "#3584E4" -end) - -client.connect_signal("unfocus", function(c) - c.border_color = "#787B80" -end) diff --git a/modules/xdg_data.lua b/modules/xdg_data.lua new file mode 100644 index 0000000..c17d378 --- /dev/null +++ b/modules/xdg_data.lua @@ -0,0 +1,100 @@ +-- Asynchronous XDG data aggregator +local menu_utils = require("menubar.utils") +local menu_gen = require("menubar.menu_gen") +local awful = require("awful") +local gears = require("gears") +menu_utils.wm_name = "" + +-- Directories to scan for .desktop files +local desktop_dirs = {} +local desktop_dirs_complete = 0 +local icon_dirs = {} +(os.getenv("XDG_DATA_DIRS")..":/home/yessiest/.local/share"):gsub("[^:]*",function(path) + if gears.filesystem.dir_readable(path.."/applications") then + table.insert(desktop_dirs, path.."/applications") + end + if gears.filesystem.dir_readable(path.."/icons") then + table.insert(icon_dirs, path.."/icons") + end +end) + + +-- Global xdg data cache +xdg = { + apps = {}, + categories = { + Other = { + icon = "applications-other", + apps = {} + }, + Wine = { + icon = "wine", + apps = {} + } + } +} + +for k,v in pairs(menu_gen.all_categories) do + xdg.categories[v.app_type] = { + name = v.name, + icon = v.icon_name, + apps = {} + } +end + +-- Asynchronous scanning process +for k,v in pairs(desktop_dirs) do + awful.spawn.with_line_callback("find "..tostring(v).." -name *.desktop",{ + stdout = function(line) + local data = menu_utils.parse_desktop_file(line) + if data.NoDisplay then + return + end + local appdata = { + name = data.Name, + category = "Other", + exec = data.Exec, + icon = (data.Icon and menu_utils.lookup_icon(data.Icon)), + description = data.Comment + } + -- Match first available cateogry for sorting + for k,v in pairs(data.Categories or {"Other"}) do + if xdg.categories[v] then + appdata.category = v + break + end + -- Oh how do I love those Wine applications and their categories + if v:match("^Wine") then + appdata.category = "Wine" + break + end + end + -- Open terminal apps in the terminal (duh) + if data.Terminal then + appdata.exec = global.terminal.." -e "..appdata.exec + end + -- Just for you, Wine - special case because you're being a shit + if (exec and exec:find("%W?wine ")) then + appdata.category = "Wine" + end + table.insert(xdg.apps,appdata) + table.insert(xdg.categories[appdata.category].apps,appdata) + end, + output_done = function() + -- Call a global signal + awesome.emit_signal("xdg::dir_finished",v) + desktop_dirs_complete = desktop_dirs_complete + 1 + end + }) +end +awesome.connect_signal("xdg::dir_finished",function(dir) + if desktop_dirs_complete == #desktop_dirs then + awesome.emit_signal("xdg::all_finished") + -- Clean up empty categories + for k,v in pairs(xdg.categories) do + if #v.apps == 0 then + xdg.categories[k] = nil + end + end + end +end) diff --git a/rc.lua b/rc.lua index d98cf67..92a31ba 100644 --- a/rc.lua +++ b/rc.lua @@ -9,7 +9,8 @@ package.cpath = package.cpath -- Modules list require("modules.errorlog") require("modules.base") -require("modules.global") require("modules.binds") -require("modules.temp_crutches") +require("modules.xdg_data") +require("modules.autostart") require("modules.static_tags") +require("modules.menu_test") diff --git a/themes/default/README b/themes/default/README new file mode 100644 index 0000000..1ddb349 --- /dev/null +++ b/themes/default/README @@ -0,0 +1,3 @@ +Background images: + Mikael Eriksson + Licensed under CC-BY-SA-3.0 diff --git a/themes/default/background.png b/themes/default/background.png new file mode 100644 index 0000000..8f52b6b Binary files /dev/null and b/themes/default/background.png differ diff --git a/themes/default/background_white.png b/themes/default/background_white.png new file mode 100644 index 0000000..bb0c5d0 Binary files /dev/null and b/themes/default/background_white.png differ diff --git a/themes/default/layouts/cornerne.png b/themes/default/layouts/cornerne.png new file mode 100644 index 0000000..c85bd56 Binary files /dev/null and b/themes/default/layouts/cornerne.png differ diff --git a/themes/default/layouts/cornernew.png b/themes/default/layouts/cornernew.png new file mode 100644 index 0000000..c3fd986 Binary files /dev/null and b/themes/default/layouts/cornernew.png differ diff --git a/themes/default/layouts/cornernw.png b/themes/default/layouts/cornernw.png new file mode 100644 index 0000000..dfe78b3 Binary files /dev/null and b/themes/default/layouts/cornernw.png differ diff --git a/themes/default/layouts/cornernww.png b/themes/default/layouts/cornernww.png new file mode 100644 index 0000000..f489010 Binary files /dev/null and b/themes/default/layouts/cornernww.png differ diff --git a/themes/default/layouts/cornerse.png b/themes/default/layouts/cornerse.png new file mode 100644 index 0000000..023ae79 Binary files /dev/null and b/themes/default/layouts/cornerse.png differ diff --git a/themes/default/layouts/cornersew.png b/themes/default/layouts/cornersew.png new file mode 100644 index 0000000..f7cfa1c Binary files /dev/null and b/themes/default/layouts/cornersew.png differ diff --git a/themes/default/layouts/cornersw.png b/themes/default/layouts/cornersw.png new file mode 100644 index 0000000..c1453c9 Binary files /dev/null and b/themes/default/layouts/cornersw.png differ diff --git a/themes/default/layouts/cornersww.png b/themes/default/layouts/cornersww.png new file mode 100644 index 0000000..a65a043 Binary files /dev/null and b/themes/default/layouts/cornersww.png differ diff --git a/themes/default/layouts/dwindle.png b/themes/default/layouts/dwindle.png new file mode 100644 index 0000000..9902d22 Binary files /dev/null and b/themes/default/layouts/dwindle.png differ diff --git a/themes/default/layouts/dwindlew.png b/themes/default/layouts/dwindlew.png new file mode 100644 index 0000000..9199049 Binary files /dev/null and b/themes/default/layouts/dwindlew.png differ diff --git a/themes/default/layouts/fairh.png b/themes/default/layouts/fairh.png new file mode 100644 index 0000000..d41deea Binary files /dev/null and b/themes/default/layouts/fairh.png differ diff --git a/themes/default/layouts/fairhw.png b/themes/default/layouts/fairhw.png new file mode 100644 index 0000000..bb50e3a Binary files /dev/null and b/themes/default/layouts/fairhw.png differ diff --git a/themes/default/layouts/fairv.png b/themes/default/layouts/fairv.png new file mode 100644 index 0000000..f5f0288 Binary files /dev/null and b/themes/default/layouts/fairv.png differ diff --git a/themes/default/layouts/fairvw.png b/themes/default/layouts/fairvw.png new file mode 100644 index 0000000..4f4ed52 Binary files /dev/null and b/themes/default/layouts/fairvw.png differ diff --git a/themes/default/layouts/floating.png b/themes/default/layouts/floating.png new file mode 100644 index 0000000..b8061a0 Binary files /dev/null and b/themes/default/layouts/floating.png differ diff --git a/themes/default/layouts/floatingw.png b/themes/default/layouts/floatingw.png new file mode 100644 index 0000000..4815894 Binary files /dev/null and b/themes/default/layouts/floatingw.png differ diff --git a/themes/default/layouts/fullscreen.png b/themes/default/layouts/fullscreen.png new file mode 100644 index 0000000..d02f6fc Binary files /dev/null and b/themes/default/layouts/fullscreen.png differ diff --git a/themes/default/layouts/fullscreenw.png b/themes/default/layouts/fullscreenw.png new file mode 100644 index 0000000..5c35bfa Binary files /dev/null and b/themes/default/layouts/fullscreenw.png differ diff --git a/themes/default/layouts/magnifier.png b/themes/default/layouts/magnifier.png new file mode 100644 index 0000000..2925414 Binary files /dev/null and b/themes/default/layouts/magnifier.png differ diff --git a/themes/default/layouts/magnifierw.png b/themes/default/layouts/magnifierw.png new file mode 100644 index 0000000..6209556 Binary files /dev/null and b/themes/default/layouts/magnifierw.png differ diff --git a/themes/default/layouts/max.png b/themes/default/layouts/max.png new file mode 100644 index 0000000..8d20844 Binary files /dev/null and b/themes/default/layouts/max.png differ diff --git a/themes/default/layouts/maxw.png b/themes/default/layouts/maxw.png new file mode 100644 index 0000000..85f5ce3 Binary files /dev/null and b/themes/default/layouts/maxw.png differ diff --git a/themes/default/layouts/spiral.png b/themes/default/layouts/spiral.png new file mode 100644 index 0000000..d9434be Binary files /dev/null and b/themes/default/layouts/spiral.png differ diff --git a/themes/default/layouts/spiralw.png b/themes/default/layouts/spiralw.png new file mode 100644 index 0000000..b78dd86 Binary files /dev/null and b/themes/default/layouts/spiralw.png differ diff --git a/themes/default/layouts/tile.png b/themes/default/layouts/tile.png new file mode 100644 index 0000000..3ede21e Binary files /dev/null and b/themes/default/layouts/tile.png differ diff --git a/themes/default/layouts/tilebottom.png b/themes/default/layouts/tilebottom.png new file mode 100644 index 0000000..6f8c257 Binary files /dev/null and b/themes/default/layouts/tilebottom.png differ diff --git a/themes/default/layouts/tilebottomw.png b/themes/default/layouts/tilebottomw.png new file mode 100644 index 0000000..a1de7b2 Binary files /dev/null and b/themes/default/layouts/tilebottomw.png differ diff --git a/themes/default/layouts/tileleft.png b/themes/default/layouts/tileleft.png new file mode 100644 index 0000000..31d6870 Binary files /dev/null and b/themes/default/layouts/tileleft.png differ diff --git a/themes/default/layouts/tileleftw.png b/themes/default/layouts/tileleftw.png new file mode 100644 index 0000000..cf14c25 Binary files /dev/null and b/themes/default/layouts/tileleftw.png differ diff --git a/themes/default/layouts/tiletop.png b/themes/default/layouts/tiletop.png new file mode 100644 index 0000000..98cade2 Binary files /dev/null and b/themes/default/layouts/tiletop.png differ diff --git a/themes/default/layouts/tiletopw.png b/themes/default/layouts/tiletopw.png new file mode 100644 index 0000000..d1d0872 Binary files /dev/null and b/themes/default/layouts/tiletopw.png differ diff --git a/themes/default/layouts/tilew.png b/themes/default/layouts/tilew.png new file mode 100644 index 0000000..fde2ca4 Binary files /dev/null and b/themes/default/layouts/tilew.png differ diff --git a/themes/default/submenu.png b/themes/default/submenu.png new file mode 100644 index 0000000..b2778e2 Binary files /dev/null and b/themes/default/submenu.png differ diff --git a/themes/default/taglist/squarefw.png b/themes/default/taglist/squarefw.png new file mode 100644 index 0000000..2a86430 Binary files /dev/null and b/themes/default/taglist/squarefw.png differ diff --git a/themes/default/taglist/squarew.png b/themes/default/taglist/squarew.png new file mode 100644 index 0000000..913f2ca Binary files /dev/null and b/themes/default/taglist/squarew.png differ diff --git a/themes/default/theme.lua b/themes/default/theme.lua new file mode 100644 index 0000000..b0be480 --- /dev/null +++ b/themes/default/theme.lua @@ -0,0 +1,131 @@ +--------------------------- +-- Default awesome theme -- +--------------------------- + +local theme_assets = require("beautiful.theme_assets") +local xresources = require("beautiful.xresources") +local dpi = xresources.apply_dpi + +local gfs = require("gears.filesystem") +local themes_path = gfs.get_themes_dir() + +local theme = {} + +theme.font = "sans 8" + +theme.bg_normal = "#222222" +theme.bg_focus = "#535d6c" +theme.bg_urgent = "#ff0000" +theme.bg_minimize = "#444444" +theme.bg_systray = theme.bg_normal + +theme.fg_normal = "#aaaaaa" +theme.fg_focus = "#ffffff" +theme.fg_urgent = "#ffffff" +theme.fg_minimize = "#ffffff" + +theme.useless_gap = dpi(0) +theme.border_width = dpi(1) +theme.border_normal = "#000000" +theme.border_focus = "#535d6c" +theme.border_marked = "#91231c" + +-- There are other variable sets +-- overriding the default one when +-- defined, the sets are: +-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile] +-- 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] +-- prompt_[fg|bg|fg_cursor|bg_cursor|font] +-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font] +-- Example: +--theme.taglist_bg_focus = "#ff0000" + +-- Generate taglist squares: +local taglist_square_size = dpi(4) +theme.taglist_squares_sel = theme_assets.taglist_squares_sel( + taglist_square_size, theme.fg_normal +) +theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel( + taglist_square_size, theme.fg_normal +) + +-- Variables set for theming notifications: +-- notification_font +-- notification_[bg|fg] +-- notification_[width|height|margin] +-- notification_[border_color|border_width|shape|opacity] + +-- Variables set for theming the menu: +-- menu_[bg|fg]_[normal|focus] +-- menu_[border_color|border_width] +theme.menu_submenu_icon = themes_path.."default/submenu.png" +theme.menu_height = dpi(15) +theme.menu_width = dpi(100) + +-- 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 = themes_path.."default/titlebar/close_normal.png" +theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png" + +theme.titlebar_minimize_button_normal = themes_path.."default/titlebar/minimize_normal.png" +theme.titlebar_minimize_button_focus = themes_path.."default/titlebar/minimize_focus.png" + +theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png" +theme.titlebar_ontop_button_focus_inactive = themes_path.."default/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_active = themes_path.."default/titlebar/ontop_focus_active.png" + +theme.titlebar_sticky_button_normal_inactive = themes_path.."default/titlebar/sticky_normal_inactive.png" +theme.titlebar_sticky_button_focus_inactive = themes_path.."default/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_active = themes_path.."default/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_active = themes_path.."default/titlebar/sticky_focus_active.png" + +theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png" +theme.titlebar_floating_button_focus_inactive = themes_path.."default/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_active = themes_path.."default/titlebar/floating_focus_active.png" + +theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar/maximized_normal_inactive.png" +theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png" + +theme.wallpaper = themes_path.."default/background.png" + +-- You can use your own layout icons like this: +theme.layout_fairh = themes_path.."default/layouts/fairhw.png" +theme.layout_fairv = themes_path.."default/layouts/fairvw.png" +theme.layout_floating = themes_path.."default/layouts/floatingw.png" +theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png" +theme.layout_max = themes_path.."default/layouts/maxw.png" +theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png" +theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png" +theme.layout_tileleft = themes_path.."default/layouts/tileleftw.png" +theme.layout_tile = themes_path.."default/layouts/tilew.png" +theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png" +theme.layout_spiral = themes_path.."default/layouts/spiralw.png" +theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png" +theme.layout_cornernw = themes_path.."default/layouts/cornernww.png" +theme.layout_cornerne = themes_path.."default/layouts/cornernew.png" +theme.layout_cornersw = themes_path.."default/layouts/cornersww.png" +theme.layout_cornerse = themes_path.."default/layouts/cornersew.png" + +-- Generate Awesome icon: +theme.awesome_icon = theme_assets.awesome_icon( + theme.menu_height, theme.bg_focus, theme.fg_focus +) + +-- Define the icon theme for application icons. If not set then the icons +-- from /usr/share/icons and /usr/share/icons/hicolor will be used. +theme.icon_theme = nil + +return theme + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/themes/default/titlebar/close_focus.png b/themes/default/titlebar/close_focus.png new file mode 100644 index 0000000..01ef825 Binary files /dev/null and b/themes/default/titlebar/close_focus.png differ diff --git a/themes/default/titlebar/close_normal.png b/themes/default/titlebar/close_normal.png new file mode 100644 index 0000000..5448ed8 Binary files /dev/null and b/themes/default/titlebar/close_normal.png differ diff --git a/themes/default/titlebar/floating_focus_active.png b/themes/default/titlebar/floating_focus_active.png new file mode 100644 index 0000000..82dcc7c Binary files /dev/null and b/themes/default/titlebar/floating_focus_active.png differ diff --git a/themes/default/titlebar/floating_focus_inactive.png b/themes/default/titlebar/floating_focus_inactive.png new file mode 100644 index 0000000..c19ba80 Binary files /dev/null and b/themes/default/titlebar/floating_focus_inactive.png differ diff --git a/themes/default/titlebar/floating_normal_active.png b/themes/default/titlebar/floating_normal_active.png new file mode 100644 index 0000000..62342d1 Binary files /dev/null and b/themes/default/titlebar/floating_normal_active.png differ diff --git a/themes/default/titlebar/floating_normal_inactive.png b/themes/default/titlebar/floating_normal_inactive.png new file mode 100644 index 0000000..e2bbdfa Binary files /dev/null and b/themes/default/titlebar/floating_normal_inactive.png differ diff --git a/themes/default/titlebar/maximized_focus_active.png b/themes/default/titlebar/maximized_focus_active.png new file mode 100644 index 0000000..d7dffd7 Binary files /dev/null and b/themes/default/titlebar/maximized_focus_active.png differ diff --git a/themes/default/titlebar/maximized_focus_inactive.png b/themes/default/titlebar/maximized_focus_inactive.png new file mode 100644 index 0000000..844389f Binary files /dev/null and b/themes/default/titlebar/maximized_focus_inactive.png differ diff --git a/themes/default/titlebar/maximized_normal_active.png b/themes/default/titlebar/maximized_normal_active.png new file mode 100644 index 0000000..a705f81 Binary files /dev/null and b/themes/default/titlebar/maximized_normal_active.png differ diff --git a/themes/default/titlebar/maximized_normal_inactive.png b/themes/default/titlebar/maximized_normal_inactive.png new file mode 100644 index 0000000..4c1ab1f Binary files /dev/null and b/themes/default/titlebar/maximized_normal_inactive.png differ diff --git a/themes/default/titlebar/minimize_focus.png b/themes/default/titlebar/minimize_focus.png new file mode 100644 index 0000000..caaceb2 Binary files /dev/null and b/themes/default/titlebar/minimize_focus.png differ diff --git a/themes/default/titlebar/minimize_normal.png b/themes/default/titlebar/minimize_normal.png new file mode 100644 index 0000000..36621d0 Binary files /dev/null and b/themes/default/titlebar/minimize_normal.png differ diff --git a/themes/default/titlebar/ontop_focus_active.png b/themes/default/titlebar/ontop_focus_active.png new file mode 100644 index 0000000..312c00b Binary files /dev/null and b/themes/default/titlebar/ontop_focus_active.png differ diff --git a/themes/default/titlebar/ontop_focus_inactive.png b/themes/default/titlebar/ontop_focus_inactive.png new file mode 100644 index 0000000..a48e1c5 Binary files /dev/null and b/themes/default/titlebar/ontop_focus_inactive.png differ diff --git a/themes/default/titlebar/ontop_normal_active.png b/themes/default/titlebar/ontop_normal_active.png new file mode 100644 index 0000000..117a203 Binary files /dev/null and b/themes/default/titlebar/ontop_normal_active.png differ diff --git a/themes/default/titlebar/ontop_normal_inactive.png b/themes/default/titlebar/ontop_normal_inactive.png new file mode 100644 index 0000000..d3a10c8 Binary files /dev/null and b/themes/default/titlebar/ontop_normal_inactive.png differ diff --git a/themes/default/titlebar/sticky_focus_active.png b/themes/default/titlebar/sticky_focus_active.png new file mode 100644 index 0000000..814499b Binary files /dev/null and b/themes/default/titlebar/sticky_focus_active.png differ diff --git a/themes/default/titlebar/sticky_focus_inactive.png b/themes/default/titlebar/sticky_focus_inactive.png new file mode 100644 index 0000000..21b000d Binary files /dev/null and b/themes/default/titlebar/sticky_focus_inactive.png differ diff --git a/themes/default/titlebar/sticky_normal_active.png b/themes/default/titlebar/sticky_normal_active.png new file mode 100644 index 0000000..bdb5595 Binary files /dev/null and b/themes/default/titlebar/sticky_normal_active.png differ diff --git a/themes/default/titlebar/sticky_normal_inactive.png b/themes/default/titlebar/sticky_normal_inactive.png new file mode 100644 index 0000000..a96b9b1 Binary files /dev/null and b/themes/default/titlebar/sticky_normal_inactive.png differ diff --git a/widgets/dismal.lua b/widgets/dismal.lua new file mode 100644 index 0000000..1375700 --- /dev/null +++ b/widgets/dismal.lua @@ -0,0 +1,131 @@ +-- Dismal - not your average run prompt +local awmtk2 = require("awmtk2") +local wibox = require("wibox") +local gears = require("gears") +local awful = require("awful") + +local xdg_search = function(name,rlimit) + local results = {} + for k,v in pairs(xdg.apps) do + if v.name:lower():find(name,nil,true) then + table.insert(results,v) + end + if rlimit <= #results then + break + end + end + return results +end + +return function(args) + local style = awmtk2.create_style("dismal",awmtk2.default,args.style) + local templates = awmtk2.create_template_lib("dismal",awmtk2.templates,args.templates) + local t = awmtk2.build_templates(templates,style) + local launchpad = awful.popup(t.popup({ + t.container { + t.textbox({ + text = "", + id = "inputbox" + }), + layout = wibox.layout.fixed.vertical, + }, + t.container({ + id = "resultbox", + layout = wibox.layout.fixed.vertical, + spacing = style.container.spacing + },{ + bg = style.container.bg_highlight, + forced_width = style.button.width or 180 + }), + t.textbox({ + markup = "Enter - Run;\nCtrl+Enter - run in terminal" + }), + spacing = style.container.spacing, + layout = wibox.layout.fixed.vertical + })) + local button_cache = gears.cache(function(name,exec,description,icon) + -- beacause apparently cache doesn't allow nil values + if icon == "" then icon = nil end + local widget = wibox.widget(t.button(t.article({ + icon = icon, + resize = true, + title = name, + description = description, + icon_size = (style.button.height and + (style.button.height-style.container.margins)) or + 30-style.container.margins + }),{ + forced_height = style.button.height or 30 + })) + local exec = exec:gsub("%%%w","") + widget:buttons( + gears.table.join( + awful.button({},1,function() + awful.spawn(exec) + launchpad.visible = false + -- i know it's deprecated, you literally give me no option + awful.keygrabber.stop() + end), + awful.button({"Control"},1,function() + awful.spawn({global.terminal,"-e",exec}) + launchpad.visible = false + awful.keygrabber.stop() + end), + awful.button({},3,function() + awful.spawn(exec) + end), + awful.button({"Control"},3,function() + awful.spawn({global.terminal,"-e",exec}) + end) + ) + ) + return widget + end) + local modifiers = {} + local results_list = launchpad.widget:get_children_by_id("resultbox")[1] + local input_field = launchpad.widget:get_children_by_id("inputbox")[1] + root.keys(gears.table.join( + root.keys(), + awful.key({ global.modkey }, "r", function() + launchpad.visible = true + if launchpad.visible then + awful.prompt.run { + prompt = "Run: ", + textbox = input_field, + hooks = { + { { "Control" }, "Return", function(cmd) + awful.spawn({global.terminal, "-e", cmd}) + end}, + { { }, "Return", function(cmd) + awful.spawn.with_shell(cmd) + end}, + { {}, 'Escape', function(cmd) + input_field.markup = "" + end}, + }, + done_callback = function() + launchpad.visible = false + end, + changed_callback = function(command) + local results = xdg_search(command,args.result_limit or 5) + results_list:reset() + for k,v in pairs(results) do + results_list:insert(1,button_cache:get( + v.name, + v.exec, + v.description or "", + v.icon or "" + )) + end + end, + completion_callback = function(before,after,ncomp) + return awful.completion.shell(before,after,ncomp,global.shell) + end, + history_path = "/tmp/.dismal_history", + history_max = 50 + } + end + end) + )) + return launchpad +end