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

VSCode opens empty file when using PCManFM #104759

Closed
hoppla20 opened this issue Nov 24, 2020 · 1 comment · Fixed by #104763
Closed

VSCode opens empty file when using PCManFM #104759

hoppla20 opened this issue Nov 24, 2020 · 1 comment · Fixed by #104763

Comments

@hoppla20
Copy link
Contributor

Describe the bug
I'm using PCManFM as Filemanager and if I try to open a File with VSCode it only opens an empty file. (This issue is known: microsoft/vscode#25987). To fix this the issue recommends to change .../code %U to .../code %F in the desktop file.

To Reproduce
Steps to reproduce the behavior:

  1. Try to open a file in PCManFM with VSCode

Expected behavior
File is opened in VSCode

Screenshots
vscode-bug
In VSCode I manullly opened the file TEST on the left and tried to open it with PCManFM. As you can see, %U tells PCManFM to return a URL, but VSCode doesn't know what to do with it. So file:/tmp/test-vscode/TEST will be converted to ~file:/tmp/test-vscode/TEST.

Additional context
I'm not quite sure whether I'm the only one with this issue, I haven't seen any other issue explaining this same problem. But a friend of mine who I introduced to NixOS also had this Problem, so I'm probably not alone.

Notify maintainers

@eadwu
@Synthetica

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.4.77, NixOS, 21.03pre251971.a371c107116 (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.8
  • channels(root): "home-manager, nixos-21.03pre251971.a371c107116, nixos-20.03-20.03.3258.86fa45b0ff1"
  • channels(vincentcui): "home-manager, nixos-21.03pre249162.1dc37370c48"
  • nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixos modules affected by the problem
module:
- vscode
- vscodium
@hoppla20
Copy link
Contributor Author

I already tried to change

  desktopItem = makeDesktopItem {
      name = executableName;
      desktopName = longName;
      comment = "Code Editing. Redefined.";
      genericName = "Text Editor";
      exec = "${executableName} %F";
      icon = "code";
      startupNotify = "true";
      categories = "Utility;TextEditor;Development;IDE;";
      mimeType = "text/plain;inode/directory;";
      extraEntries = ''
        StartupWMClass=${shortName}
        Actions=new-empty-window;
        Keywords=vscode;

        [Desktop Action new-empty-window]
        Name=New Empty Window
        Exec=${executableName} --new-window %F
        Icon=code
      '';
    };

in pkgs/applications/editors/vscode/generic.nix to

  desktopItem = makeDesktopItem {
      name = executableName;
      desktopName = longName;
      comment = "Code Editing. Redefined.";
      genericName = "Text Editor";
      exec = "${executableName} %U";
      icon = "code";
      startupNotify = "true";
      categories = "Utility;TextEditor;Development;IDE;";
      mimeType = "text/plain;inode/directory;";
      extraEntries = ''
        StartupWMClass=${shortName}
        Actions=new-empty-window;
        Keywords=vscode;

        [Desktop Action new-empty-window]
        Name=New Empty Window
        Exec=${executableName} --new-window %F
        Icon=code
      '';
    };

(Notice the exec part in the desktop entry)

After I made this change and build it with nix-env -f $NIXPKGS -iA vscode (with NIXPKGS=) VSCode would open files from PCManFM without issue. I also haven't seen any other bugs created by this.

I'm quite new to Nix and this is also my first issue, it would be really nice if you could tell me if I could have done something different or better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant