my_wins 1.0.15 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -7,8 +7,37 @@ const defaultSettings = {
7
7
  y: 0,
8
8
  height: 120,
9
9
  width: 500,
10
+ screenWidth:1920,
11
+ screenHeight:1080,
10
12
  };
11
13
 
14
+ function makeWinsArray(settings, ) {
15
+ let winsArray = settings.winsArray || [];
16
+ let {x,y,width, height, screenWidth, screenHeight} = settings;
17
+ const scr_sz = keysender.getScreenSize();
18
+ if(!screenWidth) screenWidth = scr_sz.width;
19
+ if(!screenHeight) screenHeight = scr_sz.height;
20
+
21
+
22
+ // for(let i=0;i<1000;i++) {
23
+ // y += settings.height;
24
+ // winsArray.push({x,y, width, height});
25
+ // }
26
+ const wy_total = 10;
27
+ const wx_total = 4;
28
+ const wy_step = Math.round( screenWidth*1.0/wx_total);
29
+ const wx_step = Math.round(screenHeight*1.0/wy_total);
30
+ for(let wy = 0; wy<wy_total;wy++ ) {
31
+ for(let wx = 0; wx<wy_total;wx++ ) {
32
+ const x = wy_step*wy;
33
+ const y = wx_step*wx;
34
+ winsArray.push({x,y, width:wx_step-1, height:wy_step-1});
35
+ }
36
+ }
37
+
38
+ return winsArray;
39
+ }
40
+
12
41
  const randSuffix = ()=>("_"+Math.ceil(Math.random()*999999999).toString()+Math.ceil(Math.random()*999999999).toString()).substr(0,20);
13
42
 
14
43
  function awaitDelay(delay) {
@@ -102,7 +131,9 @@ module.exports.run = async ()=>{
102
131
  await awaitDelay(settings.startTimeout || 1500);
103
132
 
104
133
  wins = keysender.getAllWindows();
105
- let y = settings.y;
134
+ let winsArray = makeWinsArray(settings);
135
+
136
+ let winIndex = 0;
106
137
  for(let k in settings.wins) {
107
138
  const w = settings.wins[k];
108
139
  const {name, title, app, cmd, no_run} = w;
@@ -115,8 +146,7 @@ module.exports.run = async ()=>{
115
146
  console.warn(`CODE00000000 There are ${win_info_candidates.length} windows with title '${title}'. Only one window expected!`);
116
147
  else {
117
148
  const win = new keysender.Hardware(win_info.handle);
118
- win.workwindow.setView({ x: settings.x, y, width: settings.width, height: settings.height });
119
- y += settings.height;
149
+ win.workwindow.setView(winsArray[winIndex]);
120
150
  win.workwindow.setForeground();
121
151
 
122
152
  win.keyboard.printText(cmd);
@@ -124,6 +154,7 @@ module.exports.run = async ()=>{
124
154
  win.keyboard.sendKey(13);
125
155
  await awaitDelay(300);
126
156
  }
157
+ winIndex++;
127
158
  }
128
159
 
129
160
  await awaitDelay(700);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my_wins",
3
- "version": "1.0.15",
3
+ "version": "1.1.0",
4
4
  "description": "Automates starting and laying out your console windows for tsc, babel, tests, verdaccio, etc...",
5
5
  "keywords": ["automation","cmd","keysender","windows","autostart","autorun"],
6
6
  "main": "./index.js",
package/pnpm-lock.yaml CHANGED
@@ -1,88 +1,49 @@
1
+ lockfileVersion: 5.3
2
+
3
+ specifiers:
4
+ json5: ^2.1.3
5
+ keysender: ^1.5.0
6
+ prettier: ^2.0.5
7
+
1
8
  dependencies:
2
- fs-extra: 9.0.0
3
9
  json5: 2.1.3
4
10
  keysender: 1.5.0
11
+
5
12
  devDependencies:
6
- prettier: registry.npmjs.org/prettier/2.0.5
7
- lockfileVersion: 5.1
13
+ prettier: 2.0.5
14
+
8
15
  packages:
9
- /at-least-node/1.0.0:
10
- dev: false
11
- engines:
12
- node: '>= 4.0.0'
13
- resolution:
14
- integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
15
- /fs-extra/9.0.0:
16
- dependencies:
17
- at-least-node: 1.0.0
18
- graceful-fs: 4.2.4
19
- jsonfile: 6.0.1
20
- universalify: 1.0.0
21
- dev: false
22
- engines:
23
- node: '>=10'
24
- resolution:
25
- integrity: sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==
26
- /graceful-fs/4.2.4:
27
- dev: false
28
- resolution:
29
- integrity: sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
16
+
30
17
  /json5/2.1.3:
31
- dependencies:
32
- minimist: 1.2.5
33
- dev: false
34
- engines:
35
- node: '>=6'
18
+ resolution: {integrity: sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==}
19
+ engines: {node: '>=6'}
36
20
  hasBin: true
37
- resolution:
38
- integrity: sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==
39
- /jsonfile/6.0.1:
40
21
  dependencies:
41
- universalify: 1.0.0
22
+ minimist: 1.2.5
42
23
  dev: false
43
- optionalDependencies:
44
- graceful-fs: 4.2.4
45
- resolution:
46
- integrity: sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==
24
+
47
25
  /keysender/1.5.0:
26
+ resolution: {integrity: sha512-6GR5lYm/HbirtF5C2CUiAxqoX7upywhxBBV6FQFmtv15844qJgTXG9SQshxTcfu0oG5axrkt7SgrFhNd6Ic68A==}
27
+ requiresBuild: true
48
28
  dependencies:
49
29
  lodash.isequal: 4.5.0
50
30
  node-addon-api: 2.0.0
51
31
  dev: false
52
- requiresBuild: true
53
- resolution:
54
- integrity: sha512-6GR5lYm/HbirtF5C2CUiAxqoX7upywhxBBV6FQFmtv15844qJgTXG9SQshxTcfu0oG5axrkt7SgrFhNd6Ic68A==
32
+
55
33
  /lodash.isequal/4.5.0:
34
+ resolution: {integrity: sha1-QVxEePK8wwEgwizhDtMib30+GOA=}
56
35
  dev: false
57
- resolution:
58
- integrity: sha1-QVxEePK8wwEgwizhDtMib30+GOA=
36
+
59
37
  /minimist/1.2.5:
38
+ resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==}
60
39
  dev: false
61
- resolution:
62
- integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
40
+
63
41
  /node-addon-api/2.0.0:
42
+ resolution: {integrity: sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA==}
64
43
  dev: false
65
- resolution:
66
- integrity: sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA==
67
- /universalify/1.0.0:
68
- dev: false
69
- engines:
70
- node: '>= 10.0.0'
71
- resolution:
72
- integrity: sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==
73
- registry.npmjs.org/prettier/2.0.5:
74
- dev: true
75
- engines:
76
- node: '>=10.13.0'
44
+
45
+ /prettier/2.0.5:
46
+ resolution: {integrity: sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==, registry: https://registry.npmjs.com/}
47
+ engines: {node: '>=10.13.0'}
77
48
  hasBin: true
78
- name: prettier
79
- resolution:
80
- integrity: sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==
81
- registry: 'https://registry.npmjs.com/'
82
- tarball: 'https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz'
83
- version: 2.0.5
84
- specifiers:
85
- fs-extra: ^9.0.0
86
- json5: ^2.1.3
87
- keysender: ^1.5.0
88
- prettier: ^2.0.5
49
+ dev: true
package/lib/temp.js DELETED
@@ -1 +0,0 @@
1
- console.log(process.argv);