summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sway/tree/view.h1
-rw-r--r--shell.nix25
-rw-r--r--sway/tree/view.c27
3 files changed, 53 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 008361f7..ee34af48 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -102,6 +102,7 @@ struct sway_view {
struct wl_listener foreign_fullscreen_request;
struct wl_listener foreign_close_request;
struct wl_listener foreign_destroy;
+ struct wl_listener foreign_minimize;
bool destroying;
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 00000000..4ccc1cb9
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,25 @@
+let
+ unstableTarball = fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
+ pkgs = import <nixpkgs> {};
+ unstable = import unstableTarball {};
+
+ shell = pkgs.mkShell {
+ depsBuildBuild = with unstable; [
+ pkg-config
+ ];
+
+ nativeBuildInputs = with unstable; [
+ cmake meson ninja pkg-config wayland-scanner scdoc
+ ];
+
+ buildInputs = with unstable; [
+ wayland libxkbcommon pcre json_c libevdev
+ pango cairo libinput libcap pam gdk-pixbuf librsvg
+ wayland-protocols libdrm wlroots dbus xwayland
+
+ # wlroots
+ libGL pixman xorg.xcbutilwm xorg.libX11 libcap xorg.xcbutilimage xorg.xcbutilerrors mesa
+ libpng ffmpeg xorg.xcbutilrenderutil seatd
+ ];
+ };
+in shell
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 1318f5fb..8b7061ba 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -688,6 +688,29 @@ static void handle_foreign_fullscreen_request(
transaction_commit_dirty();
}
+static void handle_foreign_minimize(
+ struct wl_listener *listener, void *data) {
+ struct sway_view *view = wl_container_of(
+ listener, view, foreign_minimize);
+ struct wlr_foreign_toplevel_handle_v1_minimized_event *event = data;
+ struct sway_container *container = view->container;
+ if (!container->pending.workspace) {
+ while (container->pending.parent) {
+ container = container->pending.parent;
+ }
+ }
+ if(event->minimized) {
+ if (!container->scratchpad) {
+ root_scratchpad_add_container(container, NULL);
+ } else if (container->pending.workspace) {
+ root_scratchpad_hide(container);
+ }
+ } else {
+ if(container->scratchpad)
+ root_scratchpad_show(container);
+ }
+}
+
static void handle_foreign_close_request(
struct wl_listener *listener, void *data) {
struct sway_view *view = wl_container_of(
@@ -767,6 +790,10 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
view->foreign_destroy.notify = handle_foreign_destroy;
wl_signal_add(&view->foreign_toplevel->events.destroy,
&view->foreign_destroy);
+ view->foreign_minimize.notify = handle_foreign_minimize;
+ wl_signal_add(&view->foreign_toplevel->events.request_minimize,
+ &view->foreign_minimize);
+
struct sway_container *container = view->container;
if (target_sibling) {