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

rofi: NixOS drun desktop entry paths fixed #92264

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SCOTT-HAMILTON
Copy link
Contributor

Motivation for this change

rofi didn't show any entry with drun modi.

Things done

Patched it to fetch the /run/current-system/sw/share/applications and ~/.nix-profile/share/applications desktop entries.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@symphorien
Copy link
Member

I don't think you should remove searching to $XDG_DATA_DIRS/applications. The patch should make rofi look additionally to the profile. Also maybe it's better to use $XDG_CONFIG_HOME to find the profile, but I'm not a xdg specialist.

@SCOTT-HAMILTON
Copy link
Contributor Author

Got back the $XDG_DATA_DIRS/applications, now walking threw all NIX_PROFILES with /share/applications suffix

@symphorien
Copy link
Member

It does work to find desktop files, but not their icons.

@SCOTT-HAMILTON
Copy link
Contributor Author

Now icons from <nix_every_profile>/share/icons> are fetched. Should work for most icons.

@SCOTT-HAMILTON
Copy link
Contributor Author

Added <nix_every_profile>/share/pixmaps> (to make it work with discord and maybe other apps).

@symphorien
Copy link
Member

That's a large patch. What about adding a wrapper which add $NIX_PROFILES to $XDG_DATA_DIRS instead ?
with proper bash-fu it takes one line to pass to wrapProgram with --run

@SCOTT-HAMILTON
Copy link
Contributor Author

Replaced the big patch with wrapProgram and substituteInPlace.

@stale
Copy link

stale bot commented Jan 1, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 1, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 18, 2021
@stale
Copy link

stale bot commented Jul 19, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 19, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 29, 2021
@ofborg ofborg bot requested a review from bew December 30, 2021 04:20
Copy link
Contributor

@bew bew left a comment

Choose a reason for hiding this comment

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

I don't think XDG_DATA_DIRS must be patched at package level, but should be solved at OS level (or HomeManager-level on non-NixOS), because it's not only rofi that has a problem with data dirs, but potentially all graphical apps (that use icons, fonts, ...).

@@ -58,13 +59,18 @@ stdenv.mkDerivation rec {
which
];

postInstall = ''
wrapProgram $out/bin/rofi \
--run 'export XDG_DATA_DIRS="$(sed "s| |/share:|g" < <(echo $NIX_PROFILES))/share:$XDG_DATA_DIRS"'
Copy link
Contributor

@bew bew May 16, 2022

Choose a reason for hiding this comment

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

What do you expect to have in $NIX_PROFILES from inside the build sandbox ?
Will it work in all cases? (NixOS, non-NixOS, ...)

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 12, 2022
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank marked this pull request as draft March 25, 2024 16:18
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