diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..3aacb98 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,16 @@ +name: macOS + +on: [push] + +jobs: + build: + name: Build + runs-on: macOS-latest + steps: + - uses: actions/checkout@v1 + + - name: Fetch dependencies + run: go get -d ./... + + - name: Build + run: go build diff --git a/default.nix b/default.nix index 1459660..ab9a87c 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,7 @@ { pkgs ? import {}, ... }: let - virt-manager-without-menu = pkgs.virt-viewer.overrideAttrs (oldAttrs: { - patches = oldAttrs.patches ++ [ + virt-manager-without-menu = pkgs.virt-viewer.overrideAttrs(x: { + patches = [ ./patches/0001-Remove-menu-bar.patch ./patches/0002-Do-not-grab-keyboard-mouse.patch ./patches/0003-Use-name-of-appvm-applications-as-a-title.patch @@ -18,7 +18,7 @@ buildGoModule rec { src = ./.; - vendorHash = "sha256-8eU+Mf5dxL/bAMMShXvj8I1Kdd4ysBTWvgYIXwLStPI="; + vendorSha256 = "sha256-8eU+Mf5dxL/bAMMShXvj8I1Kdd4ysBTWvgYIXwLStPI="; postFixup = '' wrapProgram $out/bin/appvm \ diff --git a/docs/installation.rst b/docs/installation.rst index 4073d36..8dfa5dd 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -4,11 +4,21 @@ Installation NixOS ----- +First, clone this repo. Then do this: + +/etc/nixos/configuration.nix:: + + imports = [ + /path/to/repo/nixos + ]; + virtualisation.appvm = { enable = true; user = "${username}"; }; +This is a temporary solution until appvm is upstreamed to nixpkgs or Nix flakes are released. + Ubuntu 20.04 ------ diff --git a/patches/0001-Remove-menu-bar.patch b/patches/0001-Remove-menu-bar.patch index 5a15686..20a0b8c 100644 --- a/patches/0001-Remove-menu-bar.patch +++ b/patches/0001-Remove-menu-bar.patch @@ -1,12 +1,25 @@ +From c26580442a4ac18f805b1795ec250d6cf5857a49 Mon Sep 17 00:00:00 2001 +From: Mikhail Klementev +Date: Wed, 22 Jan 2020 00:25:16 +0000 +Subject: [PATCH 1/4] Remove menu bar + +--- + src/resources/ui/virt-viewer.ui | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + diff --git a/src/resources/ui/virt-viewer.ui b/src/resources/ui/virt-viewer.ui -index 430f879..68856fc 100644 +index 93471a4..b029ad7 100644 --- a/src/resources/ui/virt-viewer.ui +++ b/src/resources/ui/virt-viewer.ui -@@ -137,7 +137,6 @@ - - - -- True - False - True - +@@ -18,7 +18,7 @@ + False + + +- True ++ False + False + + +-- +2.23.1 + diff --git a/patches/0002-Do-not-grab-keyboard-mouse.patch b/patches/0002-Do-not-grab-keyboard-mouse.patch index 012c37b..cec5b31 100644 --- a/patches/0002-Do-not-grab-keyboard-mouse.patch +++ b/patches/0002-Do-not-grab-keyboard-mouse.patch @@ -1,11 +1,20 @@ +From eac430d01f486e15b55d6fa992e77ded77bb4b1a Mon Sep 17 00:00:00 2001 +From: Mikhail Klementev +Date: Wed, 22 Jan 2020 00:41:34 +0000 +Subject: [PATCH 2/4] Do not grab keyboard/mouse + +--- + src/virt-viewer-display-spice.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c -index 2265f02..1d60d81 100644 +index 311178b..8e68de2 100644 --- a/src/virt-viewer-display-spice.c +++ b/src/virt-viewer-display-spice.c -@@ -317,8 +317,8 @@ virt_viewer_display_spice_new(VirtViewerSessionSpice *session, - gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(self->display)); - gtk_widget_show(GTK_WIDGET(self->display)); - g_object_set(self->display, +@@ -307,8 +307,8 @@ virt_viewer_display_spice_new(VirtViewerSessionSpice *session, + gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(self->priv->display)); + gtk_widget_show(GTK_WIDGET(self->priv->display)); + g_object_set(self->priv->display, - "grab-keyboard", TRUE, - "grab-mouse", TRUE, + "grab-keyboard", FALSE, @@ -13,3 +22,6 @@ index 2265f02..1d60d81 100644 "resize-guest", FALSE, "scaling", TRUE, NULL); +-- +2.23.1 + diff --git a/patches/0003-Use-name-of-appvm-applications-as-a-title.patch b/patches/0003-Use-name-of-appvm-applications-as-a-title.patch index 51a47bb..44c7d05 100644 --- a/patches/0003-Use-name-of-appvm-applications-as-a-title.patch +++ b/patches/0003-Use-name-of-appvm-applications-as-a-title.patch @@ -1,14 +1,26 @@ +From c5b51c0a540af34499f2b2a49cb64599c06ba293 Mon Sep 17 00:00:00 2001 +From: Mikhail Klementev +Date: Wed, 22 Jan 2020 01:24:57 +0000 +Subject: [PATCH 3/4] Use name of appvm applications as a title + +--- + src/virt-viewer-window.c | 3 +++ + 1 file changed, 3 insertions(+) + diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c -index fe740ce..d45fd4f 100644 +index 4c08423..cc8a440 100644 --- a/src/virt-viewer-window.c +++ b/src/virt-viewer-window.c -@@ -1342,6 +1342,9 @@ virt_viewer_window_update_title(VirtViewerWindow *self) - grabhint, - g_get_application_name()); - } -+ } else if (g_str_has_prefix(self->subtitle, "appvm_")) { +@@ -1362,6 +1362,9 @@ virt_viewer_window_update_title(VirtViewerWindow *self) + + if (!ungrab && !priv->subtitle) + title = g_strdup(g_get_application_name()); ++ else if (g_str_has_prefix(priv->subtitle, "appvm_")) + /* Use name of the application as a title */ -+ title = g_strdup_printf(_("%s"), &self->subtitle[strlen("appvm_")]); - } else if (self->subtitle) { ++ title = g_strdup_printf(_("%s"), &priv->subtitle[strlen("appvm_")]); + else /* translators: - * This is " - " + * This is " - " +-- +2.23.1 + diff --git a/patches/0004-Use-title-application-name-as-subtitle.patch b/patches/0004-Use-title-application-name-as-subtitle.patch index 3c51786..05219c1 100644 --- a/patches/0004-Use-title-application-name-as-subtitle.patch +++ b/patches/0004-Use-title-application-name-as-subtitle.patch @@ -1,12 +1,44 @@ +From 8e95408365b57c64a738381d132ecdc844013afb Mon Sep 17 00:00:00 2001 +From: Mikhail Klementev +Date: Wed, 22 Jan 2020 02:27:26 +0000 +Subject: [PATCH 4/4] Use title (application name) as subtitle + +--- + src/virt-viewer-app.c | 21 ++------------------- + 1 file changed, 2 insertions(+), 19 deletions(-) + diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c -index b977b7b..36bce34 100644 +index 343b1af..8267f82 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c -@@ -976,6 +976,7 @@ virt_viewer_app_set_window_subtitle(VirtViewerApp *app, - *d = '%'; - } else - subtitle = g_strdup_printf("%s (%s)", title, desc); -+ subtitle = g_strdup_printf("%s", title); - g_free(desc); - } +@@ -718,25 +718,8 @@ virt_viewer_app_set_window_subtitle(VirtViewerApp *app, + gchar *subtitle = NULL; + const gchar *title = virt_viewer_app_get_title(app); +- if (title != NULL) { +- VirtViewerDisplay *display = virt_viewer_window_get_display(window); +- gchar *d = strstr(title, "%d"); +- gchar *desc = NULL; +- +- if (display && VIRT_VIEWER_IS_DISPLAY_VTE(display)) { +- g_object_get(display, "name", &desc, NULL); +- } else { +- desc = g_strdup_printf("%d", nth + 1); +- } +- +- if (d != NULL) { +- *d = '\0'; +- subtitle = g_strdup_printf("%s%s%s", title, desc, d + 2); +- *d = '%'; +- } else +- subtitle = g_strdup_printf("%s (%s)", title, desc); +- g_free(desc); +- } ++ if (title != NULL) ++ subtitle = g_strdup_printf("%s", title); + + g_object_set(window, "subtitle", subtitle, NULL); + g_free(subtitle); +-- +2.23.1 + diff --git a/shell.nix b/shell.nix index c25b0e3..39c8cc8 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ { pkgs ? import {} }: with pkgs; mkShell { - buildInputs = [ go virt-viewer virt-manager ]; + buildInputs = [ go gocode virt-viewer virtmanager ]; }