From 55e8d06ee4f9dbb190c18198cac7c6e9f137f11a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ingo=20B=C3=BCrk?= Date: Wed, 10 Jun 2015 18:59:45 +0200 Subject: [PATCH] Added command directive 'title_format'. This directive will be used to customize the window title. --- include/commands.h | 6 ++++++ parser-specs/commands.spec | 5 +++++ src/commands.c | 11 +++++++++++ testcases/t/187-commands-parser.t | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/commands.h b/include/commands.h index 16b7e146..6d1046d4 100644 --- a/include/commands.h +++ b/include/commands.h @@ -276,6 +276,12 @@ void cmd_move_scratchpad(I3_CMD); */ void cmd_scratchpad_show(I3_CMD); +/** + * Implementation of 'title_format ' + * + */ +void cmd_title_format(I3_CMD, char *format); + /** * Implementation of 'rename workspace to ' * diff --git a/parser-specs/commands.spec b/parser-specs/commands.spec index c3e6e489..c756dd8b 100644 --- a/parser-specs/commands.spec +++ b/parser-specs/commands.spec @@ -37,6 +37,7 @@ state INITIAL: 'rename' -> RENAME 'nop' -> NOP 'scratchpad' -> SCRATCHPAD + 'title_format' -> TITLE_FORMAT 'mode' -> MODE 'bar' -> BAR @@ -374,6 +375,10 @@ state SCRATCHPAD: 'show' -> call cmd_scratchpad_show() +state TITLE_FORMAT: + format = string + -> call cmd_title_format($format) + # bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [] state BAR: bar_type = 'hidden_state' diff --git a/src/commands.c b/src/commands.c index 44b910ec..3790f50f 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1899,6 +1899,17 @@ void cmd_scratchpad_show(I3_CMD) { ysuccess(true); } +/* + * Implementation of 'title_format ' + * + */ +void cmd_title_format(I3_CMD, char *format) { + DLOG("setting title_format to %s\n", format); + + cmd_output->needs_tree_render = true; + ysuccess(true); +} + /* * Implementation of 'rename workspace [] to ' * diff --git a/testcases/t/187-commands-parser.t b/testcases/t/187-commands-parser.t index 094caeaa..fc7fa882 100644 --- a/testcases/t/187-commands-parser.t +++ b/testcases/t/187-commands-parser.t @@ -144,7 +144,7 @@ is(parser_calls("\nworkspace test"), ################################################################################ is(parser_calls('unknown_literal'), - "ERROR: Expected one of these tokens: , '[', 'move', 'exec', 'exit', 'restart', 'reload', 'shmlog', 'debuglog', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'unmark', 'resize', 'rename', 'nop', 'scratchpad', 'mode', 'bar'\n" . + "ERROR: Expected one of these tokens: , '[', 'move', 'exec', 'exit', 'restart', 'reload', 'shmlog', 'debuglog', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'unmark', 'resize', 'rename', 'nop', 'scratchpad', 'title_format', 'mode', 'bar'\n" . "ERROR: Your command: unknown_literal\n" . "ERROR: ^^^^^^^^^^^^^^^", 'error for unknown literal ok'); -- 2.39.5