Advertisement
constantin-net

kanji120

Feb 28th, 2020
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. kanji = {}
  2. kanji.w = wibox.widget {
  3. widget = wibox.widget.textbox,
  4. text = " 漢字 "
  5. }
  6. kanji.t = awful.tooltip { }
  7. kanji.t:add_to_object(kanji.w)
  8. kanji.timer = gears.timer {
  9. timeout = 120,
  10. call_now = true,
  11. autostart = true,
  12. callback = function()
  13. awful.spawn.easy_async({"bash", "-c", "cat ".. config_dir .. "/jlpt5_4_list.txt | head -n`shuf -i 1-320 -n 1` | tail -n1"},
  14. function(out)
  15. local kanji_current = string.match(out, "^(.*);.*;")
  16. local on_kun = string.match(out, ";(.*);")
  17. local rus = string.match(out, "^.*;(.*)$")
  18. kanji.w:set_text(kanji_current)
  19. kanji.t.text = on_kun .. "\n" .. rus
  20. end
  21. )
  22. end
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement