favna / hyper-overlay

A complete and customizable solution for a overlay window in your Hyper.app
MIT License
30 stars 9 forks source link

Uncaught Exception #2

Closed ChristinWhite closed 6 years ago

ChristinWhite commented 6 years ago

I'm really excited to see you've taken on this project, it definitely had some issues but was so great to use!

I switched my config from hyperterm-overlay to hyper-overlay and left my prior settings in place but I'm getting the following error any time I open Hyper, reload the window or bring up the overlay with the keyboard shortcut.

Uncaught Exception:
TypeError: Error processing argument at index 0, conversion failure from #<Object>
    at Overlay._endBounds (/Users/cwhite/.hyper_plugins/node_modules/hyper-overlay/overlay.js:331:17)
    at Overlay.show (/Users/cwhite/.hyper_plugins/node_modules/hyper-overlay/overlay.js:434:10)
    at _create (/Users/cwhite/.hyper_plugins/node_modules/hyper-overlay/overlay.js:48:14)
    at _app.createWindow (/Users/cwhite/.hyper_plugins/node_modules/hyper-overlay/overlay.js:126:9)
    at Server.Window.rpc.on (/Applications/Hyper.app/Contents/Resources/app.asar/ui/window.js:76:33)
    at emitOne (events.js:115:13)
    at Server.emit (events.js:210:7)
    at Server.ipcListener (/Applications/Hyper.app/Contents/Resources/app.asar/rpc.js:33:11)
    at emitTwo (events.js:125:13)
    at EventEmitter.emit (events.js:213:7)

Hyperterm-overlay does not throw an error.

Unless I'm missing something it looks like the config hasn't changed except possibly the hotkey set to two different options. I updated my configuration with open/close but am still getting the error.

It does not appear to get far enough to move and resize the window.

Here are my settings:

// hyperterm-overlay
        overlay: {
            alwaysOnTop   : false,     // Makes Hyperterm Overlay window stay always on top. default: `true`.
            animate       : false,     // Enable animation when show and hide the window. default: `true`.
            hasShadow     : true,      // Controls the default macOS window shadows. default: `false`.
            hideDock      : false,     // Removes the Hyper dock icon. It works only when the unique option is activated. default: `false`.
            hideOnBlur    : false,     // Hides the Hyperterm Overlay when it loses focus. default: `false`.
            position      : 'right',   // Choose where Hyperterm Overlay will be positioned: top, bottom, left or right. default: `top`.
            primaryDisplay: false,     // Show Hyperterm Overlay only on primary display. default: `false`.
            resizable     : false,     // Allow the Hyperterm Overlay be resizable. default: `false`.
            startAlone    : false,     // Makes HyperTerm Overlay the unique window displayed when started. default: `false`.
            startup       : true,      // Open HyperTerm Overlay on Hyper startup. default: `true`.
            tray          : false,     // Add icon to the system notification area, for access HyperTerm Overlay. default: `true`.
            unique        : false,     // Makes HyperTerm Overlay the unique window of Hyper. any other window will be removed. default: `false`.

            // Specify one or more hotkeys to show and hide the HyperTerm Overlay (see: Accelerator documentation). default: `['Option+Space']`
            hotkeys: {
                open : ['Control+Option+Shift+F6'],
                close: ['Control+Option+Shift+F6'],
            },

            // The size of HyperTerm Overlay when it is showing. The possible values are a `number` or a `float`. If is is a number, it represents the size im pixels. Otherwise, if it is a float, it means the percentage of the screen.
            size: 0.5,
        },

This happens both in Hyper 2.0.0 (Stable) and Canary; with and without any other plugins. macOS 10.13.5 (17F77). Here's my full config

Plugins: 
  hyperterm-paste (1.1.2),
  hyper-search (0.0.10),
  hyper-overlay (1.2.1),
  hyper-statusline (1.7.6),
  hyper-tab-icons (2.1.0),
  hypercwd (1.2.3)

If it would be helpful for troubleshooting I'm happy to jump on your Discord.

cobrabr commented 6 years ago

Same happens to me, but I can circumvent it by removing the size property from the config. If I put it back, regardless of whether it's a single integer or an object with width and height, it throws the same error.

UPDATE: looks like it only happens when I assign an object to size. @christopherdwhite, it might help you pinpoint which configuration is the root for your issues if you clear out the overlay object and then re-add each property to see which one causes the error to re-occur.

favna commented 6 years ago

Sorry for not addressing this earlier, I somehow completely missed the notification. That said, make sure the size is an object as that is required in the new config to allow setting both height and width. Example config of my own:

    overlay: {
      hasShadow: true,
      hideOnBlur: true,
      position: 'center',
      tray: true,
      size: {
        width: 0.4,
        height: 0.4
      }

Note that 0.4 on both are also the default values

favna commented 6 years ago

If this issue still persists after correcting your config please re-open it. Otherwise it will be closed for now since as far as I can tell it doesn't appear to be an issue with the plugin itself.

ChristinWhite commented 6 years ago

My apologies @Favna, this fell off my radar but I just changed my configuration to a size object with width and height and I'm no longer getting an error. Looks like @cobrabr had nailed it. Thanks both of you guys!

cobrabr commented 6 years ago

When I change my config and set size to be an object, I get the following error when I open Hyper:

screen shot 2018-08-10 at 10 24 45

If I move it back to a number, it works fine.

favna commented 6 years ago

@cobrabr can you confirm that your Hyper properly updated the plugin to the latest version by opening the package.json of the plugin folder wherever those are stored on MacOS? It should be 1.2.1

cobrabr commented 6 years ago

It looks like I had both hyper-overlay and hyperterm-overlay installed (honestly, I hadn't even noticed the change in the name :blush:).

I removed the old one and reinstalled hyper-overlay -- the package.json under .hyper_plugins says latest for hyper-overlay, and the package.json inside hyper-overlay's folder says 1.2.1.

favna commented 6 years ago

I had to make it a new name due to how NPM register works and I don't really feel like appealing for taking over the old project for it being abandoned (which is an option in NPM's publishing rules).

Good you found out why then.

cobrabr commented 6 years ago

Oh, it's still failing... I'm trying to re-pinpoint which configuration option is actually throwing things off.

cobrabr commented 6 years ago

It looks like it's the hotkeys option -- have it set to ['Super+`'], which worked fine with the old version, but seems to be failing with the new one.

cobrabr commented 6 years ago

Sorry for the spam, but I think it's finally OK: looking at some other issues, I found that hotkeys is also an object now, with open and close as properties. I've changed my config to that, and it's now working.