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

View file

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

View file

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

View file

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