diff --git a/src/util/furrytime/furrytime.nimble b/src/util/furrytime/furrytime.nimble deleted file mode 100644 index 19e9556..0000000 --- a/src/util/furrytime/furrytime.nimble +++ /dev/null @@ -1,13 +0,0 @@ -# Package - -version = "0.1.0" -author = "Paul Wilde" -description = "Displays the fuzzy time in dmenu" -license = "MIT" -srcDir = "src" -bin = @["furrytime"] - - -# Dependencies - -requires "nim >= 1.6.6" diff --git a/src/util/furrytime/src/furrytime.nim b/src/util/furrytime/src/furrytime.nim deleted file mode 100644 index 1a4d705..0000000 --- a/src/util/furrytime/src/furrytime.nim +++ /dev/null @@ -1,103 +0,0 @@ -import ../../globurrl -import std/[times] - -const default_bg = lightblue -const default_fg = black - -proc getHour(hr: int): string -proc getMinute(min: int): string - -proc getFuzzyTime(): string = - let tm = now() - var hr = tm.hour() - let min = tm.minute() - var link = "past" - if min > 32 : - link = "to" - case hr: - of 23: - hr = 0 - else: - hr = hr + 1 - if min >= 58 or min <= 02: - return getHour(hr) & " " & getMinute(min) - else: - return getMinute(min) & " " & link & " " & getHour(hr) - -proc getHour(hr: int): string = - case hr: - of 1, 13: - return "one" - of 2, 14: - return "two" - of 3, 15: - return "three" - of 4, 16: - return "four" - of 5, 17: - return "five" - of 6, 18: - return "six" - of 7, 19: - return "seven" - of 8, 20: - return "eight" - of 9, 21: - return "nine" - of 10, 22: - return "ten" - of 11, 23: - return "eleven" - of 0, 12, 24: - return "twelve" - else: - return "error" - -proc getMinute(min: int): string = - case min: - of 58,59,0,1,2: - return "o'clock" - of 3,4,5,6,7,53,54,55,56,57: - return "five" - of 8,9,10,11,12,48,49,50,51,52: - return "ten" - of 13,14,15,16,17,43,44,45,46,47: - return "quarter" - of 18,19,20,21,22,38,39,40,41,42: - return "twenty" - of 23,24,25,26,27,33,34,35,36,37: - return "twenty-five" - of 28,29,30,31,32: - return "half" - else: - return "error" - -proc getObject(time: string): Info = - var data = newInfo("Furry Time") - data.full_text = time - data.selected_bg = default_bg - data.selected_fg = default_fg - #i3bar stuff - data.color = default_fg - data.border = default_fg - return data - -proc show(time: string, next_fuzzy: bool = false) = - let data = getObject(time) - let x = outputData(data) - if x == time: - case next_fuzzy: - of true: - let t = getFuzzyTime() - show(t, false) - else: - let t = now().format("HH:mm:ss") - show(t, true) - - -proc main() = - let time = getFuzzyTime() - show(time) - -if isMainModule: - main() diff --git a/src/util/pingclurrk/pingclurrk.nimble b/src/util/pingclurrk/pingclurrk.nimble deleted file mode 100644 index 2cd8f46..0000000 --- a/src/util/pingclurrk/pingclurrk.nimble +++ /dev/null @@ -1,13 +0,0 @@ -# Package - -version = "0.1.0" -author = "Paul Wilde" -description = "A ping clock - display current ping time" -license = "GPL-3.0-or-later" -srcDir = "src" -bin = @["pingclurrk"] - - -# Dependencies - -requires "nim >= 1.6.6" diff --git a/src/util/pingclurrk/src/pingclurrk.nim b/src/util/pingclurrk/src/pingclurrk.nim deleted file mode 100644 index d01bcef..0000000 --- a/src/util/pingclurrk/src/pingclurrk.nim +++ /dev/null @@ -1,85 +0,0 @@ -import ../../globurrl -import std/[osproc, re, strutils] - -const host: string = "9.9.9.9" -const default_bg = blue -const default_fg = white -const medium_bg = alert -const medium_fg = black -const alert_bg = alert -const alert_fg = black -const warning_bg = red -const warning_fg = white - -let ping_re = re(r"time=[0-9.]+") -const ping_cmd: string = "ping -4 -c 1 " & host - -proc getPing(): float = - var ping: float = -1 - let cmdOut = execCmdEx(ping_cmd) - let lines = splitLines(cmdOut.output) - let ping_line = lines[1] - let bounds = findBounds(ping_line, ping_re) - if bounds.first > 0: - let png = ping_line[bounds.first+5..bounds.last] - ping = parseFloat(png) - return ping - -proc getObject(ping: float): Info = - let pingstr = split($ping,".") - let niceping = pingstr[0] & "." & pingstr[1][0] - var text = "🏓 " & niceping & " ms" - var state = 0 - if ping < 0: - text = "❌ No Pong" - state = 1 - else: - case ping: - of 0..100: - state = 0 - of 101..400: - state = 1 - of 401..1000: - state = 2 - else: - state = 9 - - var data = newInfo("Ping Clurrk") - data.full_text = text - # i3bar stuff - data.color = default_fg - data.border = default_bg - data.background = black - data.selected_bg = default_bg - data.selected_fg = default_fg - case state: - of 1: - data.selected_bg = medium_bg - data.selected_fg = medium_fg - # i3bar stuff - data.color = medium_bg - of 2: - data.selected_bg = alert_bg - data.selected_fg = alert_fg - # i3bar stuff - data.color = alert_bg - of 9: - data.selected_bg = warning_bg - data.selected_fg = warning_fg - # i3bar stuff - data.color = warning_bg - else: - #default options already set - let ok = true - return data - - -proc main() = - let ping = get_ping() - let data = getObject(ping) - let output = outputData(data) - if output == data.full_text: - main() - -if isMainModule: - main()