Skip to content

Commit

Permalink
Add AwesomeWM Agenda
Browse files Browse the repository at this point in the history
  • Loading branch information
frioux committed Jun 11, 2019
1 parent 5aba878 commit dd590f2
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.mdwn
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Ensure permissions are correct:

Also set up Firefox Sync

Run `gcalcli list` to authenticate to google.

# Add / Replace SSH Key

* Generate Key: `ssh-keygen -t ed25519 -o -a 100`
Expand Down
20 changes: 17 additions & 3 deletions awesome/gross/calendar_popup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ local function get_geometry(widget, screen, position)
x = wa.x + math.floor((wa.width - width) / 2)
end

return {x=x, y=y, width=width, height=height}
return {x=x, y=y, width=width, height=2*height}
end

--- Call the calendar with offset
Expand All @@ -217,7 +217,14 @@ function calendar_popup:call_calendar(offset, position, screen)

self.offset = inc_offset ~= 0 and self.offset + inc_offset or 0

local widget = self:get_widget()
local t = self:get_widget().children[2]
local path = os.getenv("TMPDIR")
if not path then path = "/tmp" end
local f = assert(io.open(path .. "/cal", "rb"))
local content = f:read("*all")
f:close()
t:set_text(content)
local widget = self:get_widget().children[1]
local raw_date = os.date("*t")
local date = {day=raw_date.day, month=raw_date.month, year=raw_date.year}
if widget._private.type == "month" and self.offset ~= 0 then
Expand Down Expand Up @@ -325,6 +332,7 @@ local function get_cal_wibox(caltype, args)
ret.screen = args.screen

local t = wibox.widget.textbox()
t:set_font("Ubuntu Mono Regular 14")
local widget = wibox.widget {
font = args.font or beautiful.font,
spacing = args.spacing,
Expand All @@ -335,7 +343,13 @@ local function get_cal_wibox(caltype, args)
_calendar_margin = args.margin,
widget = caltype == "year" and wibox.widget.calendar.year or wibox.widget.calendar.month,
}
ret:set_widget(widget)
local composite = wibox.widget({
widget,
t,
layout = wibox.layout.flex.vertical,
spacing = 2,
})
ret:set_widget(composite)

ret:buttons(gears.table.join(
abutton({ }, 1, function ()
Expand Down
9 changes: 7 additions & 2 deletions awesome/rc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ awful.screen.connect_for_each_screen(function(s)
-- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s, height = 32 })

local mytextclock = widgets.clock(s)
s.mytextclock = widgets.clock(s)

-- Add widgets to the wibox
local right = {
Expand All @@ -234,7 +234,7 @@ awful.screen.connect_for_each_screen(function(s)
smweatherwidget,
osweatherwidget,
volumecfg.widget,
mytextclock,
s.mytextclock,
s.mylayoutbox,
}
if DEBUGGING then
Expand Down Expand Up @@ -277,6 +277,11 @@ globalkeys = gears.table.join(
{description = "view next", group = "tag"}),
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
{description = "go back", group = "tag"}),
awful.key({ modkey }, "c",
function ()
awful.screen.focused().mytextclock._cal:toggle()
end,
{description = "toggle calendar", group = "awesome"}),

awful.key({ modkey, }, "j",
function () awful.client.focus.byidx( 1) end,
Expand Down
8 changes: 7 additions & 1 deletion awesome/widgets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ local vicious = require("vicious")
local wibox = require("wibox")
local gears = require("gears")

local calendar_popup = require("gross.calendar_popup")

local widgets = {}

function widgets.battery()
Expand Down Expand Up @@ -45,7 +47,11 @@ end

function widgets.clock(screen)
local widget = wibox.widget.textclock()
local self = awful.widget.calendar_popup.month({ screen = screen })
local self = calendar_popup.month({
screen = screen,
bg = "#111111",
})
widget._cal = self

-- inlined from calendar_popup:attach
local position = "tr"
Expand Down
5 changes: 5 additions & 0 deletions crontab.d/hourly/gcal
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/zsh

gcalcli --calendar fREW agenda "$(date)" "$(date --date=@$(( $(date +%s) + 8 * 60 * 60 )) )" |
cut -b 13- |
skip 1 > $TMPDIR/cal
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ -e ~/.frewmbot-local ]; then

link-file terminator_config ~/.config/terminator/config
link-file xsession ~/.xinitrc
link-file taffybar/taffybar.hs ~/.config/taffybar/taffybar.hs
link-file crontab.d/hourly/gcal ~/.crontab.d/hourly/gcal
if [ -d "$HOME/var/mail" ]; then
link-file crontab.d/hourly/notmuch ~/.crontab.d/hourly/notmuch
else
Expand Down
1 change: 1 addition & 0 deletions packages.x11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exec apt-get --no-install-recommends \
feh \
firefox \
fonts-lohit-knda \
gcalcli \
gnome-system-monitor \
gnome-power-manager \
gtk2-engines \
Expand Down

0 comments on commit dd590f2

Please sign in to comment.