Compare commits
No commits in common. "cb180c409509ac513666893beff2dae18dbe81b9" and "2aa3e0db32e96eb82ef06450ae3b82f0d564589a" have entirely different histories.
cb180c4095
...
2aa3e0db32
3 changed files with 4 additions and 99 deletions
|
@ -29,10 +29,7 @@ it can also be run without any arguments to receive a i3bar compatible json stri
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
https://user-images.githubusercontent.com/31094984/166156793-2089cc10-2649-4079-b82d-bba272253dd6.mp4
|
|
||||||
|
|
||||||
|
|
||||||
There's also an i3bar_tools_threaded folder with tools for use with i3bar/i3blocks which continously update. Currently these are not working as I recently switched from this as primary, to a secondary choice.
|
There's also an i3bar_tools_threaded folder with tools for use with i3bar/i3blocks which continously update. Currently these are not working as I recently switched from this as primary, to a secondary choice.
|
||||||
|
|
||||||
|
|
8
base.nim
8
base.nim
|
@ -44,8 +44,8 @@ const secondary* = red
|
||||||
const alert* = "#bd2c40"
|
const alert* = "#bd2c40"
|
||||||
var loop* = true
|
var loop* = true
|
||||||
var stoploop* = false
|
var stoploop* = false
|
||||||
var dmenu* = false
|
var dmenu = false
|
||||||
var rofi* = false
|
var rofi = false
|
||||||
|
|
||||||
proc newInfo*(): Info =
|
proc newInfo*(): Info =
|
||||||
return Info(
|
return Info(
|
||||||
|
@ -82,9 +82,7 @@ proc getArguments*(): seq[string] =
|
||||||
|
|
||||||
proc runDMenu*(data: Info, opts: varargs[string], rofi: bool = false): string =
|
proc runDMenu*(data: Info, opts: varargs[string], rofi: bool = false): string =
|
||||||
discard execCmd("i3-msg mode \"default\"")
|
discard execCmd("i3-msg mode \"default\"")
|
||||||
var cmd = "echo -e \""
|
var cmd = "echo -e \"" & $data.full_text & "\n"
|
||||||
if $data.full_text != "":
|
|
||||||
cmd &= $data.full_text & "\n"
|
|
||||||
for opt in opts:
|
for opt in opts:
|
||||||
cmd = cmd & opt & "\n"
|
cmd = cmd & opt & "\n"
|
||||||
cmd.removeSuffix("\n")
|
cmd.removeSuffix("\n")
|
||||||
|
|
90
notes.nim
90
notes.nim
|
@ -1,90 +0,0 @@
|
||||||
import base
|
|
||||||
import std/[os,strutils,sequtils]
|
|
||||||
|
|
||||||
proc start_notes()
|
|
||||||
|
|
||||||
const all_choices = @["exit"]
|
|
||||||
const note_choices = @["rm","back"]
|
|
||||||
const note_file = getHomeDir() & ".notes.dmenu"
|
|
||||||
|
|
||||||
proc read_notes(): seq[string] =
|
|
||||||
try:
|
|
||||||
var notes: seq[string] = @[]
|
|
||||||
for line in note_file.lines:
|
|
||||||
notes.add(line)
|
|
||||||
return notes
|
|
||||||
except:
|
|
||||||
echo "read_notes, Can't open notes file :", getCurrentExceptionMsg()
|
|
||||||
return @["<empty>"]
|
|
||||||
|
|
||||||
proc write_notes(notes: seq[string]) =
|
|
||||||
try:
|
|
||||||
let f = open(note_file, fmWrite)
|
|
||||||
for note in notes:
|
|
||||||
f.writeLine(note)
|
|
||||||
except:
|
|
||||||
echo "write_notes, Cannot write notes to file : ", getCurrentExceptionMsg()
|
|
||||||
|
|
||||||
proc remove_note(note: string) =
|
|
||||||
let notes = read_notes()
|
|
||||||
var new_notes: seq[string] = @[]
|
|
||||||
for a_note in notes:
|
|
||||||
if note != a_note:
|
|
||||||
new_notes.add(a_note)
|
|
||||||
write_notes(new_notes)
|
|
||||||
|
|
||||||
proc write_note(note: string) =
|
|
||||||
if note == "":
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
let f = open(note_file, fmAppend)
|
|
||||||
defer: f.close()
|
|
||||||
f.writeLine(strip(note))
|
|
||||||
except:
|
|
||||||
echo "write_note, Unable to write note :", getCurrentExceptionMsg()
|
|
||||||
|
|
||||||
proc get_notes(): (Info, seq[string]) =
|
|
||||||
var info = newInfo()
|
|
||||||
info.title = "Notes :"
|
|
||||||
let notes = read_notes()
|
|
||||||
return (info,notes)
|
|
||||||
|
|
||||||
proc display_option_menu(option: string) =
|
|
||||||
var select = newInfo()
|
|
||||||
select.title = "Note :"
|
|
||||||
let args = concat(@["option"],note_choices)
|
|
||||||
let chosen = outputJSON(select,args)
|
|
||||||
if chosen in note_choices:
|
|
||||||
case chosen:
|
|
||||||
of "rm":
|
|
||||||
remove_note(option)
|
|
||||||
start_notes()
|
|
||||||
of "back":
|
|
||||||
start_notes()
|
|
||||||
else:
|
|
||||||
write_note(option)
|
|
||||||
display_option_menu(chosen)
|
|
||||||
|
|
||||||
proc start_notes() =
|
|
||||||
let (info,notes) = get_notes()
|
|
||||||
let args = concat(notes, all_choices)
|
|
||||||
let option = outputJSON(info, args)
|
|
||||||
if option in all_choices:
|
|
||||||
case option:
|
|
||||||
of "exit":
|
|
||||||
return
|
|
||||||
if option in notes:
|
|
||||||
display_option_menu(option)
|
|
||||||
else:
|
|
||||||
write_note(option)
|
|
||||||
start_notes()
|
|
||||||
|
|
||||||
proc main() =
|
|
||||||
echo "Note file : ", note_file
|
|
||||||
if not dmenu and not rofi:
|
|
||||||
echo "Can only be run in dmenu or rofi mode. Exiting..."
|
|
||||||
return
|
|
||||||
start_notes()
|
|
||||||
|
|
||||||
if isMainModule:
|
|
||||||
main()
|
|
Loading…
Reference in a new issue