SHARE
TWEET

kanji180

constantin-net Feb 28th, 2020 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. day_kanji = {}
  2. day_kanji.w = wibox.widget {
  3.   widget = wibox.widget.textbox,
  4.   text = " 漢字 "
  5. }
  6. day_kanji.on_kun = "click"
  7. day_kanji.rus = "click"
  8. day_kanji.command = function() awful.spawn.with_shell(config_dir .. "day_kanji.sh") end
  9. local kanji_t = awful.tooltip { }
  10. kanji_t:add_to_object(day_kanji.w)
  11. day_kanji.w:connect_signal('mouse::enter', function()
  12.     kanji_t.text = day_kanji.on_kun .. "\n" .. day_kanji.rus
  13. end)
  14. day_kanji.w:connect_signal("button::press",
  15.     function(_, _, _, button)
  16.       if button == 1 then day_kanji.command() end
  17. end)
  18. day_kanji.t = gears.timer { timeout = 180 }
  19. day_kanji.t:connect_signal("timeout", function() day_kanji.command() end)
  20. day_kanji.t:start()
  21.  
  22. #!/bin/bash
  23. #day_kanji.sh
  24. number=`shuf -i 1-320 -n 1`
  25. word=`cat jlpt5_4_list.txt | head -n$number | tail -n1`
  26. title=`echo "${word}" | tr ';' '\n'| head -n1`
  27. on_kun=`echo "${word}" | tr ';' '\n'| head -n2 | tail -n1`
  28. rus=`echo "${word}" | tr ';' '\n'| head -n3 | tail -n1`
  29. command=`cat <<EOF
  30. day_kanji.w:set_text("${title}")
  31. day_kanji.on_kun = "${on_kun}"
  32. day_kanji.rus = "${rus}"
  33. EOF
  34. `
  35. echo "${command}" | awesome-client
  36. exit 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top