mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-11 03:32:38 +08:00
Add amarena dashboard
This commit is contained in:
parent
2961e60b0e
commit
52b4967fe0
3 changed files with 680 additions and 127 deletions
672
config/awesome/elemental/dashboard/amarena.lua
Normal file
672
config/awesome/elemental/dashboard/amarena.lua
Normal file
|
|
@ -0,0 +1,672 @@
|
|||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local helpers = require("helpers")
|
||||
|
||||
local keygrabber = require("awful.keygrabber")
|
||||
|
||||
-- Appearance
|
||||
local box_radius = beautiful.dashboard_box_border_radius or dpi(12)
|
||||
local box_gap = dpi(6)
|
||||
|
||||
-- Get screen geometry
|
||||
local screen_width = awful.screen.focused().geometry.width
|
||||
local screen_height = awful.screen.focused().geometry.height
|
||||
|
||||
-- Create the widget
|
||||
dashboard = wibox({visible = false, ontop = true, type = "dock", screen = screen.primary})
|
||||
awful.placement.maximize(dashboard)
|
||||
|
||||
dashboard.bg = beautiful.dashboard_bg or beautiful.exit_screen_bg or beautiful.wibar_bg or "#111111"
|
||||
dashboard.fg = beautiful.dashboard_fg or beautiful.exit_screen_fg or beautiful.wibar_fg or "#FEFEFE"
|
||||
|
||||
-- Add dashboard or mask to each screen
|
||||
for s in screen do
|
||||
if s == screen.primary then
|
||||
s.dashboard = dashboard
|
||||
else
|
||||
s.dashboard = helpers.screen_mask(s, dashboard.bg)
|
||||
end
|
||||
end
|
||||
|
||||
local function set_visibility(v)
|
||||
for s in screen do
|
||||
s.dashboard.visible = v
|
||||
end
|
||||
end
|
||||
|
||||
dashboard:buttons(gears.table.join(
|
||||
-- Middle click - Hide dashboard
|
||||
awful.button({ }, 2, function ()
|
||||
dashboard_hide()
|
||||
end)
|
||||
))
|
||||
|
||||
-- Helper function that puts a widget inside a box with a specified background color
|
||||
-- Invisible margins are added so that the boxes created with this function are evenly separated
|
||||
-- The widget_to_be_boxed is vertically and horizontally centered inside the box
|
||||
local function create_boxed_widget(widget_to_be_boxed, width, height, bg_color)
|
||||
local box_container = wibox.container.background()
|
||||
box_container.bg = bg_color
|
||||
box_container.forced_height = height
|
||||
box_container.forced_width = width
|
||||
box_container.shape = helpers.rrect(box_radius)
|
||||
-- box_container.shape = helpers.prrect(20, true, true, true, true)
|
||||
-- box_container.shape = helpers.prrect(30, true, true, false, true)
|
||||
|
||||
local boxed_widget = wibox.widget {
|
||||
-- Add margins
|
||||
{
|
||||
-- Add background color
|
||||
{
|
||||
-- Center widget_to_be_boxed horizontally
|
||||
nil,
|
||||
{
|
||||
-- Center widget_to_be_boxed vertically
|
||||
nil,
|
||||
-- The actual widget goes here
|
||||
widget_to_be_boxed,
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none"
|
||||
},
|
||||
layout = wibox.layout.align.horizontal,
|
||||
expand = "none"
|
||||
},
|
||||
widget = box_container,
|
||||
},
|
||||
margins = box_gap,
|
||||
color = "#FF000000",
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
return boxed_widget
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- User widget
|
||||
local user_picture_container = wibox.container.background()
|
||||
-- user_picture_container.shape = gears.shape.circle
|
||||
user_picture_container.shape = helpers.prrect(dpi(40), true, true, false, true)
|
||||
user_picture_container.forced_height = dpi(140)
|
||||
user_picture_container.forced_width = dpi(140)
|
||||
local user_picture = wibox.widget {
|
||||
{
|
||||
wibox.widget.imagebox(user.profile_picture),
|
||||
widget = user_picture_container
|
||||
},
|
||||
shape = helpers.rrect(box_radius / 2),
|
||||
widget = wibox.container.background
|
||||
}
|
||||
local username = os.getenv("USER")
|
||||
local user_text = wibox.widget.textbox(username:upper())
|
||||
user_text.font = "San Francisco Display Heavy 20"
|
||||
user_text.align = "center"
|
||||
user_text.valign = "center"
|
||||
|
||||
local host_text = wibox.widget.textbox()
|
||||
awful.spawn.easy_async_with_shell("hostname", function(out)
|
||||
-- Remove trailing whitespaces
|
||||
out = out:gsub('^%s*(.-)%s*$', '%1')
|
||||
host_text.markup = helpers.colorize_text("@"..out, x.color8)
|
||||
end)
|
||||
-- host_text.markup = "<span foreground='" .. x.color8 .."'>" .. minutes.text .. "</span>"
|
||||
host_text.font = "monospace 16"
|
||||
host_text.align = "center"
|
||||
host_text.valign = "center"
|
||||
local user_widget = wibox.widget {
|
||||
user_picture,
|
||||
helpers.vertical_pad(dpi(24)),
|
||||
user_text,
|
||||
helpers.vertical_pad(dpi(4)),
|
||||
host_text,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
local user_box = create_boxed_widget(user_widget, dpi(300), dpi(340), x.background)
|
||||
|
||||
-- Calendar
|
||||
-- Create the calendar
|
||||
local styles = {}
|
||||
styles.month = { padding = 20,
|
||||
fg_color = x.color7,
|
||||
bg_color = x.background.."00",
|
||||
border_width = 0,
|
||||
}
|
||||
styles.normal = {}
|
||||
styles.focus = { fg_color = x.color1,
|
||||
bg_color = x.color5.."00",
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
-- markup = function(t) return '<span foreground="'..x.color1..'"><b>' .. t .. '</b></span>' end,
|
||||
}
|
||||
styles.header = { fg_color = x.color4,
|
||||
bg_color = x.color1.."00",
|
||||
-- markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
markup = function(t) return '<span font_desc="sans bold 24">' .. t .. '</span>' end,
|
||||
}
|
||||
styles.weekday = { fg_color = x.color7,
|
||||
bg_color = x.color1.."00",
|
||||
padding = 3,
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
}
|
||||
local function decorate_cell(widget, flag, date)
|
||||
if flag=='monthheader' and not styles.monthheader then
|
||||
flag = 'header'
|
||||
end
|
||||
local props = styles[flag] or {}
|
||||
if props.markup and widget.get_text and widget.set_markup then
|
||||
widget:set_markup(props.markup(widget:get_text()))
|
||||
end
|
||||
-- Change bg color for weekends
|
||||
local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)}
|
||||
local weekday = tonumber(os.date('%w', os.time(d)))
|
||||
local default_fg = x.color7
|
||||
local default_bg = x.color0.."00"
|
||||
-- local default_bg = (weekday==0 or weekday==6) and x.color6 or x.color14
|
||||
local ret = wibox.widget {
|
||||
{
|
||||
widget,
|
||||
margins = (props.padding or 2) + (props.border_width or 0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
shape = props.shape,
|
||||
shape_border_color = props.border_color or x.background,
|
||||
shape_border_width = props.border_width or 0,
|
||||
fg = props.fg_color or default_fg,
|
||||
bg = props.bg_color or default_bg,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
return ret
|
||||
end
|
||||
|
||||
calendar_widget = wibox.widget {
|
||||
date = os.date('*t'),
|
||||
font = "sans 14",
|
||||
long_weekdays = false,
|
||||
spacing = dpi(3),
|
||||
fn_embed = decorate_cell,
|
||||
widget = wibox.widget.calendar.month
|
||||
}
|
||||
|
||||
local current_month = os.date('*t').month
|
||||
calendar_widget:buttons(gears.table.join(
|
||||
-- Left Click - Reset date to current date
|
||||
awful.button({ }, 1, function ()
|
||||
calendar_widget.date = os.date('*t')
|
||||
end),
|
||||
-- Scroll - Move to previous or next month
|
||||
awful.button({ }, 4, function ()
|
||||
new_calendar_month = calendar_widget.date.month - 1
|
||||
if new_calendar_month == current_month then
|
||||
calendar_widget.date = os.date('*t')
|
||||
else
|
||||
calendar_widget.date = {month = new_calendar_month, year = calendar_widget.date.year}
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 5, function ()
|
||||
new_calendar_month = calendar_widget.date.month + 1
|
||||
if new_calendar_month == current_month then
|
||||
calendar_widget.date = os.date('*t')
|
||||
else
|
||||
calendar_widget.date = {month = new_calendar_month, year = calendar_widget.date.year}
|
||||
end
|
||||
end)
|
||||
))
|
||||
|
||||
local calendar_box = create_boxed_widget(calendar_widget, dpi(300), dpi(400), x.background)
|
||||
-- local calendar_box = create_boxed_widget(calendar, 380, 540, x.color0)
|
||||
|
||||
local disk_arc = wibox.widget {
|
||||
start_angle = 3 * math.pi / 2,
|
||||
min_value = 0,
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
border_width = 0,
|
||||
thickness = dpi(8),
|
||||
forced_width = dpi(90),
|
||||
forced_height = dpi(90),
|
||||
rounded_edge = true,
|
||||
bg = x.color8.."55",
|
||||
colors = { x.color13 },
|
||||
widget = wibox.container.arcchart
|
||||
}
|
||||
|
||||
local disk_hover_text_value = wibox.widget {
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "sans medium 13",
|
||||
widget = wibox.widget.textbox()
|
||||
}
|
||||
local disk_hover_text = wibox.widget {
|
||||
disk_hover_text_value,
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "sans medium 10",
|
||||
widget = wibox.widget.textbox("free")
|
||||
},
|
||||
spacing = dpi(2),
|
||||
visible = false,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
awesome.connect_signal("evil::disk", function(used, total)
|
||||
disk_arc.value = used * 100 / total
|
||||
disk_hover_text_value.markup = helpers.colorize_text(tostring(total - used).."G", x.color4)
|
||||
end)
|
||||
|
||||
local disk_icon = wibox. widget {
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "icomoon 23",
|
||||
markup = helpers.colorize_text("", x.color4),
|
||||
widget = wibox.widget.textbox()
|
||||
}
|
||||
|
||||
local disk = wibox.widget {
|
||||
{
|
||||
nil,
|
||||
disk_hover_text,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
disk_icon,
|
||||
disk_arc,
|
||||
top_only = false,
|
||||
layout = wibox.layout.stack
|
||||
}
|
||||
|
||||
local disk_box = create_boxed_widget(disk, dpi(150), dpi(150), x.background)
|
||||
|
||||
disk_box:connect_signal("mouse::enter", function ()
|
||||
disk_icon.visible = false
|
||||
disk_hover_text.visible = true
|
||||
end)
|
||||
disk_box:connect_signal("mouse::leave", function ()
|
||||
disk_icon.visible = true
|
||||
disk_hover_text.visible = false
|
||||
end)
|
||||
|
||||
|
||||
-- File system bookmarks
|
||||
local function create_bookmark(name, path, color, hover_color)
|
||||
local bookmark = wibox.widget.textbox()
|
||||
bookmark.font = "sans bold 16"
|
||||
-- bookmark.text = wibox.widget.textbox(name:sub(1,1):upper()..name:sub(2))
|
||||
bookmark.markup = helpers.colorize_text(name, color)
|
||||
bookmark.align = "center"
|
||||
bookmark.valign = "center"
|
||||
|
||||
-- Buttons
|
||||
bookmark:buttons(gears.table.join(
|
||||
awful.button({ }, 1, function ()
|
||||
awful.spawn.with_shell(user.file_manager.." "..path)
|
||||
dashboard_hide()
|
||||
end),
|
||||
awful.button({ }, 3, function ()
|
||||
awful.spawn.with_shell(user.terminal.." -e 'ranger' "..path)
|
||||
dashboard_hide()
|
||||
end)
|
||||
))
|
||||
|
||||
-- Hover effect
|
||||
bookmark:connect_signal("mouse::enter", function ()
|
||||
bookmark.markup = helpers.colorize_text(name, hover_color)
|
||||
end)
|
||||
bookmark:connect_signal("mouse::leave", function ()
|
||||
bookmark.markup = helpers.colorize_text(name, color)
|
||||
end)
|
||||
|
||||
helpers.add_hover_cursor(bookmark, "hand1")
|
||||
|
||||
return bookmark
|
||||
end
|
||||
|
||||
local bookmarks = wibox.widget {
|
||||
create_bookmark("home", "", x.color1, x.color9),
|
||||
create_bookmark("downloads", "~/Downloads", x.color6, x.color14),
|
||||
create_bookmark("music", "~/Music", x.color2, x.color10),
|
||||
create_bookmark("pictures", "~/Pictures", x.color4, x.color12),
|
||||
create_bookmark("wallpapers", "~/Pictures/Wallpapers", x.color5, x.color13),
|
||||
create_bookmark("screenshots", user.screenshot_dir, x.color3, x.color11),
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
local bookmarks_box = create_boxed_widget(bookmarks, dpi(200), dpi(300), x.background)
|
||||
|
||||
-- Corona
|
||||
local corona_cases = wibox.widget.textbox()
|
||||
local corona_deaths = wibox.widget.textbox()
|
||||
local corona = wibox.widget {
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "Sans bold 20",
|
||||
markup = helpers.colorize_text("Pandemic", x.color2),
|
||||
widget = wibox.widget.textbox()
|
||||
},
|
||||
{
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "icomoon 20",
|
||||
markup = helpers.colorize_text("", x.color3),
|
||||
widget = wibox.widget.textbox()
|
||||
},
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "sans medium 14",
|
||||
widget = corona_cases
|
||||
},
|
||||
spacing = dpi(6),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
{
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "icomoon 20",
|
||||
markup = helpers.colorize_text("", x.color1),
|
||||
widget = wibox.widget.textbox()
|
||||
},
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "sans medium 14",
|
||||
widget = corona_deaths
|
||||
},
|
||||
spacing = dpi(6),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
spacing = dpi(20),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
awesome.connect_signal("evil::coronavirus", function(cases_total, cases_today, deaths_total, deaths_today)
|
||||
corona_cases.markup = cases_total.." <i>(+"..cases_today..")</i>"
|
||||
corona_deaths.markup = deaths_total.." <i>(+"..deaths_today..")</i>"
|
||||
end)
|
||||
|
||||
local corona_box = create_boxed_widget(corona, dpi(200), dpi(180), x.background)
|
||||
|
||||
corona_box:buttons(gears.table.join(
|
||||
-- Left click - Go to a more detailed webside
|
||||
awful.button({ }, 1, function ()
|
||||
awful.spawn.with_shell(user.browser.." https://www.worldometers.info/coronavirus/")
|
||||
dashboard_hide()
|
||||
end)
|
||||
))
|
||||
helpers.add_hover_cursor(corona_box, "hand1")
|
||||
|
||||
-- Fortune
|
||||
local fortune_command = "fortune -n 140 -s"
|
||||
local fortune_update_interval = 3600
|
||||
-- local fortune_command = "fortune -n 140 -s computers"
|
||||
local fortune = wibox.widget {
|
||||
font = "sans italic 12",
|
||||
align = "center",
|
||||
text = "Loading your cookie...",
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
local update_fortune = function()
|
||||
awful.spawn.easy_async_with_shell(fortune_command, function(out)
|
||||
-- Remove trailing whitespaces
|
||||
out = out:gsub('^%s*(.-)%s*$', '%1')
|
||||
fortune.markup = helpers.colorize_text(out, x.color6)
|
||||
end)
|
||||
end
|
||||
|
||||
gears.timer {
|
||||
autostart = true,
|
||||
timeout = fortune_update_interval,
|
||||
single_shot = false,
|
||||
call_now = true,
|
||||
callback = update_fortune
|
||||
}
|
||||
|
||||
local fortune_widget = wibox.widget {
|
||||
fortune,
|
||||
margins = box_gap * 3,
|
||||
color = "#00000000",
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
local fortune_box = create_boxed_widget(fortune_widget, dpi(300), dpi(140), x.background)
|
||||
fortune_box:buttons(gears.table.join(
|
||||
-- Left click - New fortune
|
||||
awful.button({ }, 1, update_fortune)
|
||||
))
|
||||
helpers.add_hover_cursor(fortune_box, "hand1")
|
||||
|
||||
-- URL launcher petals
|
||||
local petal_font = "Sans Bold 13"
|
||||
local function create_url_petal(text, bg_color, hover_color, url, tl, tr, br, bl)
|
||||
local petal_container = wibox.widget {
|
||||
bg = bg_color,
|
||||
forced_height = dpi(65),
|
||||
forced_width = dpi(65),
|
||||
shape = helpers.prrect(99, tl, tr, br, bl),
|
||||
widget = wibox.container.background()
|
||||
}
|
||||
|
||||
local petal = wibox.widget {
|
||||
{
|
||||
{
|
||||
font = petal_font,
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox(text)
|
||||
},
|
||||
widget = petal_container
|
||||
},
|
||||
-- Put the petal container inside a rounded container. Why?
|
||||
-- Because I want the unrounded petal corner to not be pointy!
|
||||
shape = helpers.rrect(box_radius / 2),
|
||||
widget = wibox.container.background()
|
||||
}
|
||||
|
||||
petal:buttons(
|
||||
gears.table.join(
|
||||
awful.button({ }, 1, function ()
|
||||
awful.spawn(user.browser.." "..url)
|
||||
dashboard_hide()
|
||||
end),
|
||||
awful.button({ }, 3, function ()
|
||||
awful.spawn(user.browser.." -new-window "..url, { switch_to_tags = true })
|
||||
dashboard_hide()
|
||||
end)
|
||||
))
|
||||
|
||||
petal:connect_signal("mouse::enter", function ()
|
||||
petal_container.bg = hover_color
|
||||
end)
|
||||
petal:connect_signal("mouse::leave", function ()
|
||||
petal_container.bg = bg_color
|
||||
end)
|
||||
|
||||
return petal
|
||||
end
|
||||
|
||||
-- Create the containers
|
||||
-- TODO give url / command to launch
|
||||
local petal_top_left = create_url_petal("GH", x.color4, x.color12, "https://github.com/elenapan/dotfiles", true, true, false, true)
|
||||
local petal_top_right = create_url_petal("YT", x.color1, x.color9, "https://youtube.com/", true, true, true, false)
|
||||
local petal_bottom_right = create_url_petal("4C", x.color2, x.color10, "https://4chan.org/",false, true, true, true)
|
||||
local petal_bottom_left = create_url_petal("RD", x.color3, x.color11, "https://reddit.com/",true, false, true, true)
|
||||
|
||||
-- Add clickable effects on hover
|
||||
helpers.add_hover_cursor(petal_top_left, "hand1")
|
||||
helpers.add_hover_cursor(petal_top_right, "hand1")
|
||||
helpers.add_hover_cursor(petal_bottom_left, "hand1")
|
||||
helpers.add_hover_cursor(petal_bottom_right, "hand1")
|
||||
|
||||
local url_petals = wibox.widget {
|
||||
petal_top_left,
|
||||
petal_top_right,
|
||||
petal_bottom_left,
|
||||
petal_bottom_right,
|
||||
forced_num_cols = 2,
|
||||
spacing = box_gap * 2,
|
||||
layout = wibox.layout.grid
|
||||
}
|
||||
|
||||
local url_petals_box = create_boxed_widget(url_petals, dpi(150), dpi(150), "#00000000")
|
||||
local icon_size = dpi(40)
|
||||
|
||||
-- Uptime
|
||||
local uptime_text = wibox.widget.textbox()
|
||||
awful.widget.watch("uptime -p | sed 's/^...//'", 60, function(_, stdout)
|
||||
-- Remove trailing whitespaces
|
||||
local out = stdout:gsub('^%s*(.-)%s*$', '%1')
|
||||
uptime_text.text = out
|
||||
end)
|
||||
local uptime = wibox.widget {
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "icomoon 20",
|
||||
markup = helpers.colorize_text("", x.color3),
|
||||
widget = wibox.widget.textbox()
|
||||
},
|
||||
{
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "sans medium 11",
|
||||
widget = uptime_text
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
local uptime_box = create_boxed_widget(uptime, dpi(300), dpi(80), x.background)
|
||||
|
||||
uptime_box:buttons(gears.table.join(
|
||||
awful.button({ }, 1, function ()
|
||||
dashboard_hide()
|
||||
exit_screen_show()
|
||||
end)
|
||||
))
|
||||
helpers.add_hover_cursor(uptime_box, "hand1")
|
||||
|
||||
local notification_state = wibox.widget {
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "icomoon 25",
|
||||
widget = wibox.widget.textbox("")
|
||||
}
|
||||
local function update_notification_state_icon()
|
||||
if naughty.is_suspended() then
|
||||
notification_state.markup = helpers.colorize_text(notification_state.text, x.color8)
|
||||
else
|
||||
notification_state.markup = helpers.colorize_text(notification_state.text, x.color2)
|
||||
end
|
||||
end
|
||||
update_notification_state_icon()
|
||||
local notification_state_box = create_boxed_widget(notification_state, dpi(150), dpi(78), x.background)
|
||||
notification_state_box:buttons(gears.table.join(
|
||||
-- Left click - Toggle notification state
|
||||
awful.button({ }, 1, function ()
|
||||
naughty.toggle()
|
||||
update_notification_state_icon()
|
||||
end)
|
||||
))
|
||||
|
||||
helpers.add_hover_cursor(notification_state_box, "hand1")
|
||||
|
||||
local screenshot = wibox.widget {
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "icomoon 25",
|
||||
markup = helpers.colorize_text("", x.color3),
|
||||
widget = wibox.widget.textbox()
|
||||
}
|
||||
local screenshot_box = create_boxed_widget(screenshot, dpi(150), dpi(78), x.background)
|
||||
screenshot_box:buttons(gears.table.join(
|
||||
-- Left click - Take screenshot
|
||||
awful.button({ }, 1, function ()
|
||||
helpers.screenshot("full")
|
||||
end),
|
||||
-- Right click - Take screenshot in 5 seconds
|
||||
awful.button({ }, 3, function ()
|
||||
naughty.notify({title = "Say cheese!", text = "Taking shot in 5 seconds", timeout = 4, icon = icons.screenshot})
|
||||
helpers.screenshot("full", 5)
|
||||
end)
|
||||
))
|
||||
|
||||
helpers.add_hover_cursor(screenshot_box, "hand1")
|
||||
|
||||
-- Item placement
|
||||
dashboard:setup {
|
||||
-- Center boxes vertically
|
||||
nil,
|
||||
{
|
||||
-- Center boxes horizontally
|
||||
nil,
|
||||
{
|
||||
-- Column container
|
||||
{
|
||||
-- Column 1
|
||||
user_box,
|
||||
fortune_box,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
{
|
||||
-- Column 2
|
||||
url_petals_box,
|
||||
notification_state_box,
|
||||
screenshot_box,
|
||||
disk_box,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
{
|
||||
-- Column 3
|
||||
bookmarks_box,
|
||||
corona_box,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
{
|
||||
-- Column 4
|
||||
calendar_box,
|
||||
uptime_box,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
|
||||
local dashboard_grabber
|
||||
function dashboard_hide()
|
||||
awful.keygrabber.stop(dashboard_grabber)
|
||||
set_visibility(false)
|
||||
end
|
||||
|
||||
|
||||
local original_cursor = "left_ptr"
|
||||
function dashboard_show()
|
||||
-- Fix cursor sometimes turning into "hand1" right after showing the dashboard
|
||||
-- Sigh... This fix does not always work
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
w.cursor = original_cursor
|
||||
end
|
||||
-- naughty.notify({text = "starting the keygrabber"})
|
||||
dashboard_grabber = awful.keygrabber.run(function(_, key, event)
|
||||
if event == "release" then return end
|
||||
-- Press Escape or q or F1 to hide it
|
||||
if key == 'Escape' or key == 'q' or key == 'F1' then
|
||||
dashboard_hide()
|
||||
end
|
||||
end)
|
||||
set_visibility(true)
|
||||
end
|
||||
|
|
@ -392,22 +392,8 @@ awful.widget.watch(fortune_command, fortune_update_interval, function(widget, st
|
|||
fortune.text = stdout
|
||||
end)
|
||||
|
||||
-- local start_quotation_marks = wibox.widget.textbox(" ")
|
||||
-- start_quotation_marks.font = "Iosevka Nerd Font 18"
|
||||
-- start_quotation_marks.align = "left"
|
||||
-- local end_quotation_marks = wibox.widget.textbox(" ")
|
||||
-- end_quotation_marks.font = "Iosevka Nerd Font 18"
|
||||
-- end_quotation_marks.align = "right"
|
||||
|
||||
local fortune_widget = wibox.widget {
|
||||
fortune,
|
||||
-- {
|
||||
-- start_quotation_marks,
|
||||
-- fortune,
|
||||
-- end_quotation_marks,
|
||||
-- expand = "none",
|
||||
-- layout = wibox.layout.fixed.vertical
|
||||
-- },
|
||||
margins = box_gap * 3,
|
||||
color = "#00000000",
|
||||
widget = wibox.container.margin
|
||||
|
|
@ -427,116 +413,6 @@ fortune_box:buttons(gears.table.join(
|
|||
))
|
||||
helpers.add_hover_cursor(fortune_box, "hand1")
|
||||
|
||||
-- Launcher petals
|
||||
-- local function create_launcher_petal(bg_color)
|
||||
-- local petal_container = wibox.container.background()
|
||||
-- petal_container.bg = bg_color
|
||||
-- petal_container.forced_height = dpi(65)
|
||||
-- petal_container.forced_width = dpi(65)
|
||||
-- petal_container.shape = helpers.prrect(99, true, true, false, true)
|
||||
|
||||
-- -- Put the petal container inside a rounded container. Why?
|
||||
-- -- Because I want the unrounded petal corner to not be pointy!
|
||||
-- local petal = wibox.widget {
|
||||
-- petal_container,
|
||||
-- shape = helpers.rrect(box_radius / 2),
|
||||
-- widget = wibox.container.background()
|
||||
-- }
|
||||
|
||||
-- return petal
|
||||
-- end
|
||||
|
||||
-- -- Create the containers
|
||||
-- local petal_container_top_left = create_launcher_petal(x.background)
|
||||
-- local petal_container_top_right = wibox.widget {
|
||||
-- create_launcher_petal(x.background),
|
||||
-- widget = wibox.container.mirror,
|
||||
-- reflection = { horizontal = true }
|
||||
-- }
|
||||
-- local petal_container_bottom_left = wibox.widget {
|
||||
-- create_launcher_petal(x.background),
|
||||
-- widget = wibox.container.mirror,
|
||||
-- reflection = { vertical = true }
|
||||
-- }
|
||||
-- local petal_container_bottom_right = wibox.widget {
|
||||
-- create_launcher_petal(x.background),
|
||||
-- widget = wibox.container.mirror,
|
||||
-- reflection = { horizontal = true, vertical = true }
|
||||
-- }
|
||||
|
||||
-- -- Create the icons
|
||||
-- local petal_font = "Material Design Icons 20"
|
||||
-- local petal_icon_top_left = wibox.widget.textbox("", { align = "center", valign = "center", font = petal_font })
|
||||
-- -- petal_icon_top_left.font = petal_font
|
||||
-- local petal_icon_top_right = wibox.widget.textbox("")
|
||||
-- petal_icon_top_right.font = petal_font
|
||||
-- local petal_icon_bottom_left = wibox.widget.textbox("")
|
||||
-- petal_icon_bottom_left.font = petal_font
|
||||
-- local petal_icon_bottom_right = wibox.widget.textbox("")
|
||||
-- petal_icon_bottom_right.font = petal_font
|
||||
|
||||
-- -- Finally, create the petals and add buttons
|
||||
-- local petal_top_left = wibox.widget {
|
||||
-- petal_container_top_left,
|
||||
-- petal_icon_top_left,
|
||||
-- layout = wibox.layout.stack
|
||||
-- }
|
||||
-- petal_top_left:buttons(gears.table.join(
|
||||
-- awful.button({ }, 1, function ()
|
||||
-- awful.spawn(user.browser)
|
||||
-- end)
|
||||
-- ))
|
||||
|
||||
-- local petal_top_right = wibox.widget {
|
||||
-- petal_container_top_right,
|
||||
-- petal_icon_top_right,
|
||||
-- layout = wibox.layout.stack
|
||||
-- }
|
||||
-- petal_top_right:buttons(gears.table.join(
|
||||
-- awful.button({ }, 1, function ()
|
||||
-- awful.spawn(user.browser .. " reddit.com")
|
||||
-- end)
|
||||
-- ))
|
||||
|
||||
-- local petal_bottom_left = wibox.widget {
|
||||
-- petal_container_bottom_left,
|
||||
-- petal_icon_bottom_left,
|
||||
-- layout = wibox.layout.stack
|
||||
-- }
|
||||
-- petal_bottom_left:buttons(gears.table.join(
|
||||
-- awful.button({ }, 1, function ()
|
||||
-- awful.spawn("flux")
|
||||
-- end)
|
||||
-- ))
|
||||
|
||||
-- local petal_bottom_right = wibox.widget {
|
||||
-- petal_container_bottom_right,
|
||||
-- petal_icon_bottom_right,
|
||||
-- layout = wibox.layout.stack
|
||||
-- }
|
||||
-- petal_bottom_right:buttons(gears.table.join(
|
||||
-- awful.button({ }, 1, function ()
|
||||
-- awful.spawn("lutris")
|
||||
-- end)
|
||||
-- ))
|
||||
|
||||
-- -- Add clickable effects on hover
|
||||
-- helpers.add_hover_cursor(petal_top_left, "hand1")
|
||||
-- helpers.add_hover_cursor(petal_top_right, "hand1")
|
||||
-- helpers.add_hover_cursor(petal_bottom_left, "hand1")
|
||||
-- helpers.add_hover_cursor(petal_bottom_right, "hand1")
|
||||
|
||||
-- local launcher_petals = wibox.widget {
|
||||
-- petal_top_left,
|
||||
-- petal_top_right,
|
||||
-- petal_bottom_left,
|
||||
-- petal_bottom_right,
|
||||
-- forced_num_cols = 2,
|
||||
-- spacing = box_gap * 2,
|
||||
-- layout = wibox.layout.grid
|
||||
-- }
|
||||
|
||||
-- local launcher_petals_box = create_boxed_widget(launcher_petals, dpi(150), dpi(150), "#00000000")
|
||||
local icon_size = dpi(40)
|
||||
|
||||
local brightness_icon = wibox.widget.imagebox(icons.redshift)
|
||||
|
|
@ -660,7 +536,6 @@ dashboard:setup {
|
|||
{
|
||||
-- Column 2
|
||||
time_box,
|
||||
-- launcher_petals_box,
|
||||
notification_state_box,
|
||||
screenshot_box,
|
||||
date_box,
|
||||
|
|
@ -59,7 +59,13 @@ local sidebar_themes = {
|
|||
"lovelace", -- 1 -- Uses image icons
|
||||
"amarena", -- 2 -- Text-only (consumes less RAM)
|
||||
}
|
||||
local sidebar_theme = sidebar_themes[2]
|
||||
local sidebar_theme = sidebar_themes[1]
|
||||
-- ===================================================================
|
||||
local dashboard_themes = {
|
||||
"skyfall", -- 1 --
|
||||
"amarena", -- 2 -- Displays coronavirus stats
|
||||
}
|
||||
local dashboard_theme = dashboard_themes[2]
|
||||
-- ===================================================================
|
||||
local exit_screen_themes = {
|
||||
"lovelace", -- 1 -- Uses image icons
|
||||
|
|
@ -211,7 +217,7 @@ require("elemental.exit_screen."..exit_screen_theme)
|
|||
-- Sidebar
|
||||
require("elemental.sidebar."..sidebar_theme)
|
||||
-- Dashboard (previously called: Start screen)
|
||||
require("elemental.dashboard")
|
||||
require("elemental.dashboard."..dashboard_theme)
|
||||
-- Lock screen
|
||||
-- Make sure to configure your password in the 'user' section above
|
||||
require("elemental.lock_screen")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue