Class: Depot::DesktopEntry
- Inherits:
-
Object
- Object
- Depot::DesktopEntry
- Defined in:
- lib/depot/desktop_entry.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#exec_path ⇒ Object
readonly
Returns the value of attribute exec_path.
-
#icon_name ⇒ Object
readonly
Returns the value of attribute icon_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(app_id:, name:, exec_path:, icon_name: nil) ⇒ DesktopEntry
constructor
A new instance of DesktopEntry.
Constructor Details
#initialize(app_id:, name:, exec_path:, icon_name: nil) ⇒ DesktopEntry
Returns a new instance of DesktopEntry.
9 10 11 12 13 14 |
# File 'lib/depot/desktop_entry.rb', line 9 def initialize(app_id:, name:, exec_path:, icon_name: nil) @app_id = app_id @name = name @exec_path = exec_path @icon_name = icon_name end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
7 8 9 |
# File 'lib/depot/desktop_entry.rb', line 7 def app_id @app_id end |
#exec_path ⇒ Object (readonly)
Returns the value of attribute exec_path.
7 8 9 |
# File 'lib/depot/desktop_entry.rb', line 7 def exec_path @exec_path end |
#icon_name ⇒ Object (readonly)
Returns the value of attribute icon_name.
7 8 9 |
# File 'lib/depot/desktop_entry.rb', line 7 def icon_name @icon_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/depot/desktop_entry.rb', line 7 def name @name end |
Instance Method Details
#contents ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/depot/desktop_entry.rb', line 16 def contents lines = [ "[Desktop Entry]", "Type=Application", "Version=1.0", "Name=#{escape(name)}", "Exec=#{Util.desktop_exec_quote(exec_path)}", "Terminal=false", "Categories=Utility;", "X-Depot-AppID=#{escape(app_id)}" ] lines << "Icon=#{escape(icon_name)}" if icon_name && !icon_name.empty? lines.join("\n") + "\n" end |