Skip to content

Commit

Permalink
[FB] CSK | Add custom actions
Browse files Browse the repository at this point in the history
  • Loading branch information
surapunoyousei committed Oct 7, 2023
1 parent 7765757 commit a883374
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions browser/app/profile/000-floorp.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ pref("floorp.titlebar.favicon.color", false);
pref("floorp.custom.shortcutkeysAndActions", "[]");
pref("floorp.custom.shortcutkeysAndActions.enabled", true);
pref("floorp.custom.shortcutkeysAndActions.remove.fx.actions", false);
pref("floorp.custom.shortcutkeysAndActions.customAction1", "");
pref("floorp.custom.shortcutkeysAndActions.customAction2", "");
pref("floorp.custom.shortcutkeysAndActions.customAction3", "");
pref("floorp.custom.shortcutkeysAndActions.customAction4", "");
pref("floorp.custom.shortcutkeysAndActions.customAction5", "");

// Profile Manager
pref("floorp.browser.profile-manager.enabled", true);
Expand Down
8 changes: 8 additions & 0 deletions browser/base/content/browser-custom-keyboard-shortcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,12 @@ const buildShortCutkeyFunctions = {
},
};


let customActionsFunctions = {
evalCustomeActionWithNum(num) {
let action = Services.prefs.getStringPref(`floorp.custom.shortcutkeysAndActions.customAction${num}`);
Function(action)();
}
}

buildShortCutkeyFunctions.init();
7 changes: 7 additions & 0 deletions browser/components/CustomKeyboardShortcutUtils.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ export const keyboradShortcutActions = {
// Workspace actions
openNextWorkspace: ["workspaceFunctions.manageWorkspaceFunctions.changeWorkspaceToBeforeNext();", "open-next-workspace", "workspace-action"],
openPreviousWorkspace: ["workspaceFunctions.manageWorkspaceFunctions.changeWorkspaceToAfterNext();", "open-previous-workspace", "workspace-action"],

// Custom actions
customAction1: ["customActionsFunctions.evalCustomeActionWithNum(1)", "custom-action-1", "custom-action"],
customAction2: ["customActionsFunctions.evalCustomeActionWithNum(2)", "custom-action-2", "custom-action"],
customAction3: ["customActionsFunctions.evalCustomeActionWithNum(3)", "custom-action-3", "custom-action"],
customAction4: ["customActionsFunctions.evalCustomeActionWithNum(4)", "custom-action-4", "custom-action"],
customAction5: ["customActionsFunctions.evalCustomeActionWithNum(5)", "custom-action-5", "custom-action"]
}

export const modifiersList = {
Expand Down

0 comments on commit a883374

Please sign in to comment.