Skip to content

App preferences

What is appPreferences?

App preferences allow you to add new menu entries to the global settings page. You can access this page by clicking the sandwich menu in the top-left corner and selecting Preferences. Alternatively, you can press Ctrl + ,

openClusterSettings

You will see the new component here

openClusterSettings

How to use it

Interface

This is the appPreferences interface

appPreferences: AppPreferenceRegistration[] = [];

AppPreferenceRegistration is defined as follows

1
2
3
4
5
6
interface AppPreferenceRegistration {
  title: string;
  id?: string;
  showInPreferencesTab?: string;
  components: AppPreferenceComponents;
}

Hands on

To add a new setting menu entry in cluster settings just add this code of block to your renderer/index.tsx file

1
2
3
4
5
6
7
8
9
appPreferences = [
  {
    title: "My Settings",
    components: {
      Input: () => <div>HELLO!</div>,
      Hint: () => <span>Span message</span>,
    },
  },
];

After compiling and installing the plugin, remember to close Freelens from the tray icon and reopen it, or you won’t see the new menu entries