Module: Fusuma::Plugin::Appmatcher

Defined in:
lib/fusuma/plugin/appmatcher.rb,
lib/fusuma/plugin/appmatcher/x11.rb,
lib/fusuma/plugin/appmatcher/gnome.rb,
lib/fusuma/plugin/appmatcher/version.rb,
lib/fusuma/plugin/appmatcher/user_switcher.rb,
lib/fusuma/plugin/appmatcher/gnome_extension.rb,
lib/fusuma/plugin/appmatcher/gnome_extensions/installer.rb

Overview

Detect focused applications.

Defined Under Namespace

Modules: GnomeExtensions Classes: Gnome, GnomeExtension, UserSwitcher, X11

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.backend_klassClass

Returns:

  • (Class)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fusuma/plugin/appmatcher.rb', line 17

def backend_klass
  case xdg_session_type
  when /x11/
    return X11
  when /wayland/
    case xdg_current_desktop
    when /GNOME/
      return GnomeExtension if GnomeExtensions::Installer.new.installed?

      return Gnome
    end
  end

  error_message_not_supported
  exit 1
end

.error_message_not_supportedObject



42
43
44
45
46
47
48
49
50
# File 'lib/fusuma/plugin/appmatcher.rb', line 42

def error_message_not_supported
  MultiLogger.error(
    "      appmatcher doesn't support\n      XDG_CURRENT_DESKTOP: '\#{xdg_current_desktop}'\n      XDG_SESSION_TYPE: '\#{xdg_session_type}'\"\n    ERROR\n  )\nend\n"

.xdg_current_desktopObject



38
39
40
# File 'lib/fusuma/plugin/appmatcher.rb', line 38

def xdg_current_desktop
  ENV.fetch("XDG_CURRENT_DESKTOP", "")
end

.xdg_session_typeObject



34
35
36
# File 'lib/fusuma/plugin/appmatcher.rb', line 34

def xdg_session_type
  ENV.fetch("XDG_SESSION_TYPE", "")
end