Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

il y a 7 ans
il y a 7 ans
il y a 7 ans
il y a 7 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. # DEDaemon
  2. DEDaemon is a daemon to give some of the perks of a full desktop environment to
  3. those of us running window managers.
  4. ## Installation
  5. Run `npm install -g dedaemon` as root.
  6. ## Usage
  7. ```
  8. dedaemon <config file> -- Start a new instance of dedaemon
  9. dedaemon list -- List all displays and input devices
  10. dedaemon stop -- Stop all running istances of dedaemon
  11. dedaemon reload -- Reload config file
  12. ```
  13. e.g:
  14. `dedaemon ~/.config/dedaemon.hcnf`
  15. You probably want to run that on startup. If you're running i3wm, that means
  16. adding `exec --no-startup-id dedaemon stop; dedaemon ~/.config/dedaemon.hcnf` to
  17. `~/.i3/config`. This first stop any running instance of dedaemon, then runs a
  18. new one.
  19. ## Installing
  20. **If you already have a recent node.js and npm set up:**
  21. ```
  22. sudo npm install -g dedaemon
  23. ```
  24. **If you don't have a recent version of node.js:** (replace apt with your
  25. package manager of choice)
  26. ```
  27. sudo apt install npm
  28. sudo npm install -g n
  29. sudo n stable
  30. sudo npm install -g dedaemon
  31. ```
  32. Here, we first install npm, node's package manager. We then use that to install
  33. `n`, which is a handy tool to install node. We use `n` to install the
  34. current stable version of node, and then finally install dedaemon with npm.
  35. You might also be able to use your package manager's version of node, but some
  36. distros (**cough**debian**cough**) ship _really_ old versions.
  37. ## Why?
  38. I love using i3wm, but that means I'm running just a window manager, not a
  39. desktop environment. A desktop environment usually handles a lot of stuff, like
  40. automatically applying your preferences to keyboard and mice, adapting to
  41. displays being plugged in or unplugged, and setting your wallpaper and making
  42. sure it continues to look okay when your displays change. The common solution
  43. is to have a shell script which you run at startup, which runs the commands to
  44. configure input devices, start applications, etc. The problem with that is that
  45. it adapts poorly to changes to the system after the script has started.
  46. I made dedaemon to give me some of the perks of a desktop environment, without
  47. actually running a complete desktop environment. Whenever a display is
  48. connected or disconnected, it runs the required xrandr commands to set up your
  49. displays like you want them, then runs the required feh command to set your
  50. wallpaper again. Whenever an input device is connected, it applies your desired
  51. xinput settings to the device, and re-runs whatever commands you desire
  52. (e.g xset, setxkbmap). It runs the applications and services you want to run on
  53. startup, and makes sure they are properly termminated when dedaemon stops.
  54. ### Why node.js?
  55. I suspect a lot of people will wonder why on earth this is written in
  56. javascript and using node.js. The simple reason is that I like it. Newer
  57. versions of javascript has pretty nice syntax, and node.js is really quite good
  58. at asynchronous programming; a lot of what dedaemon does is sitting idle and
  59. waiting for events, and interacting with the system. It's nice to not block
  60. while running relatively slow xrandr commands. I also find node's interface for
  61. spawning and interacting with child processes to be really nice.
  62. A lot of why people dislike node.js is dependency hell; any package has a dozen
  63. dependencies, eoch of which in turn has a dozen more sub-dependencies, etc. I
  64. personally don't like that either. That's why dedaemon has exactly one
  65. dependency, counting transient dependencies, and that's my config file parser.
  66. At the time of writing, the entire thing is around 300 kilobytes, and that's
  67. counting the node\_modules folder and everything.
  68. Even the code interacting with udev doesn't use the "proper" way of integrating
  69. C code with node, because that requires dependencies, and you suddenly end up
  70. with a hundred transient dependencies. Instead, I just wrote a tiny C program
  71. which I interract with by writing to its stdin and reading from its stdout.
  72. ## Configuration
  73. Dedaemon uses [my hconfig library](https://github.com/mortie/hconfig#syntax)
  74. to parse the config file. Refer to that page if you need help with the syntax.
  75. The file
  76. [example.hcnf](https://git.mort.coffee/mort/dedaemon/src/master/example.hcnf)
  77. contains some example configuration.
  78. ### General
  79. The `general` section is for configuration of dedaemon itself; the only
  80. property so far is `log`.
  81. ```
  82. general {
  83. log <log file>
  84. }
  85. ```
  86. ### Display
  87. The `display` section controls a display. Refer to `dedaemon list` or `xrandr`
  88. to see what values are available. The `name` property can be `*` to affect all
  89. displays.
  90. ```
  91. display <name> {
  92. mode <string | "max">
  93. rate <number | "max">
  94. where {
  95. <left-of | right-of | above | below> <name | "primary">
  96. }
  97. }
  98. ```
  99. ### Input
  100. The `input` section controls an input device. Refer to `dedaemon list` or
  101. `xinput list` to see a list of devices. The `name` property can be `*` to
  102. affect all input devices.
  103. ```
  104. input <name> {
  105. type <"pointer" | "keyboard"> - Apply only to pointer or keyboard devices
  106. options <array of arrays> - Options passed to `xinput set-prop`
  107. commands <array of strings> - Commands to run when the device is connected
  108. }
  109. ```
  110. ### Wallpaper
  111. The `wallpaper` section controlls the wallpaper.
  112. ```
  113. wallpaper {
  114. path <background image file>
  115. mode <"scale" | "center" | "fill" | "max" | "tile">
  116. }
  117. ```
  118. ### Process
  119. The `process` section describes processes you want to run whenever dedaemon
  120. starts.
  121. ```
  122. process <name> {
  123. run <array of strings> -- Command
  124. in <directory> -- Working directory
  125. env <object> -- Environment variables
  126. delay <number> -- Number of milliseconds to wait before executing
  127. }
  128. ```
  129. You can also run multiple commands in the same section, by adding `as group`,
  130. like this:
  131. ```
  132. process misc {
  133. run [
  134. [ firefox ]
  135. [ sh .startup.sh ]
  136. ] as group
  137. }
  138. ```