vrde / i3-quiet

Distraction free i3 experience
MIT License
76 stars 3 forks source link

Restore borders #3

Closed vrde closed 4 years ago

vrde commented 4 years ago

Reported on reddit.

Problem

When exiting quiet mode, in some cases borders are not restored to their original state.

Solution

If there is a border toggle command, use it. Otherwise some more complex logic to store the previous state of the window has to be implemented.

tcaxle commented 4 years ago

# i3-msg border toggle Will toggle between states none, 1pixel, and normal. However, if the user has none as their default borders (like me) this will turn on the borders when returning from quiet mode.

I suggest adding variables to the start of quiet.py:

#!/usr/bin/env python

# Choose borders from '1pixel' 'normal' 'none' 'pixel X'
DEFAULT_BORDERS = "1pixel"
ZEN_BORDERS = "none"

...

def enable_zen_mode(...):
    ...
    'border {}'.format(ZEN_BORDERS)
    ....

def disable_zen_mode(...):
    ...
    'border {}'.format(DEFAULT_BORDERS)
    ...

...

Then point users to these variables in the README.md

vdg0 commented 4 years ago

Hi, i report the issue in reddit: https://www.reddit.com/r/i3wm/comments/eqzq1d/need_to_focus_try_i3quiet_mode/ff26wwt Maybe we can use https://i3ipc-python.readthedocs.io/en/latest/con.html#i3ipc.Con to try to get the previous state of border and set that when exit the quiet-mode.

Maybe there is a good example to review at https://github.com/altdesktop/i3ipc-python/tree/master/examples

o/

vrde commented 4 years ago

Fixed by storing the current border value, see:

https://github.com/vrde/i3-quiet/blob/5bf07202c7b38f6ea71dcca8229f18e81bad0741/quiet-cmd.py#L41

And:

https://github.com/vrde/i3-quiet/blob/5bf07202c7b38f6ea71dcca8229f18e81bad0741/quiet-cmd.py#L55-L59