killown / waypy

MIT License
1 stars 0 forks source link

[Help] error on with some commands #1

Open bluebyt opened 7 months ago

bluebyt commented 7 months ago

This command is working: sock.set_workspace({"x":2, "y":2})

But this command give me an error: sock.go_next_workspace()

Traceback (most recent call last): File "/home/bluebyt/.config/ipc-scripts/./workspace2.py", line 8, in sock.go_next_workspace() File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 411, in go_next_workspace self.set_workspace(next) File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 945, in set_workspace x, y = workspace["x"], workspace["y"]


TypeError: 'int' object is not subscriptable

Archlinux
python 3.11.8
dbus-python 1.3.2

I want try this scripts, after you answered to me here:
[ipc: support workspace sets](https://github.com/WayfireWM/wayfire/pull/2156)
killown commented 7 months ago

I fixed sock.go_next_workspace() but this function will just go to the next workspace, if you want go only for workspaces with views then you need sock.go_next_workspace_with_views()

update the module:

git clone https://github.com/killown/waypy
cd waypy
python3 -m pip install .
bluebyt commented 7 months ago

I updated but I get another error. Traceback (most recent call last): File "/home/bluebyt/.config/ipc-scripts/./workspace2.py", line 4, in sock.set_workspace({"x":1, "y":1}, focused_view_id) File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 1126, in set_workspace focused_output = self.get_focused_output() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 407, in get_focused_output return self.send_json(message)["info"] ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 80, in send_json return self.read_message() ^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 69, in read_message raise Exception(response["error"]) Exception: No such method found!

killown commented 7 months ago

"vswitch/set-workspace"

you need the plugin vswitch enabled

killown commented 7 months ago

can you update the module again, I added list_methods

you can check every method and respective plugin using print(sock.list_methods())

bluebyt commented 7 months ago

Yes I have the plugin vswitch enabled. Wayfire.ini plugins = ipc ipc-rules stipc alpha animate autostart command cube expo fast-switcher fisheye grid foreign-toplevel gtk-shell idle move place resize switcher vswitch window-rules wm-actions wobbly wrot zoom scale wf-info background-view wsets

I am not sure how to use the command print(sock.list_methods())

I added this in my script:

20240322_143631

Error: Traceback (most recent call last): File "/home/bluebyt/.config/ipc-scripts/./workspace2.py", line 11, in sock.go_next_workspace() File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 589, in go_next_workspace workspaces = list(self.total_workspaces().values()) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 881, in total_workspaces winfo = self.get_active_workspace_info() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 499, in get_active_workspace_info focused_output = self.get_focused_output() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 472, in get_focused_output return self.send_json(message)["info"] ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 100, in send_json return self.read_message() ^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 81, in read_message raise Exception(response["error"]) Exception: No such method found!

killown commented 7 months ago

Yes I have the plugin vswitch enabled. Wayfire.ini plugins = ipc ipc-rules stipc alpha animate autostart command cube expo fast-switcher fisheye grid foreign-toplevel gtk-shell idle move place resize switcher vswitch window-rules wm-actions wobbly wrot zoom scale wf-info background-view wsets

I am not sure how to use the command print(sock.list_methods())

I added this in my script:

20240322_143631

Error: Traceback (most recent call last): File "/home/bluebyt/.config/ipc-scripts/./workspace2.py", line 11, in sock.go_next_workspace() File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 589, in go_next_workspace workspaces = list(self.total_workspaces().values()) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 881, in total_workspaces winfo = self.get_active_workspace_info() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 499, in get_active_workspace_info focused_output = self.get_focused_output() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 472, in get_focused_output return self.send_json(message)["info"] ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 100, in send_json return self.read_message() ^^^^^^^^^^^^^^^^^^^ File "/home/bluebyt/.local/lib/python3.11/site-packages/wayfire.py", line 81, in read_message raise Exception(response["error"]) Exception: No such method found!

list_methods will return a list of methods, just to check the available methods you can use, you can ignore it, not useful in your script!

about the focused_output, you need to install the latest wayfire-git

bluebyt commented 4 months ago

I retried the script since it has been updated, now the next workspace sock.go_next_workspace() command works, but not the previous workspace

sock.go_previous_workspace()

`Traceback (most recent call last): File "/home/bluebyt/.config/ipc-scripts/workspace2.py", line 11, in sock.go_previous_workspace() File "/home/bluebyt/.local/lib/python3.12/site-packages/wayfire/core/ipc_utils.py", line 378, in go_previous_workspace self.set_workspace(previous) File "/home/bluebyt/.local/lib/python3.12/site-packages/wayfire/ipc.py", line 363, in set_workspace x, y = workspace["x"], workspace["y"]


TypeError: 'int' object is not subscriptable`