Skip to content

Commit 31adcaa

Browse files
committed
i3/sway: add support for the I3 and Sway IPC
sway: add urgent and focused dispatchers to workspaces flake: add sway toggle WIP sway: add monitor status sway: handle multiple ipc events in one line sway: reuse socket connection for dispatches & better command type handling WIP sway: add associated monitor to a workspace i3/sway: update to allow for i3 compatibility i3/sway: manage setting the focused monitors i3/sway: fix multi monitor crash i3/sway: fix linting errors i3/sway: update nix package flag naming to i3 i3/sway: add documentation, fix module.md and impl monitorFor i3/sway: handle more workspace ipc events i3/sway: fix review i3/sway: fix crash due to newline breaking up an IPC message i3/sway: handle broken messages by forwarding to the next magic sequence i3/sway: break loop when buffer is empty i3/sway: fix monitor focus & focused monitor signal not being emitted i3/sway: use datastreams instead of qbytearrays for socket reading i3/sway: fix lint issues i3/sway: drop second socket connection, remove dispatch return value, recreate IPC connection on fatal error i3/sway: handle run_command responses i3/sway: remove reconnection on unknown event i3/sway: fix formatting, lint & avoid writing to socket if connection is not open
1 parent 84ce47b commit 31adcaa

15 files changed

+1252
-1
lines changed

BUILD.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,23 @@ To disable: `-DHYPRLAND_GLOBAL_SHORTCUTS=OFF`
182182
[hyprland-global-shortcuts-v1]: https://github.com/hyprwm/hyprland-protocols/blob/main/protocols/hyprland-global-shortcuts-v1.xml
183183

184184
#### Hyprland Focus Grab
185-
Enables windows to grab focus similarly to a context menu undr hyprland through the
185+
Enables windows to grab focus similarly to a context menu under hyprland through the
186186
[hyprland-focus-grab-v1] protocol. This feature has no extra dependencies.
187187

188188
To disable: `-DHYPRLAND_FOCUS_GRAB=OFF`
189189

190190
[hyprland-focus-grab-v1]: https://github.com/hyprwm/hyprland-protocols/blob/main/protocols/hyprland-focus-grab-v1.xml
191191

192+
### i3/Sway
193+
Enables i3 and Sway specific features, does not have any dependency on Wayland or x11.
194+
195+
To disable: `-DI3=OFF`
196+
197+
#### i3/Sway IPC
198+
Enables interfacing with i3 and Sway's IPC.
199+
200+
To disable: `-DI3_IPC=OFF`
201+
192202
## Building
193203
*For developers and prospective contributors: See [CONTRIBUTING.md](CONTRIBUTING.md).*
194204

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ boption(HYPRLAND " Hyprland" ON REQUIRES WAYLAND)
5555
boption(HYPRLAND_IPC " Hyprland IPC" ON REQUIRES HYPRLAND)
5656
boption(HYPRLAND_GLOBAL_SHORTCUTS " Hyprland Global Shortcuts" ON REQUIRES HYPRLAND)
5757
boption(HYPRLAND_FOCUS_GRAB " Hyprland Focus Grabbing" ON REQUIRES HYPRLAND)
58+
boption(I3 " I3/Sway" ON)
59+
boption(I3_IPC " I3/Sway IPC" ON REQUIRES I3)
5860
boption(X11 "X11" ON)
5961
boption(SERVICE_STATUS_NOTIFIER "System Tray" ON)
6062
boption(SERVICE_PIPEWIRE "PipeWire" ON)

default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
withPipewire ? true,
3939
withPam ? true,
4040
withHyprland ? true,
41+
withI3 ? true,
4142
}: buildStdenv.mkDerivation {
4243
pname = "quickshell${lib.optionalString debug "-debug"}";
4344
version = "0.1.0";
@@ -81,6 +82,7 @@
8182
(lib.cmakeBool "SERVICE_PIPEWIRE" withPipewire)
8283
(lib.cmakeBool "SERVICE_PAM" withPam)
8384
(lib.cmakeBool "HYPRLAND" withHyprland)
85+
(lib.cmakeBool "I3" withI3)
8486
];
8587

8688
# How to get debuginfo in gdb from a release build:

src/x11/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ qt_add_qml_module(quickshell-x11
1111
DEPENDENCIES QtQuick
1212
)
1313

14+
if(I3)
15+
add_subdirectory(i3)
16+
endif()
17+
1418
install_qml_module(quickshell-x11)
1519

1620
add_library(quickshell-x11-init OBJECT init.cpp)

src/x11/i3/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
qt_add_library(quickshell-i3 STATIC)
2+
3+
target_link_libraries(quickshell-i3 PRIVATE ${QT_DEPS})
4+
5+
set(I3_MODULES)
6+
7+
if (I3_IPC)
8+
add_subdirectory(ipc)
9+
list(APPEND I3_MODULES Quickshell.I3._Ipc)
10+
endif()
11+
12+
qt_add_qml_module(quickshell-i3
13+
URI Quickshell.I3
14+
VERSION 0.1
15+
IMPORTS ${I3_MODULES}
16+
)
17+
18+
install_qml_module(quickshell-i3)
19+
20+
qs_pch(quickshell-i3)
21+
qs_pch(quickshell-i3plugin)
22+
23+
target_link_libraries(quickshell PRIVATE quickshell-i3plugin)

src/x11/i3/ipc/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
qt_add_library(quickshell-i3-ipc STATIC
2+
connection.cpp
3+
qml.cpp
4+
workspace.cpp
5+
monitor.cpp
6+
)
7+
8+
qt_add_qml_module(quickshell-i3-ipc
9+
URI Quickshell.I3._Ipc
10+
VERSION 0.1
11+
DEPENDENCIES QtQml
12+
)
13+
14+
qs_add_module_deps_light(quickshell-i3-ipc Quickshell)
15+
16+
install_qml_module(quickshell-i3-ipc)
17+
18+
target_link_libraries(quickshell-i3-ipc PRIVATE Qt::Quick)
19+
20+
qs_module_pch(quickshell-i3-ipc SET large)
21+
22+
target_link_libraries(quickshell PRIVATE quickshell-i3-ipcplugin)

0 commit comments

Comments
 (0)