Big rewrite part 1

This commit is contained in:
Rene Kievits
2023-04-20 01:04:06 +02:00
parent 61930bf561
commit 3a85753a74
78 changed files with 3364 additions and 4090 deletions

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local aspawn = require('awful.spawn')
local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears').filesystem
@@ -13,14 +14,12 @@ local Gio = require('lgi').Gio
local gtable = require('gears.table')
local wibox = require('wibox')
-- Third party libs
local cm = require('src.modules.context_menu.init')
local dock = require('src.modules.crylia_bar.dock')
-- Local libs
local config = require('src.tools.config')
local hover = require('src.tools.hover')
local cm = require('src.modules.context_menu.init')
local dock = require('src.modules.crylia_bar.dock')
local icon_lookup = require('src.tools.gio_icon_lookup')()
local capi = {
awesome = awesome,
@@ -132,8 +131,8 @@ local function get_applications_from_file()
{ -- Icon
valign = 'center',
halign = 'center',
image = Get_gicon_path(app_info.get_icon(app)) or
Get_gicon_path(app_info.get_icon(app),
image = icon_lookup:get_gicon_path(app_info.get_icon(app)) or
icon_lookup:get_gicon_path(app_info.get_icon(app),
Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '',
resize = true,
widget = wibox.widget.imagebox,
@@ -173,11 +172,11 @@ local function get_applications_from_file()
terminal = Gio.DesktopAppInfo.get_string(desktop_app_info, 'Terminal') == 'true',
actions = Gio.DesktopAppInfo.list_actions(desktop_app_info),
desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '',
border_color = Theme_config.application_launcher.application.border_color,
border_width = Theme_config.application_launcher.application.border_width,
bg = Theme_config.application_launcher.application.bg,
fg = Theme_config.application_launcher.application.fg,
shape = Theme_config.application_launcher.application.shape,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
bg = beautiful.colorscheme.bg1,
fg = beautiful.colorscheme.fg,
shape = beautiful.shape[4],
widget = wibox.container.background,
}
local context_menu = cm {
@@ -215,7 +214,7 @@ local function get_applications_from_file()
{
name = 'Execute as sudo',
icon = gcolor.recolor_image(icondir .. 'launch.svg',
Theme_config.application_launcher.application.cm_icon_color),
beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.emit_signal('application_launcher::show')
aspawn('/home/crylia/.config/awesome/src/scripts/start_as_admin.sh ' .. app_widget.exec)
@@ -224,14 +223,14 @@ local function get_applications_from_file()
{
name = 'Pin to dock',
icon = gcolor.recolor_image(icondir .. 'pin.svg',
Theme_config.application_launcher.application.cm_icon_color),
beautiful.colorscheme.bg_purple),
callback = function()
-- Open dock.js and read all its content into a table, add the new app into the table and write it back
--[[ async.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock.json', function(data)
table.insert(data, {
name = app_widget.name or '',
icon = Get_gicon_path(app_info.get_icon(app)) or
Get_gicon_path(app_info.get_icon(app),
icon = icon_lookup.get_gicon_path(app_info.get_icon(app)) or
icon_lookup.get_gicon_path(app_info.get_icon(app),
Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '',
comment = app_widget.comment or '',
exec = app_widget.exec or '',
@@ -254,12 +253,12 @@ local function get_applications_from_file()
{
name = 'Add to desktop',
icon = gcolor.recolor_image(icondir .. 'desktop.svg',
Theme_config.application_launcher.application.cm_icon_color),
beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.emit_signal('application_launcher::show')
capi.awesome.emit_signal('desktop::add_to_desktop', {
label = app_info.get_name(app),
icon = Get_gicon_path(app_info.get_icon(app)) or '',
icon = icon_lookup:get_gicon_path(app_info.get_icon(app)) or '',
exec = Gio.DesktopAppInfo.get_string(desktop_app_info, 'Exec'),
desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '',
})
@@ -372,9 +371,9 @@ function application_grid:set_applications(search_filter)
'update::selected',
function()
if self._private.curser.y == pos.row and self._private.curser.x == pos.col then
app.border_color = Theme_config.application_launcher.application.border_color_active
app.border_color = beautiful.colorscheme.bg_purple
else
app.border_color = Theme_config.application_launcher.application.border_color
app.border_color = beautiful.colorscheme.bg1
end
end
)

View File

@@ -8,12 +8,15 @@ local akeygrabber = require('awful.keygrabber')
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local wibox = require('wibox')
local gtimer = require('gears.timer')
-- Own libs
local app_grid = require('src.modules.application_launcher.application')
local input = require('src.modules.inputbox')
local capi = {
awesome = awesome,
@@ -29,10 +32,11 @@ function application_launcher.new(args)
args = args or {}
-- Create a new inputbox
local searchbar = awidget.inputbox {
hint_text = 'Search...',
valign = 'center',
halign = 'left',
local searchbar = input {
text_hint = 'Search...',
mouse_focus = true,
fg = beautiful.colorscheme.fg,
password_mode = true,
}
-- Application launcher popup
local application_container = apopup {
@@ -42,7 +46,12 @@ function application_launcher.new(args)
{
{
{
searchbar,
{
searchbar.widget,
halign = 'left',
valign = 'center',
widget = wibox.container.place,
},
widget = wibox.container.margin,
margins = 5,
},
@@ -51,11 +60,11 @@ function application_launcher.new(args)
height = dpi(50),
},
widget = wibox.container.background,
bg = Theme_config.application_launcher.searchbar.bg,
fg = Theme_config.application_launcher.searchbar.fg,
border_color = Theme_config.application_launcher.searchbar.border_color,
border_width = Theme_config.application_launcher.searchbar.border_width,
shape = Theme_config.application_launcher.searchbar.shape,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.fg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[4],
id = 'searchbar_bg',
},
{
@@ -79,19 +88,19 @@ function application_launcher.new(args)
stretch = false,
screen = args.screen,
placement = aplacement.centered,
bg = Theme_config.application_launcher.bg,
border_color = Theme_config.application_launcher.border_color,
border_width = Theme_config.application_launcher.border_width,
bg = beautiful.colorscheme.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
}
gtable.crush(application_container, application_launcher, true)
-- Delayed call to give the popup some time to evaluate its width
gtimer.delayed_call(function()
if application_container.width then
application_container.widget.width = application_container.width
end
end)
-- Focus the searchbar when its left clicked
searchbar:buttons(gtable.join {
abutton({}, 1, function()
searchbar:focus()
end),
})
gtable.crush(application_container, application_launcher, true)
--#region Hover signals to change the cursor to a text cursor
local old_cursor, old_wibox
@@ -119,7 +128,7 @@ function application_launcher.new(args)
application_container.visible = not application_container.visible
end
if application_container.visible then
searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_active
searchbar_bg.border_color = beautiful.colorscheme.bg_blue
searchbar:focus()
else
searchbar:set_text('')
@@ -128,44 +137,41 @@ function application_launcher.new(args)
end
end)
-- Execute the currently selected application, reset the searchbar and hide the launcher
searchbar:connect_signal('submit', function(_, text)
application_grid:execute()
capi.awesome.emit_signal('application_launcher::show')
searchbar:set_text('')
application_grid:set_applications(searchbar:get_text())
searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_color
end)
-- Hide the application launcher when the keygrabber stops and reset the searchbar
searchbar:connect_signal('stopped', function(_, stop_key)
searchbar:connect_signal('inputbox::stop', function(_, stop_key)
if stop_key == 'Escape' then
capi.awesome.emit_signal('application_launcher::show')
end
searchbar:set_text('')
application_grid:set_applications(searchbar:get_text())
searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_color
searchbar_bg.border_color = beautiful.colorscheme.border_color
end)
-- When started change the background for the searchbar
searchbar:connect_signal('started', function()
searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_active
searchbar:connect_signal('inputbox::start', function()
searchbar_bg.border_color = beautiful.colorscheme.bg_blue
end)
-- On every keypress in the searchbar check for certain inputs
searchbar:connect_signal('inputbox::key_pressed', function(_, modkey, key)
searchbar:connect_signal('inputbox::keypressed', function(_, modkey, key)
if key == 'Escape' then -- Escape to stop the keygrabber, hide the launcher and reset the searchbar
searchbar:stop()
searchbar:unfocus()
capi.awesome.emit_signal('application_launcher::show')
application_grid:reset()
searchbar:set_text('')
elseif key == 'Down' or key == 'Right' then --If down or right is pressed initiate the grid navigation
elseif key == 'Return' then
application_grid:execute()
capi.awesome.emit_signal('application_launcher::show')
searchbar:set_text('')
application_grid:set_applications(searchbar:get_text())
searchbar_bg.border_color = beautiful.colorscheme.border_color
elseif key == 'Down' then --If down or right is pressed initiate the grid navigation
if key == 'Down' then
application_grid:move_down()
elseif key == 'Right' then
application_grid:move_right()
end
searchbar:stop()
searchbar:unfocus()
--New keygrabber to allow for key navigation
akeygrabber.run(function(mod, key2, event)
if event == 'press' then
@@ -197,7 +203,7 @@ function application_launcher.new(args)
end
end
end)
searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_color
searchbar_bg.border_color = beautiful.colorscheme.border_color
end
-- Update the applications in the grid
application_grid:set_applications(searchbar:get_text())

View File

@@ -2,6 +2,7 @@
local abutton = require('awful.button')
local aspawn = require('awful.spawn')
local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gshape = require('gears.shape')
@@ -70,11 +71,11 @@ function audio_controller:get_device_widget(device, name, device_type)
name = name:gsub('^%s*(.-)%s*$', '%1')
local icon_color, fg
if device_type == 'source' then
icon_color = Theme_config.volume_controller.device_microphone_fg
fg = Theme_config.volume_controller.device_microphone_fg
icon_color = beautiful.colorscheme.bg_blue
fg = beautiful.colorscheme.bg_blue
elseif device_type == 'sink' then
icon_color = Theme_config.volume_controller.device_headphones_fg
fg = Theme_config.volume_controller.device_headphones_fg
icon_color = beautiful.colorscheme.bg_purple
fg = beautiful.colorscheme.bg_purple
end
local device_widget = wibox.widget {
@@ -112,11 +113,11 @@ function audio_controller:get_device_widget(device, name, device_type)
margins = dpi(10),
widget = wibox.container.margin,
},
bg = Theme_config.volume_controller.device_bg,
bg = beautiful.colorscheme.bg,
fg = fg,
border_color = Theme_config.volume_controller.device_border_color,
border_width = Theme_config.volume_controller.device_border_width,
shape = Theme_config.volume_controller.device_shape,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[4],
widget = wibox.container.background,
sink = device,
}
@@ -137,11 +138,11 @@ function audio_controller:get_device_widget(device, name, device_type)
self:connect_signal('AC::device_changed', function(new_sink)
if device_widget.device == new_sink then
device_widget.bg = Theme_config.volume_controller.device_headphones_selected_bg
device_widget.fg = Theme_config.volume_controller.device_headphones_selected_fg
device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', Theme_config.volume_controller.device_headphones_selected_fg)
device_widget.bg = beautiful.colorscheme.bg_purple
device_widget.fg = beautiful.colorscheme.bg
device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', beautiful.colorscheme.bg)
else
device_widget.bg = Theme_config.volume_controller.device_bg
device_widget.bg = beautiful.colorscheme.bg
device_widget.fg = fg
device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', icon_color)
end
@@ -198,7 +199,7 @@ function audio_controller.new()
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.volume_controller.device_headphones_selected_icon_color),
beautiful.colorscheme.bg_purple),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -217,9 +218,11 @@ function audio_controller.new()
layout = wibox.layout.fixed.horizontal,
},
id = 'sink_dd_shape',
bg = Theme_config.volume_controller.list_bg,
fg = Theme_config.volume_controller.list_headphones_fg,
shape = Theme_config.volume_controller.list_shape,
bg = beautiful.colorscheme.bg1,
fg = beautiful.colorscheme.bg_purple,
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background,
},
{ -- sink dropdown
@@ -235,10 +238,12 @@ function audio_controller.new()
margins = dpi(10),
widget = wibox.container.margin,
},
border_color = Theme_config.volume_controller.list_border_color,
border_width = Theme_config.volume_controller.list_border_width,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
id = 'sink_list_shape',
shape = Theme_config.volume_controller.list_shape,
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background,
},
id = 'sink_height',
@@ -256,7 +261,7 @@ function audio_controller.new()
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.volume_controller.device_headphones_selected_icon_color),
beautiful.colorscheme.bg_purple),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -275,9 +280,11 @@ function audio_controller.new()
layout = wibox.layout.fixed.horizontal,
},
id = 'source_dd_shape',
bg = Theme_config.volume_controller.list_bg,
fg = Theme_config.volume_controller.list_headphones_fg,
shape = Theme_config.volume_controller.list_shape,
bg = beautiful.colorscheme.bg1,
fg = beautiful.colorscheme.bg_purple,
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background,
},
{ -- source dropdown
@@ -293,10 +300,12 @@ function audio_controller.new()
margins = dpi(10),
widget = wibox.container.margin,
},
border_color = Theme_config.volume_controller.list_border_color,
border_width = Theme_config.volume_controller.list_border_width,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
id = 'source_list_shape',
shape = Theme_config.volume_controller.list_shape,
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background,
},
id = 'source_height',
@@ -317,7 +326,7 @@ function audio_controller.new()
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
image = gcolor.recolor_image(icondir .. 'volume-high.svg', Theme_config.volume_controller.volume_fg),
image = gcolor.recolor_image(icondir .. 'volume-high.svg', beautiful.colorscheme.bg_purple),
id = 'sink_icon',
},
widget = wibox.container.constraint,
@@ -326,15 +335,13 @@ function audio_controller.new()
strategy = 'exact',
},
{
bar_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(5))
end,
bar_shape = beautiful.shape[4],
bar_height = dpi(5),
bar_color = Theme_config.volume_controller.border_color,
bar_active_color = Theme_config.volume_controller.volume_fg,
handle_color = Theme_config.volume_controller.volume_fg,
bar_color = beautiful.colorscheme.border_color,
bar_active_color = beautiful.colorscheme.bg_purple,
handle_color = beautiful.colorscheme.bg_purple,
handle_shape = gshape.circle,
handle_border_color = Theme_config.volume_controller.volume_fg,
handle_border_color = beautiful.colorscheme.bg_purple,
handle_width = dpi(15),
handle_cursor = 'left_ptr',
maximum = 100,
@@ -363,7 +370,7 @@ function audio_controller.new()
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
image = gcolor.recolor_image(icondir .. 'microphone.svg', Theme_config.volume_controller.volume_fg),
image = gcolor.recolor_image(icondir .. 'microphone.svg', beautiful.colorscheme.bg_purple),
id = 'source_icon',
},
widget = wibox.container.constraint,
@@ -372,15 +379,13 @@ function audio_controller.new()
strategy = 'exact',
},
{
bar_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(5))
end,
bar_shape = beautiful.shape[4],
bar_height = dpi(5),
bar_color = Theme_config.volume_controller.border_color,
bar_active_color = Theme_config.volume_controller.volume_fg,
handle_color = Theme_config.volume_controller.volume_fg,
bar_color = beautiful.colorscheme.border_color,
bar_active_color = beautiful.colorscheme.bg_purple,
handle_color = beautiful.colorscheme.bg_purple,
handle_shape = gshape.circle,
handle_border_color = Theme_config.volume_controller.volume_fg,
handle_border_color = beautiful.colorscheme.bg_purple,
handle_width = dpi(15),
handle_cursor = 'left_ptr',
maximum = 100,
@@ -426,7 +431,7 @@ function audio_controller.new()
w.sink_volume = volume
w.sink_muted = muted
if muted then
sink_icon:set_image(gcolor.recolor_image(icondir .. 'volume-mute.svg', Theme_config.volume_controller.volume_fg))
sink_icon:set_image(gcolor.recolor_image(icondir .. 'volume-mute.svg', beautiful.colorscheme.bg_purple))
else
local icon = icondir .. 'volume'
if volume == 0 then
@@ -440,7 +445,7 @@ function audio_controller.new()
end
sink_slider:set_value(volume)
sink_icon:set_image(gcolor.recolor_image(icon .. '.svg', Theme_config.volume_controller.volume_fg))
sink_icon:set_image(gcolor.recolor_image(icon .. '.svg', beautiful.colorscheme.bg_purple))
end
end)
@@ -460,14 +465,14 @@ function audio_controller.new()
w.source_volume = volume
w.source_muted = muted
if muted then
source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', Theme_config.volume_controller.microphone_fg))
source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', beautiful.colorscheme.bg_blue))
else
if not volume then return end
source_slider:set_value(tonumber(volume))
if volume > 0 then
source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone.svg', Theme_config.volume_controller.microphone_fg))
source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone.svg', beautiful.colorscheme.bg_blue))
else
source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', Theme_config.volume_controller.microphone_fg))
source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', beautiful.colorscheme.bg_blue))
end
end
end)
@@ -500,16 +505,14 @@ function audio_controller.new()
end
sink_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.volume_controller.device_headphones_selected_icon_color))
beautiful.colorscheme.bg_purple))
else
rubato_timer.target = 0
sink_dd_shape.shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, 4)
end
sink_dd_shape.shape = beautiful.shape[4]
sink_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.volume_controller.device_headphones_selected_icon_color))
beautiful.colorscheme.bg_purple))
end
end),
})
@@ -543,16 +546,14 @@ function audio_controller.new()
end
source_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.volume_controller.device_headphones_selected_icon_color))
beautiful.colorscheme.bg_purple))
else
rubato_timer.target = 0
source_dd_shape.shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, 4)
end
source_dd_shape.shape = beautiful.shape[4]
source_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.volume_controller.device_headphones_selected_icon_color))
beautiful.colorscheme.bg_purple))
end
end),
})

View File

@@ -5,6 +5,7 @@
-- Awesome Libs
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -39,7 +40,7 @@ function osd.new(args)
{
{ -- Volume Icon
{
image = gcolor.recolor_image(icondir .. 'volume-off.svg', Theme_config.volume_osd.icon_color),
image = gcolor.recolor_image(icondir .. 'volume-off.svg', beautiful.colorscheme.bg_purple),
valign = 'center',
halign = 'center',
resize = true,
@@ -55,8 +56,8 @@ function osd.new(args)
{
{
id = 'progressbar',
color = Theme_config.volume_osd.bar_bg_active,
background_color = Theme_config.volume_osd.bar_bg,
color = beautiful.colorscheme.bg_purple,
background_color = beautiful.colorscheme.bg1,
max_value = 100,
value = 0,
shape = gshape.rounded_rect,
@@ -84,16 +85,16 @@ function osd.new(args)
bottom = dpi(20),
widget = wibox.container.margin,
},
shape = Theme_config.volume_osd.shape,
shape = beautiful.shape[12],
widget = wibox.container.background,
},
ontop = true,
stretch = false,
visible = false,
border_color = Theme_config.volume_osd.border_color,
border_width = Theme_config.volume_osd.border_width,
fg = Theme_config.volume_osd.fg,
bg = Theme_config.volume_osd.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
fg = beautiful.colorscheme.bg_purple,
bg = beautiful.colorscheme.bg,
screen = 1,
placement = function(c) aplacement.bottom(c, { margins = dpi(20) }) end,
}
@@ -111,7 +112,7 @@ function osd.new(args)
audio_helper:connect_signal('output::get', function(_, muted, volume)
volume = tonumber(volume or 0)
if muted then
w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icondir .. 'volume-mute' .. '.svg', Theme_config.volume_osd.icon_color))
w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icondir .. 'volume-mute' .. '.svg', beautiful.colorscheme.bg_purple))
w.widget:get_children_by_id('progressbar')[1].value = 0
else
w.widget:get_children_by_id('progressbar')[1].value = volume
@@ -126,7 +127,7 @@ function osd.new(args)
icon = icon .. '-high'
end
w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icon .. '.svg', Theme_config.volume_osd.icon_color))
w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icon .. '.svg', beautiful.colorscheme.bg_purple))
w.widget:get_children_by_id('text_role')[1].text = volume
end
w:run()

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local awidget = require('awful.widget')
local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears').color
local gfilesystem = require('gears').filesystem
@@ -50,7 +51,7 @@ end
--#endregion
local dbus_proxy = require('dbus_proxy')
local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
--- Connect to a device if not connected else disconnect
function device:toggle_connect()
if not self.device.Paired then
@@ -110,8 +111,8 @@ function device.new(args)
local inputbox = input {
text = args.device.Alias or args.device.Name,
font = 'JetBrainsMono Nerd Font 12',
fg = Theme_config.bluetooth_controller.device_fg,
font = beautiful.user_config.font .. ' 12',
fg = beautiful.colorscheme.bg_blue,
}
local ret = base.make_widget_from_value(wibox.widget {
@@ -121,7 +122,7 @@ function device.new(args)
{
{
image = gcolor.recolor_image(
icondir .. icon .. '.svg', Theme_config.bluetooth_controller.icon_color),
icondir .. icon .. '.svg', beautiful.colorscheme.bg_purple),
resize = false,
valign = 'center',
halign = 'center',
@@ -165,8 +166,8 @@ function device.new(args)
margins = dpi(2),
widget = wibox.container.margin,
},
shape = Theme_config.bluetooth_controller.icon_shape,
bg = Theme_config.bluetooth_controller.con_button_color,
shape = beautiful.shape[4],
bg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
margin = dpi(5),
@@ -177,12 +178,12 @@ function device.new(args)
margins = dpi(5),
widget = wibox.container.margin,
},
bg = Theme_config.bluetooth_controller.device_bg,
fg = Theme_config.bluetooth_controller.device_fg,
border_color = Theme_config.bluetooth_controller.device_border_color,
border_width = Theme_config.bluetooth_controller.device_border_width,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg_blue,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
id = 'background',
shape = Theme_config.bluetooth_controller.device_shape,
shape = beautiful.shape[4],
widget = wibox.container.background,
})
@@ -195,7 +196,7 @@ function device.new(args)
-- Set the image of the connection button depending on the connection state
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(ret.device.Connected and icondir .. 'link.svg' or
icondir .. 'link-off.svg',
Theme_config.bluetooth_controller.icon_color_dark)
beautiful.colorscheme.bg)
local cm = context_menu {
widget_template = wibox.widget {
@@ -232,7 +233,7 @@ function device.new(args)
name = ret.device.Connected and 'Disconnect' or 'Connect',
icon = gcolor.recolor_image(ret.device.Connected and icondir .. 'bluetooth-off.svg' or
icondir .. 'bluetooth-on.svg',
Theme_config.bluetooth_controller.icon_color),
beautiful.colorscheme.bg_purple),
callback = function()
ret:toggle_connect()
end,
@@ -242,7 +243,7 @@ function device.new(args)
name = 'Pair',
icon = gcolor.recolor_image(ret.device.Paired and icondir .. 'link-off.svg' or
icondir .. 'link.svg',
Theme_config.bluetooth_controller.icon_color),
beautiful.colorscheme.bg_purple),
callback = function()
ret:toggle_pair()
end,
@@ -250,7 +251,7 @@ function device.new(args)
{ -- Trust/Untrust a device
name = ret.device.Trusted and 'Untrust' or 'Trust',
icon = gcolor.recolor_image(ret.device.Trusted and icondir .. 'untrusted.svg' or icondir .. 'trusted.svg',
Theme_config.bluetooth_controller.icon_color),
beautiful.colorscheme.bg_purple),
callback = function()
ret:toggle_trusted()
end,
@@ -258,7 +259,7 @@ function device.new(args)
},
{ -- Rename a device
name = 'Rename',
icon = gcolor.recolor_image(icondir .. 'edit.svg', Theme_config.bluetooth_controller.icon_color),
icon = gcolor.recolor_image(icondir .. 'edit.svg', beautiful.colorscheme.bg_purple),
callback = function()
inputbox:focus()
inputbox:connect_signal('inputbox::keypressed', function(_, mod, key)
@@ -271,7 +272,7 @@ function device.new(args)
},
{ -- Remove a device
name = 'Remove',
icon = gcolor.recolor_image(icondir .. 'delete.svg', Theme_config.bluetooth_controller.icon_color),
icon = gcolor.recolor_image(icondir .. 'delete.svg', beautiful.colorscheme.bg_purple),
callback = function()
args.remove_callback(ret.device)
end,
@@ -296,14 +297,14 @@ function device.new(args)
value:get_children_by_id('text_role')[1].text = ret.device.Connected and 'Disconnect' or 'Connect'
value:get_children_by_id('icon_role')[1].image = gcolor.recolor_image(ret.device.Connected and
icondir .. 'bluetooth-off.svg' or icondir .. 'bluetooth-on.svg',
Theme_config.bluetooth_controller.icon_color)
beautiful.colorscheme.bg_purple)
elseif value.id:match('trusted') then
value:get_children_by_id('text_role')[1].text = ret.device.Trusted and 'Untrust' or 'Trust'
value:get_children_by_id('icon_role')[1].image = gcolor.recolor_image(ret.device.Trusted and
icondir .. 'untrusted.svg' or icondir .. 'trusted.svg', Theme_config.bluetooth_controller.icon_color)
icondir .. 'untrusted.svg' or icondir .. 'trusted.svg', beautiful.colorscheme.bg_purple)
elseif value.id:match('paired') then
value:get_children_by_id('icon_role')[1].image = gcolor.recolor_image(ret.device.Paired and
icondir .. 'link-off.svg' or icondir .. 'link.svg', Theme_config.bluetooth_controller.icon_color)
icondir .. 'link-off.svg' or icondir .. 'link.svg', beautiful.colorscheme.bg_purple)
end
end
cm:toggle()
@@ -314,7 +315,7 @@ function device.new(args)
capi.awesome.connect_signal(ret.device.object_path .. '_updated', function(d)
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(d.Connected and icondir .. 'link.svg' or
icondir .. 'link-off.svg',
Theme_config.bluetooth_controller.icon_color_dark)
beautiful.colorscheme.bg)
end)
hover.bg_hover { widget = ret }

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local aspawn = require('awful.spawn')
local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears').color
@@ -263,7 +264,7 @@ function bluetooth.new(args)
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.connected_icon_color),
beautiful.colorscheme.bg_purple),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -281,9 +282,9 @@ function bluetooth.new(args)
},
layout = wibox.layout.fixed.horizontal,
},
bg = Theme_config.bluetooth_controller.connected_bg,
fg = Theme_config.bluetooth_controller.connected_fg,
shape = Theme_config.bluetooth_controller.connected_shape,
bg = beautiful.colorscheme.bg1,
fg = beautiful.colorscheme.bg_purple,
shape = beautiful.shape[4],
widget = wibox.container.background,
id = 'connected_bg',
},
@@ -304,9 +305,9 @@ function bluetooth.new(args)
margins = dpi(10),
widget = wibox.container.margin,
},
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = Theme_config.bluetooth_controller.con_device_shape,
border_color = beautiful.colorscheme.bg1,
border_width = dpi(2),
shape = beautiful.shape[4],
widget = wibox.container.background,
},
widget = wibox.container.constraint,
@@ -320,7 +321,7 @@ function bluetooth.new(args)
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.discovered_icon_color),
beautiful.colorscheme.bg_blue),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -339,9 +340,9 @@ function bluetooth.new(args)
layout = wibox.layout.fixed.horizontal,
},
id = 'discovered_bg',
bg = Theme_config.bluetooth_controller.discovered_bg,
fg = Theme_config.bluetooth_controller.discovered_fg,
shape = Theme_config.bluetooth_controller.discovered_shape,
bg = beautiful.colorscheme.bg1,
fg = beautiful.colorscheme.bg_blue,
shape = beautiful.shape[4],
widget = wibox.container.background,
},
id = 'discovered_margin',
@@ -360,9 +361,9 @@ function bluetooth.new(args)
margins = dpi(10),
widget = wibox.container.margin,
},
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = Theme_config.bluetooth_controller.con_device_shape,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[4],
widget = wibox.container.background,
forced_height = 0,
id = 'discovered_list',
@@ -371,7 +372,7 @@ function bluetooth.new(args)
{ -- action buttons
{
dnd_widget {
color = Theme_config.bluetooth_controller.power_bg,
color = beautiful.colorscheme.bg_blue,
size = dpi(40),
},
id = 'dnd',
@@ -384,7 +385,7 @@ function bluetooth.new(args)
{
{
image = gcolor.recolor_image(icondir .. 'refresh.svg',
Theme_config.bluetooth_controller.refresh_icon_color),
beautiful.colorscheme.bg),
resize = false,
valign = 'center',
halign = 'center',
@@ -393,8 +394,8 @@ function bluetooth.new(args)
widget = wibox.container.margin,
margins = dpi(5),
},
shape = Theme_config.bluetooth_controller.refresh_shape,
bg = Theme_config.bluetooth_controller.refresh_bg,
shape = beautiful.shape[4],
bg = beautiful.colorscheme.bg_blue,
id = 'scan',
widget = wibox.container.background,
},
@@ -515,7 +516,7 @@ function bluetooth.new(args)
end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.connected_icon_color))
beautiful.colorscheme.bg_purple))
end
end
end)
@@ -530,7 +531,7 @@ function bluetooth.new(args)
end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.connected_icon_color))
beautiful.colorscheme.bg_purple))
end
end)
@@ -545,16 +546,14 @@ function bluetooth.new(args)
end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.connected_icon_color))
beautiful.colorscheme.bg_purple))
end
else
connected_animation.target = 0
connected_margin.connected_bg.shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, 4)
end
connected_margin.connected_bg.shape = beautiful.shape[4]
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.connected_icon_color))
beautiful.colorscheme.bg_purple))
end
end)
@@ -584,7 +583,7 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.discovered_icon_color))
beautiful.colorscheme.bg_blue))
end
end
end)
@@ -600,7 +599,7 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.discovered_icon_color))
beautiful.colorscheme.bg_blue))
end
end)
@@ -616,15 +615,13 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.discovered_icon_color))
beautiful.colorscheme.bg_blue))
end
else
discovered_animation.target = 0
discovered_bg.shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, 4)
end
discovered_bg.shape = beautiful.shape[4]
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.discovered_icon_color))
beautiful.colorscheme.bg_blue))
end
end)
--#endregion

View File

@@ -5,6 +5,7 @@
-- Awesome Libs
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -44,61 +45,61 @@ function brightness_osd.new(args)
{
{ -- Brightness Icon
{
image = gcolor.recolor_image(icondir .. 'volume-off.svg', Theme_config.brightness_ods.icon_color),
image = gcolor.recolor_image(icondir .. 'volume-off.svg', beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'center',
resize = true,
id = 'icon_role',
widget = wibox.widget.imagebox
widget = wibox.widget.imagebox,
},
widget = wibox.container.constraint,
width = dpi(25),
height = dpi(25),
strategy = 'exact'
strategy = 'exact',
},
{ -- Brightness Bar
{
{
id = 'progressbar',
color = Theme_config.brightness_ods.bar_bg_active,
background_color = Theme_config.brightness_ods.bar_bg,
color = beautiful.colorscheme.bg_blue,
background_color = beautiful.colorscheme.bg,
max_value = 100,
value = 0,
shape = gshape.rounded_rect,
widget = wibox.widget.progressbar
widget = wibox.widget.progressbar,
},
widget = wibox.container.constraint,
width = dpi(250),
height = dpi(5),
},
widget = wibox.container.place
widget = wibox.container.place,
},
{ -- Brightness text
widget = wibox.widget.textbox,
id = 'text_role',
text = '0',
valign = 'center',
halign = 'center'
halign = 'center',
},
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
layout = wibox.layout.fixed.horizontal,
},
left = dpi(10),
right = dpi(10),
top = dpi(20),
bottom = dpi(20),
widget = wibox.container.margin
widget = wibox.container.margin,
},
shape = Theme_config.brightness_ods.shape,
widget = wibox.container.background
shape = beautiful.shape[4],
widget = wibox.container.background,
},
ontop = true,
stretch = false,
visible = false,
border_color = Theme_config.brightness_ods.border_color,
border_width = Theme_config.brightness_ods.border_width,
fg = Theme_config.brightness_ods.fg,
bg = Theme_config.brightness_ods.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
fg = beautiful.colorscheme.bg_blue,
bg = beautiful.colorscheme.bg,
screen = 1,
placement = function(c) aplacement.bottom(c, { margins = dpi(20) }) end,
}
@@ -110,7 +111,7 @@ function brightness_osd.new(args)
autostart = true,
callback = function()
w.visible = false
end
end,
}
backlight_helper:connect_signal('brightness_changed', function()
@@ -127,7 +128,7 @@ function brightness_osd.new(args)
icon = icon .. '-high.svg'
end
w.widget:get_children_by_id('icon')[1]:set_image(gcolor.recolor_image(icon, Theme_config.brightness_osd.icon_color))
w.widget:get_children_by_id('icon')[1]:set_image(gcolor.recolor_image(icon, beautiful.colorscheme.bg_blue))
w.widget:get_children_by_id('text_role')[1].text = brightness
w:run()
end)

View File

@@ -1,5 +1,7 @@
-- Awesome Libs
local awful = require('awful')
local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local gcolor = require('gears.color')
@@ -348,7 +350,7 @@ function calendar:create_calendar_weeks_widget()
widget = wibox.widget.textbox,
},
id = 'background',
fg = Theme_config.calendar.day.fg_unfocus,
fg = beautiful.colorscheme.bg2,
widget = wibox.container.background,
},
strategy = 'exact',
@@ -371,8 +373,8 @@ function calendar:create_weekdays_widget()
valign = 'center',
widget = wibox.widget.textbox,
},
bg = Theme_config.calendar.weekdays.bg,
fg = Theme_config.calendar.weekdays.fg,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
})
end
@@ -421,9 +423,9 @@ function calendar:create_calendar_widget()
margins = dpi(2),
widget = wibox.container.margin,
},
fg = Theme_config.calendar.task.fg,
fg = beautiful.colorscheme.bg,
bg = bg,
shape = Theme_config.calendar.task.shape,
shape = beautiful.shape[4],
forced_height = dpi(20),
widget = wibox.container.background,
}
@@ -460,11 +462,11 @@ function calendar:create_calendar_widget()
color = cal.color,
}
local task_popup = awful.popup {
local task_popup = apopup {
widget = ti,
ontop = true,
visible = false,
bg = '#00000000',
bg = gcolor.transparent,
x = capi.mouse.coords().x,
y = capi.mouse.coords().y,
screen = capi.mouse.screen,
@@ -508,16 +510,16 @@ function calendar:create_calendar_widget()
local last_month_length = self:get_last_day_in_month(last_month, year)
for i = last_month_length - months_t[self.date.month].first_day + 2, last_month_length, 1 do
local border = Theme_config.calendar.day.border_color
local bg = Theme_config.calendar.day.bg_unfocus
local fg = Theme_config.calendar.day.fg_unfocus
local border = beautiful.colorscheme.border_color
local bg = beautiful.colorscheme.bg
local fg = beautiful.colorscheme.bg2
local y = tonumber(os.date('%Y'))
local m = tonumber(os.date('%m'))
if (i == self.date.day) and (m == last_month) and (y == year) then
bg = Theme_config.calendar.day.bg_focus
fg = Theme_config.calendar.day.fg_focus
bg = beautiful.colorscheme.bg_teal
fg = beautiful.colorscheme.bg
end
local day = wibox.widget {
@@ -540,7 +542,7 @@ function calendar:create_calendar_widget()
id = 'day_bg',
widget = wibox.container.background,
bg = bg,
shape = Theme_config.calendar.day.shape,
shape = beautiful.shape[4],
fg = fg,
},
widget = wibox.container.place,
@@ -563,11 +565,11 @@ function calendar:create_calendar_widget()
},
id = 'background',
widget = wibox.container.background,
bg = Theme_config.calendar.day.bg_unfocus,
fg = Theme_config.calendar.day.fg_unfocus,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg2,
border_color = border,
border_width = Theme_config.calendar.day.border_width,
shape = Theme_config.calendar.day.shape,
border_width = dpi(2),
shape = beautiful.shape[4],
},
id = 'day',
widget = wibox.container.constraint,
@@ -586,15 +588,15 @@ function calendar:create_calendar_widget()
local row = 1
local col = months_t[self.date.month].first_day
for i = 1, months_t[self.date.month].day_count, 1 do
local border = Theme_config.calendar.day.border_color
local bg = Theme_config.calendar.day.bg
local fg = Theme_config.calendar.day.fg
local border = beautiful.colorscheme.border_color
local bg = beautiful.colorscheme.bg
local fg = beautiful.colorscheme.fg
local m = tonumber(os.date('%m'))
local y = tonumber(os.date('%Y'))
if (i == self.date.day) and (m == self.date.month) and (y == self.date.year) then
bg = Theme_config.calendar.day.bg_focus
fg = Theme_config.calendar.day.fg_focus
bg = beautiful.colorscheme.bg_teal
fg = beautiful.colorscheme.bg
end
local day = wibox.widget {
@@ -617,7 +619,7 @@ function calendar:create_calendar_widget()
id = 'day_bg',
widget = wibox.container.background,
bg = bg,
shape = Theme_config.calendar.day.shape,
shape = beautiful.shape[4],
fg = fg,
},
widget = wibox.container.place,
@@ -638,11 +640,11 @@ function calendar:create_calendar_widget()
},
id = 'background',
widget = wibox.container.background,
bg = Theme_config.calendar.day.bg,
fg = Theme_config.calendar.day.fg,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.fg,
border_color = border,
border_width = Theme_config.calendar.day.border_width,
shape = Theme_config.calendar.day.shape,
border_width = dpi(2),
shape = beautiful.shape[4],
},
widget = wibox.container.constraint,
width = dpi(100),
@@ -668,15 +670,15 @@ function calendar:create_calendar_widget()
end
for i = 1, 7 - months_t[self.date.month].last_day, 1 do
local border = Theme_config.calendar.day.border_color
local bg = Theme_config.calendar.day.bg_unfocus
local fg = Theme_config.calendar.day.fg_unfocus
local border = beautiful.colorscheme.border_color
local bg = beautiful.colorscheme.bg
local fg = beautiful.colorscheme.bg2
local m = tonumber(os.date('%m'))
local y = tonumber(os.date('%Y'))
if (i == self.date.day) and (m == next_month) and (y == year) then
bg = Theme_config.calendar.day.bg_focus
fg = Theme_config.calendar.day.fg_focus
bg = beautiful.colorscheme.bg_teal
fg = beautiful.colorscheme.bg
end
local day = wibox.widget {
{
@@ -698,7 +700,7 @@ function calendar:create_calendar_widget()
id = 'day_bg',
widget = wibox.container.background,
bg = bg,
shape = Theme_config.calendar.day.shape,
shape = beautiful.shape[4],
fg = fg,
},
widget = wibox.container.place,
@@ -719,11 +721,11 @@ function calendar:create_calendar_widget()
},
id = 'background',
widget = wibox.container.background,
bg = Theme_config.calendar.day.bg_unfocus,
fg = Theme_config.calendar.day.fg_unfocus,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg2,
border_color = border,
border_width = Theme_config.calendar.day.border_width,
shape = Theme_config.calendar.day.shape,
border_width = dpi(2),
shape = beautiful.shape[4],
},
widget = wibox.container.constraint,
width = dpi(100),
@@ -752,13 +754,13 @@ function calendar.new(args)
{
widget = wibox.widget.imagebox,
resize = false,
image = gcolor.recolor_image(icondir .. 'add_ical.svg', Theme_config.calendar.add_ical.fg_focus),
image = gcolor.recolor_image(icondir .. 'add_ical.svg', beautiful.colorscheme.bg_red),
halign = 'center',
valign = 'center',
},
id = 'add_ical',
shape = Theme_config.calendar.add_ical.shape,
bg = Theme_config.calendar.add_ical.bg,
shape = beautiful.shape[4],
bg = beautiful.colorscheme.bg_red,
widget = wibox.container.background,
},
widget = wibox.container.margin,
@@ -769,13 +771,13 @@ function calendar.new(args)
{
widget = wibox.widget.imagebox,
resize = false,
image = gcolor.recolor_image(icondir .. 'add_task.svg', Theme_config.calendar.add_task.fg),
image = gcolor.recolor_image(icondir .. 'add_task.svg', beautiful.colorscheme.bg),
halign = 'center',
valign = 'center',
},
id = 'add_task',
shape = Theme_config.calendar.add_task.shape,
bg = Theme_config.calendar.add_task.bg,
shape = beautiful.shape[4],
bg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
widget = wibox.container.margin,
@@ -876,12 +878,12 @@ function calendar.new(args)
layout = wibox.layout.fixed.horizontal,
},
widget = wibox.container.background,
bg = Theme_config.calendar.bg,
border_color = Theme_config.calendar.border_color,
border_width = Theme_config.calendar.border_width,
bg = beautiful.colorscheme.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
border_strategy = 'inner',
fg = Theme_config.calendar.fg,
shape = Theme_config.calendar.shape,
fg = beautiful.colorscheme.fg,
shape = beautiful.shape,
})
ret:get_tasks()

View File

@@ -1,5 +1,6 @@
-- Awesome Libs
local awful = require('awful')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gtable = require('gears.table')
@@ -21,7 +22,7 @@ function task_info.new(args)
local ret = gobject {}
gtable.crush(ret, task_info, true)
args.color = args.color or '#ffffff'
args.color = args.color or beautiful.colorscheme.fg
local date_long_written = os.date('%A, %d. %B %Y', os.time(args.date_start))
@@ -133,9 +134,9 @@ function task_info.new(args)
top = dpi(15),
bottom = dpi(15),
},
bg = Theme_config.calendar.task_info.bg,
fg = Theme_config.calendar.task_info.fg,
shape = Theme_config.calendar.task_info.shape,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.fg,
shape = beautiful.shape[12],
widget = wibox.container.background,
}

View File

@@ -3,7 +3,9 @@
---------------------------------------
-- Awesome Libs
local awful = require('awful')
local apopup = require('awful.popup')
local abutton = awful.button
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local base = require('wibox.widget.base')
@@ -101,8 +103,8 @@ function context_menu:make_entries(wtemplate, entries, spacing)
margins = dpi(5),
widget = wibox.container.margin,
},
bg = Theme_config.desktop.context_menu.entry_bg,
fg = Theme_config.desktop.context_menu.entry_fg,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg_red,
widget = wibox.container.background,
}
@@ -114,7 +116,7 @@ function context_menu:make_entries(wtemplate, entries, spacing)
menu_entry:get_children_by_id('text_role')[1].text = entry.name
if entry.submenu then
menu_entry:get_children_by_id('arrow_role')[1].image =
gcolor.recolor_image(icondir .. 'entry.svg', Theme_config.desktop.context_menu.entry_fg)
gcolor.recolor_image(icondir .. 'entry.svg', beautiful.colorscheme.bg_red)
end
gtable.crush(menu_entry, entry, true)
@@ -133,14 +135,13 @@ function context_menu:make_entries(wtemplate, entries, spacing)
})
if entry.submenu then
menu_entry.popup = awful.popup {
menu_entry.popup = apopup {
widget = self:make_entries(wtemplate, entry.submenu, spacing),
bg = Theme_config.desktop.context_menu.bg,
bg = beautiful.colorscheme.bg,
ontop = true,
fg = Theme_config.desktop.context_menu.fg,
border_width = Theme_config.desktop.context_menu.border_width,
border_color = Theme_config.desktop.context_menu.border_color,
shape = Theme_config.desktop.context_menu.shape,
fg = beautiful.colorscheme.bg_red,
border_width = dpi(2),
border_color = beautiful.colorscheme.border_color,
visible = false,
}
@@ -197,14 +198,13 @@ function context_menu.new(args)
local entries = ret:make_entries(args.widget_template, args.entries, args.spacing)
ret = awful.popup {
ret = apopup {
widget = entries,
bg = Theme_config.desktop.context_menu.bg,
fg = Theme_config.desktop.context_menu.fg,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg_red,
ontop = true,
border_width = Theme_config.desktop.context_menu.border_width,
border_color = Theme_config.desktop.context_menu.border_color,
shape = Theme_config.desktop.context_menu.shape,
border_width = dpi(2),
border_color = beautiful.colorscheme.border_color,
visible = false,
x = capi.mouse.coords().x + 10,
y = capi.mouse.coords().y - 10,

View File

@@ -1,10 +1,11 @@
--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
local tinsert = table.insert
local pairs = pairs
-- Awesome Libs
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local dpi = require('beautiful').xresources.apply_dpi
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local wibox = require('wibox')
local capi = {
@@ -12,93 +13,99 @@ local capi = {
client = client,
}
return function(s, widgets)
local function prepare_widgets(w)
local layout = {
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal,
}
for i, widget in pairs(w) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
elseif i == #w then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
end
local function prepare_widgets(w)
local layout = {
layout = wibox.layout.fixed.horizontal,
}
for i, widget in pairs(w) do
if i == 1 then
tinsert(layout,
{
widget,
left = dpi(6),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
elseif i == #w then
tinsert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
else
tinsert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
end
return layout
end
local top_center = apopup {
screen = s,
widget = prepare_widgets(widgets),
ontop = false,
bg = Theme_config.center_bar.bg,
visible = true,
maximum_width = dpi(500),
placement = function(c) aplacement.top(c, { margins = dpi(10) }) end,
}
top_center:struts {
top = dpi(55),
}
capi.client.connect_signal('manage', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
capi.client.connect_signal('unmanage', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
capi.client.connect_signal('property::selected', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
capi.awesome.connect_signal('refresh', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
return layout
end
return setmetatable({}, {
__call = function(_, s, widgets)
local top_center = apopup {
screen = s,
widget = {
prepare_widgets(widgets),
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(50),
},
ontop = false,
bg = beautiful.colorscheme.bg,
visible = true,
maximum_width = dpi(500),
placement = function(c) aplacement.top(c, { margins = dpi(10) }) end,
}
top_center:struts {
top = dpi(60),
}
capi.client.connect_signal('manage', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
capi.client.connect_signal('unmanage', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
capi.client.connect_signal('property::selected', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
capi.awesome.connect_signal('refresh', function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end)
end,
})

View File

@@ -1,25 +1,28 @@
--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
local setmetatable = setmetatable
local table = table
local ipairs = ipairs
local pairs = pairs
-- Awesome Libs
local lgi = require('lgi')
local Gio = lgi.Gio
local abutton = require('awful.button')
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
local wibox = require('wibox')
local gcolor = require('gears.color')
local awidget = require('awful.widget')
local aplacement = require('awful.placement')
local gtimer = require('gears.timer')
local amenu = require('awful.menu')
local lgi = require('lgi')
local Gio = lgi.Gio
local wibox = require('wibox')
-- Local libs
local config = require('src.tools.config')
local context_menu = require('src.modules.context_menu.init')
local context_menu = require('src.modules.context_menu')
local hover = require('src.tools.hover')
local icon_lookup = require('src.tools.gio_icon_lookup')()
local capi = {
awesome = awesome,
@@ -102,8 +105,8 @@ function dock:get_element_widget(desktop_file)
local GDesktopAppInfo = Gio.DesktopAppInfo.new_from_filename(desktop_file)
local icon = Get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
Get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or ''
local icon = icon_lookup:get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
icon_lookup:get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or ''
local widget = wibox.widget {
{
@@ -118,19 +121,19 @@ function dock:get_element_widget(desktop_file)
id = 'icon_role',
},
widget = wibox.container.constraint,
width = User_config.dock_icon_size,
height = User_config.dock_icon_size,
width = beautiful.user_config.dock_icon_size,
height = beautiful.user_config.dock_icon_size,
},
widget = wibox.container.margin,
margins = dpi(5),
},
widget = wibox.container.constraint,
width = User_config.dock_icon_size + dpi(10), -- + margins
height = User_config.dock_icon_size + dpi(10),
width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact',
},
bg = Theme_config.dock.element.bg,
shape = Theme_config.dock.element.shape,
bg = beautiful.colorscheme.bg1,
shape = beautiful.shape[8],
widget = wibox.container.background,
}
@@ -138,9 +141,9 @@ function dock:get_element_widget(desktop_file)
for _, action in ipairs(Gio.DesktopAppInfo.list_actions(GDesktopAppInfo)) do
table.insert(action_entries, {
name = Gio.DesktopAppInfo.get_action_name(GDesktopAppInfo, action) or '',
icon = Get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
Get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or
gcolor.recolor_image(icondir .. 'entry.svg', Theme_config.dock.cm_icon),
icon = icon_lookup:get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
icon_lookup:get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or
gcolor.recolor_image(icondir .. 'entry.svg', beautiful.colorscheme.bg_yellow),
callback = function()
Gio.DesktopAppInfo.launch_action(GDesktopAppInfo, action)
end,
@@ -149,7 +152,7 @@ function dock:get_element_widget(desktop_file)
table.insert(action_entries, {
name = 'Remove from Dock',
icon = gcolor.recolor_image(icondir .. 'context_menu/entry.svg', Theme_config.dock.cm_icon),
icon = gcolor.recolor_image(icondir .. 'context_menu/entry.svg', beautiful.colorscheme.bg_yellow),
callback = function()
local data = config.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json')
for i, v in ipairs(data) do
@@ -243,11 +246,8 @@ end
---@param args {desktop_file: string} The path to the .desktop file
function dock:pin_element(args)
if not args then return end
local e = args.desktop_file
assert(e, 'No desktop file provided')
self:emit_signal('dock::pin_element', e)
self:write_elements_to_file_async()
@@ -267,19 +267,19 @@ function dock:add_start_element()
id = 'icon_role',
},
widget = wibox.container.constraint,
width = User_config.dock_icon_size,
height = User_config.dock_icon_size,
width = beautiful.user_config.dock_icon_size,
height = beautiful.user_config.dock_icon_size,
},
widget = wibox.container.margin,
margins = dpi(5),
},
widget = wibox.container.constraint,
width = User_config.dock_icon_size + dpi(10), -- + margins
height = User_config.dock_icon_size + dpi(10),
width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact',
},
bg = Theme_config.dock.element.bg,
shape = Theme_config.dock.element.shape,
bg = beautiful.colorscheme.bg1,
shape = beautiful.shape[8],
widget = wibox.container.background,
}
@@ -297,9 +297,6 @@ function dock:add_start_element()
return widget
end
---Unpins an element from the dock by removing it from the pinned table, then writes the table to the file
---emits the signal `dock::unpin_element` then successfully removed from the table
---@param args {desktop_file: string} The path to the .desktop file
function dock:unpin_element(args)
if not args then return end
@@ -367,7 +364,7 @@ local function check_for_dock_hide(self, a_popup)
minimized = false
local y = c:geometry().y
local h = c.height
if (y + h) >= self.screen.geometry.height - User_config.dock_icon_size - 35 then
if (y + h) >= self.screen.geometry.height - beautiful.user_config.dock_icon_size - 35 then
self.visible = false
return
else
@@ -451,7 +448,7 @@ function dock.new(args)
forced_width = dpi(2),
forced_height = dpi(20),
thickness = dpi(2),
color = Theme_config.dock.element.border,
color = beautiful.colorscheme.border_color,
},
{
spacing = dpi(5),
@@ -473,7 +470,7 @@ function dock.new(args)
ontop = true,
visible = true,
placement = function(c) aplacement.bottom(c, { margins = dpi(10) }) end,
bg = Theme_config.dock.bg,
bg = beautiful.colorscheme.bg,
screen = args.screen,
}
@@ -500,7 +497,7 @@ function dock.new(args)
forced_height = dpi(20),
forced_width = dpi(2),
thickness = dpi(2),
color = Theme_config.dock.element.border,
color = beautiful.colorscheme.border_color,
},
widget = wibox.container.margin,
right = dpi(5),
@@ -520,19 +517,19 @@ function dock.new(args)
id = 'icon_role',
},
widget = wibox.container.constraint,
width = User_config.dock_icon_size,
height = User_config.dock_icon_size,
width = beautiful.user_config.dock_icon_size,
height = beautiful.user_config.dock_icon_size,
},
widget = wibox.container.margin,
margins = dpi(5),
},
widget = wibox.container.constraint,
width = User_config.dock_icon_size + dpi(10), -- + margins
height = User_config.dock_icon_size + dpi(10),
width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact',
},
bg = Theme_config.dock.element.bg,
shape = Theme_config.dock.element.shape,
bg = beautiful.colorscheme.bg1,
shape = beautiful.shape[8],
widget = wibox.container.background,
}
@@ -543,15 +540,19 @@ function dock.new(args)
}
element:buttons(gtable.join(
abutton({}, 1, function(c)
if c == client.focus then
c.minimized = true
abutton({}, 1, function()
if client == client.focus then
client.minimized = true
else
c:emit_signal('request::activate', 'tasklist', { raise = true })
if client.first_tag then
client.first_tag:view_only()
end
client:emit_signal('request::activate')
client:raise()
end
end),
abutton({}, 3, function()
amenu.client_list { theme = { width = dpi(250) } }
--TODO: Add context menu with options
end)
))

View File

@@ -1,71 +1,71 @@
--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
local tinsert = table.insert
local ipairs = ipairs
return function(s)
---Lookup function to return the widget from its easy name string
---@param widgets table
---@return widget
local function get_widgets(widgets)
local widget_table = {}
if widgets then
for _, widget in ipairs(widgets) do
if widget == 'Audio' then
table.insert(widget_table, require('src.widgets.audio')(s))
elseif widget == 'Battery' then
table.insert(widget_table, require('src.widgets.battery')(User_config.battery_kind))
elseif widget == 'Bluetooth' then
table.insert(widget_table, require('src.widgets.bluetooth')(s))
elseif widget == 'Clock' then
table.insert(widget_table, require('src.widgets.clock')())
elseif widget == 'Cpu Frequency' then
table.insert(widget_table, require('src.widgets.cpu_info')('freq'))
elseif widget == 'Cpu Temperature' then
table.insert(widget_table, require('src.widgets.cpu_info')('temp'))
elseif widget == 'Cpu Usage' then
table.insert(widget_table, require('src.widgets.cpu_info')('usage'))
elseif widget == 'Date' then
table.insert(widget_table, require('src.widgets.date')(s))
elseif widget == 'Gpu Temperature' then
table.insert(widget_table, require('src.widgets.gpu_info')('temp'))
elseif widget == 'Gpu Usage' then
table.insert(widget_table, require('src.widgets.gpu_info')('usage'))
elseif widget == 'Keyboard Layout' then
table.insert(widget_table, require('src.widgets.kblayout')(s))
elseif widget == 'Tiling Layout' then
table.insert(widget_table, require('src.widgets.layout_list')())
elseif widget == 'Network' then
table.insert(widget_table, require('src.widgets.network') { screen = s })
elseif widget == 'Power Button' then
table.insert(widget_table, require('src.widgets.power')())
elseif widget == 'Ram Usage' then
table.insert(widget_table, require('src.widgets.ram_info')())
elseif widget == 'Systray' then
table.insert(widget_table, require('src.widgets.systray')())
elseif widget == 'Taglist' then
table.insert(widget_table, require('src.widgets.taglist')(s))
elseif widget == 'Tasklist' then
table.insert(widget_table, require('src.widgets.tasklist')(s))
local beautiful = require('beautiful')
return setmetatable({}, {
__call = function(_, s)
local function get_widgets(widgets)
local widget_table = {}
if widgets then
for _, widget in ipairs(widgets) do
if widget == 'Audio' then
tinsert(widget_table, require('src.widgets.audio')(s))
elseif widget == 'Battery' then
tinsert(widget_table, require('src.widgets.battery')(beautiful.user_config.battery_kind))
elseif widget == 'Bluetooth' then
tinsert(widget_table, require('src.widgets.bluetooth')(s))
elseif widget == 'Clock' then
tinsert(widget_table, require('src.widgets.clock') {})
elseif widget == 'Cpu Frequency' then
tinsert(widget_table, require('src.widgets.cpu_info')('freq'))
elseif widget == 'Cpu Temperature' then
tinsert(widget_table, require('src.widgets.cpu_info')('temp'))
elseif widget == 'Cpu Usage' then
tinsert(widget_table, require('src.widgets.cpu_info')('usage'))
elseif widget == 'Date' then
tinsert(widget_table, require('src.widgets.date')(s))
elseif widget == 'Gpu Temperature' then
tinsert(widget_table, require('src.widgets.gpu_info')('temp'))
elseif widget == 'Gpu Usage' then
tinsert(widget_table, require('src.widgets.gpu_info')('usage'))
elseif widget == 'Keyboard Layout' then
tinsert(widget_table, require('src.widgets.kblayout')(s))
elseif widget == 'Tiling Layout' then
tinsert(widget_table, require('src.widgets.layout_list')(s))
elseif widget == 'Network' then
tinsert(widget_table, require('src.widgets.network')(s))
elseif widget == 'Power Button' then
tinsert(widget_table, require('src.widgets.power') {})
elseif widget == 'Ram Usage' then
tinsert(widget_table, require('src.widgets.ram_info') {})
elseif widget == 'Systray' then
tinsert(widget_table, require('src.widgets.systray') {})
elseif widget == 'Taglist' then
tinsert(widget_table, require('src.widgets.taglist')(s))
elseif widget == 'Tasklist' then
tinsert(widget_table, require('src.widgets.tasklist')(s))
end
end
end
return widget_table
end
if beautiful.user_config.crylia_bar then
for index, screen in ipairs(beautiful.user_config.crylia_bar) do
if index == s.index then
if screen.left_bar then
require('src.modules.crylia_bar.left_bar')(s, get_widgets(screen.left_bar))
end
if screen.center_bar then
require('src.modules.crylia_bar.center_bar')(s, get_widgets(screen.center_bar))
end
if screen.right_bar then
require('src.modules.crylia_bar.right_bar')(s, get_widgets(screen.right_bar))
end
end
end
end
return widget_table
end
if User_config.crylia_bar then
for index, screen in ipairs(User_config.crylia_bar) do
if index == s.index then
if screen.left_bar then
require('src.modules.crylia_bar.left_bar')(s, get_widgets(screen.left_bar))
end
if screen.center_bar then
require('src.modules.crylia_bar.center_bar')(s, get_widgets(screen.center_bar))
end
if screen.right_bar then
require('src.modules.crylia_bar.right_bar')(s, get_widgets(screen.right_bar))
end
end
end
end
require('src.modules.crylia_bar.dock') { screen = s }
end
require('src.modules.crylia_bar.dock') { screen = s }
end,
})

View File

@@ -1,66 +1,72 @@
--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
local tinsert = table.insert
local pairs = pairs
-- Awesome Libs
local awful = require('awful')
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
return function(s, w)
local function prepare_widgets(widgets)
local layout = {
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal,
}
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
end
end
return layout
end
local top_left = awful.popup {
screen = s,
widget = prepare_widgets(w),
ontop = false,
bg = Theme_config.left_bar.bg,
visible = true,
maximum_width = dpi(650),
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
}
top_left:struts {
top = dpi(55),
local function prepare_widgets(w)
local layout = {
layout = wibox.layout.fixed.horizontal,
}
Global_config.top_struts = dpi(55)
for i, widget in pairs(w) do
if i == 1 then
tinsert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
elseif i == #w then
tinsert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
else
tinsert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
end
end
return layout
end
return setmetatable({}, {
__call = function(_, s, w)
local top_left = apopup {
screen = s,
widget = {
prepare_widgets(w),
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(50),
},
ontop = false,
bg = beautiful.colorscheme.bg,
visible = true,
maximum_width = dpi(850),
placement = function(c) aplacement.top_left(c, { margins = dpi(10) }) end,
}
top_left:struts {
top = dpi(60),
}
end,
})

View File

@@ -1,65 +1,72 @@
--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
local tinsert = table.insert
local pairs = pairs
-- Awesome Libs
local awful = require('awful')
local dpi = require('beautiful').xresources.apply_dpi
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local wibox = require('wibox')
return function(s, w)
local function prepare_widgets(widgets)
local layout = {
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal,
}
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
end
local function prepare_widgets(w)
local layout = {
layout = wibox.layout.fixed.horizontal,
}
for i, widget in pairs(w) do
if i == 1 then
tinsert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
elseif i == #w then
tinsert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
else
tinsert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin,
})
end
return layout
end
local top_right = awful.popup {
widget = prepare_widgets(w),
ontop = false,
bg = Theme_config.right_bar.bg,
visible = true,
screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
}
top_right:struts {
top = dpi(55),
}
Global_config.top_struts = top_right
return layout
end
return setmetatable({}, {
__call = function(_, s, w)
local top_right = apopup {
widget = {
prepare_widgets(w),
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(50),
},
ontop = false,
bg = beautiful.colorscheme.bg,
visible = true,
screen = s,
placement = function(c) aplacement.top_right(c, { margins = dpi(10) }) end,
}
top_right:struts {
top = dpi(60),
}
end,
})

View File

@@ -4,6 +4,7 @@
local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local gshape = require('gears.shape')
local beautiful = require('beautiful')
return function(s)
---Lookup function to return the widget from its easy name string
@@ -16,13 +17,13 @@ return function(s)
if widget == 'Audio' then
table.insert(widget_table, require('src.widgets.audio')(s))
elseif widget == 'Battery' then
table.insert(widget_table, require('src.widgets.battery')(User_config.battery_kind))
table.insert(widget_table, require('src.widgets.battery')(beautiful.user_config.battery_kind))
elseif widget == 'Bluetooth' then
table.insert(widget_table, require('src.widgets.bluetooth')())
elseif widget == 'Clock' then
table.insert(widget_table, require('src.widgets.clock')())
elseif widget == 'Cpu Frequency' then
table.insert(widget_table, require('src.widgets.cpu_info')('freq', User_config.cpu_frequency))
table.insert(widget_table, require('src.widgets.cpu_info')('freq', beautiful.user_config.cpu_frequency))
elseif widget == 'Cpu Temperature' then
table.insert(widget_table, require('src.widgets.cpu_info')('temp'))
elseif widget == 'Cpu Usage' then
@@ -55,8 +56,8 @@ return function(s)
return widget_table
end
if User_config.crylia_wibox then
for index, screen in ipairs(User_config.crylia_wibox) do
if beautiful.user_config.crylia_wibox then
for index, screen in ipairs(beautiful.user_config.crylia_wibox) do
if index == s.index then
local function prepare_widgets(widgets)
local layout = {
@@ -112,17 +113,15 @@ return function(s)
type = 'desktop',
height = dpi(55),
width = 1920,
bg = '#212121',
bg = beautiful.colorscheme.bg,
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, 8)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(8))
end,
}
w:struts {
bottom = dpi(55),
bottom = dpi(60),
}
Global_config.bottom_struts = dpi(55)
end
end
end

View File

@@ -1,6 +1,7 @@
local Gio = require('lgi').Gio
local awful = require('awful')
local dpi = require('beautiful').xresources.apply_dpi
local beautiful = require('beautiful')
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local grid = require('wibox.layout.grid')
@@ -17,6 +18,7 @@ local capi = {
awesome = awesome,
screen = screen,
}
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/desktop/'
local desktop = { mt = {} }
@@ -88,14 +90,14 @@ end
function desktop:get_grid_index_at(y, x)
local margin_x, margin_y = dpi(10), dpi(10)
local screen_width, screen_height = self.args.screen.geometry.width - margin_x * 2, self.args.screen.geometry.height - dpi(75) - dpi(95) - margin_y * 2
local cell_width, cell_height = screen_width / 20, screen_height / 11
local cell_width, cell_height = screen_width / 15, screen_height / 8
local col = math.floor((x - margin_x) / cell_width) + 1
col = math.min(col, 20)
col = math.min(col, 15)
col = math.max(col, 1)
local row = math.floor((y - margin_y) / cell_height) + 1
row = math.min(row, 11)
row = math.min(row, 8)
row = math.max(row, 1)
return col, row
@@ -159,32 +161,32 @@ function desktop:add_element(args, pos)
entries = {
{
name = 'Open with',
icon = gcolor.recolor_image(icondir .. 'launch.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'launch.svg', beautiful.colorscheme.bg_purple),
submenu = {
--!TODO: Fetch programs and add them as entries
},
},
{
name = 'Copy',
icon = gcolor.recolor_image(icondir .. 'copy.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'copy.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'Cut',
icon = gcolor.recolor_image(icondir .. 'cut.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'cut.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'Rename',
icon = gcolor.recolor_image(icondir .. 'edit.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'edit.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'Remove',
icon = gcolor.recolor_image(icondir .. 'delete.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'delete.svg', beautiful.colorscheme.bg_purple),
callback = function()
self:remove_element(e)
self:save_layout()
@@ -192,7 +194,7 @@ function desktop:add_element(args, pos)
},
{
name = 'Actions',
icon = gcolor.recolor_image(icondir .. 'dots-vertical.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'dots-vertical.svg', beautiful.colorscheme.bg_purple),
submenu = {
-- TODO: fetch actions from desktop file
},
@@ -295,9 +297,7 @@ function desktop:draw_selector()
x = start_pos.x - self.args.screen.geometry.x,
y = start_pos.y - self.args.screen.geometry.y,
visible = true,
shape = function(cr, w, h)
gshape.rounded_rect(cr, w, h, dpi(10))
end,
shape = beautiful.shape[10],
}
selector.point = { x = start_pos.x - self.args.screen.geometry.x, y = start_pos.y - self.args.screen.geometry.y }
self.widget.manual:add(selector)
@@ -359,8 +359,8 @@ function desktop.new(args)
args.icon_size = dpi(48)
local rows = 20
local cols = 11
local rows = 15
local cols = 8
local h_spacing = dpi(10)
local v_spacing = dpi(20)
@@ -449,11 +449,11 @@ function desktop.new(args)
entries = {
{
name = 'Create new',
icon = gcolor.recolor_image(icondir .. 'file_add.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'file_add.svg', beautiful.colorscheme.bg_purple),
submenu = {
{
name = 'Folder',
icon = gcolor.recolor_image(icondir .. 'folder.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'folder.svg', beautiful.colorscheme.bg_purple),
callback = function()
--create a new folder and if it exists add a number to the end
local folder_name = 'New folder'
@@ -475,7 +475,7 @@ function desktop.new(args)
},
{
name = 'File',
icon = gcolor.recolor_image(icondir .. 'file.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'file.svg', beautiful.colorscheme.bg_purple),
callback = function()
--create new text file and if it exists add a number to the end
local file_name = 'New file.txt'
@@ -499,76 +499,76 @@ function desktop.new(args)
},
{
name = 'Terminal',
icon = gcolor.recolor_image(icondir .. 'terminal.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'terminal.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.terminal)
awful.spawn(beautiful.user_config.terminal)
end,
},
{
name = 'Web Browser',
icon = gcolor.recolor_image(icondir .. 'web_browser.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'web_browser.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.web_browser)
awful.spawn(beautiful.user_config.web_browser)
end,
},
{
name = 'File Manager',
icon = gcolor.recolor_image(icondir .. 'file_manager.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'file_manager.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.file_manager)
awful.spawn(beautiful.user_config.file_manager)
end,
},
{
name = 'Text Editor',
icon = gcolor.recolor_image(icondir .. 'text_editor.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'text_editor.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.text_editor)
awful.spawn(beautiful.user_config.text_editor)
end,
},
{
name = 'Music Player',
icon = gcolor.recolor_image(icondir .. 'music_player.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'music_player.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.music_player)
awful.spawn(beautiful.user_config.music_player)
end,
},
{
name = 'Applications',
icon = gcolor.recolor_image(icondir .. 'application.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'application.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'GTK Settings',
icon = gcolor.recolor_image(icondir .. 'gtk_settings.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'gtk_settings.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.gtk_settings)
awful.spawn(beautiful.user_config.gtk_settings)
end,
},
{
name = 'Energy Settings',
icon = gcolor.recolor_image(icondir .. 'energy_settings.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'energy_settings.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.energy_manager)
awful.spawn(beautiful.user_config.energy_manager)
end,
},
{
name = 'Screen Settings',
icon = gcolor.recolor_image(icondir .. 'screen_settings.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'screen_settings.svg', beautiful.colorscheme.bg_purple),
callback = function()
awful.spawn(User_config.screen_settings)
awful.spawn(beautiful.user_config.screen_settings)
end,
},
{
name = 'Reload Awesome',
icon = gcolor.recolor_image(icondir .. 'refresh.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'refresh.svg', beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.restart()
end,
},
{
name = 'Quit',
icon = gcolor.recolor_image(icondir .. 'quit.svg', Theme_config.desktop.context_menu.icon_color),
icon = gcolor.recolor_image(icondir .. 'quit.svg', beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.quit()
end,

View File

@@ -1,4 +1,5 @@
local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gshape = require('gears.shape')
@@ -7,6 +8,8 @@ local lgi = require('lgi')
local cairo = lgi.cairo
local wibox = require('wibox')
local input = require('src.modules.inputbox')
local element = { mt = {} }
function element:layout(_, width, height)
@@ -196,6 +199,12 @@ function element.new(args)
local text_img, size = outlined_text(args.label, args.width)
local inputbox = input {
font = 'JetBrainsMono Nerd Font 12 Regular',
mouse_focus = false,
text = args.label,
}
local w = base.make_widget_from_value(wibox.widget {
{
{
@@ -231,7 +240,7 @@ function element.new(args)
halign = 'center',
widget = wibox.container.place,
},
fg = '#ffffff',
fg = beautiful.colorscheme.fg,
bg = gcolor.transparent,
border_color = gcolor.transparent,
border_width = dpi(2),

View File

@@ -1,45 +1,32 @@
--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
local tinsert = table.insert
local load = load
local ipairs = ipairs
-- Awesome Libs
local awful = require('awful')
local beautiful = require('beautiful')
awful.screen.connect_for_each_screen(function(s)
-- Create 9 tags
awful.layout.append_default_layouts(User_config.layouts)
awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, User_config.layouts[1])
local instance = nil
if not instance then
instance = setmetatable({}, {
__call = function()
awful.screen.connect_for_each_screen(function(s)
local layouts = {}
for _, str in ipairs(beautiful.user_config.layouts) do
tinsert(layouts, load('return ' .. str, nil, 't', { awful = awful })())
end
require('src.modules.desktop.desktop') { screen = s }
require('src.modules.crylia_bar.init')(s)
--require('src.modules.crylia_wibox.init')(s)
require('src.modules.notification-center.init') { screen = s }
--require('src.modules.window_switcher.init')(s)
require('src.modules.application_launcher.init') { screen = s }
end)
awful.layout.append_default_layouts(layouts)
awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, layouts[1])
local ip = require('src.modules.inputbox.init') {
text = 'inputboxtest',
cursor_pos = 4,
highlight = {
start_pos = 1,
end_pos = 4,
},
text_hint = 'Start typing...',
}
--[[ awful.popup {
widget = ip.widget,
bg = '#212121',
visible = true,
screen = 1,
placement = awful.placement.centered,
} ]]
--[[ require('src.modules.inputbox.init') {
text = 'inputboxtest',
cursor_pos = 4,
highlight = {
start_pos = 5,
end_pos = 8,
},
}
]]
require('src.modules.desktop.desktop') { screen = s }
require('src.modules.crylia_bar')(s)
--require('src.modules.crylia_wibox.init')(s)
require('src.modules.notification-center') { screen = s }
--require('src.modules.window_switcher.init') { screen = s }
require('src.modules.application_launcher') { screen = s }
end)
end,
})
end
return instance

View File

@@ -2,6 +2,7 @@ local Pango = require('lgi').Pango
local PangoCairo = require('lgi').PangoCairo
local akey = require('awful.key')
local akeygrabber = require('awful.keygrabber')
local beautiful = require('beautiful')
local cairo = require('lgi').cairo
local gobject = require('gears.object')
local gtable = require('gears.table')
@@ -33,21 +34,10 @@ local function get_subtext_layout(layout, starti, endi)
end
function inputbox.draw_text(self)
local text = self:get_text()
local highlight = self:get_highlight()
local fg_color = { 1, 1, 1, 1 }
local cursor_color = { 1, 1, 1, 1 }
if text == '' then
fg_color = { 0.2, 0.2, 0.2, 1 }
--self._private.layout:set_text(self._private.text_hint)
--local cairo_text = self._private.text_hint
-- Get the text extents from Pango so we don't need to use cairo to get a possibly wrong extent
-- Then draw the text with cairo
--return
end
local _, pango_extent = self._private.layout:get_extents()
local surface = cairo.ImageSurface(cairo.Format.ARGB32, (pango_extent.width / Pango.SCALE) + pango_extent.x + 2, (pango_extent.height / Pango.SCALE) + pango_extent.y)
@@ -56,8 +46,8 @@ function inputbox.draw_text(self)
-- Draw highlight
if highlight.start_pos ~= highlight.end_pos then
cr:set_source_rgb(0, 0, 1)
local sub_extent = get_subtext_layout(self._private.layout, self:get_highlight().start_pos, self:get_highlight().end_pos)
local _, x_offset = self._private.layout:index_to_line_x(self:get_highlight().start_pos, false)
local sub_extent = get_subtext_layout(self._private.layout, highlight.start_pos, highlight.end_pos)
local _, x_offset = self._private.layout:index_to_line_x(highlight.start_pos, false)
cr:rectangle(
x_offset / Pango.SCALE,
pango_extent.y / Pango.SCALE,
@@ -68,23 +58,11 @@ function inputbox.draw_text(self)
end
-- Draw text
if not self.password_mode then
PangoCairo.update_layout(cr, self._private.layout)
cr:set_source_rgba(table.unpack(fg_color))
cr:move_to(0, 0)
PangoCairo.show_layout(cr, self._private.layout)
else
local count = #self._private.layout:get_text()
local passwd_string = ''
for i = 1, count, 1 do
passwd_string = passwd_string .. '🞄'
end
self._private.layout:set_text(passwd_string)
PangoCairo.update_layout(cr, self._private.layout)
cr:set_source_rgba(table.unpack(fg_color))
cr:move_to(0, 0)
PangoCairo.show_layout(cr, self._private.layout)
end
PangoCairo.update_layout(cr, self._private.layout)
cr:set_source_rgba(table.unpack(fg_color))
cr:move_to(0, 0)
PangoCairo.show_layout(cr, self._private.layout)
-- Draw cursor
if self._private.show_cursor then
cr:set_source_rgba(table.unpack(cursor_color))
@@ -141,7 +119,6 @@ function inputbox:start_keygrabber()
self:set_text(text:sub(1, cursor_pos - 1) .. text:sub(cursor_pos + 1))
self:set_cursor_pos(cursor_pos - 1)
end
self:emit_signal('inputbox::keypressed', {}, 'BackSpace')
end,
},
akey { -- Delete highlight or right of cursor
@@ -158,7 +135,6 @@ function inputbox:start_keygrabber()
else
self:set_text(text:sub(1, cursor_pos) .. text:sub(cursor_pos + 2, #text))
end
self:emit_signal('inputbox::keypressed', {}, 'Delete')
end,
},
akey { -- Move cursor to left
@@ -211,8 +187,6 @@ function inputbox:start_keygrabber()
self:set_cursor_pos(cursor_pos - 1)
self:set_highlight(nil, hl.end_pos - 1)
end
print('cursor_pos', self:get_cursor_index(), 'hl.start_pos', self:get_highlight().start_pos, 'hl.end_pos', self:get_highlight().end_pos)
end,
},
akey { -- Highlight to the right
@@ -405,7 +379,6 @@ function inputbox:start_mousegrabber(x, y)
self:set_cursor_pos(index)
mb_start = index
end
print(self:get_highlight().start_pos, self:get_highlight().end_pos)
hl = self:get_highlight()
return m.buttons[1]
end, 'xterm')
@@ -428,7 +401,7 @@ end
function inputbox:set_text(text)
if self:get_text() == text then return end
text = '<span foreground="' .. (self._private.fg or '#ffffff') .. '">' .. text .. '</span>'
text = '<span foreground="' .. (self._private.fg or beautiful.colorscheme.fg) .. '">' .. text .. '</span>'
local attributes, parsed = Pango.parse_markup(text, -1, 0)
@@ -524,7 +497,7 @@ function inputbox.new(args)
trailing = 0,
}
ret._private.fg = args.fg or '#ffffff'
ret._private.fg = args.fg or beautiful.colorscheme.fg
ret._private.highlight = args.highlight or {
start_pos = 0,
end_pos = 0,

View File

@@ -5,6 +5,7 @@
-- Awesome Libs
local abutton = require('awful.button')
local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears').table
local gfilesystem = require('gears').filesystem
@@ -169,7 +170,7 @@ function access_point.new(args)
{
image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(args.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg',
Theme_config.network_manager.access_point.icon_color),
beautiful.colorscheme.bg_red),
id = 'icon',
resize = true,
valign = 'center',
@@ -237,12 +238,12 @@ function access_point.new(args)
margins = dpi(5),
widget = wibox.container.margin,
},
bg = Theme_config.network_manager.access_point.bg,
fg = Theme_config.network_manager.access_point.fg,
border_color = Theme_config.network_manager.access_point.border_color,
border_width = Theme_config.network_manager.access_point.border_width,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg_red,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
id = 'background',
shape = Theme_config.network_manager.access_point.device_shape,
shape = beautiful.shape[8],
widget = wibox.container.background,
})
@@ -270,31 +271,31 @@ function access_point.new(args)
if ret.is_ap_active(ret.NetworkManagerAccessPoint.object_path) then
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg',
Theme_config.network_manager.access_point.icon_color2)
beautiful.colorscheme.bg)
else
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg',
Theme_config.network_manager.access_point.icon_color)
beautiful.colorscheme.bg_red)
end
end
end, 'PropertiesChanged')
if ret:is_ap_active(ret.NetworkManagerAccessPoint) then
ret.bg = Theme_config.network_manager.access_point.fg
ret.fg = Theme_config.network_manager.access_point.bg
ret.bg = beautiful.colorscheme.bg_red
ret.fg = beautiful.colorscheme.bg
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(ret.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg',
Theme_config.network_manager.access_point.icon_color2)
beautiful.colorscheme.bg)
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(
icondir .. 'link.svg', Theme_config.network_manager.access_point.icon_color2)
icondir .. 'link.svg', beautiful.colorscheme.bg)
else
ret.bg = Theme_config.network_manager.access_point.bg
ret.fg = Theme_config.network_manager.access_point.fg
ret.bg = beautiful.colorscheme.bg
ret.fg = beautiful.colorscheme.bg_red
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(ret.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg',
Theme_config.network_manager.access_point.icon_color)
beautiful.colorscheme.bg_red)
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(
icondir .. 'link.svg', Theme_config.network_manager.access_point.icon_color)
icondir .. 'link.svg', beautiful.colorscheme.bg_red)
end
ret.ap_form = ap_form {
@@ -338,7 +339,7 @@ function access_point.new(args)
name = 'ret.device.Connected' and 'Disconnect' or 'Connect',
icon = gcolor.recolor_image('ret.device.Connected' and icondir .. 'link-off.svg' or
icondir .. 'link.svg',
Theme_config.network_manager.access_point.icon_color),
beautiful.colorscheme.bg_red),
callback = function()
ret:toggle_connection(ret.NetworkManagerAccessPoint)
end,

View File

@@ -2,6 +2,7 @@ local abutton = require('awful.button')
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local gcolor = require('gears.color')
@@ -42,7 +43,7 @@ function ap_form.new(args)
{
widget = wibox.widget.textbox,
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid),
font = User_config.font.specify .. ',extra bold 16',
font = beautiful.user_config.font.specify .. ',extra bold 16',
halign = 'center',
valign = 'center',
},
@@ -53,7 +54,7 @@ function ap_form.new(args)
{
{
widget = wibox.widget.imagebox,
image = gcolor.recolor_image(icondir .. 'close.svg', Theme_config.network_manager.form.icon_fg),
image = gcolor.recolor_image(icondir .. 'close.svg', beautiful.colorscheme.bg),
resize = false,
valign = 'center',
halign = 'center',
@@ -62,15 +63,15 @@ function ap_form.new(args)
margins = dpi(5),
},
widget = wibox.container.background,
shape = Theme_config.network_manager.form.close_icon_shape,
shape = beautiful.shape[8],
id = 'close_button',
bg = Theme_config.network_manager.form.close_bg,
bg = beautiful.colorscheme.bg_red,
},
layout = wibox.layout.align.horizontal,
},
widget = wibox.container.background,
bg = Theme_config.network_manager.form.header_bg,
fg = Theme_config.network_manager.form.header_fg,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg_red,
},
{ -- Form
{ -- Password
@@ -100,10 +101,10 @@ function ap_form.new(args)
id = 'const',
},
widget = wibox.container.background,
bg = '#212121',
fg = '#F0F0F0',
border_color = '#414141',
border_width = 2,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.fg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = gshape.rounded_rect,
forced_width = 300,
forced_height = 50,
@@ -117,12 +118,12 @@ function ap_form.new(args)
{
{
checked = false,
shape = Theme_config.network_manager.form.checkbox_shape,
color = Theme_config.network_manager.form.checkbox_fg,
shape = beautiful.shape[4],
color = beautiful.colorscheme.bg,
paddings = dpi(3),
check_color = Theme_config.network_manager.form.checkbox_bg,
border_color = Theme_config.network_manager.form.checkbox_bg,
border_width = 2,
check_color = beautiful.colorscheme.bg_red,
border_color = beautiful.colorscheme.bg_red,
border_width = dpi(2),
id = 'checkbox',
widget = wibox.widget.checkbox,
},
@@ -158,9 +159,9 @@ function ap_form.new(args)
margins = dpi(10),
},
widget = wibox.container.background,
bg = Theme_config.network_manager.form.button_bg,
fg = Theme_config.network_manager.form.button_fg,
shape = Theme_config.network_manager.form.button_shape,
bg = beautiful.colorscheme.bg_blue,
fg = beautiful.colorscheme.bg,
shape = beautiful.shape[8],
id = 'connect_button',
},
widget = wibox.container.margin,
@@ -179,11 +180,10 @@ function ap_form.new(args)
visible = false,
width = dpi(600),
height = dpi(400),
bg = Theme_config.network_manager.form.bg,
fg = Theme_config.network_manager.form.fg,
shape = Theme_config.network_manager.form.shape,
border_color = Theme_config.network_manager.form.border_color,
border_width = Theme_config.network_manager.form.border_width,
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.fg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
type = 'dialog',
screen = args.screen,
}

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local base = require('wibox.widget.base')
local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -168,7 +169,7 @@ function network:scan_access_points()
app_name = 'Network Manager',
title = 'Error: Scan failed!',
message = 'Failed to scan for access points.\n' .. failure,
icon = gcolor.recolor_image(icondir .. 'ethernet.svg', Theme_config.network.icon_color),
icon = gcolor.recolor_image(icondir .. 'ethernet.svg', beautiful.colorscheme.bg),
timeout = 5,
}
return
@@ -239,7 +240,7 @@ function network.new(args)
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.network_manager.wifi_icon_color),
beautiful.colorscheme.bg_red),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -263,11 +264,9 @@ function network.new(args)
layout = wibox.layout.fixed.horizontal,
},
id = 'wifi_bg',
bg = Theme_config.network_manager.wifi_bg,
fg = Theme_config.network_manager.wifi_fg,
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
bg = beautiful.colorscheme.bg1,
fg = beautiful.colorscheme.bg_red,
shape = beautiful.shape[4],
widget = wibox.container.background,
},
id = 'wifi_margin',
@@ -287,8 +286,8 @@ function network.new(args)
margins = dpi(10),
widget = wibox.container.margin,
},
border_color = Theme_config.network_manager.ap_border_color,
border_width = Theme_config.network_manager.ap_border_width,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
@@ -299,7 +298,7 @@ function network.new(args)
{ -- action buttons
{
dnd_widget {
color = Theme_config.network_manager.power_icon_color,
color = beautiful.colorscheme.bg_red,
size = dpi(40),
},
id = 'dnd',
@@ -312,7 +311,7 @@ function network.new(args)
{
{
image = gcolor.recolor_image(icondir .. 'refresh.svg',
Theme_config.network_manager.refresh_icon_color),
beautiful.colorscheme.bg_red),
resize = false,
valign = 'center',
halign = 'center',
@@ -324,11 +323,9 @@ function network.new(args)
id = 'center',
},
border_width = dpi(2),
border_color = Theme_config.network_manager.border_color,
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
bg = Theme_config.network_manager.refresh_bg,
border_color = beautiful.colorscheme.border_color,
shape = beautiful.shape[4],
bg = beautiful.colorscheme.bg,
widget = wibox.container.background,
id = 'refresh',
},
@@ -345,12 +342,10 @@ function network.new(args)
margins = dpi(15),
widget = wibox.container.margin,
},
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(8))
end,
border_color = Theme_config.network_manager.border_color,
border_width = Theme_config.network_manager.border_width,
bg = Theme_config.network_manager.bg,
shape = beautiful.shape[8],
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
bg = beautiful.colorscheme.bg,
id = 'background',
widget = wibox.container.background,
},
@@ -460,14 +455,14 @@ function network.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.network_manager.wifi_icon_color))
beautiful.colorscheme.bg_red))
else
rubato_timer.target = 0
wifi_margin.wifi_bg.shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, true, true, true, true, dpi(4))
end
wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.network_manager.wifi_icon_color))
beautiful.colorscheme.bg_red))
end
end
)

View File

@@ -3,6 +3,7 @@
-------------------------------------
-- Awesome Libs
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gfilesystem = require('gears.filesystem')
local base = require('wibox.widget.base')
@@ -81,7 +82,7 @@ function info_center.new(args)
{
{
{
bg = Theme_config.notification_center.spacing_line.color,
bg = beautiful.colorscheme.bg1,
widget = wibox.container.background,
},
widget = wibox.container.constraint,
@@ -152,8 +153,8 @@ function info_center.new(args)
{
dnd_widget {
text = 'Do not disturb',
color = Theme_config.notification_center.dnd_color,
fg = Theme_config.notification_center.dnd_fg,
color = beautiful.colorscheme.bg_purple,
fg = beautiful.colorscheme.bg_red,
size = dpi(40),
},
id = 'dnd',
@@ -171,11 +172,9 @@ function info_center.new(args)
widget = wibox.widget.textbox,
id = 'clear',
},
fg = Theme_config.notification_center.clear_all_button.fg,
bg = Theme_config.notification_center.clear_all_button.bg,
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, 12)
end,
fg = beautiful.colorscheme.bg,
bg = beautiful.colorscheme.bg_blue,
shape = beautiful.shape[12],
id = 'clear_all_bg',
widget = wibox.container.background,
},
@@ -200,7 +199,7 @@ function info_center.new(args)
},
spacing_widget = {
thickness = dpi(2),
color = Theme_config.notification_center.spacing_color,
color = beautiful.colorscheme.bg1,
span_ratio = 0.9,
widget = wibox.widget.separator,
},
@@ -243,14 +242,14 @@ function info_center.new(args)
end)
w:get_children_by_id('dnd')[1]:get_widget():connect_signal('dnd::toggle', function(enabled)
User_config.dnd = enabled
beautiful.user_config.dnd = enabled
end)
w.container = apopup {
widget = w,
bg = Theme_config.notification_center.bg,
border_color = Theme_config.notification_center.border_color,
border_width = Theme_config.notification_center.border_width,
bg = beautiful.colorscheme.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
placement = function(c)
aplacement.top(c, { margins = dpi(10) })
end,

View File

@@ -7,9 +7,16 @@ local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local naughty = require('naughty')
local gtimer = require('gears.timer')
local beautiful = require('beautiful')
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
local abutton = require('awful.button')
local hover = require('src.tools.hover')
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
return setmetatable({}, {
__call = function()
local ret = wibox.widget {
@@ -19,35 +26,203 @@ return setmetatable({}, {
spacing = dpi(20),
}
--!No, :get_children_by_id() does not work here for some reason, yes I hate it too
--[[ naughty.connect_signal('notification_surface', function(b)
naughty.connect_signal('request::display', function(n)
local start_time = os.time()
local w = wibox.template.make_from_value(b)
w = w:get_widget()
assert(type(w) == 'table', 'w is not a wibox.widget.base')
-- Change the clock to a timer how long ago the notification was created
w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[1] = wibox.widget {
text = 'now',
font = 'JetBrainsMono Nerd Font, Bold 12',
halign = 'center',
valign = 'center',
widget = wibox.widget.textbox,
local color = beautiful.colorscheme.bg_blue
local w = wibox.widget {
{
{
{
{ -- Title
{
{
{ -- Icon
{
{
{
{
notification = n,
widget = naughty.widget.icon,
image = n.icon,
resize = true,
},
widget = wibox.container.background,
shape = beautiful.shape[4],
},
widget = wibox.container.place,
},
widget = wibox.container.constraint,
strategy = 'exact',
width = dpi(20),
height = dpi(20),
},
{ -- Title
{
notification = n,
widget = naughty.widget.title,
markup = [[<span foreground="]] ..
beautiful.colorscheme.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or
'Unknown App') .. [[</span> | <span font="JetBrainsMono Nerd Font, Regular 16">]] .. (n.title or 'System Notification') .. [[</span>]],
halign = 'left',
valign = 'center',
},
widget = wibox.container.constraint,
width = dpi(430),
height = dpi(35),
strategy = 'max',
},
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal,
},
widget = wibox.container.margin,
left = dpi(10),
},
nil,
{
{
{ -- Clock
widget = wibox.widget.textbox,
test = 'now',
font = 'JetBrainsMono Nerd Font, Bold 12',
fg = beautiful.colorscheme.bg,
halign = 'center',
valign = 'center',
id = 'timer',
},
{ -- Close button
{
{
{
{
widget = wibox.widget.imagebox,
image = gcolor.recolor_image(icondir .. 'close.svg', beautiful.colorscheme.bg),
resize = true,
halign = 'center',
valign = 'center',
},
start_angle = 4.71239,
thickness = dpi(2),
min_value = 0,
max_value = 1,
value = 1,
widget = wibox.container.arcchart,
id = 'arc',
},
fg = beautiful.colorscheme.bg,
bg = color,
widget = wibox.container.background,
id = 'arc_bg',
},
strategy = 'exact',
width = dpi(18),
height = dpi(18),
widget = wibox.container.constraint,
},
id = 'close',
visible = false,
left = dpi(5),
widget = wibox.container.margin,
},
layout = wibox.layout.fixed.horizontal,
},
right = dpi(5),
widget = wibox.container.margin,
},
layout = wibox.layout.align.horizontal,
},
widget = wibox.container.background,
bg = color,
fg = beautiful.colorscheme.bg,
shape = beautiful.shape[8],
},
{ -- Main body
{ -- Image
{
{
notification = n,
image = n.icon,
valign = 'center',
halign = 'center',
upscale = true,
resize_strategy = 'scale',
widget = naughty.widget.icon,
},
widget = wibox.container.background,
shape = beautiful.shape[10],
},
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(96),
width = dpi(96),
},
{
{
notification = n,
widget = naughty.widget.message,
font = 'JetBrainsMono Nerd Font, Regular 10',
halign = 'left',
valign = 'center',
},
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(96),
},
spacing = dpi(15),
layout = wibox.layout.fixed.horizontal,
},
{ -- Spacer
{
widget = wibox.container.background,
bg = beautiful.colorscheme.bg,
},
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(2),
},
spacing = dpi(15),
id = 'main_layout',
layout = wibox.layout.fixed.vertical,
},
widget = wibox.container.margin,
margins = dpi(15),
},
bg = beautiful.colorscheme.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[8],
widget = wibox.container.background,
},
widget = wibox.container.constraint,
strategy = 'exact',
width = dpi(600),
}
hover.bg_hover { widget = w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[2].children[1].children[1] }
w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[2]:connect_signal('button::press', function()
ret:remove_widgets(w)
ret:emit_signal('new_children')
local close = w:get_children_by_id('close')[1]
w:connect_signal('mouse::enter', function()
close.visible = true
--w:get_children_by_id('timer')[1].visible = false
end)
w:connect_signal('mouse::leave', function()
close.visible = false
--w:get_children_by_id('timer')[1].visible = true
end)
hover.bg_hover(close.children[1])
close:buttons(gtable.join(
abutton({}, 1, function()
ret:remove_widgets(w)
ret:emit_signal('new_children')
end)
))
gtimer {
timeout = 1,
autostart = true,
call_now = true,
callback = function()
local time_ago = math.floor(os.time() - start_time)
local timer_text = w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[1]
local timer_text = w:get_children_by_id('timer')[1]
if time_ago < 5 then
timer_text:set_text('now')
elseif time_ago < 60 then
@@ -64,7 +239,7 @@ return setmetatable({}, {
ret:add(w)
ret:emit_signal('new_children')
end) ]]
end)
return ret
end,

View File

@@ -4,6 +4,7 @@
-- Awesome Libs
local aspawn = require('awful.spawn')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -30,9 +31,7 @@ if not instance then
image = gsurface.load_uncached(gfilesystem.get_configuration_dir() .. 'src/assets/userpfp/userpfp.png'),
valign = 'center',
halign = 'center',
clip_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(12))
end,
clip_shape = beautiful.shape[12],
widget = wibox.widget.imagebox,
},
strategy = 'exact',
@@ -46,10 +45,11 @@ if not instance then
{
{ -- Username
image = gcolor.recolor_image(icondir .. 'user.svg',
Theme_config.notification_center.profile.username_icon_color),
beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
resize = false,
resize = true,
width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- Username
@@ -64,10 +64,11 @@ if not instance then
{
{
image = gcolor.recolor_image(icondir .. 'laptop.svg',
Theme_config.notification_center.profile.os_prefix_icon_color),
beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
resize = false,
resize = true,
width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- OS
@@ -82,10 +83,11 @@ if not instance then
{
{
image = gcolor.recolor_image(icondir .. 'penguin.svg',
Theme_config.notification_center.profile.kernel_icon_color),
beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
resize = false,
resize = true,
width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- Kernel
@@ -100,10 +102,11 @@ if not instance then
{
{
image = gcolor.recolor_image(icondir .. 'clock.svg',
Theme_config.notification_center.profile.uptime_icon_color),
beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
resize = false,
resize = true,
width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- Uptime
@@ -124,10 +127,10 @@ if not instance then
},
widget = wibox.layout.fixed.vertical,
},
fg = Theme_config.notification_center.profile.fg,
border_color = Theme_config.notification_center.profile.border_color,
border_width = Theme_config.notification_center.profile.border_width,
shape = Theme_config.notification_center.profile.shape,
fg = beautiful.colorscheme.bg_green,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[12],
widget = wibox.container.background,
},
strategy = 'exact',

View File

@@ -3,6 +3,7 @@
---------------------------
-- Awesome Libs
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local gfilesystem = require('gears.filesystem')
@@ -29,9 +30,7 @@ return setmetatable({}, { __call = function()
{
image = icondir .. 'default_image.svg',
resize = true,
clip_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(8))
end,
clip_shape = beautiful.shape[8],
valign = 'center',
halign = 'center',
widget = wibox.widget.imagebox,
@@ -53,7 +52,7 @@ return setmetatable({}, { __call = function()
id = 'title',
widget = wibox.widget.textbox,
},
fg = Theme_config.notification_center.song_info.title_fg,
fg = beautiful.colorscheme.bg_red,
widget = wibox.container.background,
},
strategy = 'max',
@@ -72,7 +71,7 @@ return setmetatable({}, { __call = function()
text = 'Unknown Artist',
widget = wibox.widget.textbox,
},
fg = Theme_config.notification_center.song_info.artist_fg,
fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
strategy = 'max',
@@ -86,7 +85,7 @@ return setmetatable({}, { __call = function()
{
resize = false,
image = gcolor.recolor_image(icondir .. 'shuffle.svg',
Theme_config.notification_center.song_info.shuffle_disabled),
beautiful.colorscheme.bg1),
valign = 'center',
halign = 'center',
id = 'shuffle',
@@ -97,7 +96,7 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
id = 'prev',
image = gcolor.recolor_image(icondir .. 'skip-prev.svg', Theme_config.notification_center.song_info.prev_enabled),
image = gcolor.recolor_image(icondir .. 'skip-prev.svg', beautiful.colorscheme.bg_teal),
widget = wibox.widget.imagebox,
},
{
@@ -106,7 +105,7 @@ return setmetatable({}, { __call = function()
halign = 'center',
id = 'play_pause',
image = gcolor.recolor_image(icondir .. 'play-pause.svg',
Theme_config.notification_center.song_info.play_enabled),
beautiful.colorscheme.bg_teal),
widget = wibox.widget.imagebox,
},
{
@@ -114,12 +113,12 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
id = 'next',
image = gcolor.recolor_image(icondir .. 'skip-next.svg', Theme_config.notification_center.song_info.next_enabled),
image = gcolor.recolor_image(icondir .. 'skip-next.svg', beautiful.colorscheme.bg_teal),
widget = wibox.widget.imagebox,
},
{
resize = false,
image = gcolor.recolor_image(icondir .. 'repeat.svg', Theme_config.notification_center.song_info.repeat_disabled),
image = gcolor.recolor_image(icondir .. 'repeat.svg', beautiful.colorscheme.bg1),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -146,7 +145,7 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
},
fg = Theme_config.notification_center.song_info.duration_fg,
fg = beautiful.colorscheme.bg_teal,
widget = wibox.container.background,
},
right = dpi(10),
@@ -154,15 +153,13 @@ return setmetatable({}, { __call = function()
},
{ -- Progressbar
{
color = Theme_config.notification_center.song_info.progress_color,
background_color = Theme_config.notification_center.song_info.progress_background_color,
color = beautiful.colorscheme.bg_purple,
background_color = beautiful.colorscheme.bg1,
max_value = 100,
value = 0,
id = 'progress',
forced_height = dpi(5),
shape = function(cr, width)
gshape.rounded_bar(cr, width, dpi(5))
end,
shape = beautiful.shape[4],
widget = wibox.widget.progressbar,
},
widget = wibox.container.place,
@@ -176,7 +173,7 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
},
fg = Theme_config.notification_center.song_info.duration_fg,
fg = beautiful.colorscheme.bg_teal,
widget = wibox.container.background,
},
left = dpi(10),
@@ -189,9 +186,9 @@ return setmetatable({}, { __call = function()
widget = wibox.container.margin,
margins = dpi(10),
},
border_color = Theme_config.notification_center.song_info.border_color,
border_width = Theme_config.notification_center.song_info.border_width,
shape = Theme_config.notification_center.song_info.shape,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[12],
widget = wibox.container.background,
},
widget = wibox.container.margin,

View File

@@ -4,6 +4,7 @@
-- Awesome Libs
local awful = require('awful')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears')
local wibox = require('wibox')
@@ -39,8 +40,8 @@ return setmetatable({}, { __call = function()
{
{
{ --Bar
color = Theme_config.notification_center.status_bar.cpu_usage_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
color = beautiful.colorscheme.bg_teal,
background_color = beautiful.colorscheme.bg1,
max_value = 100,
value = 0,
forced_height = dpi(8),
@@ -99,13 +100,15 @@ return setmetatable({}, { __call = function()
if widget == 'cpu_usage' then
cpu_usage:connect_signal('update::cpu_usage', function(_, v)
if not v then return nil end
tooltip.text = 'CPU Usage: ' .. v .. '%'
rubato_timer.target = v
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/cpu.svg',
Theme_config.notification_center.status_bar.cpu_usage_color)
beautiful.colorscheme.bg_teal)
end)
elseif widget == 'cpu_temp' then
cpu_temp:connect_signal('update::cpu_temp', function(_, v)
if not v then return nil end
local temp_icon
if v < 50 then
temp_icon = icondir .. 'cpu/thermometer-low.svg'
@@ -115,29 +118,31 @@ return setmetatable({}, { __call = function()
temp_icon = icondir .. 'cpu/thermometer-high.svg'
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon,
Theme_config.notification_center.status_bar.cpu_temp_color)
beautiful.colorscheme.bg_blue)
tooltip.text = 'CPU Temp: ' .. v .. '°C'
rubato_timer.target = v
end)
elseif widget == 'ram_usage' then
ram:connect_signal('update::ram_widget', function(_, MemTotal, _, MemAvailable)
if not MemTotal and MemAvailable then return nil end
if not MemTotal or not MemAvailable then return end
local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5)
tooltip.text = 'RAM Usage: ' .. ram_usage .. '%'
rubato_timer.target = ram_usage
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/ram.svg',
Theme_config.notification_center.status_bar.ram_usage_color)
beautiful.colorscheme.bg_red)
end)
elseif widget == 'gpu_usage' then
gpu_usage:connect_signal('update::gpu_usage', function(_, v)
if not v then return end
if not v then return nil end
tooltip.text = 'GPU Usage: ' .. v .. '%'
rubato_timer.target = tonumber(v)
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/gpu.svg',
Theme_config.notification_center.status_bar.gpu_usage_color)
beautiful.colorscheme.bg_green)
end)
elseif widget == 'gpu_temp' then
gpu_temp:connect_signal('update::gpu_temp', function(_, v)
if not v then return nil end
local temp_icon, temp_num
if v then
@@ -154,12 +159,13 @@ return setmetatable({}, { __call = function()
temp_icon = icondir .. 'cpu/thermometer-low.svg'
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon,
Theme_config.notification_center.status_bar.gpu_temp_color)
beautiful.colorscheme.bg_green)
tooltip.text = 'GPU Temp: ' .. temp_num .. '°C'
rubato_timer.target = temp_num
end)
elseif widget == 'volume' then
audio:connect_signal('sink::get', function(_, muted, volume)
if not volume and muted then return nil end
local icon = icondir .. 'audio/volume'
volume = tonumber(volume)
if not volume then
@@ -179,12 +185,13 @@ return setmetatable({}, { __call = function()
end
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg',
Theme_config.notification_center.status_bar.volume_color)
beautiful.colorscheme.bg_yellow)
tooltip.text = 'Volume: ' .. volume .. '%'
rubato_timer.target = volume
end)
elseif widget == 'microphone' then
audio:connect_signal('source::get', function(_, muted, volume)
if not volume and muted then return nil end
if not volume then
return
end
@@ -197,12 +204,13 @@ return setmetatable({}, { __call = function()
icon = icon .. '-off'
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg',
Theme_config.notification_center.status_bar.microphone_color)
beautiful.colorscheme.bg_blue)
tooltip.text = 'Microphone: ' .. volume .. '%'
rubato_timer.target = volume
end)
elseif widget == 'backlight' then
backlight:connect_signal('brightness::get', function(_, v)
if not v then return nil end
local icon = icondir .. 'brightness'
if v >= 0 and v < 34 then
icon = icon .. '-low'
@@ -212,18 +220,19 @@ return setmetatable({}, { __call = function()
icon = icon .. '-high'
end
w:get_children_by_id('image_role')[1]:set_image(gears.color.recolor_image(icon .. '.svg',
Theme_config.notification_center.status_bar.backlight_color))
beautiful.colorscheme.bg_purple))
tooltip.text = 'Backlight: ' .. v .. '%'
rubato_timer.target = v
end)
elseif widget == 'battery' then
--[[ battery:connect_signal('update::battery_widget', function(battery, battery_icon)
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(battery_icon,
Theme_config.notification_center.status_bar.battery_color)
beautiful.colorscheme.bg_purple)
tooltip.text = 'Battery: ' .. battery .. '%'
rubato_timer.target = battery
end) ]]
end
table.insert(bar_layout, w)
end
@@ -236,7 +245,7 @@ return setmetatable({}, { __call = function()
{
{
{
create_bar_layout(User_config.status_bar_widgets),
create_bar_layout(beautiful.user_config.status_bar_widgets),
width = dpi(480),
strategy = 'exact',
widget = wibox.container.constraint,
@@ -246,9 +255,9 @@ return setmetatable({}, { __call = function()
magins = dpi(10),
layout = wibox.container.margin,
},
border_color = Theme_config.notification_center.status_bar.border_color,
border_width = Theme_config.notification_center.status_bar.border_width,
shape = Theme_config.notification_center.status_bar.shape,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[12],
widget = wibox.container.background,
},
widget = wibox.container.constraint,

View File

@@ -3,6 +3,7 @@
--------------------------------
-- Awesome Libs
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local gfilesystem = require('gears.filesystem')
@@ -82,12 +83,12 @@ if not instance then
widget = wibox.widget.textbox,
id = 'description',
},
fg = Theme_config.notification_center.weather.description_fg,
fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
{ -- line
{
bg = Theme_config.notification_center.weather.line_color,
bg = beautiful.colorscheme.bg1,
widget = wibox.container.background,
},
widget = wibox.container.constraint,
@@ -99,7 +100,7 @@ if not instance then
{ -- Speed
{
image = gcolor.recolor_image(icondir .. 'weather-windy.svg',
Theme_config.notification_center.weather.speed_icon_color),
beautiful.colorscheme.bg_red),
valign = 'center',
halign = 'center',
widget = wibox.widget.imagebox,
@@ -127,7 +128,7 @@ if not instance then
valign = 'center',
halign = 'center',
image = gcolor.recolor_image(icondir .. 'humidity.svg',
Theme_config.notification_center.weather.humidity_icon_color),
beautiful.colorscheme.bg_red),
},
widget = wibox.container.constraint,
width = dpi(24),
@@ -154,9 +155,9 @@ if not instance then
},
widget = wibox.container.place,
},
border_color = Theme_config.notification_center.weather.border_color,
border_width = Theme_config.notification_center.weather.border_width,
shape = Theme_config.notification_center.weather.shape,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
shape = beautiful.shape[12],
widget = wibox.container.background,
},
top = dpi(20),
@@ -176,7 +177,7 @@ if not instance then
call_now = true,
callback = function()
aspawn.easy_async_with_shell("curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" ..
User_config.weather_secrets.city_id .. '&units=' .. User_config.weather_secrets.unit .. '&appid=' .. User_config.weather_secrets.key .. "'",
beautiful.user_config.weather_secrets.city_id .. '&units=' .. beautiful.user_config.weather_secrets.unit .. '&appid=' .. beautiful.user_config.weather_secrets.key .. "'",
function(stdout)
if not stdout:match('error') then
local weather_metadata = json_lua:decode(stdout)

View File

@@ -7,6 +7,7 @@ local abutton = require('awful.button')
local akey = require('awful.key')
local akeygrabber = require('awful.keygrabber')
local aspawn = require('awful.spawn')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
@@ -31,27 +32,27 @@ local function get_button(type)
if type == 'shutdown' then
icon = icondir .. 'shutdown.svg'
name = 'Shutdown'
bg_color = Theme_config.powermenu.shutdown_button_bg
bg_color = beautiful.colorscheme.bg_blue
command = 'shutdown now'
elseif type == 'reboot' then
icon = icondir .. 'reboot.svg'
name = 'Reboot'
bg_color = Theme_config.powermenu.reboot_button_bg
bg_color = beautiful.colorscheme.bg_red
command = 'reboot'
elseif type == 'logout' then
icon = icondir .. 'logout.svg'
name = 'Logout'
bg_color = Theme_config.powermenu.logout_button_bg
bg_color = beautiful.colorscheme.bg_yellow
command = 'awesome-client "awesome.quit()"'
elseif type == 'lock' then
icon = icondir .. 'lock.svg'
name = 'Lock'
bg_color = Theme_config.powermenu.lock_button_bg
bg_color = beautiful.colorscheme.bg_green
command = 'dm-tool lock'
elseif type == 'suspend' then
icon = icondir .. 'suspend.svg'
name = 'Suspend'
bg_color = Theme_config.powermenu.suspend_button_bg
bg_color = beautiful.colorscheme.bg_purple
command = 'systemctl suspend'
end
@@ -81,9 +82,9 @@ local function get_button(type)
margins = dpi(10),
widget = wibox.container.margin,
},
fg = Theme_config.powermenu.button_fg,
fg = beautiful.colorscheme.bg,
bg = bg_color,
shape = Theme_config.powermenu.button_shape,
shape = beautiful.shape[12],
widget = wibox.container.background,
id = 'background',
},
@@ -117,7 +118,7 @@ function powermenu.new()
{
image = icondir .. 'defaultpfp.svg',
resize = true,
clip_shape = Theme_config.powermenu.profile_picture_shape,
clip_shape = beautiful.shape[30],
valign = 'center',
halign = 'center',
id = 'icon_role',
@@ -159,7 +160,7 @@ function powermenu.new()
type = 'splash',
visible = false,
ontop = true,
bg = Theme_config.powermenu.container_bg,
bg = beautiful.colorscheme.bg .. '88',
height = capi.screen.primary.geometry.height,
width = capi.screen.primary.geometry.width,
x = capi.screen.primary.geometry.x,
@@ -201,7 +202,7 @@ function powermenu.new()
end
end)
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userName' '" .. User_config.namestyle .. "'", function(stdout)
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userName' '" .. beautiful.user_config.namestyle .. "'", function(stdout)
w:get_children_by_id('text_role')[1].text = stdout:gsub('\n', '')
end)

View File

@@ -3,19 +3,30 @@
---------------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gshape = require('gears.shape')
local gsurface = require('gears.surface')
local gtable = require('gears.table')
local wibox = require('wibox')
local gobject = require('gears.object')
local base = require('wibox.widget.base')
local gtimer = require('gears.timer')
local cairo = require('lgi').cairo
local awidget = require('awful.widget')
local capi = {
awesome = awesome,
client = client,
mouse = mouse,
}
local window_elements = require("src.modules.window_switcher.window_elements")()
--local window_elements = require("src.modules.window_switcher.window_elements")()
return function(s)
--[[ return function(s)
local window_switcher_list = wibox.widget {
window_elements,
@@ -33,9 +44,9 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
placement = awful.placement.centered,
bg = Theme_config.window_switcher.bg,
border_color = Theme_config.window_switcher.border_color,
border_width = Theme_config.window_switcher.border_width
bg = beautiful.colorscheme.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2)
}
window_switcher_container:setup {
@@ -51,4 +62,94 @@ return function(s)
end
end
)
end ]]
local client_preview = {}
function client_preview:toggle()
self.visible = not self.visible
end
return setmetatable(client_preview, {
__call = function(...)
local args = ...
local w = gobject {}
gtable.crush(w, client_preview, true)
--[[ local tl = awidget.tasklist {
screen = 1,
layout = wibox.layout.fixed.horizontal,
filter = awidget.tasklist.filter.alltags,
update_function = function(widget, _, _, _, clients)
widget:reset()
for _, c in ipairs(clients) do
local tw = wibox.widget {
{
{
{
{
widget = wibox.widget.imagebox,
resize = true,
id = c.instance,
},
widget = wibox.container.constraint,
height = dpi(256),
strategy = 'exact',
},
widget = wibox.container.place,
},
widget = wibox.container.margin,
margins = dpi(20),
},
widget = wibox.container.background,
bg = '#414141',
id = c.pid,
shape = gshape.rounded_rect,
}
gtimer {
timeout = 1 / 24,
autostart = true,
callback = function()
local content = gsurface(c.content)
local cr = cairo.Context(content)
local x, y, w, h = cr:clip_extents()
local img = cairo.ImageSurface.create(cairo.Format.ARGB32, w - x, h - y)
cr = cairo.Context(img)
cr:set_source_surface(content, 0, 0)
cr.operator = cairo.Operator.SOURCE
cr:paint()
local cont = tw:get_children_by_id('icon_role')[1]
if cont then
cont.image = gsurface.load(img)
return
end
end,
}
widget:add(tw)
end
return widget
end,
} ]]
w.popup = apopup {
widget = {},
ontop = true,
visible = true,
screen = args.screen,
placement = aplacement.centered,
bg = beautiful.colorscheme.bg,
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
}
return w
end,
})

View File

@@ -4,6 +4,7 @@
-- Awesome Libs
local awful = require('awful')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears')
local wibox = require('wibox')
@@ -91,13 +92,11 @@ return function()
margins = dpi(20),
widget = wibox.container.margin,
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
border_color = Theme_config.window_switcher.border_color,
border_width = Theme_config.window_switcher.border_width,
bg = Theme_config.window_switcher.bg,
fg = Theme_config.window_switcher.element_fg,
shape = beautiful.shape[12],
border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
bg = beautiful.colorscheme.bg,
fg = beautiful.colorscheme.bg_green,
widget = wibox.container.background,
}
@@ -119,7 +118,7 @@ return function()
local b_timed_bg = rubato.timed { duration = 0.5 }
-- starting color
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.bg)
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
-- Foreground rubato init
@@ -128,7 +127,7 @@ return function()
local b_timed_fg = rubato.timed { duration = 0.5 }
-- starting color
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.element_fg)
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
-- Border rubato init
local r_timed_border = rubato.timed { duration = 0.5 }
@@ -136,7 +135,7 @@ return function()
local b_timed_border = rubato.timed { duration = 0.5 }
-- starting color
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme
.border_color)
local function set_bg(newbg)
@@ -176,29 +175,26 @@ return function()
b_timed_border:subscribe(update_border)
if i == selected then
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.bg)
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.element_fg)
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
.border_color)
set_border(Theme_config.window_switcher.selected_border_color)
set_fg(Theme_config.window_switcher.selected_fg)
set_bg(Theme_config.window_switcher.selected_bg)
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.border_color)
set_border(beautiful.colorscheme.bg_purple)
set_fg(beautiful.colorscheme.fg)
set_bg(beautiful.colorscheme.bg1)
elseif i == selected - 1 or (selected == 1 and i == #clients_sorted) then
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.selected_bg)
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.selected_fg)
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
.selected_border_color)
set_border(Theme_config.window_switcher.border_color)
set_fg(Theme_config.window_switcher.element_fg)
set_bg(Theme_config.window_switcher.bg)
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg1)
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.fg)
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_purple)
set_border(beautiful.colorscheme.border_color)
set_fg(beautiful.colorscheme.bg_green)
set_bg(beautiful.colorscheme.bg)
else
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.bg)
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.element_fg)
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
.border_color)
set_border(Theme_config.window_switcher.border_color)
set_fg(Theme_config.window_switcher.element_fg)
set_bg(Theme_config.window_switcher.bg)
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.border_color)
set_border(beautiful.colorscheme.border_color)
set_fg(beautiful.colorscheme.bg_green)
set_bg(beautiful.colorscheme.bg)
end
end
elseif fn == 'raise' then