From 9a2a0cb36fe8f1e600e61414cad22fbb1d28a9f8 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Fri, 19 Apr 2024 11:24:44 -0400 Subject: [PATCH 1/3] bugfix: processes spawned from the compositor need to be unsnapped to avoid driver errors --- CMakeLists.txt | 5 +++++ src/miracle-wm-unsnap | 10 ++++++++++ src/miracle_config.cpp | 8 ++++---- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100755 src/miracle-wm-unsnap diff --git a/CMakeLists.txt b/CMakeLists.txt index afccc32..12ac67c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,8 +68,13 @@ add_custom_target(miracle-wm-sensible-terminal ALL cp ${CMAKE_CURRENT_SOURCE_DIR}/src/miracle-wm-sensible-terminal ${CMAKE_BINARY_DIR}/bin ) +add_custom_target(miracle-wm-unsnap ALL + cp ${CMAKE_CURRENT_SOURCE_DIR}/src/miracle-wm-unsnap ${CMAKE_BINARY_DIR}/bin +) + install(PROGRAMS src/miracle-wm-sensible-terminal + src/miracle-wm-unsnap DESTINATION ${CMAKE_INSTALL_BINDIR} ) diff --git a/src/miracle-wm-unsnap b/src/miracle-wm-unsnap new file mode 100755 index 0000000..4043ea0 --- /dev/null +++ b/src/miracle-wm-unsnap @@ -0,0 +1,10 @@ +#! /bin/bash +set -e +if [ "$SNAP_NAME" == "miracle-wm" ]; then + unset __EGL_VENDOR_LIBRARY_DIRS + unset LIBGL_DRIVERS_PATH + unset LIBINPUT_QUIRKS_DIR + + PATH="$(echo "$PATH" | sed "s#$SNAP[^:]*:##g")" +fi +exec "$@" \ No newline at end of file diff --git a/src/miracle_config.cpp b/src/miracle_config.cpp index 68b58f4..165ca4a 100644 --- a/src/miracle_config.cpp +++ b/src/miracle_config.cpp @@ -82,7 +82,7 @@ void MiracleConfig::_load() outer_gaps_x = 10; outer_gaps_y = 10; startup_apps = {}; - terminal = "miracle-wm-sensible-terminal"; + terminal = "miracle-wm-unsnap miracle-wm-sensible-terminal"; desired_terminal = ""; resize_jump = 50; @@ -525,7 +525,7 @@ void MiracleConfig::_load() YAML::Node modifiers_node; try { - command = sub_node["command"].as(); + command = "miracle-wm-unsnap " + sub_node["command"].as(); action = sub_node["action"].as(); key = sub_node["key"].as(); modifiers_node = sub_node["modifiers"]; @@ -655,7 +655,7 @@ void MiracleConfig::_load() try { - auto command = node["command"].as(); + auto command = "miracle-wm-unsnap " + node["command"].as(); bool restart_on_death = false; if (node["restart_on_death"]) { @@ -677,7 +677,7 @@ void MiracleConfig::_load() { try { - terminal = config["terminal"].as(); + terminal = "miracle-wm-unsnap " + config["terminal"].as(); } catch (YAML::BadConversion const& e) { From f9457a4375b6eb50a4c986e9bec2f5f0fa0e8a1d Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Fri, 19 Apr 2024 11:32:34 -0400 Subject: [PATCH 2/3] version: bump to 0.2.0 --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e05b5f8..af7267f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -6,7 +6,7 @@ description: | that provides a tiling-window manager. confinement: classic base: core22 -version: 0.1.0 +version: 0.2.0 architectures: - build-on: amd64 From f5cfd5b2ff2faa24061dcd5f9225cf7091b6bd60 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Fri, 19 Apr 2024 11:38:54 -0400 Subject: [PATCH 3/3] tests: updating tests to accomodate miracle-wm-unsnap --- tests/miracle_config_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/miracle_config_test.cpp b/tests/miracle_config_test.cpp index 1e7d84a..9816c06 100644 --- a/tests/miracle_config_test.cpp +++ b/tests/miracle_config_test.cpp @@ -165,7 +165,7 @@ TEST_F(MiracleConfigTest, CanCreateCustomAction) MirKeyboardAction::mir_keyboard_action_down, KEY_X, mir_input_event_modifier_meta); - EXPECT_EQ(custom_action->command, "echo Hi"); + EXPECT_EQ(custom_action->command, "miracle-wm-unsnap echo Hi"); EXPECT_EQ(custom_action->key, KEY_X); EXPECT_EQ(custom_action->action, mir_keyboard_action_down); } @@ -256,7 +256,7 @@ TEST_F(MiracleConfigTest, ValidStartupAppsAreParsed) MiracleConfig config(runner, path); EXPECT_EQ(config.get_startup_apps().size(), 1); - EXPECT_EQ(config.get_startup_apps()[0].command, "echo Hi"); + EXPECT_EQ(config.get_startup_apps()[0].command, "miracle-wm-unsnap echo Hi"); EXPECT_EQ(config.get_startup_apps()[0].restart_on_death, true); }