Add defaultHotbarPage tweak

This commit is contained in:
Oliver 2026-01-16 18:00:25 -07:00
parent 2adb616701
commit 6bf72b313a
3 changed files with 44 additions and 1 deletions

View file

@ -17,6 +17,10 @@
"name": "Chat Background",
"hint": "(v13+) Adds a background to the chat tab of the right-hand sidebar."
},
"defaultHotbarPage": {
"name": "Default Hotbar Page",
"hint": "What page the hotbar will default to when loading into Foundry."
},
"hotbarButtonGap": {
"name": "Hotbar Button Gap",
"hint": "(v13+) Allows changing the amount of space between the hotbar buttons."

View file

@ -1,8 +1,9 @@
// Settings
// Tweaks
import { addGlobalDocReferrer } from "../tweaks/addGlobalDocReferrer.mjs";
import { autoUnpauseOnLoad } from "../tweaks/autoUnpauseOnLoad.mjs";
import { chatImageLinks } from "../tweaks/chatImageLinks.mjs";
import { chatSidebarBackground } from "../tweaks/chatSidebarBackground.mjs";
import { defaultHotbarPage } from "../tweaks/defaultHotbarPage.mjs";
import { hotbarButtonGap } from "../tweaks/hotbarButtonGap.mjs";
import { hotbarButtonSize } from "../tweaks/hotbarButtonSize.mjs";
import { preventTokenRotation } from "../tweaks/preventTokenRotation.mjs";
@ -40,6 +41,7 @@ Hooks.on(`setup`, () => {
restricted: false,
type: HotbarSettingsMenu,
});
defaultHotbarPage();
hotbarButtonSize();
hotbarButtonGap();
repositionHotbar();

View file

@ -0,0 +1,37 @@
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
import { __ID__ } from "../consts.mjs";
import { Logger } from "../utils/Logger.mjs";
import { preventTweakRegistration } from "../utils/preRegisterTweak.mjs";
import { registerCategorySetting } from "../utils/SubMenuSettings.mjs";
export const key = `defaultHotbarPage`;
export function defaultHotbarPage() {
status[key] = SettingStatusEnum.Unknown;
if (preventTweakRegistration(key)) { return };
// #region Registration
Logger.log(`Registering setting: ${key}`);
registerCategorySetting(`hotbar`, __ID__, key, {
name: `OFT.setting.${key}.name`,
hint: `OFT.setting.${key}.hint`,
scope: `user`,
type: new foundry.data.fields.NumberField({
min: 1,
max: 5,
step: 1,
}),
default: 1,
config: true,
requiresReload: false,
});
// #endregion Registration
// #region Implementation
Hooks.once(`ready`, () => {
ui.hotbar.changePage(game.settings.get(__ID__, key));
});
// #endregion Implementation
status[key] = SettingStatusEnum.Registered;
};