Skip to content
This repository was archived by the owner on Jun 12, 2025. It is now read-only.

Commit 57f08af

Browse files
committed
add info
1 parent 0b5162a commit 57f08af

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ An unofficial async python wrapper for Hyprland's IPC supposed to somewhat work
99
- [x] event listeners
1010
- [x] keybinds
1111
- [ ] windowrules
12-
- [ ] hyprland info
12+
- [x] hyprland info
1313
- [x] misc hyprland commands(change workspace, move active window etc...)*(dispatchers)*
1414
- [ ] a nice way to handle colors
1515
- [ ] build `settings.py` file based on current hl version

src/hyprland/dispatch.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async def split_ratio(x:float):
7676

7777
async def toggle_opaque():
7878
await async_command_send('/dispatch toggleopaque')
79-
79+
###
8080
async def move_cursor_to_corner(c):
8181
await async_command_send(f'/dispatch movecursortocorner {c}')
8282

@@ -104,5 +104,17 @@ async def bring_active_to_top():
104104
async def toggles_pecial_workspace(sw=None):
105105
await async_command_send(f'/dispatch togglespecialworkspace {sw if sw else ""}')
106106

107+
### end of the actual dispatch commands
108+
### and henceforth are the commands that are not
109+
107110
async def reload_config():
108-
await async_command_send('/reload')
111+
await async_command_send('reload')
112+
113+
async def kill_mode():
114+
await async_command_send('kill')
115+
116+
async def cursor_theme(theme,size):
117+
await async_command_send(f'cursor {theme} {size}')
118+
119+
async def switch_xkb_layout(device,cmd):
120+
await async_command_send(f'switchxkblayout {device} {cmd}')

src/hyprland/info.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from .sockets import async_command_send
2+
import json
3+
4+
5+
class Info:
6+
async def version():
7+
return json.loads(await async_command_send('version -j'))
8+
9+
async def monitors():
10+
return json.loads(await async_command_send('monitors -j'))
11+
12+
async def workspaces():
13+
return json.loads(await async_command_send('workspaces -j'))
14+
15+
async def clients():
16+
return json.loads(await async_command_send('clients -j'))
17+
18+
async def devices():
19+
return json.loads(await async_command_send('devices -j'))
20+
21+
async def active_window():
22+
return json.loads(await async_command_send('activewindow -j'))
23+
24+
async def layers():
25+
return json.loads(await async_command_send('layers -j'))
26+
27+
async def splash():
28+
return json.loads(await async_command_send('splash'))
29+
30+
async def get_option(opt):
31+
return await async_command_send(f'getoption {opt}')
32+
33+
async def cursor_pos():
34+
return json.loads(await async_command_send('cursorpos -j'))
35+
36+
37+
38+
39+

0 commit comments

Comments
 (0)