Module: Fusuma::Plugin::Appmatcher
- Defined in:
- lib/fusuma/plugin/appmatcher.rb,
lib/fusuma/plugin/appmatcher/x11.rb,
lib/fusuma/plugin/appmatcher/cosmic.rb,
lib/fusuma/plugin/appmatcher/version.rb,
lib/fusuma/plugin/appmatcher/hyprland.rb,
lib/fusuma/plugin/appmatcher/user_switcher.rb,
lib/fusuma/plugin/appmatcher/gnome_extension.rb,
lib/fusuma/plugin/appmatcher/unsupported_backend.rb,
lib/fusuma/plugin/appmatcher/gnome_extensions/installer.rb
Overview
Detect focused applications.
Defined Under Namespace
Modules: GnomeExtensions, UserSwitcher
Classes: Cosmic, GnomeExtension, Hyprland, UnsupportedBackend, X11
Constant Summary
collapse
- VERSION =
"0.12.0"
Class Method Summary
collapse
Class Method Details
.backend_klass ⇒ Class
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/fusuma/plugin/appmatcher.rb', line 19
def backend_klass
case xdg_session_type
when /x11/
return X11
when /wayland/
case xdg_current_desktop
when /GNOME/
if GnomeExtensions::Installer.new.enabled?
return GnomeExtension
else
MultiLogger.warn "Appmatcher Gnome Shell Extension is NOT enabled"
MultiLogger.warn "Please enable it by running the following command:"
MultiLogger.warn ""
MultiLogger.warn "$ fusuma-appmatcher --install-gnome-extension"
MultiLogger.warn ""
end
when /Hyprland/i
return Hyprland if hyprland_available?
when /COSMIC/i
if Cosmic.available?
return Cosmic
else
MultiLogger.warn "cos-cli command not found"
MultiLogger.warn "Please install cos-cli to use appmatcher with COSMIC desktop:"
MultiLogger.warn ""
MultiLogger.warn " $ cargo install --git https://github.com/estin/cos-cli"
MultiLogger.warn ""
end
end
end
MultiLogger.warn "appmatcher doesn't support"
UnsupportedBackend
end
|
.hyprland_available? ⇒ Boolean
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/fusuma/plugin/appmatcher.rb', line 62
def hyprland_available?
instance_sig = ENV["HYPRLAND_INSTANCE_SIGNATURE"]
return false unless instance_sig
xdg_runtime = ENV.fetch("XDG_RUNTIME_DIR", "/tmp")
[
File.join(xdg_runtime, "hypr", instance_sig, ".socket2.sock"),
File.join("/tmp", "hypr", instance_sig, ".socket2.sock")
].any? { |p| File.exist?(p) }
end
|
.xdg_current_desktop ⇒ Object
58
59
60
|
# File 'lib/fusuma/plugin/appmatcher.rb', line 58
def xdg_current_desktop
ENV.fetch("ORIGINAL_XDG_CURRENT_DESKTOP", ENV.fetch("XDG_CURRENT_DESKTOP", ""))
end
|
.xdg_session_type ⇒ Object
54
55
56
|
# File 'lib/fusuma/plugin/appmatcher.rb', line 54
def xdg_session_type
ENV.fetch("XDG_SESSION_TYPE", "")
end
|