Skip to content

Commit 10d11b8

Browse files
authored
Merge pull request #11 from nealie/master
Add FreeBSD support.
2 parents edba010 + 8f79b06 commit 10d11b8

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> [![Build Status](https://travis-ci.org/bithavoc/node-desktop-idle.svg?branch=master)](https://travis-ci.org/bithavoc/node-desktop-idle)
44
> [![Monthly Downloads](https://img.shields.io/npm/dm/desktop-idle.svg)](https://www.npmjs.com/package/desktop-idle)
55
6-
Node/Electron module to detect idle desktop users (OSX, Windows and Linux).
6+
Node/Electron module to detect idle desktop users (OSX, Windows, Linux and FreeBSD).
77

88
**Stable | Actively maintained | Pull Requests Welcome**
99

binding.gyp

+31-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,36 @@
4242
}
4343
],
4444
[
45+
'OS=="freebsd"',
46+
{
47+
"sources": [
48+
"src/linux/idle.cc"
49+
],
50+
"variables": {
51+
"pkg-config": "pkg-config"
52+
},
53+
"sources": [
54+
"src/linux/idle.cc"
55+
],
56+
"include_dirs": [
57+
"/usr/local/include"
58+
],
59+
"direct_dependent_settings": {
60+
"cflags": [
61+
"<!@(<(pkg-config) --cflags x11 xext xscrnsaver)",
62+
],
63+
},
64+
"link_settings": {
65+
"ldflags": [
66+
"<!@(<(pkg-config) --libs-only-other --libs-only-L x11 xext xscrnsaver)",
67+
],
68+
"libraries": [
69+
"<!@(<(pkg-config) --libs-only-l x11 xext xscrnsaver)",
70+
]
71+
}
72+
}
73+
],
74+
[
4575
'OS=="win"',
4676
{
4777
"sources": [
@@ -58,4 +88,4 @@
5888
]
5989
}
6090
]
61-
}
91+
}

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
],
1616
"homepage": "https://github.com/bithavoc/node-desktop-idle",
1717
"licenses": [
18-
{
19-
"type": "MIT",
20-
"url": "https://github.com/bithavoc/node-desktop-idle/blob/master/LICENSE"
21-
}
18+
{
19+
"type": "MIT",
20+
"url": "https://github.com/bithavoc/node-desktop-idle/blob/master/LICENSE"
21+
}
2222
],
2323
"repository": {
2424
"type": "git",
@@ -28,7 +28,8 @@
2828
"windows",
2929
"linux",
3030
"darwin",
31-
"win32"
31+
"win32",
32+
"freebsd"
3233
],
3334
"engines": {
3435
"node": ">=7.9.0"

src/linux/idle.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ double desktop_idle_get_time() {
1111
unsigned long idle = info->idle;
1212
XFree(info);
1313
XCloseDisplay(dpy);
14-
return idle / 1000; // to seconds
14+
return idle / 1000.0; // to seconds
1515
}

0 commit comments

Comments
 (0)