From ae102073b83dc8b0d05d255aa1c5f9ba98880568 Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Thu, 23 Nov 2023 09:50:15 +0000 Subject: [PATCH] added calendurr --- src/dispatcher.nim | 3 +++ src/model/tool.nim | 3 ++- src/parser.nim | 2 ++ src/util/{calendurr/src => }/calendurr.nim | 28 +++++++--------------- src/util/calendurr/calendurr.nimble | 13 ---------- 5 files changed, 16 insertions(+), 33 deletions(-) rename src/util/{calendurr/src => }/calendurr.nim (64%) delete mode 100644 src/util/calendurr/calendurr.nimble diff --git a/src/dispatcher.nim b/src/dispatcher.nim index 527fd1b..6a7c3f0 100644 --- a/src/dispatcher.nim +++ b/src/dispatcher.nim @@ -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" diff --git a/src/model/tool.nim b/src/model/tool.nim index 60853f5..8273b72 100644 --- a/src/model/tool.nim +++ b/src/model/tool.nim @@ -7,4 +7,5 @@ type Batturry, Volurrme, Netwurrk, - Emurrji + Emurrji, + Calendurr diff --git a/src/parser.nim b/src/parser.nim index 670c18b..d192959 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -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) diff --git a/src/util/calendurr/src/calendurr.nim b/src/util/calendurr.nim similarity index 64% rename from src/util/calendurr/src/calendurr.nim rename to src/util/calendurr.nim index 2160e85..67ae458 100644 --- a/src/util/calendurr/src/calendurr.nim +++ b/src/util/calendurr.nim @@ -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() - diff --git a/src/util/calendurr/calendurr.nimble b/src/util/calendurr/calendurr.nimble deleted file mode 100644 index ce853ed..0000000 --- a/src/util/calendurr/calendurr.nimble +++ /dev/null @@ -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"