Add layout short name

This commit is contained in:
Johannes Marbach 2021-09-19 13:12:30 +02:00
parent 00fe6cafcc
commit a8275d0e35
7 changed files with 18 additions and 1 deletions

View file

@ -9,6 +9,7 @@
**/
static const char * const name_us = "US English";
static const char * const short_name_us = "us";
/* Layer: Lowercase letters - generated from base */
@ -154,6 +155,7 @@ static const sq2lv_layer_t layers_us[] = {
**/
static const char * const name_de = "German";
static const char * const short_name_de = "de";
/* Layer: Lowercase letters - generated from base */
@ -348,12 +350,14 @@ const sq2lv_layout_t sq2lv_layouts[] = {
/* US English */
{
.name = name_us,
.short_name = short_name_us,
.num_layers = num_layers_us,
.layers = layers_us
},
/* German */
{
.name = name_de,
.short_name = short_name_de,
.num_layers = num_layers_de,
.layers = layers_de
}

View file

@ -39,6 +39,8 @@ typedef struct {
typedef struct {
/* Layout name */
const char * const name;
/* Layout short name */
const char * const short_name;
/* Total number of layers */
const int num_layers;
/* Layers array */

View file

@ -10,6 +10,7 @@
**/
static const char * const name_terminal_us = "US English (Terminal)";
static const char * const short_name_terminal_us = "terminal/us";
/* Layer: Lowercase letters - generated from base */
@ -256,6 +257,7 @@ const sq2lv_layout_t sq2lv_layouts[] = {
/* US English (Terminal) */
{
.name = name_terminal_us,
.short_name = short_name_terminal_us,
.num_layers = num_layers_terminal_us,
.layers = layers_terminal_us
}

View file

@ -46,6 +46,8 @@ typedef struct {
typedef struct {
/* Layout name */
const char * const name;
/* Layout short name */
const char * const short_name;
/* Total number of layers */
const int num_layers;
/* Layers array */

View file

@ -9,6 +9,7 @@
**/
static const char * const name_us = "US English";
static const char * const short_name_us = "us";
/* Layer: Lowercase letters - generated from base */
@ -159,6 +160,7 @@ const sq2lv_layout_t sq2lv_layouts[] = {
/* US English */
{
.name = name_us,
.short_name = short_name_us,
.num_layers = num_layers_us,
.layers = layers_us
}

View file

@ -38,6 +38,8 @@ typedef struct {
typedef struct {
/* Layout name */
const char * const name;
/* Layout short name */
const char * const short_name;
/* Total number of layers */
const int num_layers;
/* Layers array */

View file

@ -644,6 +644,7 @@ if __name__ == '__main__':
c_builder.add_section_comment(f'Layout: {layout_id_to_layout_name(layout_id)} - generated from {layout_id}')
c_builder.add_line()
c_builder.add_line(f'static const char * const name_{layout_identifier} = "{layout_id_to_layout_name(layout_id)}";')
c_builder.add_line(f'static const char * const short_name_{layout_identifier} = "{layout_id}";')
c_builder.add_line()
layer_identifiers = []
@ -768,6 +769,8 @@ if __name__ == '__main__':
h_builder.add_line('typedef struct {')
h_builder.add_line(' /* Layout name */')
h_builder.add_line(' const char * const name;')
h_builder.add_line(' /* Layout short name */')
h_builder.add_line(' const char * const short_name;')
h_builder.add_line(' /* Total number of layers */')
h_builder.add_line(' const int num_layers;')
h_builder.add_line(' /* Layers array */')
@ -800,7 +803,7 @@ if __name__ == '__main__':
for i, layout in enumerate(layouts):
c_builder.add_line(' /* ' + layout['name'] + ' */')
c_builder.add_line(' {')
fields = ['name', 'num_layers', 'layers']
fields = ['name', 'short_name', 'num_layers', 'layers']
identifier = layout['identifier']
for j, field in enumerate(fields):
c_builder.add_line(f' .{field} = {field}_{identifier}{comma_if_needed(fields, j)}')