add new calendar widget with ics file support, fix some bugs and added some game rules so steam games fullscreen isn't as annoying
This commit is contained in:
@@ -22,7 +22,7 @@ return function(s)
|
||||
spacing = dpi(10),
|
||||
layout = require("src.lib.overflow_widget.overflow").vertical,
|
||||
scrollbar_width = 0,
|
||||
step = dpi(50),
|
||||
step = dpi(100),
|
||||
id = "scroll_bar",
|
||||
},
|
||||
spacing = dpi(10),
|
||||
|
||||
1085
awesome/src/modules/calendar/calendar.lua
Normal file
1085
awesome/src/modules/calendar/calendar.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
--------------------------------------------------------------------------------------------------------------
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local async = require("async")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local Gio = require("lgi").Gio
|
||||
local gears = require("gears")
|
||||
@@ -25,7 +26,7 @@ return function(screen)
|
||||
---@param size number The size of the widget
|
||||
---@return widox.widget | nil The widget or nil if the program is not found
|
||||
local function create_dock_element(program, size)
|
||||
if not program then return end
|
||||
|
||||
local dock_element = wibox.widget {
|
||||
{
|
||||
{
|
||||
@@ -164,15 +165,14 @@ return function(screen)
|
||||
end
|
||||
|
||||
local prog = json:decode(data:read("a"))
|
||||
if (not prog) or prog == "" then return end
|
||||
data:close()
|
||||
for _, pr in ipairs(prog) do
|
||||
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
|
||||
local col = Theme_config.dock.indicator_bg
|
||||
for _, c in ipairs(client.get()) do
|
||||
local icon_name = pr.icon
|
||||
if not c.class then return end
|
||||
if icon_name:match(string.lower(c.class)) or c.class:match(string.lower(icon_name)) or
|
||||
(string.lower(c.name) == string.lower(icon_name)) or c.name:match(string.lower(icon_name)) then
|
||||
if icon_name:match(string.lower(c.class or c.name)) or c.class:match(string.lower(icon_name)) or
|
||||
c.name:match(string.lower(icon_name)) then
|
||||
if c == client.focus then
|
||||
col = Theme_config.dock.indicator_focused_bg
|
||||
elseif c.urgent then
|
||||
@@ -253,9 +253,7 @@ return function(screen)
|
||||
return
|
||||
end
|
||||
local dock_data = json:decode(data:read("a"))
|
||||
if (not dock_data) or dock_data == "" then
|
||||
return
|
||||
end
|
||||
data:close()
|
||||
for _, program in ipairs(dock_data) do
|
||||
table.insert(dock_elements, create_dock_element(program, User_config.dock_icon_size))
|
||||
end
|
||||
|
||||
@@ -27,5 +27,6 @@ awful.screen.connect_for_each_screen(
|
||||
require("src.modules.notification-center.init")(s)
|
||||
require("src.modules.window_switcher.init")(s)
|
||||
require("src.modules.application_launcher.init")(s)
|
||||
require("src.modules.calendar.calendar")(s)
|
||||
end
|
||||
)
|
||||
|
||||
@@ -130,11 +130,46 @@ return function(s)
|
||||
widget = wibox.container.place,
|
||||
}
|
||||
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local rubato_timed = rubato.timed { duration = 1, pos = 0 }
|
||||
|
||||
local toggle_button = wibox.widget {
|
||||
{
|
||||
left_button,
|
||||
right_button,
|
||||
widget = wibox.layout.flex.horizontal
|
||||
id = "background",
|
||||
widget = wibox.widget {
|
||||
fit = function(_, width, height)
|
||||
return width, height
|
||||
end,
|
||||
draw = function(_, _, cr, width, height)
|
||||
-- Clear for next drawing
|
||||
--cr:set_operator(cairo.Operator.CLEAR);
|
||||
local function move_dnd()
|
||||
cr:set_source(gears.color(Theme_config.notification_center.dnd.bg));
|
||||
cr:paint();
|
||||
cr:set_source(gears.color(Theme_config.notification_center.dnd.disabled))
|
||||
cr:move_to(rubato_timed.pos, 0)
|
||||
local x = rubato_timed.pos
|
||||
local y = 5
|
||||
local newwidth = width / 2 - 10
|
||||
local newheight = height - 10
|
||||
|
||||
local radius = height / 6.0
|
||||
local degrees = math.pi / 180.0;
|
||||
|
||||
cr:new_sub_path()
|
||||
cr:arc(x + newwidth - radius, y + radius, radius, -90 * degrees, 0 * degrees)
|
||||
cr:arc(x + newwidth - radius, y + newheight - radius, radius, 0 * degrees, 90 * degrees)
|
||||
cr:arc(x + radius, y + newheight - radius, radius, 90 * degrees, 180 * degrees)
|
||||
cr:arc(x + radius, y + radius, radius, 180 * degrees, 270 * degrees)
|
||||
cr:close_path()
|
||||
cr:fill()
|
||||
end
|
||||
|
||||
rubato_timed:subscribe(move_dnd)
|
||||
rubato_timed.target = width / 2 + 5
|
||||
end
|
||||
}
|
||||
},
|
||||
active = false,
|
||||
widget = wibox.container.background,
|
||||
@@ -152,22 +187,20 @@ return function(s)
|
||||
"button::press",
|
||||
function()
|
||||
if toggle_button.active then
|
||||
left_button.visible = true
|
||||
right_button.visible = false
|
||||
toggle_button.active = not toggle_button.active
|
||||
toggle_button.border_color = Theme_config.notification_center.dnd.border_disabled
|
||||
User_config.dnd = false
|
||||
rubato_timed.target = 5
|
||||
else
|
||||
left_button.visible = false
|
||||
right_button.visible = true
|
||||
toggle_button.active = not toggle_button.active
|
||||
toggle_button.border_color = Theme_config.notification_center.dnd.border_enabled
|
||||
User_config.dnd = true
|
||||
rubato_timed.target = 50
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local dnd = wibox.widget { -- Clear all button
|
||||
local dnd = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
@@ -348,12 +381,22 @@ return function(s)
|
||||
end
|
||||
)
|
||||
|
||||
local function mouse_leave()
|
||||
notification_center.visible = false
|
||||
end
|
||||
|
||||
awesome.connect_signal("notification_center::block_mouse_events", function()
|
||||
notification_center:disconnect_signal("mouse::leave", mouse_leave)
|
||||
end)
|
||||
|
||||
awesome.connect_signal("notification_center::unblock_mouse_events", function()
|
||||
notification_center:connect_signal("mouse::leave", mouse_leave)
|
||||
end)
|
||||
|
||||
-- Hide notification_center when mouse leaves it
|
||||
notification_center:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
notification_center.visible = false
|
||||
end
|
||||
mouse_leave
|
||||
)
|
||||
|
||||
-- Clear all notifications on button press
|
||||
|
||||
@@ -15,7 +15,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
local nl = {}
|
||||
|
||||
nl.notification_list = { layout = require("src.lib.overflow_widget.overflow").vertical, scrollbar_width = 0,
|
||||
step = dpi(20), spacing = dpi(20) }
|
||||
step = dpi(100), spacing = dpi(20) }
|
||||
|
||||
-- @param {table} notification
|
||||
-- @return {widget} notifications_list
|
||||
|
||||
@@ -90,6 +90,14 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
|
||||
awesome.connect_signal(
|
||||
"update::cpu_usage",
|
||||
function(cpu_usage)
|
||||
@@ -160,7 +168,13 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"update::cpu_temp",
|
||||
function(cpu_temp)
|
||||
@@ -239,7 +253,13 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"update::ram_widget",
|
||||
function(MemTotal, _, MemAvailable)
|
||||
@@ -312,7 +332,13 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"update::gpu_usage",
|
||||
function(gpu_usage)
|
||||
@@ -383,7 +409,13 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"update::gpu_temp",
|
||||
function(gpu_temp)
|
||||
@@ -472,7 +504,13 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"audio::get",
|
||||
function(muted, volume)
|
||||
@@ -563,7 +601,13 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"microphone::get",
|
||||
function(muted, volume)
|
||||
@@ -647,22 +691,20 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"brightness::get",
|
||||
function(brightness)
|
||||
local icon = icondir .. "brightness/brightness"
|
||||
if brightness >= 0 and brightness < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness >= 34 and brightness < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(icon .. ".svg",
|
||||
"update::backlight",
|
||||
function(backlight, backlight_icon)
|
||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon,
|
||||
Theme_config.notification_center.status_bar.backlight_color)
|
||||
tooltip.text = "Backlight: " .. brightness .. "%"
|
||||
rubato_timer.target = brightness
|
||||
tooltip.text = "Backlight: " .. backlight .. "%"
|
||||
rubato_timer.target = backlight
|
||||
end
|
||||
)
|
||||
elseif widget == "battery" then
|
||||
@@ -728,7 +770,13 @@ return function()
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"update::battery_widget",
|
||||
function(battery, battery_icon)
|
||||
|
||||
@@ -68,11 +68,13 @@ return function(s)
|
||||
Theme_config.volume_controller.device_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_headphones_selected_bg
|
||||
device.fg = Theme_config.volume_controller.device_headphones_selected_fg
|
||||
Hover_signal(device)
|
||||
else
|
||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
||||
Theme_config.volume_controller.device_headphones_selected_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_bg
|
||||
device.fg = Theme_config.volume_controller.device_headphones_fg
|
||||
Hover_signal(device)
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -85,16 +87,17 @@ return function(s)
|
||||
Theme_config.volume_controller.device_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_headphones_selected_bg
|
||||
device.fg = Theme_config.volume_controller.device_headphones_selected_fg
|
||||
Hover_signal(device)
|
||||
else
|
||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
||||
Theme_config.volume_controller.device_headphones_selected_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_bg
|
||||
device.fg = Theme_config.volume_controller.device_headphones_fg
|
||||
Hover_signal(device)
|
||||
end
|
||||
end
|
||||
)
|
||||
awesome.emit_signal("update::bg_sink", node)
|
||||
Hover_signal(device)
|
||||
else
|
||||
device:connect_signal(
|
||||
"button::press",
|
||||
@@ -115,11 +118,13 @@ return function(s)
|
||||
Theme_config.volume_controller.device_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_microphone_selected_bg
|
||||
device.fg = Theme_config.volume_controller.device_microphone_selected_fg
|
||||
Hover_signal(device)
|
||||
else
|
||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
||||
Theme_config.volume_controller.device_microphone_selected_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_bg
|
||||
device.fg = Theme_config.volume_controller.device_microphone_fg
|
||||
Hover_signal(device)
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -132,16 +137,17 @@ return function(s)
|
||||
Theme_config.volume_controller.device_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_microphone_selected_bg
|
||||
device.fg = Theme_config.volume_controller.device_microphone_selected_fg
|
||||
Hover_signal(device)
|
||||
else
|
||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
||||
Theme_config.volume_controller.device_microphone_selected_icon_color)
|
||||
device.bg = Theme_config.volume_controller.device_bg
|
||||
device.fg = Theme_config.volume_controller.device_microphone_fg
|
||||
Hover_signal(device)
|
||||
end
|
||||
end
|
||||
)
|
||||
awesome.emit_signal("update::bg_source", node)
|
||||
Hover_signal(device)
|
||||
end
|
||||
return device
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user