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

Change query_runfile (View) to use xdg-open by default #209

Merged
merged 1 commit into from
Oct 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions etc/cfg_bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ defbindings("WMPlex.toplevel", {

bdoc("Query for file to edit.", "edit"),
kpress(META.."F5",
"mod_query.query_editfile(_, 'run-mailcap --action=edit')"),
"mod_query.query_editfile(_, EDIT_COMMAND or 'run-mailcap --action=edit')"),

bdoc("Query for file to view.", "view"),
kpress(META.."F6",
"mod_query.query_runfile(_, 'run-mailcap --action=view')"),
"mod_query.query_runfile(_, VIEW_COMMAND or 'xdg-open')"),

bdoc("Query for keybinding.", "qkb"),
kpress(META.."F7",
Expand Down
4 changes: 4 additions & 0 deletions etc/cfg_notion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

-- Terminal emulator.
--XTERM="xterm"
-- Edit file command, mod_query.query_editfile
--EDIT_COMMAND="run-mailcap --action=edit"
-- View file command, mod_query.query_viewfile
--VIEW_COMMAND="xdg-open"
wilhelmy marked this conversation as resolved.
Show resolved Hide resolved

-- Some basic settings.
ioncore.set{
Expand Down
4 changes: 2 additions & 2 deletions mod_query/mod_query.lua
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,12 @@ end

--DOC
-- Asks for a file to be viewed. This script uses
-- \command{run-mailcap --action=view} by default, but you may provide an
-- \command{xdg-open} by default, but you may provide an
-- alternative script to use. The default prompt is "View file:" (translated).
function mod_query.query_runfile(mplex, script, prompt)
mod_query.query_execfile(mplex,
prompt or TR("View file:"),
script or "run-mailcap --action=view")
script or "xdg-open")
Copy link
Collaborator

Choose a reason for hiding this comment

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

… and if VIEW_COMMAND is global, it can theoretically be used here. Not sure that's clean design, though, and whether or not it should be global. Any opinions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about it but I saw mod_dock as a separate module and didn't want to "trust" that those variables are defined. Let me know if you think these should point to those vars.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we decide to go with the "cmds" approach mentioned above, I think (cmds and cmds.VIEW) or "xdg-open" should work around the value being nil


end

Expand Down