Desktop files support in ${HOMEBREW_PREFIX}/share/applications
#3945
Unanswered
tranzystorekk
asked this question in
Linux
Replies: 3 comments 1 reply
|
They are not afaik. |
0 replies
|
Still relevant today. I think we can just manually create a Something like this I'm hoping..
class KittyCatApp < Formula
# ...
def install
# ...
install_desktop_entry
end
# And maybe also this depending on your Linux distro?
def post_install
system "update-desktop-database", "#{HOMEBREW_PREFIX}/share/applications" if which("update-desktop-database")
end
private
def install_desktop_entry
desktop_file = Dir[libexec/"*.desktop"].first
return unless desktop_file
entry = File.read(desktop_file)
entry.gsub!(/^Exec=.*/, "Exec=#{bin}/kittycatapp")
(share/"applications").mkpath
(share/"applications/kittycatapp.desktop").write entry
icon_name = entry[/^Icon=(.+)$/, 1]
return unless icon_name
Dir[libexec/"**/#{icon_name}.{png,svg}"].each do |icon_file|
size = icon_file[%r{/(\d+x\d+)/}, 1] || "512x512"
icon_dest = share/"icons/hicolor/#{size}/apps"
icon_dest.mkpath
icon_dest.install icon_file
end
end
end |
1 reply
|
I was looking into this today, and when trying to add |
0 replies
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 to comment
Uh oh!
There was an error while loading. Please reload this page.
Are desktop files installed by formulae somehow supported/documented in homebrew? I wanted to know if there's a trick to e.g. getting desktop shortcuts in any desktop environment.
All reactions