Skip to content

Commit

Permalink
screen refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bytes-chaser committed Aug 10, 2022
1 parent 804b0c2 commit fad0926
Show file tree
Hide file tree
Showing 14 changed files with 556 additions and 447 deletions.
463 changes: 23 additions & 440 deletions .config/awesome/screen/init.lua

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions .config/awesome/screen/notif_icon/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local icons = require("commons.icons")

return {
create = function(s)
local notif_icon = icons.wbi("", 14)

notif_icon:buttons(gears.table.join(awful.button({ }, 1, function()
s.notif.visible = not s.notif.visible
end)))

return notif_icon

end
}
20 changes: 20 additions & 0 deletions .config/awesome/screen/notifications/delete_btn.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local wibox = require("wibox")
local notif_center = require("widgets.notification_center")


local delete_all_notif = wibox.widget{
text = "Delete All",
font = beautiful.font,
align = "center",
opacity = 1,
widget = wibox.widget.textbox,
}

delete_all_notif:buttons(gears.table.join(awful.button({ }, 1, function()
notif_center:reset()
end)))

return delete_all_notif;
56 changes: 56 additions & 0 deletions .config/awesome/screen/notifications/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local wibox = require("wibox")
local dpi = beautiful.xresources.apply_dpi
local notif_center = require("widgets.notification_center")
local delete_btn = require("screen.notifications.delete_btn")

return {

create = function(s)

local notif = awful.wibar {

position = "right",
screen = s,
width = dpi(400),
height = dpi(1000),
visible = false,

margins = {
top = dpi(20),
right = dpi(10)
},
}


local header = {
widget = wibox.container.margin,
margins = dpi(10),
{
markup = "<span foreground='" .. beautiful.fg_focus .."'>Notifications</span>",
font = beautiful.font_famaly .. '20',
align = "center",
opacity = 1,
widget = wibox.widget.textbox,
}
}


notif:setup {
layout = wibox.layout.fixed.vertical,
{
bg = beautiful.palette_c7,
widget = wibox.container.background,
header,
},
delete_btn,
notif_center
}

return notif


end
}
102 changes: 102 additions & 0 deletions .config/awesome/screen/panels_switch/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local wibox = require("wibox")
local dpi = beautiful.xresources.apply_dpi
local icons = require("commons.icons")


local close_all_sub_panels = function(s)
s.stats.visible = false
s.dev.visible = false
s.user.visible = false
end


local create_munu_panel_button = function(glyph, text, btn_fn)
local btn = wibox.widget{
{
{
icons.wbi(glyph, 12),
margins = dpi(5),
widget = wibox.container.margin
},
bg = beautiful.palette_c7,
widget = wibox.container.background
},
margins = dpi(5),
widget = wibox.container.margin

}

local myclock_t = awful.tooltip {
objects = { btn },
timer_function = function()
return text
end,
}

btn_fn(btn)
return btn
end


return {
create = function(s)
return {
layout = wibox.layout.fixed.horizontal,


create_munu_panel_button("", "User", function(btn)
btn:buttons(gears.table.join(awful.button({ }, 1, function()
if sub_panel_mode == 'user' and show_sub_panel then
s.user.visible = false
show_sub_panel = false
else
if not sub_panel_mode ~= 'user' then
close_all_sub_panels(s)
end
show_sub_panel = true
sub_panel_mode = 'user'
s.user.visible = true

end
end)))
end),

create_munu_panel_button("", "Devtools", function(btn)
btn:buttons(gears.table.join(awful.button({ }, 1, function()
if sub_panel_mode == 'dev' and show_sub_panel then
s.dev.visible = false
show_sub_panel = false
else
if not sub_panel_mode ~= 'dev' then
close_all_sub_panels(s)
end
show_sub_panel = true
sub_panel_mode = 'dev'
s.dev.visible = true

end
end)))
end),

create_munu_panel_button("", "Stats", function(btn)
btn:buttons(gears.table.join(awful.button({ }, 1, function()
if sub_panel_mode == 'stat' and show_sub_panel then
s.stats.visible = false
show_sub_panel = false
else
if not sub_panel_mode ~= 'stat' then
close_all_sub_panels(s)
end
show_sub_panel = true
sub_panel_mode = 'stat'
s.stats.visible = true

end
end)))
end),
}
end
}
20 changes: 20 additions & 0 deletions .config/awesome/screen/rclick_menu.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local awful = require("awful")
local beautiful = require("beautiful")
local hotkeys_popup = require("awful.hotkeys_popup")
local menubar = require("menubar")

myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{ "quit", function() awesome.quit() end },
}

mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
}
})


menubar.utils.terminal = terminal
24 changes: 24 additions & 0 deletions .config/awesome/screen/tags/buttons.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local awful = require("awful")
local gears = require("gears")

taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end),

awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),

awful.button({ }, 3, awful.tag.viewtoggle),

awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),

awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),

awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
61 changes: 61 additions & 0 deletions .config/awesome/screen/tags/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
local awful = require("awful")
local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")

require("screen.tags.buttons")

return {

create = function(s)


local name_section = {
{
{
id = 'text_role',
widget = wibox.widget.textbox,
},
layout = wibox.layout.fixed.horizontal,
},
margins = dpi(8),
widget = wibox.container.margin
}


local widget_template = {
id = 'background_role',
widget = wibox.container.background,
{
widget = wibox.container.margin,
margins = {
top = 5,
bottom = 5,
left = 6,
right = 6,
},
{
name_section,
bg = beautiful.palette_c7,
shape = cfg.tags.shape,
widget = wibox.container.background
},
},
}


return awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = taglist_buttons,

layout = {
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
},

widget_template = widget_template
}
end
}
27 changes: 27 additions & 0 deletions .config/awesome/screen/tasks/buttons.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local awful = require("awful")
local gears = require("gears")

tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end),

awful.button({ }, 3, function()
awful.menu.client_list({ theme = { width = 250 } })
end),

awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),

awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
41 changes: 41 additions & 0 deletions .config/awesome/screen/tasks/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
local awful = require("awful")
local wibox = require("wibox")
local shape = require("commons.shape")

require("screen.tasks.buttons")

return {
create = function(s)
local name_section = {
left = 10,
right = 10,
widget = wibox.container.margin,
{
layout = wibox.container.scroll.horizontal,
max_size = 400,
speed = 300,
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
{
id = 'text_role',
widget = wibox.widget.textbox,
align = 'center',
valign = 'center',
}
}
}


local widget_template = {
name_section,
shape = shape.default_frr,
widget = wibox.container.background,
}

return awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.focused,
buttons = tasklist_buttons,
widget_template = widget_template
}
end
}
Loading

0 comments on commit fad0926

Please sign in to comment.