oc-tweaks 0.5.1 → 0.5.2

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/dist/index.js +7 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -552,13 +552,13 @@ function calculatePosition(slotIndex, config) {
552
552
  const height = config.height;
553
553
  const gap = config.gap ?? 12;
554
554
  const margin = config.screenMargin ?? 20;
555
- const screenLeftExpr = typeof config.screenLeft === "number" ? `${config.screenLeft}` : "([System.Windows.Forms.Screen]::FromPoint([System.Windows.Forms.Cursor]::Position).WorkingArea.Left)";
556
- const screenTopExpr = typeof config.screenTop === "number" ? `${config.screenTop}` : "([System.Windows.Forms.Screen]::FromPoint([System.Windows.Forms.Cursor]::Position).WorkingArea.Top)";
557
- const screenWidthExpr = typeof config.screenWidth === "number" ? `${config.screenWidth}` : "([System.Windows.Forms.Screen]::FromPoint([System.Windows.Forms.Cursor]::Position).WorkingArea.Width)";
558
- const screenHeightExpr = typeof config.screenHeight === "number" ? `${config.screenHeight}` : "([System.Windows.Forms.Screen]::FromPoint([System.Windows.Forms.Cursor]::Position).WorkingArea.Height)";
559
- const leftExpr = `(${screenLeftExpr} + ${screenWidthExpr} - ${width} - ${margin})`;
555
+ const screenLeftExpr = typeof config.screenLeft === "number" ? `${config.screenLeft}` : "($targetScreen.Left)";
556
+ const screenTopExpr = typeof config.screenTop === "number" ? `${config.screenTop}` : "($targetScreen.Top)";
557
+ const screenRightExpr = typeof config.screenWidth === "number" ? `(${screenLeftExpr} + ${config.screenWidth})` : "($targetScreen.Right)";
558
+ const screenBottomExpr = typeof config.screenHeight === "number" ? `(${screenTopExpr} + ${config.screenHeight})` : "($targetScreen.Bottom)";
559
+ const leftExpr = `(${screenRightExpr} - ${width} - ${margin})`;
560
560
  if (position === "bottom-right") {
561
- const topExpr2 = `(${screenTopExpr} + ${screenHeightExpr} - ${margin} - ((${slotIndex} + 1) * (${height} + ${gap})))`;
561
+ const topExpr2 = `(${screenBottomExpr} - ${margin} - ((${slotIndex} + 1) * (${height} + ${gap})))`;
562
562
  return {
563
563
  startupLocation: "Manual",
564
564
  leftExpr,
@@ -716,6 +716,7 @@ async function runWpfNotification($, shellCommand, title, message, tag, style, p
716
716
  "Add-Type -AssemblyName PresentationCore",
717
717
  "Add-Type -AssemblyName WindowsBase",
718
718
  "Add-Type -AssemblyName System.Windows.Forms",
719
+ "$targetScreen = [System.Windows.Forms.Screen]::FromPoint([System.Windows.Forms.Cursor]::Position).WorkingArea",
719
720
  "",
720
721
  "Add-Type -TypeDefinition @'",
721
722
  "using System;",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-tweaks",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"