switched back to dmenu mode as I personally prefer it
This commit is contained in:
parent
5cd6f85b5d
commit
4bf9a8e266
5 changed files with 17 additions and 19 deletions
26
base.nim
26
base.nim
|
@ -34,7 +34,6 @@ type
|
||||||
x*: int
|
x*: int
|
||||||
y*: int
|
y*: int
|
||||||
|
|
||||||
const font = "Hermit-8"
|
|
||||||
const background* = "#000000"
|
const background* = "#000000"
|
||||||
const backgroundalt* = "#bb222222"
|
const backgroundalt* = "#bb222222"
|
||||||
const backgroundalt2* = "#bb333333"
|
const backgroundalt2* = "#bb333333"
|
||||||
|
@ -57,17 +56,17 @@ const primary* = yellow
|
||||||
const secondary* = red
|
const secondary* = red
|
||||||
const alert* = "#bd2c40"
|
const alert* = "#bd2c40"
|
||||||
const MAX_LINES = 20
|
const MAX_LINES = 20
|
||||||
|
const font = "Hermit-12"
|
||||||
var loop* = false
|
var loop* = false
|
||||||
var stoploop* = true
|
var stoploop* = true
|
||||||
var dmenu* = false
|
var tool* = "dmenu"
|
||||||
var rofi* = true
|
|
||||||
var passmenu* = false
|
var passmenu* = false
|
||||||
var command_wrapper* = false
|
var command_wrapper* = false
|
||||||
var run_command* = ""
|
var run_command* = ""
|
||||||
|
|
||||||
proc newInfo*(str: string = "Info"): Info =
|
proc newInfo*(str: string = "Info"): Info =
|
||||||
var title = str
|
var title = str
|
||||||
if rofi:
|
if tool == "rofi":
|
||||||
title = title & " : "
|
title = title & " : "
|
||||||
return Info(
|
return Info(
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -81,7 +80,7 @@ proc newInfo*(str: string = "Info"): Info =
|
||||||
color: foreground,
|
color: foreground,
|
||||||
)
|
)
|
||||||
|
|
||||||
proc newMenuConfig(cmd: string = "rofi -dmenu"): Menu =
|
proc newMenuConfig(cmd: string = "dmenu"): Menu =
|
||||||
var menu = Menu()
|
var menu = Menu()
|
||||||
menu.command = cmd
|
menu.command = cmd
|
||||||
menu.prompt = "-p"
|
menu.prompt = "-p"
|
||||||
|
@ -89,14 +88,13 @@ proc newMenuConfig(cmd: string = "rofi -dmenu"): Menu =
|
||||||
menu.lines_shown = "-l"
|
menu.lines_shown = "-l"
|
||||||
return menu
|
return menu
|
||||||
|
|
||||||
proc newRofiConfig(): Menu =
|
proc newRofiConfig(cmd: string = "rofi -dmenu"): Menu =
|
||||||
var menu = newMenuConfig()
|
var menu = newMenuConfig(cmd)
|
||||||
menu.extra_cmd = "-markup-rows -kb-row-select \"Tab\" -kb-row-tab \"\""
|
menu.extra_cmd = "-markup-rows -kb-row-select \"Tab\" -kb-row-tab \"\""
|
||||||
return menu
|
return menu
|
||||||
|
|
||||||
proc newDmenuConfig(cmd: string = "dmenu"): Menu =
|
proc newDmenuConfig(cmd: string = "dmenu"): Menu =
|
||||||
var menu = newMenuConfig("dmenu")
|
var menu = newMenuConfig(cmd)
|
||||||
menu.command = cmd
|
|
||||||
menu.bottom = "-b"
|
menu.bottom = "-b"
|
||||||
menu.grabkb = "-f"
|
menu.grabkb = "-f"
|
||||||
menu.monitor = "-m"
|
menu.monitor = "-m"
|
||||||
|
@ -112,9 +110,9 @@ proc newMenu(): Menu =
|
||||||
return newDmenuConfig("passmenu")
|
return newDmenuConfig("passmenu")
|
||||||
elif command_wrapper:
|
elif command_wrapper:
|
||||||
return newDmenuConfig(run_command)
|
return newDmenuConfig(run_command)
|
||||||
elif rofi:
|
elif tool == "rofi":
|
||||||
return newRofiConfig()
|
return newRofiConfig()
|
||||||
elif dmenu:
|
elif tool == "dmenu":
|
||||||
return newDmenuConfig()
|
return newDmenuConfig()
|
||||||
return newMenuConfig()
|
return newMenuConfig()
|
||||||
|
|
||||||
|
@ -205,7 +203,7 @@ proc copyToClipboard*(str: string) =
|
||||||
|
|
||||||
proc outputData*(data: Info, args: varargs[string]): string {.discardable.} =
|
proc outputData*(data: Info, args: varargs[string]): string {.discardable.} =
|
||||||
var output = ""
|
var output = ""
|
||||||
if rofi:
|
if tool == "rofi":
|
||||||
output = runMenu(data,args, rofi = true)
|
output = runMenu(data,args, rofi = true)
|
||||||
elif loop:
|
elif loop:
|
||||||
# mainly for i3bar/i3blocks compatible output
|
# mainly for i3bar/i3blocks compatible output
|
||||||
|
@ -237,10 +235,10 @@ for idx, arg in args:
|
||||||
stoploop = false
|
stoploop = false
|
||||||
of "dmenu":
|
of "dmenu":
|
||||||
stoploop = true
|
stoploop = true
|
||||||
dmenu = true
|
tool = "dmenu"
|
||||||
of "rofi":
|
of "rofi":
|
||||||
stoploop = true
|
stoploop = true
|
||||||
rofi = true
|
tool = "rofi"
|
||||||
of ["pass","passmenu"]:
|
of ["pass","passmenu"]:
|
||||||
passmenu = true
|
passmenu = true
|
||||||
break
|
break
|
||||||
|
|
2
date.nim
2
date.nim
|
@ -1,5 +1,5 @@
|
||||||
import base
|
import base
|
||||||
import std/[os,times,osproc,re]
|
import std/[times,osproc,re]
|
||||||
|
|
||||||
const default_bg = blue
|
const default_bg = blue
|
||||||
const default_fg = white
|
const default_fg = white
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import base
|
import base
|
||||||
import std/[os,times]
|
import std/[times]
|
||||||
|
|
||||||
const default_bg = lightblue
|
const default_bg = lightblue
|
||||||
const default_fg = black
|
const default_fg = black
|
||||||
|
|
|
@ -158,7 +158,7 @@ proc startNotes() =
|
||||||
|
|
||||||
proc main() =
|
proc main() =
|
||||||
echo "Note dir : ", note_dir
|
echo "Note dir : ", note_dir
|
||||||
if not dmenu and not rofi:
|
if tool != "dmenu" and tool != "rofi":
|
||||||
echo "Can only be run in dmenu or rofi mode. Exiting..."
|
echo "Can only be run in dmenu or rofi mode. Exiting..."
|
||||||
return
|
return
|
||||||
startNotes()
|
startNotes()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#curl https://www.tidetimes.org.uk/exmouth-dock-tide-times-20190101 | grep -E -o ">((High|Low)|([0-9]+:[0-9]+)|([0-9]+\.[0-9]+m))"
|
#curl https://www.tidetimes.org.uk/exmouth-dock-tide-times-20190101 | grep -E -o ">((High|Low)|([0-9]+:[0-9]+)|([0-9]+\.[0-9]+m))"
|
||||||
import base
|
import base
|
||||||
import std/[re,httpclient,os,times,osproc,sequtils]
|
import std/[re,httpclient,times,osproc,sequtils]
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# Pass location in as variable
|
# Pass location in as variable
|
||||||
|
@ -76,7 +76,7 @@ proc getDesign(tides: seq[Tide]): Info =
|
||||||
data.args = my_tides
|
data.args = my_tides
|
||||||
return data
|
return data
|
||||||
|
|
||||||
proc getTides*(get_tomorrow: bool = false) {.gcsafe.}=
|
proc getTides*(get_tomorrow: bool = false) =
|
||||||
var mytides = TideList()
|
var mytides = TideList()
|
||||||
mytides.Tides = getTideData(get_tomorrow)
|
mytides.Tides = getTideData(get_tomorrow)
|
||||||
mytides.Tides = sortTides(mytides.Tides, get_tomorrow)
|
mytides.Tides = sortTides(mytides.Tides, get_tomorrow)
|
||||||
|
|
Loading…
Reference in a new issue