xiaoxiaoflood / firefox-scripts

userChromeJS / autoconfig.js and extensions
Mozilla Public License 2.0
989 stars 85 forks source link

Keyconfig doesn't seem to be fully working. #58

Closed mzso closed 3 years ago

mzso commented 3 years ago

Hi! I had Dorando keyconfig for a long while. I copied all extensions.dorandoKeyConfig.* settings to prefs.js. But almost neither seem to show up or function. The one that works is the hotkey to open the keyconfig settings window. Which is fortunate, because I have no idea how to open it otherwise. How do you do that in current FF? I checked, the settings are still there in prefs.js, so firefox didn't remove them. So I have no idea why it doesn't work.

Also, the text coloring doesn't work. normally user created shortcuts are purple. But now this single hotkey that works is just plain black. The other colors seem to work. Red for disabled. And blue/orange I forgot what for.

xiaoxiaoflood commented 3 years ago

How do you do that in current FF?

image or image

Also, the text coloring doesn't work. normally user created shortcuts are purple. But now this single hotkey that works is just plain black.

Everything is fine here. image

So I can't reproduce the issue without further details. Keyconfig is fully working for me on Fx 83.0b10.

mzso commented 3 years ago

@xiaoxiaoflood Newly created keys seem to have proper color. Old ones don't, apparently. Don't know why. Just plain copied settings as I said. From the old prefs.js, to the new one. Then installed the extension.

Yeah, I didn't find the settings at first. (By default there's no options button, only a hidden menu item in the addon manager. )

xiaoxiaoflood commented 3 years ago

So I:

  1. Created a new profile.

  2. Installed userChromeJS (copying files).

  3. With Fx closed, copied all and only extensions.dorandoKeyConfig.* prefs from my default profile to new one's prefs.js.

  4. Opened Fx with the new profile and installed keyconfig.

I didn't even have to restart again (keyconfig wasn't built to be restartless, it isn't a true bootstrapped addon). Keyconfig is fully working. My personal hotkeys are working and showing up with proper colors in keyconfig manager.

It may be obvious, but you should only change prefs.js when you're sure Fx is not running with your profile. Opened profile rewrites prefs.js all the time, so it's useless to edit the file while Fx is open.

mzso commented 3 years ago

@xiaoxiaoflood Well, all I can do is scratch my head, because I pretty much did the same

xiaoxiaoflood commented 3 years ago

Maybe can you paste your extensions.dorandoKeyConfig.* for me to test if there is something special with them? Or are they too personal?

mzso commented 3 years ago

@xiaoxiaoflood commented on 2020. nov. 17. 04:51 CET:

Maybe can you paste your extensions.dorandoKeyConfig.* for me to test if there is something special with them? Or are they too personal?

Not really, it's just filled with embarassing tinkered disabled a non-working stuff. :) Clipboarder.2020.11.17.txt

I did it again, this time it appeared in the new profile. Maybe something went wrong with copy pasting. Or maybe I installed keyconfig first and there were some duplicate items.

Unfortunately most don't work though. Perhaps (if it's not too much to ask) you could tell me how to load an url in a tab, that would be good to open extension settings, especially nowadays with webextensions if I can figure out their urls. Also my hotkeys for DTA mostly work except for saving hovered links with DTA, which was really useful. (Influenced by old flashgot addon which got abandoned before XUL addons)

Don't know, maybe this is too complicated:

    /*Code*/
    // Save Link with dTa! OneClick
    Components.utils.import("resource://gre/modules/ctypes.jsm");
    var user32 = ctypes.open("user32");
    var BOOL = ctypes.int;
    var LONG = ctypes.long;
    var POINT = ctypes.StructType("tagPOINT", [{x:LONG}, {y:LONG}]);
    var LPPOINT = POINT.ptr;
    var GetCursorPos = user32.declare('GetCursorPos', ctypes.winapi_abi, BOOL, LPPOINT);
    var point = new POINT;
    if (GetCursorPos(point.address())) {
      var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
        getInterface(Components.interfaces.nsIDOMWindowUtils);
      var MOUSEEVENTF_RIGHTDOWN = 0x0008;
      var MOUSEEVENTF_RIGHTUP = 0x0010;
      utils.sendNativeMouseEvent(point.x, point.y, MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, null);
    }
    user32.close();
    setTimeout(function () {
      document.getElementById("dta:turbo-link").doCommand();
      document.getElementById("contentAreaContextMenu").hidePopup();
      setTimeout(function () {
        var win = Services.wm.getMostRecentWindow("alert:alert");
        if (win &&
            win.document.getElementById("alertTitleLabel") &&
            win.document.getElementById("alertTitleLabel").value == "DownThemAll!") {
          win.onAlertClose();
        }
      }, 2000);
    }, 1000);

I have gFindBar.startFind(gFindBar.FIND_TYPEAHEAD); and gFindBar.startFind(gFindBar.FIND_LINKS) for the quickfind bar, and strangely on some pages it works on others it doesn't.

xiaoxiaoflood commented 3 years ago

Ah. Your hotkeys are like

user_pref("extensions.dorandoKeyConfig.main.xxx_key1_Gyorskeresés 2.", "!][][][gFindBar.startFind(gFindBar.FIND_TYPEAHEAD);][chrome://browser/content/browser.xul");

Since Fx 69 the main window URL changed from chrome://browser/content/browser.xul to chrome://browser/content/browser.xhtml.

If you're trying to use so outdated codes, probably some (or many) of them won't work. There's a reason why I had to fix so many things in every single addon on this repo to get them to work in current Fx.

Sorry, but I cant fix things for you.

About the code you pasted, I quickly noticed that var utils = ... is outdated, you should use window.windowUtils.sendNativeMouseEvent directly instead of utils.sendNativeMouseEvent.

That's all I can do, sorry.

mzso commented 3 years ago

@xiaoxiaoflood Thanks for the tips.

xiaoxiaoflood commented 3 years ago

Closing this one as apparently it's not keyconfig's bug but the use of outdated codes as hotkeys.