Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
i3-woman
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
i3-woman
Commits
37d3bf26
Commit
37d3bf26
authored
2 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Watch: Disable on_Workspace_focus switch (for screenshot loading)
parent
2943011c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
woman/watch.py
+20
-0
20 additions, 0 deletions
woman/watch.py
with
20 additions
and
0 deletions
woman/watch.py
+
20
−
0
View file @
37d3bf26
...
...
@@ -9,6 +9,8 @@ import Xlib
import
Xlib.display
import
Xlib.X
from
contextlib
import
contextmanager
import
argparse
import
i3ipc
...
...
@@ -54,11 +56,29 @@ def event_workspace_deleted(w):
if
shared
.
output_of_workspace
[
master
]
==
{}:
shared
.
output_of_workspace
.
pop
(
master
)
disable_on_workspace_focus
=
0
# Non-zero is true
# Base usage: Advance number on activate, decrease on deactivate
@contextmanager
def
disable_on_workspace_focus_context
():
global
disable_on_workspace_focus
try
:
disable_on_workspace_focus
+=
1
yield
None
finally
:
disable_on_workspace_focus
-=
1
def
i3_watch
():
shared
.
init_thread
()
def
on_workspace_focus
(
i3p
,
e
):
if
disable_on_workspace_focus
>
0
:
with
shared
.
lock
:
shared
.
output
=
e
.
current
.
ipc_data
[
'
output
'
]
master
,
slave
=
parse_workspace
(
e
.
current
.
name
)
event_workspace_is_on
((
master
,
slave
),
shared
.
output
)
shared
.
workspace_on
[
shared
.
output
]
=
(
master
,
slave
)
return
with
shared
.
lock
:
output
=
e
.
current
.
ipc_data
[
'
output
'
]
if
output
!=
shared
.
output
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment