Skip to content

Commit

Permalink
Floating calendar widget
Browse files Browse the repository at this point in the history
  • Loading branch information
worron committed Oct 13, 2020
1 parent 31f3a7c commit 5105a76
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 3 deletions.
2 changes: 1 addition & 1 deletion color/blue/autostart-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function autostart.run()
awful.spawn.with_shell("pragha --toggle_view")
end

-- Read and commads from file and spawn them
-- Read and commands from file and spawn them
--------------------------------------------------------------------------------
function autostart.run_from_file(file_)
local f = io.open(file_)
Expand Down
2 changes: 1 addition & 1 deletion redflat
Submodule redflat updated 2 files
+374 −0 float/calendar.lua
+7 −4 menu.lua
6 changes: 5 additions & 1 deletion shade/ruby/rc-ruby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ taglist.layouts = {
local textclock = {}
textclock.widget = redflat.widget.textclock({ timeformat = "%H:%M", dateformat = "%b %d %a" })

textclock.buttons = awful.util.table.join(
awful.button({}, 1, function() redflat.float.calendar:show() end)
)

-- Layoutbox configure
--------------------------------------------------------------------------------
local layoutbox = {}
Expand Down Expand Up @@ -322,7 +326,7 @@ awful.screen.connect_for_each_screen(
env.wrapper(sysmon.widget.ram, "ram", sysmon.buttons.ram),
env.wrapper(sysmon.widget.battery, "battery"),
separator,
env.wrapper(textclock.widget, "textclock"),
env.wrapper(textclock.widget, "textclock", textclock.buttons),
separator,
env.wrapper(tray.widget, "tray", tray.buttons),
},
Expand Down
25 changes: 25 additions & 0 deletions themes/colored/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ theme.fonts = {
main = "Play bold 13", -- player widget main font
time = "Play bold 15", -- player widget current time font
},
-- very custom calendar fonts
calendar = {
clock = "Play bold 28", date = "Play 16", week_numbers = "Play 12", weekdays_header = "Play 12",
days = "Play 14", default = "Play 14", focus = "Play 12 Bold", controls = "Play bold 16"
},
}

theme.cairo_fonts = {
Expand Down Expand Up @@ -205,6 +210,26 @@ function theme:update()
------------------------------------------------------------
self.float.brightness.notify = { icon = self.wicon.brightness }

-- Floating calendar
------------------------------------------------------------
self.float.calendar.geometry = { width = 364, height = 460 }
self.float.calendar.border_width = 0
self.float.calendar.show_week_numbers = false
self.float.calendar.calendar_item_margin = { 4, 8, 2, 2 }
self.float.calendar.spacing = { separator = 26, datetime = 5, controls = 5, calendar = 12 }
self.float.calendar.separator = { marginh = { 0, 0, 12, 12 } }

-- dirty colors correction
self.float.calendar.color = {
border = self.color.border,
wibox = self.color.wibox,
icon = self.color.icon,
main = "transparent",
highlight = self.color.main,
gray = self.color.gray,
text = self.color.text,
}

-- Floating window control helper
------------------------------------------------------------
self.float.control.icon = {
Expand Down
3 changes: 3 additions & 0 deletions themes/colorless/common/arrow_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions themes/colorless/common/arrow_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions themes/colorless/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ theme.fonts = {
main = "sans bold 12", -- player widget main font
time = "sans bold 14", -- player widget current time font
},
-- very custom calendar fonts
calendar = {
clock = "Sans 24", date = "Sans 15", week_numbers = "Sans 12", weekdays_header = "Sans 11",
days = "Sans 12", default = "Sans 10", focus = "Sans 14 Bold", controls = "Sans 13"
},
}

theme.cairo_fonts = {
Expand All @@ -97,6 +102,8 @@ theme.icon = {
warning = theme.path .. "/common/warning.svg",
awesome = theme.path .. "/common/awesome.svg",
system = theme.path .. "/common/system.svg",
left = theme.path .. "/common/arrow_left.svg",
right = theme.path .. "/common/arrow_right.svg",
unknown = theme.path .. "/common/unknown.svg",
}

Expand Down Expand Up @@ -1079,6 +1086,42 @@ function theme:init()
color = self.color, -- colors (main used)
}

-- Floating calendar
------------------------------------------------------------
self.float.calendar = {
geometry = { width = 340, height = 420 },
margin = { 20, 20, 20, 15 },
controls_margin = { 0, 0, 5, 0 },
calendar_item_margin = { 2, 5, 2, 2 },
spacing = { separator = 28, datetime = 5, controls = 5, calendar = 8 },
controls_icon_size = { width = 18, height = 18 },
separator = {},
border_width = 2,
days = {
weeknumber = { fg = self.color.gray, bg = "transparent" },
weekday = { fg = self.color.gray, bg = "transparent" },
weekend = { fg = self.color.highlight, bg = self.color.gray },
today = { fg = self.color.highlight, bg = self.color.main },
day = { fg = self.color.text, bg = "transparent" },
default = { fg = "white", bg = "transparent" }
},
fonts = self.fonts.calendar,
icon = { next = self.icon.right, prev = self.icon.left },
clock_format = "%H:%M",
date_format = "%A, %d. %B",
clock_refresh_seconds = 60,
weeks_start_sunday = false,
show_week_numbers = true,
show_weekday_header = true,
long_weekdays = false,
weekday_name_replacements = {},
screen_gap = 0,
set_position = nil,
shape = nil,
screen_gap = 2 * self.useless_gap, -- screen edges gap on placement
color = self.color, -- colors (main used)
}

-- Notify (redflat notification widget)
------------------------------------------------------------
self.float.notify = {
Expand Down

0 comments on commit 5105a76

Please sign in to comment.