Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25f8a0c

Browse files
committed
feat(komorebi): enhance workspace and layout management with monitor index support
Updated the KomorebiClient methods to include monitor index parameters for workspace activation and layout changes. This improves the functionality by allowing users to specify which monitor's workspace to activate or change the layout for, enhancing multi-monitor support.
1 parent9e892e7 commit25f8a0c

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

‎src/core/utils/komorebi/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def get_workspace_by_window_hwnd(self, workspaces: list[Optional[dict]], window_
8282
ifmanaged_window['hwnd']==window_hwnd:
8383
returnadd_index(workspace,i)
8484

85-
defactivate_workspace(self,ws_idx:int,wait:bool=False)->None:
86-
p=subprocess.Popen([self._komorebic_path,"focus-workspace",str(ws_idx)],shell=True)
85+
defactivate_workspace(self,m_idx:int,ws_idx:int,wait:bool=False)->None:
86+
p=subprocess.Popen([self._komorebic_path,"focus-monitor-workspace",str(m_idx),str(ws_idx)],shell=True)
8787

8888
ifwait:
8989
p.wait()
@@ -105,9 +105,9 @@ def toggle_focus_mouse(self) -> None:
105105
exceptsubprocess.SubprocessError:
106106
logging.exception("Failed to toggle focus-follows-mouse")
107107

108-
defchange_layout(self,layout:str)->None:
108+
defchange_layout(self,m_idx:int,ws_idx:int,layout:str)->None:
109109
try:
110-
subprocess.Popen([self._komorebic_path,"change-layout",layout],shell=True)
110+
subprocess.Popen([self._komorebic_path,"workspace-layout",str(m_idx),str(ws_idx),layout],shell=True)
111111
exceptsubprocess.SubprocessError:
112112
logging.exception(f"Failed to change layout of currently active workspace to{layout}")
113113

@@ -133,7 +133,9 @@ def flip_layout_horizontal_and_vertical(self) -> None:
133133

134134
deftoggle(self,toggle_type:str,wait:bool=False)->None:
135135
try:
136-
p=subprocess.Popen([self._komorebic_path,f"toggle-{toggle_type}"],shell=True)
136+
137+
command=f'"{self._komorebic_path}" focus-monitor-at-cursor && "{self._komorebic_path}" toggle-{toggle_type}'
138+
p=subprocess.Popen(command,shell=True)
137139

138140
ifwait:
139141
p.wait()

‎src/core/widgets/komorebi/active_layout.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, label: str, layouts: list[str], layout_icons: dict[str, str],
9090
self.register_callback("flip_layout_vertical",self._komorebic.flip_layout_vertical)
9191
self.register_callback("flip_layout_horizontal_and_vertical",self._komorebic.flip_layout_horizontal_and_vertical)
9292
self.register_callback("first_layout",self._first_layout)
93-
self.register_callback("toggle_tiling",lambda:self._komorebic.toggle("tiling"))
93+
self.register_callback("toggle_tiling",lambda:self._komorebic.toggle("tiling"),)
9494
self.register_callback("toggle_float",lambda:self._komorebic.toggle("float"))
9595
self.register_callback("toggle_monocle",lambda:self._komorebic.toggle("monocle"))
9696
self.register_callback("toggle_maximise",lambda:self._komorebic.toggle("maximise"))
@@ -102,22 +102,25 @@ def __init__(self, label: str, layouts: list[str], layout_icons: dict[str, str],
102102
def_reset_layouts(self):
103103
self._layouts=deque([x.replace('_','-')forxinself._layouts_config])
104104

105+
defchange_layout(self,layout:str):
106+
self._komorebic.change_layout(self._komorebi_screen['index'],self._focused_workspace['index'],layout)
107+
105108
def_first_layout(self):
106109
ifself._is_shift_layout_allowed():
107110
self._reset_layouts()
108-
self._komorebic.change_layout(self._layouts[0])
111+
self.change_layout(self._layouts[0])
109112

110113
def_next_layout(self):
111114
ifself._is_shift_layout_allowed():
112115
self._layouts.rotate(1)
113-
self._komorebic.change_layout(self._layouts[0])
116+
self.change_layout(self._layouts[0])
114117
ifself._animation['enabled']:
115118
AnimationManager.animate(self,self._animation['type'],self._animation['duration'])
116119

117120
def_prev_layout(self):
118121
ifself._is_shift_layout_allowed():
119122
self._layouts.rotate(-1)
120-
self._komorebic.change_layout(self._layouts[0])
123+
self.change_layout(self._layouts[0])
121124
ifself._animation['enabled']:
122125
AnimationManager.animate(self,self._animation['type'],self._animation['duration'])
123126

‎src/core/widgets/komorebi/workspaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def update_and_redraw(self, status: WorkspaceStatus):
6464

6565
defactivate_workspace(self):
6666
try:
67-
self.komorebic.activate_workspace(self.workspace_index)
67+
self.komorebic.activate_workspace(self.parent_widget._komorebi_screen['index'],self.workspace_index)
6868
ifself._animation:
6969
self.animate_buttons()
7070
exceptException:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp