Browse Source

README, and other changes

master
mortie 6 years ago
parent
commit
2f5446fd81
4 changed files with 110 additions and 4 deletions
  1. 105
    1
      README.md
  2. 2
    1
      dedaemon.js
  3. 2
    2
      example.hcnf
  4. 1
    0
      js/parse-conf.js

+ 105
- 1
README.md View File

@@ -11,6 +11,7 @@ Run `npm install -g dedaemon` as root.

```
dedaemon <config file> -- Start a new instance of dedaemon
dedaemon list -- List all displays and input devices
dedaemon stop -- Stop all running istances of dedaemon
dedaemon reload -- Reload config file
```
@@ -24,6 +25,109 @@ adding `exec --no-startup-id dedaemon stop; dedaemon ~/.config/dedaemon.hcnf` to
`~/.i3/config`. This first stop any running instance of dedaemon, then runs a
new one.

## Why?

I love using i3wm, but that means I'm running just a window manager, not a
desktop environment. A desktop environment usually handles a lot of stuff, like
automatically applying your preferences to keyboard and mice, adapting to
displays being plugged in or unplugged, and setting your wallpaper and making
sure it continues to look okay when your displays change. The common solution
is to have a shell script which you run at startup, which runs the commands to
configure input devices, start applications, etc. The problem with that is that
it adapts poorly to changes to the system after the script has started.

I made dedaemon to give me some of the perks of a desktop environment, without
actually running a complete desktop environment. Whenever a display is
connected or disconnected, it runs the required xrandr commands to set up your
displays like you want them, then runs the required feh command to set your
wallpaper again. Whenever an input device is connected, it applies your desired
xinput settings to the device, and re-runs whatever commands you desire
(e.g xset, setxkbmap). It runs the applications and services you want to run on
startup, and makes sure they are properly termminated when dedaemon stops.

## Configuration

There will be stuff here later.
Dedaemon uses [my hconfig library](https://github.com/mortie/hconfig#syntax)
to parse the config file. Refer to that page if you need help with the syntax.

The file
[example.hcnf](https://git.mort.coffee/mort/dedaemon/src/master/example.hcnf)
contains some example configuration.

### General

The `general` section is for configuration of dedaemon itself; the only
property so far is `log`.

```
general {
log <log file>
}
```

### Display

The `display` section controls a display. Refer to `dedaemon list` or `xrandr`
to see what values are available. The `name` property can be `*` to affect all
displays.

```
display <name> {
mode <string | "max">
rate <number | "max">
where {
<left-of | right-of | above | below> <name | "primary">
}
}
```

### Input

The `input` section controls an input device. Refer to `dedaemon list` or
`xinput list` to see a list of devices. The `name` property can be `*` to
affect all input devices.

```
input <name> {
type <"pointer" | "keyboard"> - Apply only to pointer or keyboard devices
options <array of arrays> - Options passed to `xinput set-prop`
commands <array of strings> - Commands to run when the device is connected
}
```

### Wallpaper

The `wallpaper` section controlls the wallpaper.

```
wallpaper {
path <background image file>
mode <"scale" | "center" | "fill" | "max" | "tile">
}
```

### Process

The `process` section describes processes you want to run whenever dedaemon
starts.

```
process <name> {
run <array of strings> -- Command
in <directory> -- Working directory
env <object> -- Environment variables
delay <number> -- Number of milliseconds to wait before executing
}
```

You can also run multiple commands in the same section, by adding `as group`,
like this:

```
process misc {
run [
[ firefox ]
[ sh .startup.sh ]
] as group
}
```

+ 2
- 1
dedaemon.js View File

@@ -18,7 +18,8 @@ var modules = {
if (!process.argv[2]) {
console.error("Usage:", process.argv[1], "<config file>");
console.error(" ", process.argv[1], "list -- List display and input devices");
console.error(" ", process.argv[1], "reload -- Reload the running daemon");
console.error(" ", process.argv[1], "reload -- Reload the running dedaemon instance");
console.error(" ", process.argv[1], "stop -- Stop all running dedaemon instances");
process.exit(1);
}


+ 2
- 2
example.hcnf View File

@@ -19,10 +19,10 @@ input * {
type keyboard
commands [
"xset r rate 200 60"
"setxkbmap dvorak -option ctrl:swapcaps -option altwin:swap_alt_win"
"setxkbmap us -option ctrl:swapcaps -option altwin:swap_alt_win"
]
}

wallpaper {
path /home/martin/background.jpg
path "$(HOME)/background.jpg"
}

+ 1
- 0
js/parse-conf.js View File

@@ -32,6 +32,7 @@ var configStructure = {
props: {
name: "null",
path: "string",
mode: [ "string", "null" ],
},
},
process: {

Loading…
Cancel
Save