Add method to determine window manager
This commit is contained in:
parent
f6e113c0b6
commit
4acf36c97b
|
@ -39,12 +39,14 @@ from distutils.version import LooseVersion as V
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
import nbxmpp
|
import nbxmpp
|
||||||
|
from gi.repository import Gdk
|
||||||
|
|
||||||
import gajim
|
import gajim
|
||||||
from gajim.common import config as c_config
|
from gajim.common import config as c_config
|
||||||
from gajim.common import configpaths
|
from gajim.common import configpaths
|
||||||
from gajim.common import ged as ged_module
|
from gajim.common import ged as ged_module
|
||||||
from gajim.common.i18n import LANG
|
from gajim.common.i18n import LANG
|
||||||
|
from gajim.common.const import Display
|
||||||
from gajim.common.contacts import LegacyContactsAPI
|
from gajim.common.contacts import LegacyContactsAPI
|
||||||
from gajim.common.events import Events
|
from gajim.common.events import Events
|
||||||
from gajim.common.types import NetworkEventsControllerT # pylint: disable=unused-import
|
from gajim.common.types import NetworkEventsControllerT # pylint: disable=unused-import
|
||||||
|
@ -212,6 +214,18 @@ def is_installed(dependency):
|
||||||
def is_flatpak():
|
def is_flatpak():
|
||||||
return gajim.IS_FLATPAK
|
return gajim.IS_FLATPAK
|
||||||
|
|
||||||
|
def is_display(display):
|
||||||
|
# XWayland reports as Display X11, so try with env var
|
||||||
|
is_wayland = os.environ.get('XDG_SESSION_TYPE') == 'wayland'
|
||||||
|
if is_wayland and display == Display.WAYLAND:
|
||||||
|
return True
|
||||||
|
|
||||||
|
default = Gdk.Display.get_default()
|
||||||
|
if default is None:
|
||||||
|
log('gajim').warning('Could not determine window manager')
|
||||||
|
return False
|
||||||
|
return default.__class__.__name__ == display.value
|
||||||
|
|
||||||
def disable_dependency(dependency):
|
def disable_dependency(dependency):
|
||||||
_dependencies[dependency] = False
|
_dependencies[dependency] = False
|
||||||
|
|
||||||
|
|
|
@ -199,6 +199,7 @@ class MUCUser(IntEnum):
|
||||||
AFFILIATION = 3
|
AFFILIATION = 3
|
||||||
AFFILIATION_TEXT = 4
|
AFFILIATION_TEXT = 4
|
||||||
|
|
||||||
|
|
||||||
@unique
|
@unique
|
||||||
class Trust(IntEnum):
|
class Trust(IntEnum):
|
||||||
UNTRUSTED = 0
|
UNTRUSTED = 0
|
||||||
|
@ -206,6 +207,14 @@ class Trust(IntEnum):
|
||||||
BLIND = 2
|
BLIND = 2
|
||||||
VERIFIED = 3
|
VERIFIED = 3
|
||||||
|
|
||||||
|
|
||||||
|
class Display(Enum):
|
||||||
|
X11 = 'X11Display'
|
||||||
|
WAYLAND = 'GdkWaylandDisplay'
|
||||||
|
WIN32 = 'GdkWin32Display'
|
||||||
|
QUARTZ = 'GdkQuartzDisplay'
|
||||||
|
|
||||||
|
|
||||||
EME_MESSAGES = {
|
EME_MESSAGES = {
|
||||||
'urn:xmpp:otr:0':
|
'urn:xmpp:otr:0':
|
||||||
_('This message was encrypted with OTR '
|
_('This message was encrypted with OTR '
|
||||||
|
|
Loading…
Reference in New Issue