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

[REQUEST] Follow Type=Link standard desktop entries with drun #1166

Closed
jsamr opened this issue Aug 24, 2020 · 4 comments
Closed

[REQUEST] Follow Type=Link standard desktop entries with drun #1166

jsamr opened this issue Aug 24, 2020 · 4 comments
Milestone

Comments

@jsamr
Copy link

jsamr commented Aug 24, 2020

Describe the feature
As per version 1.5 of the Desktop Entry Specification, an entry can be of Type=Link to point to a resource, but rofi (1.5.4-2, archlinux) doesn't display such entries when running rofi -show drun.

Example of such entry:

[Desktop Entry]
Name=Plex Server Console
Icon=plex-icon
Type=Link
URL=http://localhost:32400/web

When reporting a feature request include the following information:

  • Rofi version:
    • 1.5.4
@flavorjones
Copy link
Contributor

@DaveDavenport would you be open to a PR introducing this behavior?

@DaveDavenport
Copy link
Collaborator

Yes. I guess best is to launch URL with xdg-open util.

flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 25, 2020
From the [freedesktop spec][1]:

> This specification defines 3 types of desktop entries:
> Application (type 1), Link (type 2) and Directory (type 3). To allow
> the addition of new types in the future, implementations should
> ignore desktop entries with an unknown type.

This commit adds an enum to capture these types, and adds `type` to
DRunModeEntry.

  [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 25, 2020
Note that we're introducing some logic that will differ depending on
the Desktop entry type (Application or Link). The logic is:

- if entry is Application type,
  - then Exec is required
  - and the value is saved in .exec
  - and drun_mode_result calls exec_cmd_entry
- if entry is Link type,
  - then URL is required (but is not saved in the DRunModeEntry)
  - and drun_mode_result calls new function launch_link_entry

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 25, 2020
Note that this introduces a new dependency on xdg-open, which may not
be installed. In that case, rofi will display an error dialog
with something like:

  "Failed to execute child process xdg-open (No such file or directory)"

which hopefully is explanatory enough for folks.

part of davatorium#1166
@flavorjones
Copy link
Contributor

I've opened #1168 with a proposed implementation for this.

@DaveDavenport DaveDavenport added this to the 1.7 milestone Aug 25, 2020
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
In previous commit, this was a hard-coded string.

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
In previous commit, this was a hard-coded string.

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
Note that we're introducing some logic that will differ depending on
the Desktop entry type (Application or Link). The logic is:

- if entry is Application type,
  - then Exec is required
  - and the value is saved in .exec
  - and drun_mode_result calls exec_cmd_entry
- if entry is Link type,
  - then URL is required (but is not saved in the DRunModeEntry)
  - and drun_mode_result calls new function launch_link_entry

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
Note that this introduces a new dependency on xdg-open, which may not
be installed. In that case, rofi will display an error dialog
with something like:

  "Failed to execute child process xdg-open (No such file or directory)"

which hopefully is explanatory enough for folks.

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
In previous commit, this was a hard-coded string.

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
Note that we're introducing some logic that will differ depending on
the Desktop entry type (Application or Link). The logic is:

- if entry is Application type,
  - then Exec is required
  - and the value is saved in .exec
  - and drun_mode_result calls exec_cmd_entry
- if entry is Link type,
  - then URL is required (but is not saved in the DRunModeEntry)
  - and drun_mode_result calls new function launch_link_entry

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
Note that this introduces a new dependency on xdg-open, which may not
be installed. In that case, rofi will display an error dialog
with something like:

  "Failed to execute child process xdg-open (No such file or directory)"

which hopefully is explanatory enough for folks.

part of davatorium#1166
flavorjones added a commit to flavorjones/rofi that referenced this issue Aug 26, 2020
In previous commit, this was a hard-coded string.

part of davatorium#1166
DaveDavenport pushed a commit that referenced this issue Aug 26, 2020
* [DRun] Introduce data structure changes for Link desktop entries

From the [freedesktop spec][1]:

> This specification defines 3 types of desktop entries:
> Application (type 1), Link (type 2) and Directory (type 3). To allow
> the addition of new types in the future, implementations should
> ignore desktop entries with an unknown type.

This commit adds an enum to capture these types, and adds `type` to
DRunModeEntry.

  [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

part of #1166

* [DRun] Sanity check Link entries and capture the URL

Note that we're introducing some logic that will differ depending on
the Desktop entry type (Application or Link). The logic is:

- if entry is Application type,
  - then Exec is required
  - and the value is saved in .exec
  - and drun_mode_result calls exec_cmd_entry
- if entry is Link type,
  - then URL is required (but is not saved in the DRunModeEntry)
  - and drun_mode_result calls new function launch_link_entry

part of #1166

* [DRun] Launch desktop links via xdg-open

Note that this introduces a new dependency on xdg-open, which may not
be installed. In that case, rofi will display an error dialog
with something like:

  "Failed to execute child process xdg-open (No such file or directory)"

which hopefully is explanatory enough for folks.

part of #1166

* Make drun options comments consistent and add a bit of whitespace

* [DRun] new config option drun-url-launcher for opening links

In previous commit, this was a hard-coded string.

part of #1166
@DaveDavenport DaveDavenport modified the milestones: 1.7, 1.6 Aug 26, 2020
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants