SafeEyes icon indicating copy to clipboard operation
SafeEyes copied to clipboard

Do Not Disturb does not honor "Do Not Interrupt"

Open stdedos opened this issue 7 years ago • 11 comments

I am not sure how the method is working, but, at least the application appears in px aux:

sntentos@optiplex-9010 [2018-05-11 10:24:24]:~$  ps aux | grep 'zoo[m]'
sntentos 20751  0.0  0.0  13292  1580 ?        S    Μάι07   0:00 /usr/bin/zoom zoommtg://zoom.us/join?
sntentos 20756  0.0  0.0   4504   844 ?        S    Μάι07   0:00 sh -c export SSB_HOME=/home/sntentos/.zoom; export QSG_INFO=1; export LD_LIBRARY_PATH=/opt/zoom; /opt/zoom/zoom "zoommtg://zoom.us/join? "
sntentos 20757  0.4  1.6 5003840 533296 ?      Sl   Μάι07  25:32 /opt/zoom/zoom zoommtg://zoom.us/join? 

stdedos avatar May 11 '18 07:05 stdedos

Hi, May I know the app name. Sorry I couldn't find it using the command name.

Until we fix the problem you can try this solution.

  1. Open that application and a terminal
  2. Enter xprop WM_CLASS in terminal, hit enter and click on that application window
  3. It will print the window class of that app (For example I got WM_CLASS(STRING) = "Navigator", "Firefox" for Firefox)
  4. Add the window class to always interrupt in Do Not Disturb preference. safeeyes_dnd

slgobinath avatar May 11 '18 11:05 slgobinath

@slgobinath The application name is Zoom (https://zoom.us/)

WM_CLASS(STRING) = "zoom", "zoom"

... and it's already in the configuration :confused: image

Of course, I have no idea how they are implementing Full Screen :confused: I always keep it to be Full Screen, but, depending on sharing status etc, it is possible that the application goes to "windowed mode" (but still covers a high monitor percentile) and/or maximized mode.

I still keep in topmost on the active monitor, most of the time

stdedos avatar May 11 '18 12:05 stdedos

Further question: would that configuration be correct also? image

(The issue is still active for me obviously)

stdedos avatar Jan 23 '19 14:01 stdedos

You need to separate them by space. I have to change this to comma in the next version.

slgobinath avatar Jan 23 '19 14:01 slgobinath

Why not do both at the same time? They are both "valid" separators since you don't do Window Title as in e.g. Do Not Disturb does not honor "Do Not Interrupt" · Issue #254 · slgobinath/SafeEyes - Google Chrome

A documenting tooltip would be nice on whatever is the final decision.

stdedos avatar Jan 23 '19 14:01 stdedos

+1 I will implement is soon.

slgobinath avatar Jan 23 '19 14:01 slgobinath

Could you please help me to test the Zoom application.

  1. Save the following code as test.py somewhere.
import subprocess, time

import gi
gi.require_version('Gdk', '3.0')
from gi.repository import Gdk
from gi.repository import GdkX11

print("Switch to the window you want to test and wait for 10 sec...")
time.sleep(10) # Adjust the waiting time in seconds based on your convenient

screen = Gdk.Screen.get_default()
active_window = screen.get_active_window()
if active_window:
        active_xid = str(active_window.get_xid())
        cmdlist = ['xprop', '-root', '-notype', '-id',
                   active_xid, 'WM_CLASS', '_NET_WM_STATE']
        try:
            stdout = subprocess.check_output(cmdlist).decode('utf-8')
        except subprocess.CalledProcessError:
            print('Error in finding full-screen application')
        else:
        	print(stdout)
  1. Open Zoom.
  2. Execute the script from Terminal using python3 test.py
  3. Switch to Zoom and wait for 10 seconds (time.sleep(10) is used to give you enough time to switch to Zoom but you may need to wait for at least 10 seconds while having Zoom as the active window)
  4. After 10 seconds, switch to the Terminal and share the output here.

slgobinath avatar Jan 23 '19 14:01 slgobinath

Result:

$ ./safeeyes_iss254_test.py 
Switch to the window you want to test and wait for 10 sec...
WM_CLASS = "zoom", "zoom"
_NET_WM_STATE = _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_FOCUSED

$

Of course, I think it would reasonable to start filtering by FullScreen windows in "production code" (i.e. somehow query all _NET_WM_STATE = _NET_WM_STATE_FULLSCREEN windows).

That "test code" could be more useful.


and/or this code as a plugin:




def interact(banner=None):
    import readline  # optional, will allow Up/Down/History in the console
    import code, sys

    # use exception trick to pick up the current frame
    try:
        raise None
    except:
        frame = sys.exc_info()[2].tb_frame.f_back

    # evaluate commands in current namespace
    namespace = frame.f_globals.copy()
    namespace.update(frame.f_locals)

    code.interact(banner=banner, local=namespace)

stdedos avatar Jan 23 '19 16:01 stdedos

Actually, the test code was from the plugin code. Your output looks good. There should be a logical mistake in my code: https://github.com/slgobinath/SafeEyes/blob/master/safeeyes/plugins/donotdisturb/plugin.py#L41 I will check this today.

slgobinath avatar Jan 23 '19 16:01 slgobinath

Actually, the test code was from the plugin code. Your output looks good. There should be a logical mistake in my code: https://github.com/slgobinath/SafeEyes/blob/master/safeeyes/plugins/donotdisturb/plugin.py#L41 I will check this today.

Of course, I think it would reasonable to start filtering by FullScreen windows in "production code" (i.e. somehow query all _NET_WM_STATE = _NET_WM_STATE_FULLSCREEN windows).

Well ... as I mentioned: Don't get_active_window()!


On a multi-screen environment, I might have one app in fullscreen, and use the rest of the monitors for something else.

I believe the code should check if "there is a visible fullscreen window". Or, at least, if "there is a full screen window that's not minimized" (if it is possible for a fullscreen window to be "minimized")

stdedos avatar Jan 23 '19 17:01 stdedos

I'm also using Zoom but never maximize it and only run it when doing calls, so I rewrote the plugin to check for any windows with the given class: https://github.com/toupeira/dotfiles/tree/master/config/safeeyes/plugins/donotdisturb-apps ( (also using libwnck instead of xprop)

Maybe this could be added as a checkbox Only skip breaks for fullscreen windows, though I'm not sure how that would play with the Interrupt these windows regardless of their state option.

Another feature could be matching on window title rather than class, so for Zoom you could only match meeting windows with ^Zoom Meeting ID: .

toupeira avatar Mar 13 '20 13:03 toupeira