added powermenu

This commit is contained in:
Rene Kievits
2021-11-06 04:57:15 +01:00
parent 7843046d5b
commit b73cfe028a
35 changed files with 1060 additions and 251 deletions

View File

@@ -42,9 +42,11 @@ function _M.get(globalkeys)
"#" .. i + 9,
function()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
if client.focus then
local tag = screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
end
end
end,
{description = "Move focused client on tag " .. i, group = "Tag"}

View File

@@ -25,8 +25,8 @@ function _M.get()
{ description = "Close window", group = "Client" }
),
awful.key(
{ modkey, "Control" },
"Space",
{ modkey },
"space",
awful.client.floating.toggle,
{ description = "Toggle floating window", group = "Client" }
),

View File

@@ -170,14 +170,6 @@ function _M.get()
end,
{description = "Decrease the number of columns", group = "Layout"}
),
awful.key(
{ modkey },
"space",
function ()
awful.layout.inc( 1)
end,
{description = "Select next", group = "Layout"}
),
awful.key(
{ modkey, "Shift" },
"space",
@@ -333,7 +325,7 @@ function _M.get()
{ modkey },
"F5",
function (c)
awful.spawn("xbacklight -inc 10")
awful.spawn("xbacklight -inc 10%+")
awesome.emit_signal("module::brightness_osd:show", true)
awesome.emit_signal("module::brightness_slider:update")
awesome.emit_signal("widget::brightness_osd:rerun")
@@ -343,10 +335,10 @@ function _M.get()
{ modkey },
"F4",
function (c)
awful.spawn("xbacklight -dec 10")
awful.spawn("xbacklight -dec 10%-")
awesome.emit_signal("widget::brightness_osd:rerun")
awesome.emit_signal("module::brightness_osd:show", true)
awesome.emit_signal("module::brightness_slider:update")
awesome.emit_signal("widget::brightness_osd:rerun")
end
),
awful.key(
@@ -356,6 +348,13 @@ function _M.get()
local t = awful.screen.focused().selected_tag
t:delete()
end
),
awful.key(
{ },
"Escape",
function ()
awesome.emit_signal("module::powermenu:hide")
end
)
)

View File

@@ -49,7 +49,7 @@ awful.screen.connect_for_each_screen(
end,
layout = wibox.layout.flex.horizontal
}
-- Bar for all the widgets
s.top_right = awful.popup {
widget = {
@@ -71,26 +71,39 @@ awful.screen.connect_for_each_screen(
s.calendar_osd_container = awful.popup{
widget = {},
ontop = true,
bg = "#00000000",
border_width = dpi(1),
border_color = "#454545",
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, dpi(500), dpi(300))
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
border_width = dpi(0),
border_color = colors.color["Grey800"],
placement = function (c)
awful.placement.top_left(c, {margins = dpi(10)})
awful.placement.top_right(c, {
margins = {
right = dpi(100),
top = dpi(60)
}
})
end,
visible = false
}
local hide_osd = gears.timer{
timeout = 0.25,
autostart = true,
callback = function ()
s.calendar_osd_container.visible = false
end
}
-- OSD Container
s.osd_container = awful.popup{
s.volume_container = awful.popup{
widget = {
margins = dpi(10),
widget = wibox.container.margin
},
ontop = true,
bg = "#00000000",
border_width = dpi(1),
border_width = dpi(0),
border_color = "#454545",
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
@@ -98,6 +111,53 @@ awful.screen.connect_for_each_screen(
placement = function (c)
awful.placement.bottom_right(c, {margins = dpi(10)})
end,
visible = false,
}
local hide_volume_osd = gears.timer{
timeout = 1,
autostart = true,
callback = function ()
s.volume_container.visible = false
end
}
s.brightness_container = awful.popup{
widget = {
margins = dpi(10),
widget = wibox.container.margin
},
ontop = true,
bg = "#00000000",
border_width = dpi(0),
border_color = "#454545",
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
placement = function (c)
awful.placement.bottom_right(c, {margins = dpi(10)})
end,
visible = false
}
local hide_brightness_osd = gears.timer{
timeout = 1,
autostart = true,
callback = function ()
s.brightness_container.visible = false
end
}
s.powermenu_container = wibox{
screen = s,
type = "splash",
visible = false,
ontop = true,
bg = "#21212188",
height = s.geometry.height,
width = s.geometry.width,
x = s.geometry.x,
y = s.geometry.y
}
-- All the modules and widgets
@@ -109,11 +169,11 @@ awful.screen.connect_for_each_screen(
s.date = require("theme.crylia.widgets.date")()
s.clock = require("theme.crylia.widgets.clock")()
s.bluetooth = require("theme.crylia.widgets.bluetooth")()
s.calendar_osd = require("theme.crylia.modules.calendar_osd")
--s.addtag = require("theme.crylia.widgets.addtag")()
s.calendar_osd = require("theme.crylia.modules.calendar_osd")()
s.layoutlist = require("theme.crylia.widgets.layout_list")()
s.powerbutton = require("theme.crylia.widgets.power")()
s.kblayout = require("theme.crylia.widgets.kblayout")()
s.powermenu = require("theme.crylia.modules.powermenu")()
s.top_left:setup {
nil,
@@ -186,6 +246,14 @@ awful.screen.connect_for_each_screen(
bottom = dpi(6),
widget = wibox.container.margin
},
{
s.kblayout,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
s.date,
left = dpi(3),
@@ -201,7 +269,8 @@ awful.screen.connect_for_each_screen(
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},{
},
{
s.powerbutton,
left = dpi(3),
right = dpi(6),
@@ -215,31 +284,166 @@ awful.screen.connect_for_each_screen(
layout = wibox.layout.align.horizontal
}
s.osd_container:setup{
{
s.volume_osd,
layout = wibox.layout.fixed.horizontal
},
spacing = dpi(10),
{
s.brightness_osd,
layout = wibox.layout.fixed.horizontal
},
layout = wibox.layout.align.vertical
s.volume_container:setup{
s.volume_osd,
layout = wibox.layout.fixed.horizontal
}
s.brightness_container:setup{
s.brightness_osd,
layout = wibox.layout.fixed.horizontal
}
s.calendar_osd_container:setup{
s.calendar_osd,
visible = false,
layout = wibox.layout.align.horizontal
}
s.powermenu_container:setup{
s.powermenu,
layout = wibox.layout.flex.horizontal
}
s.powermenu_container:buttons(
gears.table.join(
awful.button(
{},
3,
function ()
awesome.emit_signal("module::powermenu:hide")
end
)
)
)
-- Signals
awesome.connect_signal(
"module::powermenu:show",
function()
for s in screen do
s.powermenu_container.visible = false
end
awful.screen.focused().powermenu_container.visible = true
end
)
awesome.connect_signal(
"module::powermenu:hide",
function()
for s in screen do
s.powermenu_container.visible = false
end
end
)
awesome.connect_signal(
"hide_centerbar",
function (hide)
s.top_center.visible = hide
end
)
awesome.connect_signal(
"widget::brightness_osd:rerun",
function ()
if hide_brightness_osd.started then
hide_brightness_osd:again()
else
hide_brightness_osd:start()
end
end
)
awesome.connect_signal(
"module::brightness_osd:show",
function ()
s.brightness_container.visible = true
end
)
s.brightness_container:connect_signal(
"mouse::enter",
function ()
s.brightness_container.visible = true
hide_brightness_osd:stop()
end
)
s.brightness_container:connect_signal(
"mouse::leave",
function ()
s.brightness_container.visible = true
hide_brightness_osd:again()
end
)
awesome.connect_signal(
"module::volume_osd:show",
function ()
s.volume_container.visible = true
end
)
s.volume_container:connect_signal(
"mouse::enter",
function ()
s.volume_container.visible = true
hide_volume_osd:stop()
end
)
s.volume_container:connect_signal(
"mouse::leave",
function ()
s.volume_container.visible = true
hide_volume_osd:again()
end
)
awesome.connect_signal(
"widget::volume_osd:rerun",
function ()
if hide_volume_osd.started then
hide_volume_osd:again()
else
hide_volume_osd:start()
end
end
)
s.calendar_osd_container:connect_signal(
"mouse::enter",
function ()
s.calendar_osd_container.visible = true
hide_osd:stop()
end
)
s.calendar_osd_container:connect_signal(
"mouse::leave",
function ()
s.calendar_osd_container.visible = false
hide_osd:stop()
end
)
awesome.connect_signal(
"widget::calendar_osd:stop",
function ()
s.calendar_osd_container.visible = true
hide_osd:stop()
end
)
awesome.connect_signal(
"widget::calendar_osd:rerun",
function ()
if hide_osd.started then
hide_osd:again()
else
hide_osd:start()
end
end
)
end
)

View File

@@ -19,7 +19,7 @@ M.session = {
}
M.applications = {
{ "Brave", "brave-browser" },
{ "Firefox", "firefox" },
{ "VS Code", "code" },
{ "Blender", "blender" },
{ "Steam", "steam" },

View File

@@ -37,13 +37,14 @@ function _M.get(clientkeys, clientbuttons)
"pop-up"
}
},
properties = { floating = true }
properties = { floating = true, titlebars_enabled = true }
},
{
id = "titlebar",
rule_any = {
type = { "normal", "dialog" }
type = { "normal", "dialog", "modal", "utility" }
},
properties = { titlebars_enabled = false }
properties = { titlebars_enabled = true }
}
}
return rules

View File

@@ -1,7 +1,6 @@
-- Awesome Libs
local awful = require("awful")
local beautiful = require("beautiful")
local naughty = require("naughty")
client.connect_signal(
@@ -43,6 +42,7 @@ client.connect_signal(
end
)
-- Sloppy focus
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false})
@@ -51,7 +51,7 @@ end)
-- Workaround for focused border color, why in the love of god doesnt it work with
-- beautiful.border_focus
client.connect_signal("focus", function (c)
c.border_color = "#bdbdbd"
c.border_color = "#616161"
end)
client.connect_signal("unfocus", function (c)

View File

@@ -87,6 +87,9 @@ awful.rules.rules = main.rules(
-- Signals
require("main.signals")
-- Titlebar
require("theme.crylia.modules.titlebar")
-- Autostart programs
--awful.spawn.with_shell("~/.screenlayout/single_screen.sh")
awful.spawn.with_shell("picom --experimental-backends")

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none"/><path d="M20 7v10H4V7h16m0-2H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-3 0h2v2H5zm0-3h2v2H5zm3 6h8v2H8zm6-3h2v2h-2zm0-3h2v2h-2zm3 3h2v2h-2zm0-3h2v2h-2z"/></svg>

After

Width:  |  Height:  |  Size: 400 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z" /></svg>

After

Width:  |  Height:  |  Size: 549 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z" /></svg>

After

Width:  |  Height:  |  Size: 530 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M16,17V14H9V10H16V7L21,12L16,17M14,2A2,2 0 0,1 16,4V6H14V4H5V20H14V18H16V20A2,2 0 0,1 14,22H5A2,2 0 0,1 3,20V4A2,2 0 0,1 5,2H14Z" /></svg>

After

Width:  |  Height:  |  Size: 423 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z" /></svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M16.56,5.44L15.11,6.89C16.84,7.94 18,9.83 18,12A6,6 0 0,1 12,18A6,6 0 0,1 6,12C6,9.83 7.16,7.94 8.88,6.88L7.44,5.44C5.36,6.88 4,9.28 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,9.28 18.64,6.88 16.56,5.44M13,3H11V13H13" /></svg>

After

Width:  |  Height:  |  Size: 508 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M18.73,18C15.4,21.69 9.71,22 6,18.64C2.33,15.31 2.04,9.62 5.37,5.93C6.9,4.25 9,3.2 11.27,3C7.96,6.7 8.27,12.39 12,15.71C13.63,17.19 15.78,18 18,18C18.25,18 18.5,18 18.73,18Z" /></svg>

After

Width:  |  Height:  |  Size: 468 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>

After

Width:  |  Height:  |  Size: 258 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M3 3h18v2H3z"/></svg>

After

Width:  |  Height:  |  Size: 171 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M6 19h12v2H6z"/></svg>

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 KiB

View File

@@ -9,10 +9,12 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local naughty = require("naughty")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/brightness/"
--TODO: fix backlight keys and osd not working correctly
-- TODO: fix backlight keys and osd not working correctly
return function ()
local brightness_osd_widget = wibox.widget{
@@ -28,7 +30,7 @@ return function ()
},
nil,
{
ic = "value",
id = "value",
text = "0%",
align = "center",
valign = "center",
@@ -81,10 +83,10 @@ return function ()
right = dpi(24),
widget = wibox.container.margin
},
bg = color.color["Grey900"] .. '44',
bg = color.color["Grey900"],
widget = wibox.container.background,
ontop = true,
visible = false,
visible = true,
type = "notification",
forced_height = dpi(100),
forced_width = dpi(300),
@@ -95,9 +97,8 @@ return function ()
"property::value",
function ()
local brightness_value = brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:get_value()
-- Performance is horrible, or it overrides and executes at the same time as the keybindings
awful.spawn("xbacklight -set " .. brightness_value .. "%", false)
--awful.spawn("xbacklight -set " .. brightness_value, false)
brightness_osd_widget.container.osd_layout.label_value_layout.value:set_text(brightness_value .. "%")
awesome.emit_signal(
@@ -134,44 +135,6 @@ return function ()
)
end
local hide_osd = gears.timer{
timeout = 5,
autostart = true,
callback = function ()
brightness_osd_widget.visible = false
end
}
-- Signals
brightness_osd_widget:connect_signal(
"mouse::enter",
function ()
brightness_osd_widget.visible = true
hide_osd:stop()
end
)
brightness_osd_widget:connect_signal(
"mouse::leave",
function ()
brightness_osd_widget.visible = true
hide_osd:again()
end
)
awesome.connect_signal(
"widget::brightness_osd:rerun",
function ()
if hide_osd.started then
hide_osd:again()
else
hide_osd:start()
end
end
)
update_slider()
awesome.connect_signal(
"module::brightness_slider:update",
function ()
@@ -186,13 +149,6 @@ return function ()
end
)
awesome.connect_signal(
"module::brightness_osd:show",
function ()
brightness_osd_widget.visible = true
end
)
update_slider()
return brightness_osd_widget
end

View File

@@ -1,78 +1,122 @@
---------------------------------------
-- This is the calendar_osd module --
---------------------------------------
-- Awesome Libs
local wibox = require("wibox")
local awful = require("awful")
local gears = require("gears")
local naughty = require("naughty")
local dpi = require("beautiful").xresources.apply_dpi
local color = require("theme.crylia.colors")
local styles = {}
return function ()
local styles = {}
styles.month = {
padding = 15,
bg_color = color.color["Grey900"],
border_width = 1,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.normal = {
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.focus = {
fg_color = color.color["Grey900"],
bg_color = color.color["TealA200"],
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.header = {
fg_color = color.color["Teal200"],
markup = function(t) return '<b>' .. t .. '</b>' end,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.weekday = {
padding = 8,
fg_color = color.color["Teal200"],
markup = function(t) return '<b>' .. t .. '</b>' end,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
local function decorate_cell(widget, flag, date)
if flag=='monthheader' and not styles.monthheader then
flag = 'header'
end
local props = styles[flag] or {}
if props.markup and widget.get_text and widget.set_markup then
widget:set_markup(props.markup(widget:get_text()))
end
-- Change bg color for weekends
local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)}
local weekday = tonumber(os.date('%w', os.time(d)))
local default_bg = (weekday==0 or weekday==6) and color.color["Grey900"] or color.color["Grey800"]
local ret = wibox.widget {
{
widget,
margins = 10,
widget = wibox.container.margin
},
shape = props.shape,
shape_border_color = color.color["Grey800"],
shape_border_width = 1,
fg = props.fg_color or '#999999',
bg = props.bg_color or default_bg,
widget = wibox.container.background
styles.month = {
padding = 15,
bg_color = color.color["Grey900"],
border_width = 1,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.normal = {
fg_color = color.color["Grey900"],
font = "JetBrainsMonoExtraBold NF",
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.focus = {
fg_color = color.color["Grey900"],
bg_color = color.color["Purple200"],
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.header = {
fg_color = color.color["Grey900"],
bg_color = color.color["Teal200"],
markup = function(t) return '<b>' .. t .. '</b>' end,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.weekday = {
padding = 8,
fg_color = color.color["Grey900"],
bg_color = color.color["Teal200"],
markup = function(t) return '<b>' .. t .. '</b>' end,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
local function decorate_cell(widget, flag, date)
if flag=='monthheader' and not styles.monthheader then
flag = 'header'
end
local props = styles[flag] or {}
if props.markup and widget.get_text and widget.set_markup then
widget:set_markup(props.markup(widget:get_text()))
end
-- Change bg color for weekends
local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)}
local weekday = tonumber(os.date('%w', os.time(d)))
local default_bg = (weekday == 0 or weekday == 6) and color.color["Red200"] or color.color["White"]
local ret = wibox.widget {
{
widget,
left = dpi(8),
right = dpi(8),
top = dpi(4),
bottom = dpi(4),
widget = wibox.container.margin
},
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
fg = props.fg_color or '#999999',
bg = props.bg_color or default_bg,
widget = wibox.container.background
}
return ret
end
local calendar = wibox.widget {
date = os.date('*t'),
fn_embed = decorate_cell,
widget = wibox.widget.calendar.month,
font = "JetBrainsMonoExtraBold NF",
spacing = dpi(10)
}
return ret
end
local cal = wibox.widget {
date = os.date('*t'),
fn_embed = decorate_cell,
widget = wibox.widget.calendar.month
}
return cal
local calendar_osd_widget = wibox.widget{
{
widget = wibox.widget.textbox,
fg = "#ffffff",
align = "center",
valign = "center",
font = "DS-Digital, Bold Italic 50",
id = "digital_clock"
},
{
widget = calendar
},
visible = true,
layout = wibox.layout.fixed.vertical
}
local set_clock = function ()
calendar_osd_widget.digital_clock:set_text(os.date("%H:%M"))
end
local calendar_clock_update = gears.timer {
timeout = 5,
autostart = true,
call_now = true,
callback = function ()
set_clock()
end
}
return calendar_osd_widget
end

View File

@@ -0,0 +1,243 @@
--------------------------------
-- This is the network widget --
--------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("theme.crylia.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local naughty = require("naughty")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/powermenu/"
return function ()
local profile_picture = wibox.widget {
image = icondir .. "defaultpfp.svg",
resize = true,
forced_height = dpi(200),
clip_shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 30)
end,
widget = wibox.widget.imagebox
}
local profile_name = wibox.widget {
align = 'center',
valign = 'center',
text = " ",
font = "JetBrains Mono Bold 30",
widget = wibox.widget.textbox
}
local update_profile_picture = function ()
awful.spawn.easy_async_with_shell(
[=[
iconPath="/var/lib/AccountsService/icons/${USER}"
userIconPath="${HOME}/.config/awesome/theme/crylia/assets/userpfp/"
if [[ -f "${userIconPath}" ]];
then
if [[ -f "${iconPath}" ]];
then
if ! cmp --silent "${userIconPath}.png" "${iconPath}";
then
cp "${iconPath}" "${userIconPath}${USER}.png"
fi
printf "${userIconPath}.png"
else
printf "${userIconPath}.png"
fi
exit;
else
if [[ -f "${iconPath}" ]];
then
cp "${iconPath}" "${userIconPath}${USER}.png"
printf "${userIconPath}${USER}.png"
exit;
fi
fi
]=],
function (stdout)
if stdout then
profile_picture:set_image(stdout:gsub("\n", ""))
else
profile_picture:set_image(icondir .. "defaultpfp.svg")
end
end
)
end
update_profile_picture()
local namestyle = "userhost"
local update_user_name = function()
awful.spawn.easy_async_with_shell(
[=[
fullname="$(getent passwd `whoami` | cut -d ':' -f 5)"
user="$(whoami)"
host="$(hostname)"
if [[ "]=] .. namestyle .. [=[" == "userhost" ]];
then
printf "$user@$host"
elif [[ "]=] .. namestyle .. [=[" == "fullname" ]];
then
printf "$fullname"
else
printf "Rick Astley"
fi
]=],
function(stdout)
if stdout:gsub("\n", "") == "Rick Astley" then
profile_picture:set_image(awful.util.getdir("config") .. "theme/crylia/assets/userpfp/" .. "rickastley.jpg")
end
profile_name:set_text(stdout)
end
)
end
update_user_name()
local button = function(name, icon, bg_color, callback)
local item = wibox.widget{
{
{
{
{
{
--image = gears.color.recolor_image(icon, color.color["Grey900"]),
image = icon,
resize = true,
forced_height = dpi(30),
widget = wibox.widget.imagebox
},
margins = dpi(0),
widget = wibox.container.margin
},
{
{
text = name,
font = "JetBrains Mono Bold 30",
widget = wibox.widget.textbox
},
margins = dpi(0),
widget = wibox.container.margin
},
widget = wibox.layout.fixed.horizontal
},
margins = dpi(10),
widget = wibox.container.margin
},
fg = color.color["Grey900"],
bg = bg_color,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
widget = wibox.container.background
},
spacing = dpi(0),
layout = wibox.layout.align.vertical
}
item:connect_signal(
"button::release",
function()
callback()
end
)
return item
end
local suspend_command = function()
awful.spawn.easy_async_with_shell("dm-tool lock & systemctl suspend")
awesome.emit_signal("module::powermenu:hide")
end
local logout_command = function()
awesome.quit()
end
local lock_command = function()
awful.spawn.easy_async_with_shell("dm-tool lock")
awesome.emit_signal("module::powermenu:hide")
end
local shutdown_command = function()
awful.spawn.easy_async_with_shell("shutdown now")
awesome.emit_signal("module::powermenu:hide")
end
local reboot_command = function()
awful.spawn.easy_async_with_shell("reboot")
awesome.emit_signal("module::powermenu:hide")
end
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color.color["Blue200"], shutdown_command)
local reboot_button = button("Reboot", icondir .. "reboot.svg", color.color["Red200"], reboot_command)
local suspend_button = button("Suspend", icondir .. "suspend.svg", color.color["Yellow200"], suspend_command)
local logout_button = button("Logout", icondir .. "logout.svg", color.color["Green200"], logout_command)
local lock_button = button("Lock", icondir .. "lock.svg", color.color["Orange200"], lock_command)
local powermenu = wibox.widget {
layout = wibox.layout.align.vertical,
expand = "none",
nil,
{
{
nil,
{
{
nil,
{
nil,
{
profile_picture,
margins = dpi(0),
widget = wibox.container.margin
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
},
nil,
layout = wibox.layout.align.vertical,
expand = "none"
},
spacing = dpi(50),
{
profile_name,
margins = dpi(0),
widget = wibox.container.margin
},
layout = wibox.layout.fixed.vertical
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
},
{
nil,
{
{
shutdown_button,
reboot_button,
logout_button,
lock_button,
suspend_button,
spacing = dpi(30),
layout = wibox.layout.fixed.horizontal
},
margins = dpi(0),
widget = wibox.container.margin
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
},
layout = wibox.layout.align.vertical
},
nil
}
return powermenu
end

View File

@@ -0,0 +1,180 @@
-----------------------------------
-- This is the titlebar module --
-----------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("theme.crylia.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
awful.titlebar.enable_tooltip = true
awful.titlebar.fallback_name = 'Client'
local double_click_event_handler = function(double_click_event)
if double_click_timer then
double_click_timer:stop()
double_click_timer = nil
double_click_event()
return
end
double_click_timer = gears.timer.start_new(
0.20,
function()
double_click_timer = nil
return false
end
)
end
local create_click_events = function (c)
local buttons = gears.table.join(
awful.button(
{},
1,
function ()
double_click_event_handler(function ()
if c.floating then
c.float = false
return
end
c.maximized = not c.maximized
c:raise()
end)
c:activate { context = 'titlebar', action = 'mouse_move' }
end
),
awful.button(
{},
3,
function ()
c:activate { context = 'titlebar', action = 'mouse_resize' }
end
)
)
return buttons
end
local create_titlebar = function (c, bg, size)
awful.titlebar(c, { position = "left", bg = bg, size = size }) : setup {
{
{
{
awful.titlebar.widget.closebutton(c),
widget = wibox.container.background,
bg = color.color["Red200"],
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
end
},
{
awful.titlebar.widget.maximizedbutton(c),
widget = wibox.container.background,
bg = color.color["Yellow200"],
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
end
},
{
awful.titlebar.widget.minimizebutton(c),
widget = wibox.container.background,
bg = color.color["Green200"],
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
end
},
spacing = dpi(10),
layout = wibox.layout.fixed.vertical
},
margins = dpi(8),
widget = wibox.container.margin
},
{
buttons = create_click_events(c),
layout = wibox.layout.flex.vertical
},
nil,
layout = wibox.layout.align.vertical
}
end
local create_titlebar_dialog = function(c, bg, size)
awful.titlebar(c, {position = "left", bg = bg, size = size}) : setup {
{
{
{
awful.titlebar.widget.closebutton(c),
widget = wibox.container.background,
bg = color.color["Red200"],
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
end
},
{
awful.titlebar.widget.minimizebutton(c),
widget = wibox.container.background,
bg = color.color["Green200"],
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
end
},
spacing = dpi(7),
layout = wibox.layout.fixed.vertical
},
margins = dpi(8),
widget = wibox.container.margin
},
{
buttons = create_click_events(c),
layout = wibox.layout.flex.vertical
},
nil,
layout = wibox.layout.align.vertical
}
end
local draw_titlebar = function (c)
if c.type == 'normal' then
if c.class == 'Firefox' then
create_titlebar(c, '#121212AA', 35)
elseif c.name == "Steam" then
create_titlebar(c, '#121212AA', 0)
elseif c.name == "Settings" then
create_titlebar(c, '#121212AA', 0)
elseif c.class == "gcr-prompter" or c.class == "Gcr-prompter" then
create_titlebar(c, '#121212AA', 0)
else
create_titlebar(c, '#121212AA', 35)
end
elseif c.type == 'dialog' then
create_titlebar_dialog(c, '#121212AA', 35)
elseif c.type == 'modal' then
create_titlebar(c, '#121212AA', 35)
end
end
client.connect_signal(
"request::titlebars",
function (c)
draw_titlebar(c)
if not c.floating then
awful.titlebar.hide(c, 'left')
end
end
)
client.connect_signal(
'property::floating',
function (c)
if c.floating then
if c.class == "Steam" then
awful.titlebar.hide(c, 'left')
else
awful.titlebar.show(c, 'left')
end
else
awful.titlebar.hide(c, 'left')
end
end
)

View File

@@ -81,10 +81,10 @@ return function ()
right = dpi(24),
widget = wibox.container.margin
},
bg = color.color["Grey900"] .. '44',
bg = color.color["Grey900"],
widget = wibox.container.background,
ontop = true,
visible = false,
visible = true,
type = "notification",
forced_height = dpi(100),
forced_width = dpi(300),
@@ -147,14 +147,6 @@ return function ()
)
end
local hide_osd = gears.timer{
timeout = 5,
autostart = true,
callback = function ()
volume_osd_widget.visible = false
end
}
-- Signals
awesome.connect_signal(
"module::slider:update",
@@ -170,40 +162,6 @@ return function ()
end
)
awesome.connect_signal(
"module::volume_osd:show",
function ()
volume_osd_widget.visible = true
end
)
volume_osd_widget:connect_signal(
"mouse::enter",
function ()
volume_osd_widget.visible = true
hide_osd:stop()
end
)
volume_osd_widget:connect_signal(
"mouse::leave",
function ()
volume_osd_widget.visible = true
hide_osd:again()
end
)
awesome.connect_signal(
"widget::volume_osd:rerun",
function ()
if hide_osd.started then
hide_osd:again()
else
hide_osd:start()
end
end
)
update_slider()
return volume_osd_widget
end

View File

@@ -7,8 +7,10 @@
local colors = require("theme.crylia.colors")
local dpi = require("beautiful.xresources").apply_dpi
local gears = require("gears")
local awful = require("awful")
-- Note that most variables wont change anything since almost everything you see is individually themed
-- Icon directory path
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/titlebar/"
Theme.font = "JetBrains Mono, Bold"
@@ -23,9 +25,9 @@ Theme.fg_focus = colors.color["White"]
Theme.fg_urgent = colors.color["White"]
Theme.fg_minimize = colors.color["White"]
Theme.useless_gap = dpi(5) -- Change this if you dont like window gaps
Theme.border_width = dpi(1) -- Change this if you dont like borders
Theme.border_normal = colors.color["Grey600"]
Theme.useless_gap = dpi(5) -- Change this to 0 if you dont like window gaps
Theme.border_width = dpi(0) -- Change this to 0 if you dont like borders
Theme.border_normal = colors.color["Grey800"]
--Theme.border_focus = colors.color["Red"] -- Doesnt work, no idea why; workaround is in signals.lua
Theme.border_marked = colors.color["Red400"]
@@ -35,8 +37,8 @@ Theme.menu_width = dpi(200)
Theme.menu_bg_normal = colors.color["Grey900"]
Theme.menu_bg_focus = colors.color["Grey800"]
Theme.menu_fg_focus = colors.color["White"]
Theme.menu_border_color = colors.color["Grey600"]
Theme.menu_border_width = dpi(1)
Theme.menu_border_color = colors.color["Grey800"]
Theme.menu_border_width = dpi(0)
Theme.taglist_fg_focus = colors.color["Grey900"]
Theme.taglist_bg_focus = colors.color["White"]
@@ -44,19 +46,23 @@ Theme.taglist_bg_focus = colors.color["White"]
Theme.tooltip_border_color = colors.color["Grey700"]
Theme.tooltip_bg = colors.color["Grey800"]
Theme.tooltip_fg = colors.color["White"]
Theme.tooltip_border_width = dpi(1)
Theme.tooltip_border_width = dpi(0)
Theme.tooltip_shape = function (cr, width, heigth)
gears.shape.rounded_rect(cr, width, heigth, 10)
end
Theme.notification_bg = colors.color["Grey900"]
Theme.notification_fg = colors.color["White"]
Theme.notification_border_width = dpi(1)
Theme.notification_border_color = colors.color["Grey800"]
Theme.notification_border_width = dpi(0)
Theme.notification_border_color = colors.color["Grey900"]
Theme.notification_shape = function (cr, width, heigth)
gears.shape.rounded_rect(cr, width, heigth, 10)
end
Theme.notification_margin = dpi(10)
Theme.notification_max_width = dpi(400)
Theme.notification_max_height = dpi(1000)
Theme.notification_icon_size = dpi(40)
Theme.notification_icon_size = dpi(40)
Theme.titlebar_close_button_normal = icondir .. "close.svg"
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"

View File

@@ -115,6 +115,7 @@ return function ()
audio_widget:connect_signal(
"button::press",
function ()
awesome.emit_signal("module::volume_osd:show", true)
audio_widget.bg = color.color["Yellow200"] .. "bb"
end
)
@@ -137,13 +138,6 @@ return function ()
end
)
audio_widget:connect_signal(
"button::press",
function ()
awesome.emit_signal("module::volume_osd:show", true)
end
)
awesome.connect_signal(
"widget::volume",
function (c)

View File

@@ -75,6 +75,7 @@ return function ()
date_widget:connect_signal(
"mouse::enter",
function ()
awesome.emit_signal("widget::calendar_osd:stop", true)
old_bg = date_widget.bg
date_widget.bg = color.color["Teal200"] .. "dd"
local w = mouse.current_wibox
@@ -102,6 +103,7 @@ return function ()
date_widget:connect_signal(
"mouse::leave",
function ()
awesome.emit_signal("widget::calendar_osd:rerun", true)
date_widget.bg = old_bg
if old_wibox then
old_wibox.cursor = old_cursor

View File

@@ -0,0 +1,121 @@
------------------------------
-- This is the audio widget --
------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("theme.crylia.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/kblayout/"
return function ()
local kblayout_widget = wibox.widget{
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
resize = false,
image = gears.color.recolor_image(icondir .. "keyboard.svg", color.color["Grey900"])
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(6),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "kblayout_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(5),
right = dpi(10),
widget = wibox.container.margin
},
bg = color.color["Green200"],
fg = color.color["Grey900"],
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
}
local layout = "";
local get_kblayout = function ()
awful.spawn.easy_async_with_shell(
[[ setxkbmap -query | grep layout | awk '{print $2}' ]],
function (stdout)
layout = stdout
kblayout_widget.container.kblayout_layout.label.text = stdout
return stdout
end
)
return layout
end
local set_kblayout = function (kblayout)
kblayout = "de"
if get_kblayout():gsub("\n", "") == "de" then
kblayout = "ru"
end
awful.spawn.easy_async_with_shell("setxkbmap -layout " .. kblayout)
get_kblayout()
end
-- Signals
local old_wibox, old_cursor, old_bg
kblayout_widget:connect_signal(
"mouse::enter",
function ()
old_bg = kblayout_widget.bg
kblayout_widget.bg = color.color["Green200"] .. "dd"
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
)
kblayout_widget:connect_signal(
"button::press",
function ()
set_kblayout()
kblayout_widget.bg = color.color["Green200"] .. "bb"
end
)
kblayout_widget:connect_signal(
"button::release",
function ()
kblayout_widget.bg = color.color["Green200"] .. "dd"
end
)
kblayout_widget:connect_signal(
"mouse::leave",
function ()
kblayout_widget.bg = old_bg
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)
get_kblayout()
return kblayout_widget
end

View File

@@ -131,7 +131,7 @@ return function ()
[[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]],
function (stdout)
local essid = stdout:match("SSID: (.-)\n") or "N/A"
local bitrate = stdout: match("tx bitrate: (.+/s)") or "N/A"
local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A"
local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
if healthy then
@@ -177,7 +177,7 @@ return function ()
return
end
wifi_strength = tonumber(stdout)
network_widget.container.network_layout.spacing = dpi(10)
network_widget.container.network_layout.spacing = dpi(8)
network_widget.container.network_layout.label.visible = true
network_widget.container.network_layout.label:set_text(tostring(wifi_strength))
local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5)
@@ -259,7 +259,7 @@ return function ()
end
network_widget.container.network_layout.label.visible = false
update_tooltip("Network unreachable")
network_widget.test.test2.spacing = dpi(0)
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color.color["Grey900"]))
end

View File

@@ -75,7 +75,8 @@ return function ()
"button::release",
function ()
power_widget.bg = color.color["Red200"] .. "dd"
awful.spawn("rofi -show power-menu -modi 'power-menu:~/.config/rofi/rofi-power-menu --choices=shutdown/reboot/logout/lockscreen' -theme ~/.config/rofi/powermenu/powermenu.rasi")
awesome.emit_signal("module::powermenu:show")
--awful.spawn("rofi -show power-menu -modi 'power-menu:~/.config/rofi/rofi-power-menu --choices=shutdown/reboot/logout/lockscreen' -theme ~/.config/rofi/powermenu/powermenu.rasi")
end
)

View File

@@ -3,6 +3,7 @@ local awful = require("awful")
local gears = require("gears")
local dpi = require("beautiful").xresources.apply_dpi
local color = require("theme.crylia.colors")
local naughty = require("naughty")
local list_update = function (widget, buttons, label, data, objects)
widget:reset()
@@ -63,7 +64,31 @@ local list_update = function (widget, buttons, label, data, objects)
widget = wibox.widget.background
}
tag_widget:buttons(buttons, object)
local function create_buttons(buttons, object)
if buttons then
local btns = {}
for _, b in ipairs(buttons) do
-- Create a proxy button object: it will receive the real
-- press and release events, and will propagate them to the
-- button object the user provided, but with the object as
-- argument.
local btn = awful.button {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
end,
on_release = function()
b:emit_signal('release', object)
end
}
btns[#btns + 1] = btn
end
return btns
end
end
tag_widget:buttons(create_buttons(buttons, object))
local text, bg_color, bg_image, icon, args = label(object, tag_label)
@@ -94,7 +119,7 @@ local list_update = function (widget, buttons, label, data, objects)
margins = dpi(6),
widget = wibox.container.margin
}
icon.icon_container.icon:set_image(client.icon)
icon.icon_container.icon:set_image(client:get_icon(1))
tag_widget.widget_margin.container:setup({
icon,
layout = wibox.layout.align.horizontal
@@ -110,7 +135,12 @@ local list_update = function (widget, buttons, label, data, objects)
"mouse::enter",
function ()
old_bg = tag_widget.bg
tag_widget.bg = "#3A475C" .. "dd"
--naughty.notify({title = tostring(old_bg)})
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
@@ -122,14 +152,22 @@ local list_update = function (widget, buttons, label, data, objects)
tag_widget:connect_signal(
"button::press",
function ()
tag_widget.bg = "#3A475C" .. "bb"
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#bbbbbb' .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
end
end
)
tag_widget:connect_signal(
"button::release",
function ()
tag_widget.bg = "#3A475C" .. "dd"
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
end
end
)
@@ -147,7 +185,6 @@ local list_update = function (widget, buttons, label, data, objects)
widget:add(tag_widget)
widget:set_spacing(dpi(6))
end
end
local tag_list = function (s)

View File

@@ -62,7 +62,31 @@ local list_update = function (widget, buttons, label, data, objects)
delay_show = 1
}
task_widget:buttons(buttons, object)
local function create_buttons(buttons, object)
if buttons then
local btns = {}
for _, b in ipairs(buttons) do
-- Create a proxy button object: it will receive the real
-- press and release events, and will propagate them to the
-- button object the user provided, but with the object as
-- argument.
local btn = awful.button {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
end,
on_release = function()
b:emit_signal('release', object)
end
}
btns[#btns + 1] = btn
end
return btns
end
end
task_widget:buttons(create_buttons(buttons, object))
local text, bg, bg_image, icon, args = label(object, task_title)
@@ -72,7 +96,7 @@ local list_update = function (widget, buttons, label, data, objects)
else
local text_full = text:match('>(.-)<')
if text_full then
text = text_full
text = object.class:sub(1,20)
task_tool_tip:set_text(text_full)
task_tool_tip:add_to_object(task_widget)
else
@@ -88,7 +112,7 @@ local list_update = function (widget, buttons, label, data, objects)
end
if icon then
task_icon.icon:set_image(icon)
task_icon.icon:set_image(object:get_icon(1))
else
task_icon_margin:set_margins(0)
end
@@ -101,7 +125,11 @@ local list_update = function (widget, buttons, label, data, objects)
"mouse::enter",
function ()
old_bg = task_widget.bg
task_widget.bg = "#ffffff" .. "bb"
if object == client.focus then
task_widget.bg = '#dddddddd'
else
task_widget.bg = '#3A475Cdd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
@@ -113,14 +141,22 @@ local list_update = function (widget, buttons, label, data, objects)
task_widget:connect_signal(
"button::press",
function ()
task_widget.bg = "#ffffff" .. "aa"
if object == client.focus then
task_widget.bg = "#ffffffaa"
else
task_widget.bg = '#3A475Caa'
end
end
)
task_widget:connect_signal(
"button::release",
function ()
task_widget.bg = "#ffffff" .. "bb"
if object == client.focus then
task_widget.bg = "#ffffffdd"
else
task_widget.bg = '#3A475Cdd'
end
end
)
@@ -148,21 +184,33 @@ return function(s)
return awful.widget.tasklist(
s,
awful.widget.tasklist.filter.currenttags,
gears.table.join(
awful.util.table.join(
awful.button(
{},
1,
function (c)
function(c)
if c == client.focus then
c.minimized = true
else
-- Without this, the following
-- :isvisible() makes no sense
c.minimized = false
if not c.invisible() and c.first_tag then
c:emit_signal("request::activate")
c:raise()
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
-- This will also un-minimize
-- the client, if needed
c:emit_signal('request::activate')
c:raise()
end
end
),
awful.button(
{},
3,
function(c)
c:kill()
end
)
),
{},