electron-screenshots 0.5.20 → 0.5.21

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.
Files changed (2) hide show
  1. package/lib/screenshots.js +21 -22
  2. package/package.json +4 -4
@@ -152,7 +152,6 @@ var Screenshots = /** @class */ (function (_super) {
152
152
  }
153
153
  // 先清除 Kiosk 模式,然后取消全屏才有效
154
154
  this.$win.setKiosk(false);
155
- this.$win.setSimpleFullScreen(false);
156
155
  this.$win.blur();
157
156
  this.$win.blurWebView();
158
157
  this.$win.unmaximize();
@@ -216,6 +215,7 @@ var Screenshots = /** @class */ (function (_super) {
216
215
  Screenshots.prototype.createWindow = function (display) {
217
216
  var _a, _b;
218
217
  return __awaiter(this, void 0, void 0, function () {
218
+ var windowTypes;
219
219
  var _this = this;
220
220
  return __generator(this, function (_c) {
221
221
  switch (_c.label) {
@@ -227,6 +227,11 @@ var Screenshots = /** @class */ (function (_super) {
227
227
  _c.sent();
228
228
  // 复用未销毁的窗口
229
229
  if (!this.$win || ((_b = (_a = this.$win) === null || _a === void 0 ? void 0 : _a.isDestroyed) === null || _b === void 0 ? void 0 : _b.call(_a))) {
230
+ windowTypes = {
231
+ darwin: 'panel',
232
+ linux: 'dock',
233
+ win32: 'toolbar',
234
+ };
230
235
  this.$win = new electron_1.BrowserWindow({
231
236
  title: 'screenshots',
232
237
  x: display.x,
@@ -234,42 +239,40 @@ var Screenshots = /** @class */ (function (_super) {
234
239
  width: display.width,
235
240
  height: display.height,
236
241
  useContentSize: true,
242
+ type: windowTypes[process.platform],
237
243
  frame: false,
238
244
  show: false,
239
245
  autoHideMenuBar: true,
240
246
  transparent: true,
241
- // mac resizable 设置为 true 会导致应用崩溃
242
- resizable: process.platform !== 'darwin',
247
+ resizable: false,
243
248
  movable: false,
249
+ minimizable: false,
250
+ maximizable: false,
244
251
  // focusable 必须设置为 true, 否则窗口不能及时响应esc按键,输入框也不能输入
245
252
  focusable: true,
246
- // mac fullscreenable 设置为 true 会导致应用崩溃
247
- fullscreenable: process.platform !== 'darwin',
253
+ skipTaskbar: true,
254
+ alwaysOnTop: true,
248
255
  /**
249
256
  * linux 下必须设置为false,否则不能全屏显示在最上层
250
- * mac 下设置为false,否则可能会导致程序坞不恢复问题
251
- * https://github.com/nashaofu/screenshots/issues/148
257
+ * mac 下设置为false,否则可能会导致程序坞不恢复问题,且与 kiosk 模式冲突
252
258
  */
253
- // fullscreen: process.platform === 'darwin',
254
- // 设为true 防止mac新开一个桌面,影响效果
255
- simpleFullscreen: process.platform === 'darwin',
259
+ fullscreen: false,
260
+ // mac fullscreenable 设置为 true 会导致应用崩溃
261
+ fullscreenable: false,
262
+ kiosk: true,
256
263
  backgroundColor: '#00000000',
257
264
  titleBarStyle: 'hidden',
258
- alwaysOnTop: true,
259
- enableLargerThanScreen: true,
260
- skipTaskbar: true,
261
265
  hasShadow: false,
262
266
  paintWhenInitiallyHidden: false,
267
+ // mac 特有的属性
268
+ roundedCorners: false,
269
+ enableLargerThanScreen: false,
263
270
  acceptFirstMouse: true,
264
271
  });
265
272
  this.$win.on('show', function () {
266
273
  var _a, _b;
267
274
  (_a = _this.$win) === null || _a === void 0 ? void 0 : _a.focus();
268
- /**
269
- * 在窗口显示时设置,防止与 fullscreen、x、y、width、height 等冲突, 导致显示效果不符合预期
270
- * mac 下不设置 kiosk 模式,https://github.com/nashaofu/screenshots/issues/148
271
- */
272
- (_b = _this.$win) === null || _b === void 0 ? void 0 : _b.setKiosk(process.platform !== 'darwin');
275
+ (_b = _this.$win) === null || _b === void 0 ? void 0 : _b.setKiosk(true);
273
276
  });
274
277
  this.$win.on('closed', function () {
275
278
  _this.$win = null;
@@ -287,10 +290,6 @@ var Screenshots = /** @class */ (function (_super) {
287
290
  });
288
291
  }
289
292
  this.$win.blur();
290
- this.$win.setKiosk(false);
291
- if (process.platform === 'darwin') {
292
- this.$win.setSimpleFullScreen(true);
293
- }
294
293
  this.$win.setBounds(display);
295
294
  this.$view.setBounds({
296
295
  x: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-screenshots",
3
- "version": "0.5.20",
3
+ "version": "0.5.21",
4
4
  "description": "electron 截图插件",
5
5
  "types": "lib/screenshots.d.ts",
6
6
  "main": "lib/screenshots.js",
@@ -37,8 +37,8 @@
37
37
  "dependencies": {
38
38
  "debug": "^4.3.4",
39
39
  "fs-extra": "^11.1.1",
40
- "node-screenshots": "^0.1.2",
41
- "react-screenshots": "^0.5.19"
40
+ "node-screenshots": "^0.1.4",
41
+ "react-screenshots": "^0.5.21"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "electron": ">=14"
@@ -58,5 +58,5 @@
58
58
  "rimraf": "^4.4.1",
59
59
  "typescript": "^5.0.2"
60
60
  },
61
- "gitHead": "d00ff54ee3d3372a043e3cfc16c363e01c9cd01e"
61
+ "gitHead": "34341ff2e6ae3856ff2c838b9b8f8843c90a789d"
62
62
  }