Compare commits

...

2 commits

Author SHA1 Message Date
75201b189f updated readme with brief descriptions of each tool 2022-05-03 21:48:16 +01:00
912d413748 added notes feature 2022-05-03 21:43:47 +01:00
2 changed files with 28 additions and 3 deletions

View file

@ -27,6 +27,18 @@ or
``` ```
it can also be run without any arguments to receive a i3bar compatible json string it can also be run without any arguments to receive a i3bar compatible json string
## Tools
- `pingclock` performs a single `ping` to a server and returns the response time
- `battery` shows the current battery level
- `brightness` shows the current backlight level and gives options to adjust it
- `volume` shows the current volume level and gives options to adjust and manage it
- `date` shows the date
- `fuzzytime` shows the fuzzytime clock
- `wlan` shows the state of the wireless network interface. SSID connected to and signal level.
- `nic` shows the status and/or the ip address of the network interface card
- `temperature` shows the current CPU temperature
- `notes` a simple one liner note taking tool, displaying notes in dmenu/rofi
Personally, I have these bound to key combinations in i3. In fact, I have a seperate `bindsym` mode in which all these tools are accessible i.e. `$mod+i` to get to "info" mode then `p` to show pingclock. Personally, I have these bound to key combinations in i3. In fact, I have a seperate `bindsym` mode in which all these tools are accessible i.e. `$mod+i` to get to "info" mode then `p` to show pingclock.
## You can also set the volume and brightness levels by typing a numeric figure into the dmenu/rofi input box ## You can also set the volume and brightness levels by typing a numeric figure into the dmenu/rofi input box

View file

@ -20,6 +20,7 @@ proc read_notes(): seq[string] =
proc write_notes(notes: seq[string]) = proc write_notes(notes: seq[string]) =
try: try:
let f = open(note_file, fmWrite) let f = open(note_file, fmWrite)
defer: f.close()
for note in notes: for note in notes:
f.writeLine(note) f.writeLine(note)
except: except:
@ -43,6 +44,16 @@ proc write_note(note: string) =
except: except:
echo "write_note, Unable to write note :", getCurrentExceptionMsg() echo "write_note, Unable to write note :", getCurrentExceptionMsg()
proc replace_note(new_note: string, old_note: string) =
let notes = read_notes()
var new_notes: seq[string] = @[]
for a_note in notes:
if old_note == a_note:
new_notes.add(new_note)
else:
new_notes.add(a_note)
write_notes(new_notes)
proc get_notes(): (Info, seq[string]) = proc get_notes(): (Info, seq[string]) =
var info = newInfo() var info = newInfo()
info.title = "Notes :" info.title = "Notes :"
@ -52,7 +63,7 @@ proc get_notes(): (Info, seq[string]) =
proc display_option_menu(option: string) = proc display_option_menu(option: string) =
var select = newInfo() var select = newInfo()
select.title = "Note :" select.title = "Note :"
let args = concat(@["option"],note_choices) let args = concat(@[option],note_choices)
let chosen = outputJSON(select,args) let chosen = outputJSON(select,args)
if chosen in note_choices: if chosen in note_choices:
case chosen: case chosen:
@ -61,9 +72,11 @@ proc display_option_menu(option: string) =
start_notes() start_notes()
of "back": of "back":
start_notes() start_notes()
elif chosen != "" and chosen != option:
replace_note(chosen, option)
display_option_menu(chosen)
else: else:
write_note(option) display_option_menu(option)
display_option_menu(chosen)
proc start_notes() = proc start_notes() =
let (info,notes) = get_notes() let (info,notes) = get_notes()