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/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 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) { 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); }