Skip to content

Instantly share code, notes, and snippets.

@c80609a

c80609a/0_HOW.md

Created Mar 22, 2019
Embed
What would you like to do?
xdg-mime, Ubuntu 18.04, RubyMine-2018.2, Gnome, BetterErrors

Make files, do chmod +x, modify existing files; RubyMine -> tools -> create command line launcher.

Execute:

xdg-mime default rubymine.desktop x-scheme-handler/rubymine

Check output:

xdg-mime query default x-scheme-handler/rubymine
# /home/scout/git/get-the-boat/config/initializers/better_errors.rb
if defined?(BetterErrors)
BetterErrors.editor = "rubymine://open?file=%{file}&line=%{line}" # same same as into /home/scout/.local/bin/mine-open.sh
end
#!/usr/bin/env ruby
#encoding: UTF-8
# /home/scout/.local/bin/mine-open.sh
#script opens URL in format `rubymine://open?file=%{file}&line=%{line}` in RubyMine
require 'uri'
url = ARGV.first
/file=(?<file>.+)&line=(?<line>\d+)/ =~ url # same same as into initializers/better_errors.rb
file_arg = URI.unescape(file)
line_arg = line ? ":#{line}" : ""
cmd = "mine #{file_arg}#{line_arg}"
`#{cmd}`
# ~/.local/share/applications/
[MIME Cache]
x-scheme-handler/rubymine=rubymine.desktop;
# ~/.local/share/applications/rubymine.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/home/scout/.local/bin/mine-open.sh %u
MimeType=x-scheme-handler/rubymine;
Name=Rubymine
Comment=BetterErrors
@c80609a

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.