Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android-studio: fixing gui on tiling window managers #168391

Merged

Conversation

danielbarter
Copy link
Contributor

@danielbarter danielbarter commented Apr 12, 2022

Description of changes

On tiling window managers like sway, we need to set _JAVA_AWT_WM_NONREPARENTING=1 in the android-studio wrapper for the gui to launch correctly as described here: https://github.com/swaywm/sway/wiki#issues-with-java-applications

Things done

Added an extra argument to the android-studio derivation that lets us set the environment variable in the android-studio wrapper. After change on swaywm

{ pkgs ? import /home/danielbarter/nixpkgs {} }:

with pkgs; mkShell {
  buildInputs =  [
    (android-studio.override { tiling_wm = true;})
  ];
}

provides a working android studio.

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

Copy link
Member

@fabianhjr fabianhjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, no test since I don't use sway or other tiling wm.

@@ -80,6 +81,7 @@ let
--set-default JAVA_HOME "$out/jre" \
--set ANDROID_EMULATOR_USE_SYSTEM_LIBS 1 \
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
${if tiling_wm then "--set _JAVA_AWT_WM_NONREPARENTING 1" else ""} \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern is if this is the right way to do this. Seems a little messy

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not done this conditionals but another way would be to add it at the end as an optional.

Examples from nixpkgs:

57-  ''
58:   + (lib.optionalString (lisp-compiler.pname == "ecl") ''
59-     cp src/binary-ecl/maxima.fas* "$out/lib/maxima/${version}/binary-ecl/"
60-   '')
64:  ) ++ lib.optional enableCuda "-DGMX_GPU=CUDA";
39-    "--with-gmp=${lib.getDev gmp}"
40-    "--with-readline=${lib.getDev readline}"
41-  ]
42:  ++ lib.optional stdenv.isDarwin "--host=x86_64-darwin"
43:  ++ lib.optional withThread "--mt=pthread";

Though, not really sure about best practices so can't help much more than pointing some of this examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah, that is a little nicer.

@@ -80,6 +81,7 @@ let
--set-default JAVA_HOME "$out/jre" \
--set ANDROID_EMULATOR_USE_SYSTEM_LIBS 1 \
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
${lib.optionalString tiling_wm "--set _JAVA_AWT_WM_NONREPARENTING 1"} \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fabianhjr
Copy link
Member

@ofborg eval

@fabianhjr fabianhjr self-requested a review April 12, 2022 20:35
Copy link
Member

@fabianhjr fabianhjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 packages built:
android-studio androidStudioPackages.beta androidStudioPackages.canary androidStudioPackages.dev

LGTM, evals and builds though ofborg had an issue. Could someone rerun the ofborg eval?

@ofborg ofborg bot requested a review from fabianhjr April 12, 2022 21:34
@danielbarter
Copy link
Contributor Author

When i first opened the PR, github was having some issues i think which is where the borg error came from. Once i rebased, the checks ran normally

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/842

@SuperSandro2000 SuperSandro2000 merged commit 4f68abc into NixOS:master May 4, 2022
@fabianhjr fabianhjr removed the request for review from kevincox May 4, 2022 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants