map to function to run multiple actions i.e. zen mode #3799
Answered
by
kovidgoyal
jimcornmell
asked this question in
Q&A
Replies: 5 comments 6 replies
-
See the very first example here:
https://sw.kovidgoyal.net/kitty/kittens/custom.html
|
Beta Was this translation helpful? Give feedback.
1 reply
-
One last question (promise) How can you tell you are in fullscreen mode? I can see in the C there is "is_window_fullscreen" but cannot see the equivalent in the python API. |
Beta Was this translation helpful? Give feedback.
0 replies
-
On Mon, Jul 05, 2021 at 03:38:58AM -0700, jimcornmell wrote:
One last question (promise) How can you tell you are in fullscreen mode? I can see in the C there is "is_window_fullscreen" but cannot see the equivalent in the python API.
There isn't. Fullscreen can be triggerred in many ways, from outside of
kitty as well. And there are different types of fullscreen on different
platforms.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
On Mon, Jul 05, 2021 at 05:20:15AM -0700, jimcornmell wrote:
Hi, In that case whats the easiest way to persist a value between instantiations of the kitten without resorting to databases or system variables?
The UI part of the kitten is invoked in the same process, just use a
global variable.
|
Beta Was this translation helpful? Give feedback.
3 replies
-
```py
from kittens.tui.handler import result_handler
def main(args):
pass
@result_handler(no_ui=True)
def handle_result(args, answer, target_window_id, boss):
in_zen_mode = getattr(boss, 'in_zen_mode', False)
boss.change_font_size("all", "-" if in_zen_mode else '+', 5.0)
boss.toggle_fullscreen()
boss.in_zen_mode = not in_zen_mode
```
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jimcornmell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm interested to create a keyboard mapping to go to a zen mode, which makes sets full screen and increases the font size. Something like the following in the kitty config file. Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions