added calendurr

This commit is contained in:
Paul Wilde 2023-11-23 09:50:15 +00:00
parent c341c9242a
commit ae102073b8
5 changed files with 16 additions and 33 deletions

View file

@ -6,6 +6,7 @@ import util/batturry
import util/volurrme
import util/netwurrk
import util/emurrji
import util/calendurr
proc dispatch*(cfg: Config) =
case cfg.run
@ -21,5 +22,7 @@ proc dispatch*(cfg: Config) =
netwurrk.go()
of Emurrji:
emurrji.go()
of Calendurr:
calendurr.go()
else:
echo "No valid run command given"

View file

@ -7,4 +7,5 @@ type
Batturry,
Volurrme,
Netwurrk,
Emurrji
Emurrji,
Calendurr

View file

@ -25,6 +25,8 @@ proc parseArgs*() =
myConfig.run = Netwurrk
of "emurrji", "emoji":
myConfig.run = Emurrji
of "calendurr", "calender", "cal":
myConfig.run = Calendurr
else:
echo p.help
quit(1)

View file

@ -1,8 +1,10 @@
import ../../globurrl
import std/[times,osproc,re]
import times
import osproc
import re
import ../common
import ../output
const default_bg = blue
const default_fg = white
const default_format = "yyyy-MM-dd"
const cal_pos_x = "20"
const cal_pos_y = "20"
@ -10,9 +12,6 @@ const cal_pos_y = "20"
proc getObject(date: string): Info =
var data = newInfo("Calendurr")
data.full_text = date
data.border = default_bg
data.selected_bg = default_bg
data.selected_fg = default_fg
return data
proc newCalendar(): string =
@ -24,13 +23,7 @@ proc newCalendar(): string =
"""
return c
proc openCalendar*(input: i3barInput) =
var c = newCalendar()
c = replace(c,re"%pos_x", $(input.x - 111))
c = replace(c,re"%pos_y", $input.y)
discard execCmd(c)
proc dmenuCalendar() =
proc openCalendar() =
var c = newCalendar()
c = replace(c,re"%pos_x", cal_pos_x)
c = replace(c,re"%pos_y", cal_pos_y)
@ -41,12 +34,9 @@ proc getDate*() =
let data = getObject(date_today)
let output = outputData(data)
if output == date_today:
dmenuCalendar()
openCalendar()
proc main() =
proc go*() =
getDate()
if isMainModule:
main()

View file

@ -1,13 +0,0 @@
# Package
version = "0.1.0"
author = "Paul Wilde"
description = "Displays the date in dmenu"
license = "MIT"
srcDir = "src"
bin = @["calendurr"]
# Dependencies
requires "nim >= 1.6.6"