Initial commit

This commit is contained in:
jorraan committed 2021-11-29 19:57:00 +11:00
1 parent ed88af090f
commit 05c9c7fc71
448 files changed
+46802

No files matched your search

+70
View File
@@ -0,0 +1,70 @@
local awful = require('awful')
local left_panel = require('layout.left-panel')
local top_panel = require('layout.top-panel')
local right_panel = require('layout.right-panel')
-- Create a wibox panel for each screen and add it
screen.connect_signal(
'request::desktop_decoration',
function(s)
if s.index == 1 then
s.left_panel = left_panel(s)
s.top_panel = top_panel(s, true)
else
s.top_panel = top_panel(s, false)
end
s.right_panel = right_panel(s)
s.right_panel_show_again = false
end
)
-- Hide bars when app go fullscreen
function update_bars_visibility()
for s in screen do
if s.selected_tag then
local fullscreen = s.selected_tag.fullscreen_mode
-- Order matter here for shadow
s.top_panel.visible = not fullscreen
if s.left_panel then
s.left_panel.visible = not fullscreen
end
if s.right_panel then
if fullscreen and s.right_panel.visible then
s.right_panel:toggle()
s.right_panel_show_again = true
elseif not fullscreen and not s.right_panel.visible and s.right_panel_show_again then
s.right_panel:toggle()
s.right_panel_show_again = false
end
end
end
end
end
tag.connect_signal(
'property::selected',
function(t)
update_bars_visibility()
end
)
client.connect_signal(
'property::fullscreen',
function(c)
if c.first_tag then
c.first_tag.fullscreen_mode = c.fullscreen
end
update_bars_visibility()
end
)
client.connect_signal(
'unmanage',
function(c)
if c.fullscreen then
c.screen.selected_tag.fullscreen_mode = false
update_bars_visibility()
end
end
)
+72
View File
@@ -0,0 +1,72 @@
local awful = require('awful')
local beautiful = require('beautiful')
local wibox = require('wibox')
local gears = require('gears')
local dpi = beautiful.xresources.apply_dpi
local icons = require('theme.icons')
local tag_list = require('widget.tag-list')
local clickable_container = require('widget.clickable-container')
return function(s, panel, action_bar_width)
local menu_icon = wibox.widget {
{
id = 'menu_btn',
image = icons.menu,
resize = true,
widget = wibox.widget.imagebox
},
margins = dpi(10),
widget = wibox.container.margin
}
local open_dashboard_button = wibox.widget {
{
menu_icon,
widget = clickable_container
},
bg = beautiful.background .. '66',
widget = wibox.container.background
}
open_dashboard_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
panel:toggle()
end
)
)
)
panel:connect_signal(
'opened',
function()
menu_icon.menu_btn:set_image(gears.surface(icons.close_small))
end
)
panel:connect_signal(
'closed',
function()
menu_icon.menu_btn:set_image(gears.surface(icons.menu))
end
)
return wibox.widget {
id = 'action_bar',
layout = wibox.layout.align.vertical,
forced_width = action_bar_width,
{
require('widget.search-apps')(),
tag_list(s),
require("widget.xdg-folders")(),
layout = wibox.layout.fixed.vertical,
},
nil,
open_dashboard_button
}
end
@@ -0,0 +1,47 @@
local wibox = require('wibox')
local gears = require('gears')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local hardware_header = wibox.widget {
text = 'Hardware Monitor',
font = 'Inter Regular 12',
align = 'left',
valign = 'center',
widget = wibox.widget.textbox
}
return wibox.widget {
layout = wibox.layout.fixed.vertical,
{
{
hardware_header,
left = dpi(24),
right = dpi(24),
widget = wibox.container.margin
},
bg = beautiful.groups_title_bg,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, beautiful.groups_radius)
end,
forced_height = dpi(35),
widget = wibox.container.background
},
{
{
layout = wibox.layout.fixed.vertical,
require('widget.cpu-meter'),
require('widget.ram-meter'),
require('widget.temperature-meter'),
require('widget.harddrive-meter')
},
bg = beautiful.groups_bg,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, beautiful.groups_radius)
end,
widget = wibox.container.background
}
}
@@ -0,0 +1,80 @@
local awful = require('awful')
local wibox = require('wibox')
local gears = require('gears')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local clickable_container = require('widget.clickable-container')
local icons = require('theme.icons')
return function(_, panel)
local search_widget = wibox.widget {
{
{
{
image = icons.search,
resize = true,
widget = wibox.widget.imagebox
},
top = dpi(12),
bottom = dpi(12),
widget = wibox.container.margin
},
{
text = 'Global Search',
font = 'Inter Regular 12',
align = 'left',
valign = 'center',
widget = wibox.widget.textbox
},
spacing = dpi(24),
layout = wibox.layout.fixed.horizontal
},
left = dpi(24),
right = dpi(24),
forced_height = dpi(48),
widget = wibox.container.margin
}
search_button = wibox.widget {
{
search_widget,
widget = clickable_container
},
bg = beautiful.groups_bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, beautiful.groups_radius)
end,
widget = wibox.container.background
}
search_button:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
panel:run_rofi()
end
)
)
)
return wibox.widget {
{
{
layout = wibox.layout.fixed.vertical,
spacing = dpi(7),
search_button,
require('layout.left-panel.dashboard.hardware-monitor'),
require('layout.left-panel.dashboard.quick-settings'),
},
nil,
require('widget.end-session')(),
layout = wibox.layout.align.vertical
},
margins = dpi(16),
widget = wibox.container.margin
}
end
@@ -0,0 +1,67 @@
local wibox = require('wibox')
local gears = require('gears')
local beautiful = require('beautiful')
local bar_color = beautiful.groups_bg
local dpi = beautiful.xresources.apply_dpi
local quick_header = wibox.widget {
text = 'Quick Settings',
font = 'Inter Regular 12',
align = 'left',
valign = 'center',
widget = wibox.widget.textbox
}
return wibox.widget {
layout = wibox.layout.fixed.vertical,
spacing = dpi(7),
{
layout = wibox.layout.fixed.vertical,
{
{
quick_header,
left = dpi(24),
right = dpi(24),
widget = wibox.container.margin
},
forced_height = dpi(35),
bg = beautiful.groups_title_bg,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, beautiful.groups_radius)
end,
widget = wibox.container.background
},
{
layout = wibox.layout.fixed.vertical,
spacing = dpi(7),
{
{
layout = wibox.layout.fixed.vertical,
require('widget.brightness-slider'),
require('widget.volume-slider'),
require('widget.airplane-mode'),
require('widget.bluetooth-toggle'),
require('widget.blue-light')
},
bg = beautiful.groups_bg,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, beautiful.groups_radius)
end,
widget = wibox.container.background
},
{
{
layout = wibox.layout.fixed.vertical,
require('widget.blur-slider'),
require('widget.blur-toggle')
},
bg = beautiful.groups_bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, beautiful.groups_radius)
end,
widget = wibox.container.background
}
}
}
}
+154
View File
@@ -0,0 +1,154 @@
local wibox = require('wibox')
local awful = require('awful')
local gears = require('gears')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local apps = require('configuration.apps')
local left_panel = function(screen)
local action_bar_width = dpi(45)
local panel_content_width = dpi(350)
local panel = wibox {
screen = screen,
width = action_bar_width,
type = 'dock',
height = screen.geometry.height,
x = screen.geometry.x,
y = screen.geometry.y,
ontop = true,
shape = gears.shape.rectangle,
bg = beautiful.background,
fg = beautiful.fg_normal
}
panel.opened = false
panel:struts {
left = action_bar_width
}
local backdrop = wibox {
ontop = true,
screen = screen,
bg = beautiful.transparent,
type = 'utility',
x = screen.geometry.x,
y = screen.geometry.y,
width = screen.geometry.width,
height = screen.geometry.height
}
function panel:run_rofi()
awesome.spawn(
apps.default.rofi_global,
false,
false,
false,
false,
function()
panel:toggle()
end
)
-- Hide panel content if rofi global search is opened
panel:get_children_by_id('panel_content')[1].visible = false
end
-- "Punch a hole" on backdrop to show the left dashboard
local update_backdrop = function(wibox_backdrop, wibox_panel)
local cairo = require('lgi').cairo
local geo = wibox_panel.screen.geometry
wibox_backdrop.x = geo.x
wibox_backdrop.y = geo.y
wibox_backdrop.width = geo.width
wibox_backdrop.height = geo.height
-- Create an image surface that is as large as the wibox_panel screen
local shape = cairo.ImageSurface.create(cairo.Format.A1, geo.width, geo.height)
local cr = cairo.Context(shape)
-- Fill with "completely opaque"
cr.operator = 'SOURCE'
cr:set_source_rgba(1, 1, 1, 1)
cr:paint()
-- Remove the shape of the client
local c_geo = wibox_panel:geometry()
local c_shape = gears.surface(wibox_panel.shape_bounding)
cr:set_source_rgba(0, 0, 0, 0)
cr:mask_surface(c_shape, c_geo.x + wibox_panel.border_width - geo.x, c_geo.y + wibox_panel.border_width - geo.y)
c_shape:finish()
wibox_backdrop.shape_bounding = shape._native
shape:finish()
wibox_backdrop:draw()
end
local open_panel = function(should_run_rofi)
panel.width = action_bar_width + panel_content_width
backdrop.visible = true
update_backdrop(backdrop, panel)
panel:get_children_by_id('panel_content')[1].visible = true
if should_run_rofi then
panel:run_rofi()
end
panel:emit_signal('opened')
end
local close_panel = function()
panel.width = action_bar_width
panel:get_children_by_id('panel_content')[1].visible = false
backdrop.visible = false
update_backdrop(backdrop, panel)
panel:emit_signal('closed')
end
-- Hide this panel when app dashboard is called.
function panel:hide_dashboard()
close_panel()
end
function panel:toggle(should_run_rofi)
self.opened = not self.opened
if self.opened then
open_panel(should_run_rofi)
else
close_panel()
end
end
backdrop:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
panel:toggle()
end
)
)
)
panel:setup {
layout = wibox.layout.align.horizontal,
nil,
{
id = 'panel_content',
bg = beautiful.transparent,
widget = wibox.container.background,
visible = false,
forced_width = panel_content_width,
{
require('layout.left-panel.dashboard')(screen, panel),
layout = wibox.layout.stack
}
},
require('layout.left-panel.action-bar')(screen, panel, action_bar_width)
}
return panel
end
return left_panel
+166
View File
@@ -0,0 +1,166 @@
local awful = require('awful')
local wibox = require('wibox')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
panel_visible = false
local right_panel = function(s)
-- Set right panel geometry
local panel_width = dpi(350)
local panel_x = s.geometry.x + s.geometry.width - panel_width
local panel = wibox {
ontop = true,
screen = s,
visible = false,
type = 'dock',
width = panel_width,
height = s.geometry.height,
x = panel_x,
y = s.geometry.y,
bg = beautiful.background,
fg = beautiful.fg_normal
}
panel.opened = false
s.backdrop_rdb = wibox {
ontop = true,
screen = s,
bg = beautiful.transparent,
type = 'utility',
x = s.geometry.x,
y = s.geometry.y,
width = s.geometry.width,
height = s.geometry.height
}
panel:struts {
right = 0
}
open_panel = function()
local focused = awful.screen.focused()
panel_visible = true
focused.backdrop_rdb.visible = true
focused.right_panel.visible = true
panel:emit_signal('opened')
end
close_panel = function()
local focused = awful.screen.focused()
panel_visible = false
focused.right_panel.visible = false
focused.backdrop_rdb.visible = false
panel:emit_signal('closed')
end
-- Hide this panel when app dashboard is called.
function panel:hide_dashboard()
close_panel()
end
function panel:toggle()
self.opened = not self.opened
if self.opened then
open_panel()
else
close_panel()
end
end
function panel:switch_pane(mode)
if mode == 'notif_mode' then
-- Update Content
panel:get_children_by_id('notif_id')[1].visible = true
panel:get_children_by_id('pane_id')[1].visible = false
elseif mode == 'today_mode' then
-- Update Content
panel:get_children_by_id('notif_id')[1].visible = false
panel:get_children_by_id('pane_id')[1].visible = true
end
end
s.backdrop_rdb:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
panel:toggle()
end
)
)
)
local separator = wibox.widget {
orientation = 'horizontal',
opacity = 0.0,
forced_height = 15,
widget = wibox.widget.separator,
}
local line_separator = wibox.widget {
orientation = 'horizontal',
forced_height = dpi(1),
span_ratio = 1.0,
color = beautiful.groups_title_bg,
widget = wibox.widget.separator
}
panel : setup {
{
expand = 'none',
layout = wibox.layout.fixed.vertical,
{
layout = wibox.layout.align.horizontal,
expand = 'none',
nil,
require('widget.info-center-switch'),
nil
},
separator,
line_separator,
separator,
{
layout = wibox.layout.stack,
-- Today Pane
{
id = 'pane_id',
visible = true,
layout = wibox.layout.fixed.vertical,
{
layout = wibox.layout.fixed.vertical,
spacing = dpi(7),
require('widget.user-profile'),
require('widget.weather'),
require('widget.email'),
require('widget.social-media'),
require('widget.calculator')
},
},
-- Notification Center
{
id = 'notif_id',
visible = false,
require('widget.notif-center')(s),
layout = wibox.layout.fixed.vertical,
}
},
},
margins = dpi(16),
widget = wibox.container.margin
}
return panel
end
return right_panel
@@ -0,0 +1,135 @@
local awful = require('awful')
local wibox = require('wibox')
local gears = require('gears')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local clickable_container = require('widget.clickable-container')
-- Variable used for switching panel modes
right_panel_mode = 'today_mode'
local active_button = beautiful.groups_title_bg
local inactive_button = beautiful.transparent
local notif_text = wibox.widget
{
text = 'Notifications',
font = 'Inter Bold 11',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox
}
local notif_button = clickable_container(
wibox.container.margin(
notif_text, dpi(0), dpi(0), dpi(7), dpi(7)
)
)
local wrap_notif = wibox.widget {
notif_button,
forced_width = dpi(140),
bg = inactive_button,
border_width = dpi(1),
border_color = beautiful.groups_title_bg,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(
cr, width, height, false, true, true, false, beautiful.groups_radius
)
end,
widget = wibox.container.background
}
local today_text = wibox.widget
{
text = 'Today',
font = 'Inter Bold 11',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox
}
local today_button = clickable_container(
wibox.container.margin(
today_text, dpi(0), dpi(0), dpi(7), dpi(7)
)
)
local wrap_today = wibox.widget {
today_button,
forced_width = dpi(140),
bg = active_button,
border_width = dpi(1),
border_color = beautiful.groups_title_bg,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(
cr, width, height, true, false, false, true, beautiful.groups_radius
)
end,
widget = wibox.container.background
}
local switcher = wibox.widget {
expand = 'none',
layout = wibox.layout.fixed.horizontal,
wrap_today,
wrap_notif
}
function switch_rdb_pane(right_panel_mode)
local focused = awful.screen.focused()
if right_panel_mode == 'notif_mode' then
-- Update button color
wrap_notif.bg = active_button
wrap_today.bg = inactive_button
-- Change panel content of right-panel.lua
focused.right_panel:switch_pane(right_panel_mode)
elseif right_panel_mode == 'today_mode' then
-- Update button color
wrap_notif.bg = inactive_button
wrap_today.bg = active_button
-- Change panel content of right-panel.lua
focused.right_panel:switch_pane(right_panel_mode)
end
end
notif_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
switch_rdb_pane('notif_mode')
end
)
)
)
today_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
switch_rdb_pane('today_mode')
end
)
)
)
return switcher
+99
View File
@@ -0,0 +1,99 @@
local awful = require('awful')
local beautiful = require('beautiful')
local wibox = require('wibox')
local gears = require('gears')
local icons = require('theme.icons')
local dpi = beautiful.xresources.apply_dpi
local clickable_container = require('widget.clickable-container')
local task_list = require('widget.task-list')
local top_panel = function(s, offset)
local offsetx = 0
if offset == true then
offsetx = dpi(45)
end
local panel = wibox
{
ontop = true,
screen = s,
type = 'dock',
height = dpi(28),
width = s.geometry.width - offsetx,
x = s.geometry.x + offsetx,
y = s.geometry.y,
stretch = false,
bg = beautiful.background,
fg = beautiful.fg_normal
}
panel:struts
{
top = dpi(28)
}
panel:connect_signal(
'mouse::enter',
function()
local w = mouse.current_wibox
if w then
w.cursor = 'left_ptr'
end
end
)
s.systray = wibox.widget {
visible = false,
base_size = dpi(20),
horizontal = true,
screen = 'primary',
widget = wibox.widget.systray
}
local clock = require('widget.clock')(s)
local layout_box = require('widget.layoutbox')(s)
local add_button = require('widget.open-default-app')(s)
s.tray_toggler = require('widget.tray-toggle')
s.updater = require('widget.package-updater')()
s.screen_rec = require('widget.screen-recorder')()
s.mpd = require('widget.mpd')()
s.bluetooth = require('widget.bluetooth')()
s.battery = require('widget.battery')()
s.network = require('widget.network')()
s.info_center_toggle = require('widget.info-center-toggle')()
panel : setup {
layout = wibox.layout.align.horizontal,
expand = 'none',
{
layout = wibox.layout.fixed.horizontal,
task_list(s),
add_button
},
clock,
{
layout = wibox.layout.fixed.horizontal,
spacing = dpi(5),
{
s.systray,
margins = dpi(5),
widget = wibox.container.margin
},
s.tray_toggler,
s.updater,
s.screen_rec,
s.mpd,
s.network,
s.bluetooth,
s.battery,
layout_box,
s.info_center_toggle
}
}
return panel
end
return top_panel