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

Overview

Detect focused applications.

Defined Under Namespace

Classes: Gnome, UserSwitcher, X11

Constant Summary collapse

VERSION =
'0.1.6'

Class Method Summary collapse

Class Method Details

.backend_klassClass

Returns:

  • (Class)


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

def backend_klass
  case xdg_session_type
  when /x11/
    return X11
  when /wayland/
    return Gnome if xdg_current_desktop =~ /GNOME/
  end
  MultiLogger.error(
    <<~ERROR
      appmatcher doesn't support
      XDG_CURRENT_DESKTOP: '#{xdg_current_desktop}'
      XDG_SESSION_TYPE: '#{xdg_session_type}'"
    ERROR
  )
  exit 1
end

.xdg_current_desktopObject



36
37
38
# File 'lib/fusuma/plugin/appmatcher.rb', line 36

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

.xdg_session_typeObject



32
33
34
# File 'lib/fusuma/plugin/appmatcher.rb', line 32

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