Add config files for awesomewm, alacritty, picom and rofi
This commit is contained in:
198
awesome/theme/crylia/modules/brightness_osd.lua
Normal file
198
awesome/theme/crylia/modules/brightness_osd.lua
Normal file
@@ -0,0 +1,198 @@
|
||||
---------------------------------------
|
||||
-- This is the brightness_osd 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")
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/brightness/"
|
||||
|
||||
--TODO: fix backlight keys and osd not working correctly
|
||||
return function ()
|
||||
|
||||
local brightness_osd_widget = wibox.widget{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "label",
|
||||
text = "Brightness",
|
||||
align = "left",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
nil,
|
||||
{
|
||||
ic = "value",
|
||||
text = "0%",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "label_value_layout",
|
||||
forced_height = dpi(48),
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "brightness-high.svg", color.color["White"]),
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(12),
|
||||
bottom = dpi(12),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "brightness_slider",
|
||||
bar_shape = gears.shape.rounded_rect,
|
||||
bar_height = dpi(2),
|
||||
bar_color = color.color["White"],
|
||||
bar_active_color = color.color["White"],
|
||||
handle_color = color.color["White"],
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_width = dpi(15),
|
||||
handle_border_color = color.color["White"],
|
||||
handle_border_width = dpi(1),
|
||||
maximum = 100,
|
||||
widget = wibox.widget.slider
|
||||
},
|
||||
id = "slider_layout",
|
||||
forced_height = dpi(24),
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_slider_layout",
|
||||
spacing = dpi(24),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "osd_layout",
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(24),
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color.color["Grey900"] .. '44',
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
visible = false,
|
||||
type = "notification",
|
||||
forced_height = dpi(100),
|
||||
forced_width = dpi(300),
|
||||
offset = dpi(5),
|
||||
}
|
||||
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal(
|
||||
"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)
|
||||
brightness_osd_widget.container.osd_layout.label_value_layout.value:set_text(brightness_value .. "%")
|
||||
|
||||
awesome.emit_signal(
|
||||
"widget::brightness:update",
|
||||
brightness_value
|
||||
)
|
||||
|
||||
if awful.screen.focused().show_brightness_osd then
|
||||
awesome.emit_signal(
|
||||
"module::brightness_osd:show",
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
local icon = icondir .. "brightness"
|
||||
if brightness_value >= 0 and brightness_value < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness_value >= 34 and brightness_value < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness_value >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.icon_margin.icon:set_image(gears.color.recolor_image(icon .. ".svg", color.color["White"]))
|
||||
end
|
||||
)
|
||||
|
||||
local update_slider = function ()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ xbacklight -get ]],
|
||||
function (stdout)
|
||||
stdout = stdout:sub(1,-9)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(stdout))
|
||||
end
|
||||
)
|
||||
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 ()
|
||||
update_slider()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::brightness:update",
|
||||
function (value)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_osd:show",
|
||||
function ()
|
||||
brightness_osd_widget.visible = true
|
||||
end
|
||||
)
|
||||
|
||||
update_slider()
|
||||
return brightness_osd_widget
|
||||
end
|
||||
98
awesome/theme/crylia/modules/calendar_osd.lua
Normal file
98
awesome/theme/crylia/modules/calendar_osd.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
local wibox = require("wibox")
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local watch = awful.widget.watch
|
||||
local color = require("theme.crylia.colors")
|
||||
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/date/"
|
||||
|
||||
local calendar_osd = function ()
|
||||
|
||||
local calendar_osd_time = wibox.widget{
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
text = os.date("%H-%M-%S"),
|
||||
id = "clock",
|
||||
font = "digital-7 italic",
|
||||
forced_height = dpi(50)
|
||||
},
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
|
||||
--[[ local create_calendar = function (widget, date)
|
||||
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"]
|
||||
local container = wibox.widget {
|
||||
{
|
||||
widget,
|
||||
margins = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, height, widget)
|
||||
end,
|
||||
shape_border_width = dpi(1),
|
||||
shape_border_color = color.color["Grey800"],
|
||||
fg = color.color["White"],
|
||||
bg = color.color["Grey900"],
|
||||
widget = wibox.container.background
|
||||
}
|
||||
end ]]
|
||||
|
||||
local calendar = wibox.widget{
|
||||
font = "digital-7 italic",
|
||||
date = os.date("*t"),
|
||||
spacing = dpi(15),
|
||||
--fn_embed = create_calendar,
|
||||
widget = wibox.widget.calendar.month()
|
||||
}
|
||||
|
||||
local current_month = calendar:get_date().month
|
||||
|
||||
local update_active_month = function (i)
|
||||
local date = calendar:get_date()
|
||||
date.month = date.month + i,
|
||||
calendar:set_date(nil),
|
||||
calendar:set_date(date)
|
||||
end
|
||||
|
||||
calendar:buttons(
|
||||
gears.table.join(
|
||||
awful.button(
|
||||
{ },
|
||||
4,
|
||||
function ()
|
||||
update_active_month(-1)
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{ },
|
||||
5,
|
||||
function ()
|
||||
update_active_month(1)
|
||||
end
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
local calendar_widget = wibox.widget{
|
||||
{
|
||||
calendar_osd_time,
|
||||
calendar,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
bg = color.color["White"] .. "00",
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, dpi(500), dpi(300))
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
return calendar_widget
|
||||
end
|
||||
|
||||
return calendar_osd
|
||||
209
awesome/theme/crylia/modules/volume_osd.lua
Normal file
209
awesome/theme/crylia/modules/volume_osd.lua
Normal file
@@ -0,0 +1,209 @@
|
||||
-----------------------------------
|
||||
-- This is the volume_old 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")
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/audio/"
|
||||
|
||||
-- Returns the volume_osd
|
||||
return function ()
|
||||
|
||||
local volume_osd_widget = wibox.widget{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "label",
|
||||
text = "Volume",
|
||||
align = "left",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
nil,
|
||||
{
|
||||
id = "value",
|
||||
text = "0%",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "label_value_layout",
|
||||
forced_height = dpi(48),
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "volume-high.svg", color.color["White"]),
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(12),
|
||||
bottom = dpi(12),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "volume_slider",
|
||||
bar_shape = gears.shape.rounded_rect,
|
||||
bar_height = dpi(2),
|
||||
bar_color = color.color["White"],
|
||||
bar_active_color = color.color["White"],
|
||||
handle_color = color.color["White"],
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_width = dpi(15),
|
||||
handle_border_color = color.color["White"],
|
||||
handle_border_width = dpi(1),
|
||||
maximum = 100,
|
||||
widget = wibox.widget.slider
|
||||
},
|
||||
id = "slider_layout",
|
||||
forced_height = dpi(24),
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_slider_layout",
|
||||
spacing = dpi(24),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "osd_layout",
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(24),
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color.color["Grey900"] .. '44',
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
visible = false,
|
||||
type = "notification",
|
||||
forced_height = dpi(100),
|
||||
forced_width = dpi(300),
|
||||
offset = dpi(5),
|
||||
}
|
||||
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:connect_signal(
|
||||
"property::value",
|
||||
function ()
|
||||
local volume_level = volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:get_value()
|
||||
|
||||
awful.spawn("amixer sset Master ".. volume_level .. "%", false)
|
||||
awesome.emit_signal("widget::volume")
|
||||
volume_osd_widget.container.osd_layout.label_value_layout.value:set_text(volume_level .. "%")
|
||||
|
||||
awesome.emit_signal(
|
||||
"widget::volume:update",
|
||||
volume_level
|
||||
)
|
||||
|
||||
if awful.screen.focused().show_volume_osd then
|
||||
awesome.emit_signal(
|
||||
"module::volume_osd:show",
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
local icon = icondir .. "volume"
|
||||
if volume_level < 1 then
|
||||
icon = icon .. "-mute"
|
||||
elseif volume_level >= 1 and volume_level < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif volume_level >= 34 and volume_level < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif volume_level >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin.icon:set_image(gears.color.recolor_image(icon .. ".svg", color.color["White"]))
|
||||
end
|
||||
)
|
||||
|
||||
local update_slider = function ()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ awk -F"[][]" '/dB/ { print $6 }' <(amixer sget Master) ]],
|
||||
function (stdout)
|
||||
if stdout:match("off") then
|
||||
volume_osd_widget.container.osd_layout.label_value_layout.value:set_text("0%")
|
||||
--volume_osd_slider.volume_slider:set_value(0)
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color.color["White"]))
|
||||
else
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master) ]],
|
||||
function (stdout)
|
||||
stdout = stdout:sub(1, -3)
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(stdout))
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
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",
|
||||
function ()
|
||||
update_slider()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume:update",
|
||||
function (value)
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value))
|
||||
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
|
||||
Reference in New Issue
Block a user