fennerm / flashfocus

Simple focus animations for tiling window managers.
MIT License
748 stars 10 forks source link

flash-on-focus does not work as expected #48

Closed albasili closed 4 years ago

albasili commented 4 years ago

I do not observe any flashing effect when creating a new window and/or switching focus on an existing one. Currently I'm using the following setup:

  box: debian 10
  window manager: i3-gaps built from source
  compositor: compton (0.1~beta2+20150922)
  terminal: urxvt

any suggestion?

fennerm commented 4 years ago

Is your config file default? If not could you post the contents?

albasili commented 4 years ago

My config is not default, you can find it here: http://sprunge.us/peBor3

fennerm commented 4 years ago

Sorry I meant your flashfocus.yml config

On Monday, April 20, 2020, albasili notifications@github.com wrote:

My config is not default, you can find it here: http://sprunge.us/peBor3

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fennerm/flashfocus/issues/48#issuecomment-616390658, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEY7SHEO5V7AZW5AMO6BPDRNQA5VANCNFSM4MHA3DBA .

albasili commented 4 years ago

Here's my flashfocus config: http://sprunge.us/X5daYV

maricn commented 4 years ago

UPDATE: Check the bottom of my comment.

~I have the same problem,~ using exactly the same versions as OP, except i use sakura for terminal.. but i don't think that's important, since flashfocus doesn't work on any window..

the logs look like it's working:

nikola@work-x1c-mx19 ~ » killall flashfocus && flashfocus
INFO: Detected display protocol: X11
INFO: Loading configuration from /home/nikola/.config/flashfocus/flashfocus.yml
INFO: Initializing with parameters:
{'time': 250.0, 'flash_fullscreen': True, 'ntimepoints': 16, 'flash_opacity': 0.2, 'flash_lone_windows': 'on_open_close', 'simple': False, 'default_opacity': 0.9, 'rules': [{'window_class': re.compile('X-terminal-emulator'), 'default_opacity': 0.85, 'flash_opacity': 0.2, 'simple': False, 'flash_on_focus': True, 'ntimepoints': 16, 'time': 250.0, 'flash_lone_windows': 'on_open_close'}, {'flash_opacity': 0.4, 'window_class': re.compile('^(Firefox Developer Edition|Slack|Chromium|Chrome|tutanota-desktop)$'), 'default_opacity': 1.0, 'simple': False, 'flash_on_focus': True, 'ntimepoints': 16, 'time': 250.0, 'flash_lone_windows': 'on_open_close'}], 'flash_on_focus': True}
INFO: Initializing default window opacity...
INFO: Setting all windows to their default opacity...
INFO: Window 81788929 matches criteria of rule 1
INFO: Window 56623107 matches criteria of rule 1
INFO: Window 69206019 matches criteria of rule 1
INFO: Window 106954755 matches criteria of rule 0
INFO: Window 140509187 matches criteria of rule 0
INFO: Window 117440515 matches criteria of rule 0
INFO: Window 138412035 matches criteria of rule 0
INFO: Window 159383555 matches criteria of rule 0
INFO: Window 121634819 matches criteria of rule 0
INFO: Window 150994947 matches criteria of rule 0
INFO: Window 54525955 matches criteria of rule 0
INFO: Initializing threads...
INFO: Threads initialized, waiting for events...
INFO: Focus shifted to 69206019
INFO: Window 69206019 matches criteria of rule 1
INFO: Flashing window 69206019
INFO: Resetting window 69206019 opacity to default
INFO: Focus shifted to 54525955
INFO: Window 54525955 matches criteria of rule 0
INFO: Flashing window 54525955
INFO: Resetting window 54525955 opacity to default

and my config is:

## @@@@@@@@@@@@@@@@@@@@@@
## Flashfocus config file
## @@@@@@@@@@@@@@@@@@@@@@

# Opacity of window during flash.
flash-opacity: 0.2

# Windows are restored to this opacity value at the end of a flash.
default-opacity: 0.9

# Length of flash in milliseconds.
time: 250

# If true, flashes are not faded out. This will improve performance but flashes
# won't be smooth.
simple: false

# Number of animation frames in a flash.
ntimepoints: 16

# Set this to false if you don't want windows to flash on focus.
flash-on-focus: true

# Set this to false if you don't want fullscreen windows to flash.
flash-fullscreen: true

# Whether or not to flash windows if they are the only window on the desktop.
# Possible values:
#   'always':
#      Always flash lone windows
#   'never':
#      Never flash lone windows
#   'on_open_close':
#      Lone windows will be flashed only if a) if they were just opened and b)
#      if another window was just closed. 
#   'on_switch':
#      Lone windows will be flashed only upon switching desktops.
flash-lone-windows: 'on_open_close'

rules:
  - window-class: X-terminal-emulator
    default-opacity: 0.85
  - window-class: ^(Firefox Developer Edition|Slack|Chromium|Chrome|tutanota-desktop)$
    default-opacity: 1
    flash-opacity: 0.4

relevant part of my ~/.xinitrc:

####### visual stuff ~~~~~~~~~~~~~~~~~~~~~
# init ~/.Xresources
xrdb -merge ~/.Xresources

# exec --no-startup-id compton -cCGb --backend glx --vsync opengl
compton -cCGb --backend glx --vsync opengl
# flash window on focus (wait for compton)
$(sleep 3 && flashfocus) &

exec i3 # --shmlog-size=26214400 # -d all 2>&1 1>/home/nikola/i3.log

UPDATE: I think my issue is not the same as OP's. I looked deeper into it and it seems my compton sometimes crashes on laptop wakeup (probably due to my secondary monitor waking up slower than the laptop). When I restart compton properly, it seems to recover.

fennerm commented 4 years ago

Thanks will take a look at this asap

yigitsever commented 4 years ago

Hello, I was having the same issue on arch with i3 and compton (now picom appearently). my conky window lost transparency as well so tried;

$ compton -b

[ 05/09/2020 14:31:06.965 parse_config_libconfig ERROR ] "paint-on-overlay" has been removed as an option, and the feature is enabled whenever possible
[ 05/09/2020 14:31:06.965 main FATAL ERROR ] Failed to create new session.

so the fix was simply removing

paint-on-overlay = true;

restarting picom and flashfocus. hope that solves it.

albasili commented 4 years ago

@yigitsever I tried but no joy, still not working. I can provide logs if necessary, please advice which ones are useful.

yigitsever commented 4 years ago

@albasili It might be a compositor issue like mine, can you run compton through command line and see if it errors out?

On 20/05/11 02:30PM, albasili wrote:

@yigitsever I tried but no joy, still not working. I can provide logs if necessary, please advice which ones are useful.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/fennerm/flashfocus/issues/48#issuecomment-626976131

albasili commented 4 years ago

I tried running flashfocus directly and here's the error:

 Traceback (most recent call last):
  File "/usr/local/bin/flashfocus", line 8, in <module>
    from flashfocus.cli import cli
  File "build/bdist.linux-x86_64/egg/flashfocus/__init__.py", line 20, in <module>
  File "/usr/local/lib/python2.7/dist-packages/flashfocus-2.1.3-py2.7.egg/flashfocus/compat.py", line 16
    def get_display_protocol() -> DisplayProtocol:
                               ^
SyntaxError: invalid syntax

I guess that explains... The question is: why?

yigitsever commented 4 years ago

That's a type hint syntax from python 3.5, how did you install flashfocus, what's your python version?

GuillaumeDeconinck commented 4 years ago

Hi everyone, I'm experiencing the same issue with exactly the same error when trying to run flashfocus.

I noticed that there were also some issues during the installation.

creating /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew
creating /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib
creating /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7
creating /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages
creating /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/server.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/types.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/client.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/color.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/flasher.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/util.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/compat.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/errors.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/router.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/__init__.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/config.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
creating /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/display_protocols
copying build/lib/flashfocus/display_protocols/__init__.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/display_protocols
copying build/lib/flashfocus/display_protocols/sway.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/display_protocols
copying build/lib/flashfocus/display_protocols/x11.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/display_protocols
copying build/lib/flashfocus/display.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/cli.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/default_config.yml -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/sockets.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
copying build/lib/flashfocus/pid.py -> /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus
byte-compiling /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/server.py to server.pyc
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/server.py", line 44
    def __init__(self, config: Dict) -> None:
                             ^
SyntaxError: invalid syntax

byte-compiling /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/types.py to types.pyc
byte-compiling /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/client.py to client.pyc
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/client.py", line 12
    def client_request_flash() -> None:
                               ^
SyntaxError: invalid syntax

byte-compiling /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/color.py to color.pyc
byte-compiling /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/flasher.py to flasher.pyc
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/flasher.py", line 50
    time: Number,
        ^
SyntaxError: invalid syntax

byte-compiling /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/util.py to util.pyc
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/util.py", line 6
    def match_regex(regex: Pattern, target: str) -> bool:
                         ^
SyntaxError: invalid syntax

byte-compiling /home/gde/.cache/yay/flashfocus-git/pkg/flashfocus-git/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/compat.py to compat.pyc
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/flashfocus/compat.py", line 16
    def get_display_protocol() -> DisplayProtocol:
                               ^
SyntaxError: invalid syntax
...

I haven't put all the logs, all the errors look like the ones above.

I have Python 2.7.17 (default, Dec 24 2019, 17:49:09) installed with linuxbrew on Arch(Manjaro).

Hope it can help ;)

EDIT: Tried with pip install flashfocus and now it works on my side

albasili commented 4 years ago

@yigitsever I've removed it and installed again via pip install flashfocus. I have python 2.7.

Now it doesn't crash, but it still doesn't work.

fennerm commented 4 years ago

@albasili Flashfocus is python3 only. Python2 is no longer maintained so I'd recommend updating your python version if possible. If you can't update for some reason, you could try pip install 'flashfocus==1.2.7 to install an older version of flashfocus but it might be missing some features.

albasili commented 4 years ago

@fennerm just for you to know, I've tried flashfocus==1.2.7 but no joy.

Switching the entire system to python3 is easier said than done. I'm on a Debian distro and many utilities depend on python 2. I could run flashfocus in a dedicated venv but I'm not sure how to do that in within i3, something that would deserve more digging. Anyway, thanks for your support.

fennerm commented 4 years ago

I’m sorry to hear that @albasili :(. Unfortunately continuing python2 support long term is difficult as a package maintainer. More and more dependencies are going py3 only. Adding sway compatibility also wouldn’t have been possible without dropping py2 support.

On Wed, May 20, 2020 at 12:46 PM albasili notifications@github.com wrote:

@fennerm https://github.com/fennerm just for you to know, I've tried flashfocus==1.2.7 but no joy.

Switching the entire system to python3 is easier said than done. I'm on a Debian distro and many utilities depend on python 2. I could run flashfocus in a dedicated venv but I'm not sure how to do that in within i3, something that would deserve more digging. Anyway, thanks for your support.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/fennerm/flashfocus/issues/48#issuecomment-631687233, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEY7SAVUEWD527QGC6PORTRSQXPXANCNFSM4MHA3DBA .