Skip to content

Commit

Permalink
Fix some i3 command syntax
Browse files Browse the repository at this point in the history
Also simplify move_to_scratchpad
  • Loading branch information
lbonn committed Feb 29, 2024
1 parent e43a196 commit 053b3f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions i3_quickterm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ def select_shell(conf: Conf) -> Optional[str]:
return shell


def move_to_scratchpad(conn: i3ipc.Connection, selector: str):
conn.command(f"{selector} floating enable, move scratchpad")
def move_to_scratchpad(conn: i3ipc.Connection, con: i3ipc.Con):
conn.command(f"[con_id={con.id}] floating enable, move scratchpad")


def get_current_workspace(conn: i3ipc.Connection):
Expand Down Expand Up @@ -304,7 +304,7 @@ def launch_inplace(self):
def toggle_on_current_ws(self):
"""If on another workspace: hide, otherwise show on current"""
assert self.con is not None
move_to_scratchpad(self.conn, f"[con_id={self.con.id}]")
move_to_scratchpad(self.conn, self.con)

qt_ws = self.con.workspace()
if self.ws is not None and (qt_ws is None or qt_ws.name != self.ws.name):
Expand Down Expand Up @@ -333,8 +333,8 @@ def focus_on_current_ws(self):
f"[con_mark={self.mark}] "
f"move scratchpad, "
f"scratchpad show, "
f"resize set {width} px {height} px, "
f"move absolute position {posx}px {posy}px"
f"resize set {width} {height} px, "
f"move absolute position {posx} {posy} px"
)

def execute_term(self):
Expand Down Expand Up @@ -373,7 +373,7 @@ def run_qt(qt: Quickterm, in_place: bool = False):
c = qt.con_in_workspace(MARK_QT_PATTERN)
if c is not None:
# undefined shell and visible on workspace: hide
move_to_scratchpad(qt.conn, f"[con_id={c.id}]")
move_to_scratchpad(qt.conn, c)
return

# undefined shell and nothing on workspace: ask for shell selection
Expand Down
4 changes: 2 additions & 2 deletions tests/test_quickterm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_launch_inplace(i3ipc_connection, conf, execvp):
call("mark quickterm_shell"),
call(
"[con_mark=quickterm_shell] move scratchpad, scratchpad show, "
"resize set 0 px 0 px, move absolute position 0px 0px"
"resize set 0 0 px, move absolute position 0 0 px"
),
]
)
Expand Down Expand Up @@ -144,7 +144,7 @@ def new_workspace():
call("[con_id=0] floating enable, move scratchpad"),
call(
"[con_mark=quickterm_shell] move scratchpad, scratchpad show, "
"resize set 0 px 0 px, move absolute position 0px 0px"
"resize set 0 0 px, move absolute position 0 0 px"
),
]
)
Expand Down

0 comments on commit 053b3f5

Please sign in to comment.