lib/launchy/detect/nix_desktop_environment.rb in launchy-2.3.0 vs lib/launchy/detect/nix_desktop_environment.rb in launchy-2.4.0

- old
+ new

@@ -20,10 +20,14 @@ def self.fallback_browsers %w[ firefox seamonkey opera mozilla netscape galeon ] end + def self.browsers + [ browser, fallback_browsers ].flatten + end + #--------------------------------------- # The list of known desktop environments #--------------------------------------- class Kde < NixDesktopEnvironment @@ -58,17 +62,30 @@ def self.browser 'exo-open' end end - class Fluxbox < NixDesktopEnvironment + # Fall back environment as the last case + class Xdg < NixDesktopEnvironment def self.is_current_desktop_environment? - ENV['DESKTOP_SESSION'] == 'fluxbox' + Launchy::Application.find_executable( browser ) end def self.browser 'xdg-open' end end + + # The one that is found when all else fails. And this must be declared last + class NotFound < NixDesktopEnvironment + def self.is_current_desktop_environment? + true + end + + def self.browser + [] + end + end + end end