# Hide/show toolsclient manually/automatically

**URL:** <https://discuss.kakoune.com/t/hide-show-toolsclient-manually-automatically/1895>\
**Category:** Help\
**Tags:** plugins\
**Created:** [September 27, 2021, 1:22pm UTC](https://discuss.kakoune.com/t/hide-show-toolsclient-manually-automatically/1895 "2021-09-27T13:22:13Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![almr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/almr/32/934_2.png) [@almr](https://discuss.kakoune.com/u/almr)\
**Post date:** [September 28, 2021, 5:45am UTC](https://discuss.kakoune.com/t/hide-show-toolsclient-manually-automatically/1895/3 "2021-09-28T05:45:16Z")

</div>

Do you need the string-equality (`streq`) hack I’ve mentioned in my [kakscript computability post](https://discuss.kakoune.com/t/kakscript-has-loop-catch-this-head-tail-shift-int-0-streq-etc/1885))?

```auto
def list-len-eq0 -params 0 nop # empty-list test

decl str-list str_test
def streq -params 2 %{
  set global str_test %arg{1}
  set -remove global str_test %arg{2}
  list-len-eq0 %opt{str_test}
}

```

Then, you can `if-then-else` via exceptions:

```auto
try %{ streq %arg{1} %opt{toolsclent}
#then code
} catch %{
#else code
}

```

This is how I defined the `+=ssl` alias (aka `sel-editor-live-new`) in [sel-editor](https://discuss.kakoune.com/t/sel-editor-editable-live-selection-summary-buffer/1877/4). If `toolsclient` is not defined, it automatically resets to `%val{client}`.

You also probably need a `ClientClose` hook (I haven’t added added this yet to `sel-editor`) to remove the `toolsclient` setting if, well, the `toolsclient` closes.

My post also details a way to check for a _specific_ exception, so you can make your `if-then-else` foolproof.

_Final note_: if you use this, please add a “namespace prefix” to all commands, so they don’t collide with other plugins.

---

_[View the full topic](https://discuss.kakoune.com/t/hide-show-toolsclient-manually-automatically/1895)._
