File tree Expand file tree Collapse file tree 2 files changed +22
-26
lines changed
Expand file tree Collapse file tree 2 files changed +22
-26
lines changed Original file line number Diff line number Diff line change @@ -415,30 +415,8 @@ def scratchpad(self) -> 'Con':
415415 :returns: The scratchpad container.
416416 :rtype: class:`Con`
417417 """
418- root = self .root ()
418+ for con in self .root ():
419+ if con .type == 'workspace' and con .name == "__i3_scratch" :
420+ return con
419421
420- i3con = None
421- for c in root .nodes :
422- if c .name == "__i3" :
423- i3con = c
424- break
425-
426- if not i3con :
427- return None
428-
429- i3con_content = None
430- for c in i3con .nodes :
431- if c .name == "content" :
432- i3con_content = c
433- break
434-
435- if not i3con_content :
436- return None
437-
438- scratch = None
439- for c in i3con_content .nodes :
440- if c .name == "__i3_scratch" :
441- scratch = c
442- break
443-
444- return scratch
422+ return None
Original file line number Diff line number Diff line change 1+ from .ipctest import IpcTest
2+
3+ import pytest
4+
5+
6+ class TestScratchpad (IpcTest ):
7+ @pytest .mark .asyncio
8+ async def test_scratchpad (self , i3 ):
9+ scratchpad = (await i3 .get_tree ()).scratchpad ()
10+ assert scratchpad is not None
11+ assert scratchpad .name == '__i3_scratch'
12+ assert scratchpad .type == 'workspace'
13+ assert not scratchpad .floating_nodes
14+ win = self .open_window ()
15+ await i3 .command ('move scratchpad' )
16+ scratchpad = (await i3 .get_tree ()).scratchpad ()
17+ assert scratchpad is not None
18+ assert scratchpad .floating_nodes
You can’t perform that action at this time.
0 commit comments