DesktopScope.kt 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package eu.mjdev.desktop.provider
  2. import androidx.compose.runtime.Composable
  3. import eu.mjdev.desktop.provider.DesktopProvider.Companion.LocalDesktop
  4. // todo theme user support
  5. @Suppress("unused", "MemberVisibilityCanBePrivate")
  6. open class DesktopScope(
  7. val api: DesktopProvider
  8. ) {
  9. val isDebug
  10. get() = api.isDebug
  11. val scope
  12. get() = api.scope
  13. val containerSize
  14. get() = api.containerSize
  15. val graphicsDevice
  16. get() = api.graphicsDevice
  17. val graphicsEnvironment
  18. get() = api.graphicsEnvironment
  19. val isTransparencySupported
  20. get() = api.isTransparencySupported
  21. val osDetails
  22. get() = api.osDetails
  23. val machineName
  24. get() = api.machineName
  25. val currentUser
  26. get() = api.currentUser
  27. val homeDir
  28. get() = api.homeDir
  29. val theme
  30. get() = currentUser.theme
  31. val iconSet
  32. get() = theme.iconSet
  33. val ai
  34. get() = api.ai
  35. // val adb
  36. // get() = api.adbHandler
  37. val imageLoader
  38. get() = api.imageLoader
  39. // val scriptManager
  40. // get() = api.scriptManager
  41. // val scriptEngine
  42. // get() = api.scriptEngine
  43. val connectionManager
  44. get() = api.connectionManager
  45. // val windowsManager
  46. // get() = api.windowsManager
  47. // val dbus
  48. // get() = api.dbus
  49. val gnome
  50. get() = api.gnome
  51. val appsProvider
  52. get() = api.appsProvider
  53. val appCategories
  54. get() = appsProvider.appCategories
  55. val allApps
  56. get() = appsProvider.allApps
  57. val favoriteApps
  58. get() = appsProvider.favoriteApps
  59. val palette
  60. get() = api.palette
  61. val desktopUtils
  62. get() = api.desktopUtils
  63. val controlCenterPages
  64. get() = api.controlCenterPages
  65. val backgroundColorState
  66. get() = api.palette.backgroundColorState
  67. val backgroundColor
  68. get() = api.palette.backgroundColor
  69. val iconsTintColorState
  70. get() = api.palette.iconsTintColor
  71. val iconsTintColor
  72. get() = api.palette.iconsTintColor
  73. val textColorState
  74. get() = api.palette.textColorState
  75. val textColor
  76. get() = textColorState.value
  77. val borderColor
  78. get() = api.palette.borderColor
  79. val disabledColor
  80. get() = api.palette.disabledColor
  81. val appMenuMinWidth = theme.appMenuMinWidth
  82. val appMenuMinHeight = theme.appMenuMinHeight
  83. val menuPadding = theme.appMenuOuterPadding
  84. val panelAutoHideEnabled
  85. get() = theme.panelHideDelay > 0L
  86. val backgrounds
  87. get() = currentUser.backgrounds
  88. companion object {
  89. @Composable
  90. fun withDesktopScope(
  91. api: DesktopProvider = LocalDesktop.current,
  92. block: @Composable DesktopScope.() -> Unit
  93. ) = DesktopScope(api).apply {
  94. block()
  95. }
  96. }
  97. }