Browse Source

first draft of AWMTK2 and a test widget (dismal)

master
Yessiest 2 years ago
parent
commit
0eb2c2ac43
  1. 231
      libs/awmtk2.lua
  2. 18
      modules/autostart.lua
  3. 24
      modules/base.lua
  4. 3
      modules/errorlog.lua
  5. 5
      modules/global.lua
  6. 8
      modules/menu_test.lua
  7. 16
      modules/temp_crutches.lua
  8. 100
      modules/xdg_data.lua
  9. 5
      rc.lua
  10. 3
      themes/default/README
  11. BIN
      themes/default/background.png
  12. BIN
      themes/default/background_white.png
  13. BIN
      themes/default/layouts/cornerne.png
  14. BIN
      themes/default/layouts/cornernew.png
  15. BIN
      themes/default/layouts/cornernw.png
  16. BIN
      themes/default/layouts/cornernww.png
  17. BIN
      themes/default/layouts/cornerse.png
  18. BIN
      themes/default/layouts/cornersew.png
  19. BIN
      themes/default/layouts/cornersw.png
  20. BIN
      themes/default/layouts/cornersww.png
  21. BIN
      themes/default/layouts/dwindle.png
  22. BIN
      themes/default/layouts/dwindlew.png
  23. BIN
      themes/default/layouts/fairh.png
  24. BIN
      themes/default/layouts/fairhw.png
  25. BIN
      themes/default/layouts/fairv.png
  26. BIN
      themes/default/layouts/fairvw.png
  27. BIN
      themes/default/layouts/floating.png
  28. BIN
      themes/default/layouts/floatingw.png
  29. BIN
      themes/default/layouts/fullscreen.png
  30. BIN
      themes/default/layouts/fullscreenw.png
  31. BIN
      themes/default/layouts/magnifier.png
  32. BIN
      themes/default/layouts/magnifierw.png
  33. BIN
      themes/default/layouts/max.png
  34. BIN
      themes/default/layouts/maxw.png
  35. BIN
      themes/default/layouts/spiral.png
  36. BIN
      themes/default/layouts/spiralw.png
  37. BIN
      themes/default/layouts/tile.png
  38. BIN
      themes/default/layouts/tilebottom.png
  39. BIN
      themes/default/layouts/tilebottomw.png
  40. BIN
      themes/default/layouts/tileleft.png
  41. BIN
      themes/default/layouts/tileleftw.png
  42. BIN
      themes/default/layouts/tiletop.png
  43. BIN
      themes/default/layouts/tiletopw.png
  44. BIN
      themes/default/layouts/tilew.png
  45. BIN
      themes/default/submenu.png
  46. BIN
      themes/default/taglist/squarefw.png
  47. BIN
      themes/default/taglist/squarew.png
  48. 131
      themes/default/theme.lua
  49. BIN
      themes/default/titlebar/close_focus.png
  50. BIN
      themes/default/titlebar/close_normal.png
  51. BIN
      themes/default/titlebar/floating_focus_active.png
  52. BIN
      themes/default/titlebar/floating_focus_inactive.png
  53. BIN
      themes/default/titlebar/floating_normal_active.png
  54. BIN
      themes/default/titlebar/floating_normal_inactive.png
  55. BIN
      themes/default/titlebar/maximized_focus_active.png
  56. BIN
      themes/default/titlebar/maximized_focus_inactive.png
  57. BIN
      themes/default/titlebar/maximized_normal_active.png
  58. BIN
      themes/default/titlebar/maximized_normal_inactive.png
  59. BIN
      themes/default/titlebar/minimize_focus.png
  60. BIN
      themes/default/titlebar/minimize_normal.png
  61. BIN
      themes/default/titlebar/ontop_focus_active.png
  62. BIN
      themes/default/titlebar/ontop_focus_inactive.png
  63. BIN
      themes/default/titlebar/ontop_normal_active.png
  64. BIN
      themes/default/titlebar/ontop_normal_inactive.png
  65. BIN
      themes/default/titlebar/sticky_focus_active.png
  66. BIN
      themes/default/titlebar/sticky_focus_inactive.png
  67. BIN
      themes/default/titlebar/sticky_normal_active.png
  68. BIN
      themes/default/titlebar/sticky_normal_inactive.png
  69. 131
      widgets/dismal.lua

231
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

18
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
})

24
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)

3
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

5
modules/global.lua

@ -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

8
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)
))

16
modules/temp_crutches.lua

@ -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)

100
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)

5
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")

3
themes/default/README

@ -0,0 +1,3 @@
Background images:
Mikael Eriksson <mikael_eriksson@miffe.org>
Licensed under CC-BY-SA-3.0

BIN
themes/default/background.png

After

Width: 2048  |  Height: 1536  |  Size: 218 KiB

BIN
themes/default/background_white.png

After

Width: 2048  |  Height: 1536  |  Size: 262 KiB

BIN
themes/default/layouts/cornerne.png

After

Width: 64  |  Height: 64  |  Size: 272 B

BIN
themes/default/layouts/cornernew.png

After

Width: 64  |  Height: 64  |  Size: 272 B

BIN
themes/default/layouts/cornernw.png

After

Width: 64  |  Height: 64  |  Size: 263 B

BIN
themes/default/layouts/cornernww.png

After

Width: 64  |  Height: 64  |  Size: 264 B

BIN
themes/default/layouts/cornerse.png

After

Width: 64  |  Height: 64  |  Size: 264 B

BIN
themes/default/layouts/cornersew.png

After

Width: 64  |  Height: 64  |  Size: 264 B

BIN
themes/default/layouts/cornersw.png

After

Width: 64  |  Height: 64  |  Size: 263 B

BIN
themes/default/layouts/cornersww.png

After

Width: 64  |  Height: 64  |  Size: 264 B

BIN
themes/default/layouts/dwindle.png

After

Width: 64  |  Height: 64  |  Size: 320 B

BIN
themes/default/layouts/dwindlew.png

After

Width: 64  |  Height: 64  |  Size: 320 B

BIN
themes/default/layouts/fairh.png

After

Width: 64  |  Height: 64  |  Size: 245 B

BIN
themes/default/layouts/fairhw.png

After

Width: 64  |  Height: 64  |  Size: 245 B

BIN
themes/default/layouts/fairv.png

After

Width: 64  |  Height: 64  |  Size: 246 B

BIN
themes/default/layouts/fairvw.png

After

Width: 64  |  Height: 64  |  Size: 246 B

BIN
themes/default/layouts/floating.png

After

Width: 64  |  Height: 64  |  Size: 282 B

BIN
themes/default/layouts/floatingw.png

After

Width: 64  |  Height: 64  |  Size: 282 B

BIN
themes/default/layouts/fullscreen.png

After

Width: 64  |  Height: 64  |  Size: 866 B

BIN
themes/default/layouts/fullscreenw.png

After

Width: 64  |  Height: 64  |  Size: 865 B

BIN
themes/default/layouts/magnifier.png

After

Width: 64  |  Height: 64  |  Size: 345 B

BIN
themes/default/layouts/magnifierw.png

After

Width: 64  |  Height: 64  |  Size: 345 B

BIN
themes/default/layouts/max.png

After

Width: 64  |  Height: 64  |  Size: 574 B

BIN
themes/default/layouts/maxw.png

After

Width: 64  |  Height: 64  |  Size: 581 B

BIN
themes/default/layouts/spiral.png

After

Width: 64  |  Height: 64  |  Size: 328 B

BIN
themes/default/layouts/spiralw.png

After

Width: 64  |  Height: 64  |  Size: 328 B

BIN
themes/default/layouts/tile.png

After

Width: 64  |  Height: 64  |  Size: 265 B

BIN
themes/default/layouts/tilebottom.png

After

Width: 64  |  Height: 64  |  Size: 264 B

BIN
themes/default/layouts/tilebottomw.png

After

Width: 64  |  Height: 64  |  Size: 264 B

BIN
themes/default/layouts/tileleft.png

After

Width: 64  |  Height: 64  |  Size: 266 B

BIN
themes/default/layouts/tileleftw.png

After

Width: 64  |  Height: 64  |  Size: 266 B

BIN
themes/default/layouts/tiletop.png

After

Width: 56  |  Height: 56  |  Size: 260 B

BIN
themes/default/layouts/tiletopw.png

After

Width: 64  |  Height: 64  |  Size: 265 B

BIN
themes/default/layouts/tilew.png

After

Width: 64  |  Height: 64  |  Size: 265 B

BIN
themes/default/submenu.png

After

Width: 25  |  Height: 25  |  Size: 440 B

BIN
themes/default/taglist/squarefw.png

After

Width: 8  |  Height: 32  |  Size: 187 B

BIN
themes/default/taglist/squarew.png

After

Width: 8  |  Height: 32  |  Size: 193 B

131
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

BIN
themes/default/titlebar/close_focus.png

After

Width: 64  |  Height: 64  |  Size: 966 B

BIN
themes/default/titlebar/close_normal.png

After

Width: 64  |  Height: 64  |  Size: 966 B

BIN
themes/default/titlebar/floating_focus_active.png

After

Width: 64  |  Height: 64  |  Size: 386 B

BIN
themes/default/titlebar/floating_focus_inactive.png

After

Width: 64  |  Height: 64  |  Size: 237 B

BIN
themes/default/titlebar/floating_normal_active.png

After

Width: 64  |  Height: 64  |  Size: 386 B

BIN
themes/default/titlebar/floating_normal_inactive.png

After

Width: 64  |  Height: 64  |  Size: 237 B

BIN
themes/default/titlebar/maximized_focus_active.png

After

Width: 64  |  Height: 64  |  Size: 480 B

BIN
themes/default/titlebar/maximized_focus_inactive.png

After

Width: 64  |  Height: 64  |  Size: 452 B

BIN
themes/default/titlebar/maximized_normal_active.png

After

Width: 64  |  Height: 64  |  Size: 480 B

BIN
themes/default/titlebar/maximized_normal_inactive.png

After

Width: 64  |  Height: 64  |  Size: 452 B

BIN
themes/default/titlebar/minimize_focus.png

After

Width: 64  |  Height: 64  |  Size: 234 B

BIN
themes/default/titlebar/minimize_normal.png

After

Width: 64  |  Height: 64  |  Size: 225 B

BIN
themes/default/titlebar/ontop_focus_active.png

After

Width: 64  |  Height: 64  |  Size: 467 B

BIN
themes/default/titlebar/ontop_focus_inactive.png

After

Width: 64  |  Height: 64  |  Size: 604 B

BIN
themes/default/titlebar/ontop_normal_active.png

After

Width: 64  |  Height: 64  |  Size: 467 B

BIN
themes/default/titlebar/ontop_normal_inactive.png

After

Width: 64  |  Height: 64  |  Size: 604 B

BIN
themes/default/titlebar/sticky_focus_active.png

After

Width: 64  |  Height: 64  |  Size: 654 B

BIN
themes/default/titlebar/sticky_focus_inactive.png

After

Width: 64  |  Height: 64  |  Size: 758 B

BIN
themes/default/titlebar/sticky_normal_active.png

After

Width: 64  |  Height: 64  |  Size: 654 B

BIN
themes/default/titlebar/sticky_normal_inactive.png

After

Width: 64  |  Height: 64  |  Size: 758 B

131
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 = "<b>Enter</b> - Run;\n<b>Ctrl+Enter</b> - 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 = "<b>Run: </b>",
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
Loading…
Cancel
Save