awesome: serenityos titlebar mode, title text drop shadow, cyclefocus stylings
This commit is contained in:
parent
7e3c217495
commit
d241e19413
5 changed files with 90 additions and 49 deletions
|
@ -6,7 +6,10 @@ return {
|
|||
editor = "nano",
|
||||
screenshot = HOME .. "/.local/bin/screenie",
|
||||
modkey = "Mod4",
|
||||
theme = "amora_focus",
|
||||
theme = {
|
||||
scheme = "amora_focus",
|
||||
serenity_titlebar = false,
|
||||
},
|
||||
font = "Terminus 8",
|
||||
gap = 4,
|
||||
border_width = 1,
|
||||
|
|
|
@ -5,7 +5,7 @@ local gears = require("gears")
|
|||
local vars = require("modules/vars")
|
||||
|
||||
local config = vars.config
|
||||
local theme = require("themes/".. config.theme)
|
||||
local theme = require("themes/".. config.theme.scheme)
|
||||
|
||||
require("icons")(vars.env.ICON_DIR, theme)
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
local awful = require("awful")
|
||||
local beautiful = require("beautiful")
|
||||
local gears = require("gears")
|
||||
local lain = require("lain")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local vars = require("modules/vars")
|
||||
local win9x = require("modules/win9x")
|
||||
|
||||
local function make_win9x_button(child)
|
||||
|
@ -23,46 +25,27 @@ local function make_win9x_button(child)
|
|||
}
|
||||
end
|
||||
|
||||
-- serentiy uses 19px tall titlebars :(
|
||||
--[[local _lines = {}
|
||||
for i = 1, 8 do
|
||||
_lines[#_lines + 1] = wibox.widget({
|
||||
widget = wibox.widget.separator,
|
||||
color = beautiful.win9x_dark,
|
||||
orientation = "horizontal",
|
||||
thickness = 1,
|
||||
forced_height = 1,
|
||||
border_width = 0,
|
||||
})
|
||||
_lines[#_lines + 1] = wibox.widget({
|
||||
widget = wibox.widget.separator,
|
||||
color = "#00000000",
|
||||
orientation = "horizontal",
|
||||
thickness = 1,
|
||||
forced_height = 1,
|
||||
border_width = 0,
|
||||
})
|
||||
end
|
||||
_lines[#_lines + 1] = wibox.widget({
|
||||
widget = wibox.widget.separator,
|
||||
color = beautiful.win9x_dark,
|
||||
orientation = "horizontal",
|
||||
thickness = 1,
|
||||
forced_height = 1,
|
||||
border_width = 0,
|
||||
})
|
||||
_lines.layout = wibox.layout.fixed.vertical
|
||||
local function _serenity_lines(cr, width, height, focus)
|
||||
local col = focus and beautiful.__colors.color0 or beautiful.win9x_outer
|
||||
|
||||
local serenity_lines = {
|
||||
_lines,
|
||||
top = 2,
|
||||
left = 2,
|
||||
bottom = 2,
|
||||
right = 0,
|
||||
layout = wibox.container.margin,
|
||||
}--]]
|
||||
local y = 0
|
||||
for i = 1, math.ceil(height / 2) do
|
||||
cr:set_source(gears.color(col))
|
||||
cr:rectangle(0, y, width, 1)
|
||||
cr:fill()
|
||||
|
||||
y = y + 2
|
||||
end
|
||||
end
|
||||
local function _serenity_lines_focus(cr, width, height)
|
||||
_serenity_lines(cr, width, height, true)
|
||||
end
|
||||
local function _serenity_lines_normal(cr, width, height)
|
||||
_serenity_lines(cr, width, height, false)
|
||||
end
|
||||
|
||||
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||
local serenity = vars.config.theme.serenity_titlebar or false
|
||||
client.connect_signal("request::titlebars", function(c)
|
||||
-- buttons for the titlebar
|
||||
local buttons = gears.table.join(
|
||||
|
@ -108,8 +91,34 @@ client.connect_signal("request::titlebars", function(c)
|
|||
layout = wibox.container.background,
|
||||
})
|
||||
|
||||
local lines = wibox.widget({
|
||||
wibox.widget({}),
|
||||
shape = c.focus and _serenity_lines_focus or _serenity_lines_normal,
|
||||
layout = wibox.container.background,
|
||||
})
|
||||
local function update_lines(focus)
|
||||
lines:set_shape(focus and _serenity_lines_focus or _serenity_lines_normal)
|
||||
end
|
||||
|
||||
local shadow_title = awful.titlebar.widget.titlewidget(c)
|
||||
shadow_title:set_markup_silently(lain.util.markup(beautiful.win9x_outer, c.name or awful.titlebar.fallback_name))
|
||||
|
||||
c:connect_signal("focus", function()
|
||||
shadow_title:set_markup_silently(lain.util.markup(beautiful.__colors.color0, c.name or awful.titlebar.fallback_name))
|
||||
update_lines(true)
|
||||
end)
|
||||
c:connect_signal("unfocus", function()
|
||||
shadow_title:set_markup_silently(lain.util.markup(beautiful.win9x_outer, c.name or awful.titlebar.fallback_name))
|
||||
update_lines(false)
|
||||
end)
|
||||
c:connect_signal("property::name", function()
|
||||
local focused = c == client.focus
|
||||
local col = focused and beautiful.__colors.color0 or beautiful.win9x_outer
|
||||
shadow_title:set_markup_silently(lain.util.markup(col, c.name or awful.titlebar.fallback_name))
|
||||
end)
|
||||
|
||||
local titlebar = awful.titlebar(c, {
|
||||
size = 24,
|
||||
size = serenity and 25 or 24,
|
||||
fg_normal = beautiful.win9x_unfocus,
|
||||
fg_focus = beautiful.fg_focus,
|
||||
bg_normal = beautiful.win9x_dark,
|
||||
|
@ -137,20 +146,32 @@ client.connect_signal("request::titlebars", function(c)
|
|||
awful.titlebar.widget.iconwidget(c),
|
||||
left = 2,
|
||||
right = 2,
|
||||
top = 1,
|
||||
top = serenity and 2 or 1,
|
||||
bottom = 1,
|
||||
layout = wibox.container.margin,
|
||||
},
|
||||
{
|
||||
{
|
||||
shadow_title,
|
||||
top = serenity and 1 or 2,
|
||||
left = 1,
|
||||
layout = wibox.container.margin,
|
||||
},
|
||||
awful.titlebar.widget.titlewidget(c),
|
||||
left = 2,
|
||||
layout = wibox.container.margin,
|
||||
layout = wibox.layout.stack,
|
||||
},
|
||||
buttons = buttons,
|
||||
spacing = 2,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
{ -- Middle
|
||||
--serenity_lines,
|
||||
serenity and {
|
||||
lines,
|
||||
top = 2,
|
||||
bottom = 2,
|
||||
left = 2,
|
||||
layout = wibox.container.margin,
|
||||
} or nil,
|
||||
buttons = buttons,
|
||||
layout = wibox.layout.flex.horizontal
|
||||
},
|
||||
|
@ -174,10 +195,10 @@ client.connect_signal("request::titlebars", function(c)
|
|||
left = 2,
|
||||
right = 2,
|
||||
top = 1,
|
||||
bottom = 1,
|
||||
bottom = serenity and 2 or 1,
|
||||
layout = wibox.container.margin,
|
||||
},
|
||||
forced_height = 18,
|
||||
forced_height = serenity and 19 or 18,
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -109,12 +109,12 @@ local function border_top(cr, width, height)
|
|||
cr:fill()
|
||||
|
||||
cr:set_source(gears.color(beautiful.win9x_bright))
|
||||
cr:rectangle(1, 1, width - 2, 1)
|
||||
cr:rectangle(1, 1, width - 3, 1)
|
||||
cr:rectangle(1, 2, 1, height - 2)
|
||||
cr:fill()
|
||||
|
||||
cr:set_source(gears.color(beautiful.win9x_dark))
|
||||
cr:rectangle(width - 2, 2, 1, height)
|
||||
cr:rectangle(width - 2, 1, 1, height)
|
||||
cr:fill()
|
||||
|
||||
cr:set_source(gears.color(beautiful.win9x_outer))
|
||||
|
@ -163,4 +163,4 @@ return {
|
|||
},
|
||||
taskbar = taskbar,
|
||||
divider = divider,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
pcall(require, "luarocks.loader")
|
||||
|
||||
local awful = require("awful")
|
||||
local beautiful = require("beautiful")
|
||||
local cyclefocus = require("cyclefocus")
|
||||
local lain = require("lain")
|
||||
local naughty = require("naughty")
|
||||
local wibox = require("wibox")
|
||||
|
||||
require("awful.autofocus")
|
||||
require("awful.hotkeys_popup.keys")
|
||||
|
@ -84,6 +86,21 @@ cyclefocus.move_mouse_pointer = false
|
|||
cyclefocus.cycle_filters = {
|
||||
function() return true end,
|
||||
}
|
||||
cyclefocus.preset_for_offset = {
|
||||
default = function(preset, args)
|
||||
preset.font = vars.config.font
|
||||
preset.icon_size = 16
|
||||
local title = cyclefocus.get_client_title(args.client, false)
|
||||
local col = args.client.minimized and beautiful.fg_minimize or beautiful.fg_normal
|
||||
preset.text = lain.util.markup(col, title)
|
||||
end,
|
||||
["0"] = function(preset, args)
|
||||
preset.font = vars.config.font
|
||||
preset.icon_size = 16
|
||||
preset.text = lain.util.markup(beautiful.tasklist_fg_focus, cyclefocus.get_client_title(args.client, false))
|
||||
end,
|
||||
}
|
||||
cyclefocus.icon_col_width = 2
|
||||
|
||||
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
||||
screen.connect_signal("property::geometry", utils.set_wallpaper)
|
||||
|
|
Loading…
Reference in a new issue