Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ux/#2496): Configurable mode indicator #3391

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/docs/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ The configuration file, `configuration.json` is in the Oni2 directory, whose loc

- `workbench.statusBar.visible` __(_bool_ default: `true`)__ - Controls the visibility of the status bar.

- `workbench.statusBar.modeIndicator` __(_"left"|"right"|"none"_ default: `right`)__ - Controls the position of the mode indicator.

- `window.menuBarVisibility` __(_"visible" | "hidden"_ default: `"visible"`)__ - Controls the visibility of the menu bar.

- `oni.layout.showLayoutTabs` __(_"always"|"smart"|"never"_ default: `"smart"`)__ - Controls the display of layout tabs. `"smart"` will only show the tabs if there's more than one.
Expand Down
1 change: 1 addition & 0 deletions src/Core/ConfigurationDefaults.re
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ let getDefaultConfigString = configName =>
"workbench.sideBar.location": "left",
"workbench.sideBar.visible": true,
"workbench.statusBar.visible": true,
"workbench.statusBar.modeIndicator": "left",
"workbench.tree.indent": 2,
"vim.useSystemClipboard": ["yank"]
}
Expand Down
29 changes: 25 additions & 4 deletions src/Feature/StatusBar/Feature_StatusBar.re
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ module View = {
~theme,
~dispatch,
~workingDirectory: string,
~modeIndicator: string,
(),
) => {
let activeNotifications = Feature_Notification.active(notifications);
Expand Down Expand Up @@ -557,7 +558,27 @@ module View = {
|> Option.map(register => <macro register />)
|> Option.value(~default=React.empty);

let modeIndicatorStart =
switch (modeIndicator) {
| "left" =>
<section align=`FlexStart>
<ModeIndicator font theme mode subMode />
</section>
| _ => React.empty
};

let modeIndicatorEnd =
switch (modeIndicator) {
| "left"
| "none" => React.empty
| _ =>
<section align=`FlexEnd>
<ModeIndicator font theme mode subMode />
</section>
};

<View ?key style={Styles.view(background, yOffset)}>
modeIndicatorStart
<section align=`FlexStart>
<notificationCount
dispatch
Expand Down Expand Up @@ -585,18 +606,18 @@ module View = {
</section>
<notificationPopups />
</sectionGroup>
<section align=`FlexEnd>
<ModeIndicator font theme mode subMode />
</section>
modeIndicatorEnd
</View>;
};
};

module Configuration = {
open Config.Schema;
let visible = setting("workbench.statusBar.visible", bool, ~default=true);
let modeIndicator =
setting("workbench.statusBar.modeIndicator", string, ~default="rigth");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
setting("workbench.statusBar.modeIndicator", string, ~default="rigth");
setting("workbench.statusBar.modeIndicator", string, ~default="right");

};

module Contributions = {
let configuration = Configuration.[visible.spec];
let configuration = Configuration.[visible.spec, modeIndicator.spec];
};
6 changes: 5 additions & 1 deletion src/Feature/StatusBar/Feature_StatusBar.rei
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@ module View: {
~theme: ColorTheme.Colors.t,
~dispatch: msg => unit,
~workingDirectory: string,
~modeIndicator: string,
unit
) =>
Revery.UI.element;
};

// CONFIGURATION

module Configuration: {let visible: Config.Schema.setting(bool);};
module Configuration: {
let visible: Config.Schema.setting(bool);
let modeIndicator: Config.Schema.setting(string);
};

// CONTRIBUTIONS

Expand Down
3 changes: 3 additions & 0 deletions src/UI/Root.re
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ let make = (~dispatch, ~state: State.t, ()) => {
workingDirectory={Feature_Workspace.workingDirectory(
state.workspace,
)}
modeIndicator={
Feature_StatusBar.Configuration.modeIndicator.get(config)
}
/>
</View>;
} else {
Expand Down