My configuration files for Debian/Ubuntu applications
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

cal.md 2.9 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ## Usage
  2. [Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
  3. ### Description
  4. Creates a calendar notification that can be attached to widgets.
  5. This is a simpler but [faster](https://github.com/awesomeWM/awesome/issues/1861)
  6. alternative to [`awful.widget.calendar_popup`](https://awesomewm.org/doc/api/classes/awful.widget.calendar_popup.html), which emulates UNIX's `cal`.
  7. ```lua
  8. local mycal = lain.widget.cal()
  9. ```
  10. ## Input table
  11. Variable | Meaning | Type | Default
  12. --- | --- | --- | ---
  13. `attach_to` | List of widgets | table | empty table
  14. `week_start` | First day of the week | integer | 2 (Monday)
  15. `three` | Display three months spanning the date | boolean | false
  16. `followtag` | Display the notification on currently focused screen | boolean | false
  17. `week_number` | Display the week number | string ("none", "left" or "right") | "none"
  18. `week_number_format` | Week number format | string | `"%3d \| "` for "left", `"\| %-3d"` for "right"
  19. `icons` | Path to calendar icons | string | [icons/cal/white/](https://github.com/lcpz/lain/tree/master/icons/cal/white)
  20. `notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/cal#default-notification_preset)
  21. Set `attach_to` as the list of widgets to which you want to attach the calendar, like this:
  22. ```lua
  23. local mycal = lain.widget.cal {
  24. attach_to = { mywidget1, mywidget2, ... },
  25. -- [...]
  26. }
  27. ```
  28. For every widget in `attach_to`:
  29. - Left click / scroll down: switch to previous month.
  30. - Middle click show current month.
  31. - Right click / scroll up: switch to next month.
  32. With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
  33. ### Default `notification_preset`
  34. ```lua
  35. notification_preset = {
  36. font = "Monospace 10",
  37. fg = "#FFFFFF",
  38. bg = "#000000"
  39. }
  40. ```
  41. ## Output table
  42. Variable | Meaning | Type
  43. --- | --- | ---
  44. `attach` | Attach the calendar to an input widget | function
  45. `show` | Show calendar | function
  46. `hide` | Hide calendar | function
  47. `attach` takes as argument any widget you want to attach the calendar to, while
  48. `show` takes as optional argument an integer to indicate the seconds to timeout.
  49. ## Keybinding
  50. ```lua
  51. awful.key({ altkey }, "c", function () mycal.show(7) end)
  52. ```
  53. Where `altkey = "Mod1"`.
  54. ## Notes
  55. * Naughty notifications require `notification_preset.font` to be **monospaced**, in order to correctly display the output.
  56. * If you want to [disable notification icon](https://github.com/lcpz/lain/pull/351), set `icons = ""` in the input table.
  57. * If you want to localise the calendar, put `os.setlocale(os.getenv("LANG"))` in your `rc.lua`.
  58. * If you want to get notifications [only with mouse clicks](https://github.com/lcpz/lain/issues/320) on a given widget, use this code:
  59. ```lua
  60. yourwidget:disconnect_signal("mouse::enter", mycal.hover_on)
  61. ```