Compare commits

...

13 Commits

8 changed files with 252 additions and 5 deletions

View File

@ -4,6 +4,10 @@ my slightly overcomplicated awesomewm config
more content coming soon
# the awmtk2 branch
This is a development branch for testing out various new ideas for a rewrite of the original awmtk theme system. This branch is primarily just a way for me to work on things without breaking the original desktop.
# wow look at these screenshots
(may or may not represent the real thing)
@ -36,4 +40,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
```

View File

@ -54,6 +54,7 @@ awful.screen.connect_for_each_screen(function(s)
})
-- Add screen lock
require("widgets.lock")({screen = s, obscure = true})
require("widgets.dismal")({})
require("widgets.unitybar")(s,{
top_widgets = {
require("widgets.polytasklist")({

View File

@ -3,6 +3,8 @@ local gears = require("gears")
local beautiful = require("beautiful")
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
local dockapps = {}
local dockapp_size = 64
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
@ -54,6 +56,38 @@ awful.rules.rules = {
}, properties = { titlebars_enabled = true }
},
-- Rules for dockapps
{ rule_any = { name = {
"wmMand",
"wmwork",
"wmmisc",
"wmmon"
} },
properties = {
skip_taskbar = true,
dockable = true,
titlebars_enabled = false,
sticky = true,
below = true,
placement = awful.placement.top_right+awful.placement.no_offscreen,
callback = function(c)
while (#dockapps > 0) and (not dockapps[#dockapps].valid) do
table.remove(dockapps,#dockapps)
end
if #dockapps > 0 then
awful.placement.next_to(c,{
geometry = dockapps[#dockapps],
preferred_positions = "bottom",
preferred_anchors = "middle"
})
end
c.width = dockapps_size
c.height = dockapps_size
table.insert(dockapps,c)
end
},
},
-- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } },

View File

@ -2,10 +2,11 @@ local awful = require("awful")
local gears = require("gears")
-- {{{ Variable definitions
global = {}
global.debug = true
global.awesome_dir = os.getenv("HOME").."/.config/awesome/"
global.config_dir = os.getenv("HOME").."/.awesome/"
global.themes_dir = os.getenv("HOME").."/.config/awesome/themes/"
global.theme = global.awesome_dir .. "themes/unity/theme.lua"
global.theme = global.awesome_dir .. "themes/unity_simplified/theme.lua"
global.terminal = "xterm"
global.editor = os.getenv("EDITOR") or "vim"
global.editor_cmd = global.terminal .. " -e ".. global.editor

79
libs/awmtk2.lua Normal file
View File

@ -0,0 +1,79 @@
local wibox = require("wibox")
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local awmtk = {}
-- {{{ Utils
awmtk.create_class = function(name,overrides,style,parent_class)
return setmetatable(overrides,{
__index = function(self,k)
-- Per-widget 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]
end
end
})
end
awmtk.create_style = function(style_name,parent,overrides)
local new_style = {}
for name,parent_class in pairs(parent) do
new_style[name] = awmtk.create_class(
name,
(overrides and overrides[name]) or {},
(beautiful[style_name] or {}),
parent_class
)
end
return new_style
end
-- }}}
-- {{{ Default style
-- Default style
awmtk.default = {
base = setmetatable({
-- { Backgrounds
-- custom background color for highlighting elements
bg_highlight = beautiful.bg_highlight or beautiful.bg_focus,
-- }
-- { Borders
-- Borders for popups
shape_border_width = beautiful.shape_border_width or 0,
shape_border_color = beautiful.shape_border_color or beautiful.bg_normal,
-- }
-- { Shapes
inner_margin = beautiful.inner_margin or 5,
rounding = beautiful.rounding or 0,
-- }
},{__index = beautiful})
}
-- Container subclass
awmtk.default.container = awmtk.create_class("container",{
},awmtk.default,awmtk.default.base)
-- Button subclass
awmtk.default.button = awmtk.create_class("button",{
inner_margin = 1
},awmtk.default,awmtk.default.base)
-- Icon subclass
awmtk.default.icon = awmtk.create_class("icon",{
inner_margin = 1
},awmtk.default,awmtk.default.base)
-- }}}
return awmtk

View File

@ -236,6 +236,15 @@ theme = require("themes.icons")(theme)
theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus
)
theme.dismal = {
container = {
bg_normal = "#202020",
rounding = 5
}
}
-- 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 = "Adwaita"

View File

@ -31,11 +31,13 @@ return function(args)
local icon_name = out:match("icon%-name:%s+'(battery%-[^']+)'")
local value = out:match("percentage:%s+(%d+%%)")
icon:get_children_by_id("widget_icon")[1].image =
style[(icon_name or ""):gsub("%-","_")] or
style["battery_missing_symbolic"]
if args.percentage and value then
style[(icon_name or ""):gsub("%-","_")]
if args.percentage and value and icon_name then
icon:get_children_by_id("widget_text")[1].markup = value
end
if not icon_name then
icon:get_children_by_id("widget_text")[1].markup = ""
end
end)
end
}

117
widgets/dismal.lua Normal file
View File

@ -0,0 +1,117 @@
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
return function(args)
local style = awmtk2.create_style("dismal",awmtk2.default,args.style)
local rounded_shape = function(cr,width,height)
return gears.shape.rounded_rect(cr,width,height,style.container.rounding)
end
local separator = wibox.widget({
widget = wibox.widget.separator,
forced_width = 220,
orientation = "horizontal",
forced_height = 10,
thickness = 1,
color = style.container.bg_focus,
border_width = 0
})
local inputbox = wibox.widget {
{
markup = "",
widget = wibox.widget.textbox
},
widget = wibox.container.margin,
margins = style.container.inner_margin,
id = "inputbox",
bg = style.button.bg_focus
}
local launchpad = awful.popup({
widget = {
{
{
inputbox,
{
{
{
{
markup = " ",
widget = wibox.widget.textbox,
id = "result1"
},
separator,
{
markup = " ",
widget = wibox.widget.textbox,
id = "result2"
},
separator,
{
markup = " ",
widget = wibox.widget.textbox,
id = "result3"
},
separator,
{
markup = " ",
widget = wibox.widget.textbox,
id = "result4"
},
layout = wibox.layout.fixed.vertical
},
widget = wibox.container.margin,
margins = style.container.inner_margin
},
widget = wibox.container.background,
bg = style.container.bg_normal,
shape_border_width = 1,
shape_border_color = style.container.bg_focus,
shape = rounded_shape
},
{
markup = "<b>Enter</b> - run; <b>Ctrl+Enter</b> - run in terminal",
widget = wibox.widget.textbox
},
layout = wibox.layout.fixed.vertical
},
widget = wibox.container.margin,
margins = style.container.inner_margin
},
bg = style.container.bg_normal,
widget = wibox.container.background
},
placement = awful.placement.no_overlap,
shape = rounded_shape,
visible = false,
ontop = true
})
local modifiers = {}
root.keys(gears.table.join(
root.keys(),
awful.key({ global.modkey }, "0", function()
launchpad.visible = true
if launchpad.visible then
awful.prompt.run {
prompt = "<b>Run: </b>",
textbox = inputbox.children[1],
hooks = {
{ { "Control" }, "Return", function(cmd)
awful.spawn({global.terminal, "-e", cmd})
end},
{ { }, "Return", function(cmd)
awful.spawn(cmd)
end},
{ {}, 'Escape', function(cmd)
textbox.markup = ""
end}
},
done_callback = function()
launchpad.visible = false
end
}
end
end)
))
return launchpad
end