Browse Source

Code Improvements and directory structure changes.

sisyphus
Dustin Falgout 8 years ago
parent
commit
83884e7f67
  1. 52
      Makefile
  2. 37
      build/utils.sh
  3. 35
      dist/web-greeter.conf
  4. 33
      dist/web-greeter.yml
  5. 0
      themes/default/.tx/combine_translations.js
  6. 0
      themes/default/.tx/config
  7. 0
      themes/default/COPYING
  8. 0
      themes/default/README.md
  9. 0
      themes/default/css/style.css
  10. 0
      themes/default/i18n/af.json
  11. 0
      themes/default/i18n/ar.json
  12. 0
      themes/default/i18n/az.json
  13. 0
      themes/default/i18n/be.json
  14. 0
      themes/default/i18n/bg.json
  15. 0
      themes/default/i18n/ca.json
  16. 0
      themes/default/i18n/cs.json
  17. 0
      themes/default/i18n/da.json
  18. 0
      themes/default/i18n/de.json
  19. 0
      themes/default/i18n/el.json
  20. 0
      themes/default/i18n/en.json
  21. 0
      themes/default/i18n/eo.json
  22. 0
      themes/default/i18n/es.json
  23. 0
      themes/default/i18n/et.json
  24. 0
      themes/default/i18n/eu.json
  25. 0
      themes/default/i18n/fa.json
  26. 0
      themes/default/i18n/fi.json
  27. 0
      themes/default/i18n/fr.json
  28. 0
      themes/default/i18n/gl.json
  29. 0
      themes/default/i18n/gu.json
  30. 0
      themes/default/i18n/he.json
  31. 0
      themes/default/i18n/hi.json
  32. 0
      themes/default/i18n/hr.json
  33. 0
      themes/default/i18n/hu.json
  34. 0
      themes/default/i18n/id.json
  35. 0
      themes/default/i18n/it.json
  36. 0
      themes/default/i18n/ja.json
  37. 0
      themes/default/i18n/ka.json
  38. 0
      themes/default/i18n/ko.json
  39. 0
      themes/default/i18n/lt.json
  40. 0
      themes/default/i18n/mk.json
  41. 0
      themes/default/i18n/mr.json
  42. 0
      themes/default/i18n/ms.json
  43. 0
      themes/default/i18n/nb.json
  44. 0
      themes/default/i18n/nl.json
  45. 0
      themes/default/i18n/pa.json
  46. 0
      themes/default/i18n/pl.json
  47. 0
      themes/default/i18n/pt.json
  48. 0
      themes/default/i18n/ro.json
  49. 0
      themes/default/i18n/ru.json
  50. 0
      themes/default/i18n/sk.json
  51. 0
      themes/default/i18n/sl.json
  52. 0
      themes/default/i18n/sr.json
  53. 0
      themes/default/i18n/sv.json
  54. 0
      themes/default/i18n/ta.json
  55. 0
      themes/default/i18n/tg.json
  56. 0
      themes/default/i18n/tl.json
  57. 0
      themes/default/i18n/tr.json
  58. 0
      themes/default/i18n/translations.json
  59. 0
      themes/default/i18n/uk.json
  60. 0
      themes/default/i18n/vi.json
  61. 0
      themes/default/i18n/xh.json
  62. 0
      themes/default/i18n/zh.json
  63. 0
      themes/default/i18n/zu.json
  64. 0
      themes/default/img/antergos-logo-user.png
  65. 0
      themes/default/img/antergos.png
  66. 0
      themes/default/img/fallback_bg.jpg
  67. 0
      themes/default/img/screenshot1.jpg
  68. 0
      themes/default/img/screenshot2.jpg
  69. 0
      themes/default/img/screenshot3.jpg
  70. 10
      themes/default/index.html
  71. 0
      themes/default/index.theme
  72. 2
      themes/default/js/greeter.js
  73. 0
      themes/default/js/translations.js
  74. 0
      themes/default/package.json
  75. 1
      web-greeter/bridge/Config.py
  76. 8
      web-greeter/bridge/ThemeUtils.py
  77. 47
      web-greeter/greeter.py
  78. 6
      web-greeter/resources/js/ThemeUtils.js
  79. 42
      web-greeter/whither.yml

52
Makefile

@ -2,7 +2,7 @@
DO := ./build/utils.sh DO := ./build/utils.sh
SET_CONFIG := $(DO) set-config SET_CONFIG := $(DO) set-config
DESTDIR ?= '/' DESTDIR ?= /
define colorecho define colorecho
@tput setaf 118 || true @tput setaf 118 || true
@ -10,27 +10,55 @@ define colorecho
@tput sgr0 || true @tput sgr0 || true
endef endef
ifeq ($(MAKECMDGOALS),build_dev)
debug_mode := True
decorated := True
stays_on_top := False
endif
all: install
apply_config: # Configuration: Use values from command line if provided, default values otherwise.
@# | KEY | VALUE FROM COMMAND LINE | DEFAULT VALUE background_images_dir ?= $(realpath $(DESTDIR)/usr/share/backgrounds)
@$(SET_CONFIG) background_images_dir '$(background_images_dir)' /usr/share/backgrounds config_dir ?= $(realpath $(DESTDIR)/etc/lightdm)
@$(SET_CONFIG) config_dir '$(config_dir)' /etc/lightdm debug_mode ?= False
@$(SET_CONFIG) greeters_dir '$(greeters_dir)' /usr/share/xgreeters decorated ?= False
@$(SET_CONFIG) locale_dir '$(locale_dir)' /usr/share/locale greeters_dir ?= $(realpath $(DESTDIR)/usr/share/xgreeters)
@$(SET_CONFIG) themes_dir '$(themes_dir)' /usr/share/web-greeter locale_dir ?= $(realpath $(DESTDIR)/usr/share/locale)
themes_dir ?= $(realpath $(DESTDIR)/usr/share/web-greeter/themes)
logo_image ?= $(themes_dir)/default/img/antergos-logo-user.png
stays_on_top ?= True
user_image ?= $(themes_dir)/default/img/antergos.png
build_init: clean _apply_config:
@$(SET_CONFIG) background_images_dir $(background_images_dir)
@$(SET_CONFIG) config_dir $(config_dir)
@$(SET_CONFIG) debug_mode $(debug_mode)
@$(SET_CONFIG) decorated $(decorated)
@$(SET_CONFIG) greeters_dir $(greeters_dir)
@$(SET_CONFIG) locale_dir $(locale_dir)
@$(SET_CONFIG) themes_dir $(themes_dir)
@$(SET_CONFIG) logo_image $(logo_image)
@$(SET_CONFIG) stays_on_top $(stays_on_top)
@$(SET_CONFIG) user_image $(user_image)
_build_init: clean
$(DO) build-init $(DO) build-init
build: build_init apply_config all: install
build: _build_init _apply_config
$(DO) build $(DO) build
build_dev: install
sudo $(DO) install-dev
clean: clean:
$(DO) clean $(DO) clean
install: build install: build
$(DO) install $(DESTDIR) sudo $(DO) install $(DESTDIR)
$(call colorecho, SUCCESS!) $(call colorecho, SUCCESS!)
.PHONY: all _apply_config _build_init build build_dev clean install

37
build/utils.sh

@ -31,7 +31,7 @@ do_build() {
# Compile Resources # Compile Resources
(combine_javascript_sources \ (combine_javascript_sources \
&& pyrcc5 -o ../../resources.py ../resources.qrc) && pyrcc5 -o "${BUILD_DIR}/${PKGNAME}/resources.py" ../resources.qrc)
# Create "Zip Application" # Create "Zip Application"
(cd "${PKGNAME}" \ (cd "${PKGNAME}" \
@ -56,23 +56,27 @@ do_install() {
&& mv themes/_vendor .) && mv themes/_vendor .)
# Man Page # Man Page
cp "${REPO_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}/usr/share/man/man1" cp "${BUILD_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}/usr/share/man/man1"
# Greeter Config # Greeter Config
cp "${REPO_DIR}/dist/${PKGNAME}.conf" "${INSTALL_ROOT}/etc/lightdm" cp "${BUILD_DIR}/dist/${PKGNAME}.yml" "${INSTALL_ROOT}/etc/lightdm"
# AppData File # AppData File
cp "${REPO_DIR}/dist/com.antergos.${PKGNAME}.appdata.xml" "${INSTALL_ROOT}/usr/share/metainfo" cp "${BUILD_DIR}/dist/com.antergos.${PKGNAME}.appdata.xml" "${INSTALL_ROOT}/usr/share/metainfo"
# Desktop File # Desktop File
cp "${REPO_DIR}/dist/com.antergos.${PKGNAME}.desktop" "${INSTALL_ROOT}/usr/share/xgreeters" cp "${BUILD_DIR}/dist/com.antergos.${PKGNAME}.desktop" "${INSTALL_ROOT}/usr/share/xgreeters"
# Do Install! # Do Install!
[[ -e "${DESTDIR}" ]] || mkdir -p "${DESTDIR}" [[ -e "${DESTDIR}" ]] || mkdir -p "${DESTDIR}"
cp -R "${INSTALL_ROOT}"/* "${DESTDIR}" cp -R "${INSTALL_ROOT}"/* "${DESTDIR}"
# Fix Permissions # Fix Permissions
chown -R "${SUDO_UID}:${SUDO_GID}" "${BUILD_DIR}" [[ -n "${SUDO_UID}" ]] && chown -R "${SUDO_UID}:${SUDO_GID}" "${BUILD_DIR}"
}
do_install_dev() {
cp -RH "${REPO_DIR}/whither/whither" /usr/lib/python3.6/site-packages/
} }
do_success() { do_success() {
@ -88,18 +92,17 @@ generate_pot_file() {
} }
init_build_dir() { init_build_dir() {
[[ -e "${BUILD_DIR}/web-greeter" ]] && return 0 [[ -e "${BUILD_DIR}/web-greeter" ]] && rm -rf "${BUILD_DIR}/web-greeter"
cp -R "${REPO_DIR}/web-greeter" "${BUILD_DIR}" [[ -e "${BUILD_DIR}/dist" ]] && rm -rf "${BUILD_DIR}/dist"
cp -R -t "${BUILD_DIR}" "${REPO_DIR}/web-greeter" "${REPO_DIR}/dist"
} }
set_config() { set_config() {
( [[ -z "$1" ]] || [[ -z "$2" && -z "$3" ]] ) && return 1 [[ -z "$1" || -z "$2" ]] && return 1
local KEY VALUE
KEY="$1"
[[ '' != "$2" ]] && VALUE="$2" || VALUE="$3"
sed -i "s|@${KEY}@|${VALUE}|g" "${BUILD_DIR}/web-greeter/whither.yml" sed -i "s|'@$1@'|$2|g" \
"${BUILD_DIR}/web-greeter/whither.yml" \
"${BUILD_DIR}/dist/web-greeter.yml"
} }
@ -134,7 +137,11 @@ case "$1" in
do_install do_install
;; ;;
install-dev)
do_install_dev
;;
set-config) set-config)
set_config "$2" "$3" "$4" set_config "$2" "$3"
;; ;;
esac esac

35
dist/web-greeter.conf vendored

@ -1,35 +0,0 @@
#
# [greeter]
# debug_mode = Greeter theme debug mode.
# detect_theme_errors = Provide an option to load a fallback theme when theme errors are detected.
# screensaver_timeout = Blank the screen after this many seconds of inactivity.
# secure_mode = Don't allow themes to make remote http requests.
# time_format = A moment.js format string so the greeter can generate localized time for display.
# time_language = Language to use when displaying the time or "auto" to use the system's language.
# webkit_theme = Webkit theme to use.
#
# NOTE: See moment.js documentation for format string options: http://momentjs.com/docs/#/displaying/format/
#
[greeter]
debug_mode = false
detect_theme_errors = true
screensaver_timeout = 300
secure_mode = true
time_format = LT
time_language = auto
webkit_theme = antergos
#
# [branding]
# background_images = Path to directory that contains background images for use by themes.
# logo = Path to logo image for use by greeter themes.
# user_image = Default user image/avatar. This is used by themes for users that have no .face image.
#
# NOTE: Paths must be accessible to the lightdm system user account (so they cannot be anywhere in /home)
#
[branding]
background_images = /usr/share/backgrounds
logo = /usr/share/lightdm-webkit/themes/antergos/img/antergos.png
user_image = /usr/share/lightdm-webkit/themes/antergos/img/antergos-logo-user.png

33
dist/web-greeter.yml vendored

@ -0,0 +1,33 @@
#
# branding:
# background_images_dir: Path to directory that contains background images for use by themes.
# logo_image: Path to logo image for use by greeter themes.
# user_image: Default user image/avatar. This is used by themes when user has no .face image.
#
# NOTE: Paths must be accessible to the lightdm system user account (so they cannot be anywhere in /home)
#
branding:
background_images_dir: '@background_images_dir@'
logo_image: '@logo_image@'
user_image: '@user_image@'
#
# greeter:
# debug_mode: Enable debug mode for the greeter as well as greeter themes.
# detect_theme_errors: Provide an option to load a fallback theme when theme errors are detected.
# screensaver_timeout: Blank the screen after this many seconds of inactivity.
# secure_mode: Don't allow themes to make remote http requests.
# theme: Greeter theme to use.
# time_format: A moment.js format string so the greeter can generate localized time for display.
# time_language: Language to use when displaying the time or "auto" to use the system's language.
#
# NOTE: See moment.js documentation for format string options: http://momentjs.com/docs/#/displaying/format
#
greeter:
debug_mode: '@debug_mode@'
detect_theme_errors: True
screensaver_timeout: 300
secure_mode: True
theme: default
time_format: LT
time_language: auto

0
themes/antergos/.tx/combine_translations.js → themes/default/.tx/combine_translations.js vendored

0
themes/antergos/.tx/config → themes/default/.tx/config vendored

0
themes/antergos/COPYING → themes/default/COPYING vendored

0
themes/antergos/README.md → themes/default/README.md vendored

0
themes/antergos/css/style.css → themes/default/css/style.css vendored

0
themes/antergos/i18n/af.json → themes/default/i18n/af.json vendored

0
themes/antergos/i18n/ar.json → themes/default/i18n/ar.json vendored

0
themes/antergos/i18n/az.json → themes/default/i18n/az.json vendored

0
themes/antergos/i18n/be.json → themes/default/i18n/be.json vendored

0
themes/antergos/i18n/bg.json → themes/default/i18n/bg.json vendored

0
themes/antergos/i18n/ca.json → themes/default/i18n/ca.json vendored

0
themes/antergos/i18n/cs.json → themes/default/i18n/cs.json vendored

0
themes/antergos/i18n/da.json → themes/default/i18n/da.json vendored

0
themes/antergos/i18n/de.json → themes/default/i18n/de.json vendored

0
themes/antergos/i18n/el.json → themes/default/i18n/el.json vendored

0
themes/antergos/i18n/en.json → themes/default/i18n/en.json vendored

0
themes/antergos/i18n/eo.json → themes/default/i18n/eo.json vendored

0
themes/antergos/i18n/es.json → themes/default/i18n/es.json vendored

0
themes/antergos/i18n/et.json → themes/default/i18n/et.json vendored

0
themes/antergos/i18n/eu.json → themes/default/i18n/eu.json vendored

0
themes/antergos/i18n/fa.json → themes/default/i18n/fa.json vendored

0
themes/antergos/i18n/fi.json → themes/default/i18n/fi.json vendored

0
themes/antergos/i18n/fr.json → themes/default/i18n/fr.json vendored

0
themes/antergos/i18n/gl.json → themes/default/i18n/gl.json vendored

0
themes/antergos/i18n/gu.json → themes/default/i18n/gu.json vendored

0
themes/antergos/i18n/he.json → themes/default/i18n/he.json vendored

0
themes/antergos/i18n/hi.json → themes/default/i18n/hi.json vendored

0
themes/antergos/i18n/hr.json → themes/default/i18n/hr.json vendored

0
themes/antergos/i18n/hu.json → themes/default/i18n/hu.json vendored

0
themes/antergos/i18n/id.json → themes/default/i18n/id.json vendored

0
themes/antergos/i18n/it.json → themes/default/i18n/it.json vendored

0
themes/antergos/i18n/ja.json → themes/default/i18n/ja.json vendored

0
themes/antergos/i18n/ka.json → themes/default/i18n/ka.json vendored

0
themes/antergos/i18n/ko.json → themes/default/i18n/ko.json vendored

0
themes/antergos/i18n/lt.json → themes/default/i18n/lt.json vendored

0
themes/antergos/i18n/mk.json → themes/default/i18n/mk.json vendored

0
themes/antergos/i18n/mr.json → themes/default/i18n/mr.json vendored

0
themes/antergos/i18n/ms.json → themes/default/i18n/ms.json vendored

0
themes/antergos/i18n/nb.json → themes/default/i18n/nb.json vendored

0
themes/antergos/i18n/nl.json → themes/default/i18n/nl.json vendored

0
themes/antergos/i18n/pa.json → themes/default/i18n/pa.json vendored

0
themes/antergos/i18n/pl.json → themes/default/i18n/pl.json vendored

0
themes/antergos/i18n/pt.json → themes/default/i18n/pt.json vendored

0
themes/antergos/i18n/ro.json → themes/default/i18n/ro.json vendored

0
themes/antergos/i18n/ru.json → themes/default/i18n/ru.json vendored

0
themes/antergos/i18n/sk.json → themes/default/i18n/sk.json vendored

0
themes/antergos/i18n/sl.json → themes/default/i18n/sl.json vendored

0
themes/antergos/i18n/sr.json → themes/default/i18n/sr.json vendored

0
themes/antergos/i18n/sv.json → themes/default/i18n/sv.json vendored

0
themes/antergos/i18n/ta.json → themes/default/i18n/ta.json vendored

0
themes/antergos/i18n/tg.json → themes/default/i18n/tg.json vendored

0
themes/antergos/i18n/tl.json → themes/default/i18n/tl.json vendored

0
themes/antergos/i18n/tr.json → themes/default/i18n/tr.json vendored

0
themes/antergos/i18n/translations.json → themes/default/i18n/translations.json vendored

0
themes/antergos/i18n/uk.json → themes/default/i18n/uk.json vendored

0
themes/antergos/i18n/vi.json → themes/default/i18n/vi.json vendored

0
themes/antergos/i18n/xh.json → themes/default/i18n/xh.json vendored

0
themes/antergos/i18n/zh.json → themes/default/i18n/zh.json vendored

0
themes/antergos/i18n/zu.json → themes/default/i18n/zu.json vendored

0
themes/antergos/img/antergos-logo-user.png → themes/default/img/antergos-logo-user.png vendored

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

0
themes/antergos/img/antergos.png → themes/default/img/antergos.png vendored

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

0
themes/antergos/img/fallback_bg.jpg → themes/default/img/fallback_bg.jpg vendored

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 219 KiB

0
themes/antergos/img/screenshot1.jpg → themes/default/img/screenshot1.jpg vendored

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

0
themes/antergos/img/screenshot2.jpg → themes/default/img/screenshot2.jpg vendored

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

0
themes/antergos/img/screenshot3.jpg → themes/default/img/screenshot3.jpg vendored

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

10
themes/antergos/index.html → themes/default/index.html vendored

@ -38,16 +38,16 @@
<!--<script type="text/javascript" src="../_vendor/js/mock.js"></script>--> <!--<script type="text/javascript" src="../_vendor/js/mock.js"></script>-->
<!-- Vendor CSS --> <!-- Vendor CSS -->
<link rel="stylesheet" type="text/css" href="../_vendor/css/bootswatch-paper.bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="../../_vendor/css/bootswatch-paper.bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="../_vendor/fonts/font-awesome/font-awesome.min.css"/> <link rel="stylesheet" type="text/css" href="../../_vendor/fonts/font-awesome/font-awesome.min.css"/>
<!-- Theme's CSS --> <!-- Theme's CSS -->
<link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style.css">
<!-- Vendor JavaScript --> <!-- Vendor JavaScript -->
<script src="../_vendor/js/jquery.min.js"></script> <script src="../../_vendor/js/jquery.min.js"></script>
<script src="../_vendor/js/bootstrap.min.js"></script> <script src="../../_vendor/js/bootstrap.min.js"></script>
<script src="../_vendor/js/js.cookie.min.js"></script> <script src="../../_vendor/js/js.cookie.min.js"></script>
<!-- Theme JavaScript --> <!-- Theme JavaScript -->
<script src="js/translations.js"></script> <script src="js/translations.js"></script>

0
themes/antergos/index.theme → themes/default/index.theme vendored

2
themes/antergos/js/greeter.js → themes/default/js/greeter.js vendored

@ -248,7 +248,7 @@ class BackgroundManager {
* @param {jQuery.Deferred} deferred * @param {jQuery.Deferred} deferred
*/ */
initialize( deferred ) { initialize( deferred ) {
if ( ! _bg_self.current_background ) { if ( is_empty( _bg_self.current_background ) ) {
_bg_self.random_background = _config._set( 'true', 'background_manager', 'random_background' ); _bg_self.random_background = _config._set( 'true', 'background_manager', 'random_background' );
} }

0
themes/antergos/js/translations.js → themes/default/js/translations.js vendored

0
themes/antergos/package.json → themes/default/package.json vendored

1
web-greeter/bridge/Config.py

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Config.py # Config.py

8
web-greeter/bridge/ThemeUtils.py

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# ThemeUtils.py # ThemeUtils.py
@ -40,11 +39,10 @@ from whither.bridge import (
class ThemeUtils(BridgeObject): class ThemeUtils(BridgeObject):
def __init__(self, greeter, config, user_config, *args, **kwargs): def __init__(self, greeter, config, *args, **kwargs):
super().__init__(name='ThemeUtils', *args, **kwargs) super().__init__(name='ThemeUtils', *args, **kwargs)
self._config = config self._config = config
self._user_config = user_config
self._greeter = greeter self._greeter = greeter
@bridge.method(str, bool, result=Variant) @bridge.method(str, bool, result=Variant)
@ -60,9 +58,9 @@ class ThemeUtils(BridgeObject):
allowed = False allowed = False
allowed_dirs = ( allowed_dirs = (
self._config.themes_dir, self._config.themes_dir,
self._user_config.branding.background_images, self._config.branding.background_images_dir,
self._greeter.shared_data_directory, self._greeter.shared_data_directory,
'/tmp/' '/tmp'
) )
for allowed_dir in allowed_dirs: for allowed_dir in allowed_dirs:

47
web-greeter/greeter.py

@ -27,12 +27,17 @@
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. # along with Web Greeter; If not, see <http://www.gnu.org/licenses/>.
# Standard Lib # Standard Lib
import configparser
import os import os
from typing import (
ClassVar,
Type,
)
# 3rd-Party Libs # 3rd-Party Libs
from whither.app import App from whither.app import App
from whither.base.data import AttributeDict from whither.base.data import AttributeDict
from whither.base.config_loader import ConfigLoader
from whither.bridge import BridgeObject
# This Application # This Application
import resources import resources
@ -42,48 +47,44 @@ from bridge import (
ThemeUtils, ThemeUtils,
) )
# Typing Helpers
BridgeObj = Type[BridgeObject]
BASE_DIR = os.path.dirname(os.path.realpath(__file__)) BASE_DIR = os.path.dirname(os.path.realpath(__file__))
CONFIG_FILE = os.path.join(BASE_DIR, 'whither.yml') CONFIG_FILE = os.path.join(BASE_DIR, 'whither.yml')
class WebGreeter(App): class WebGreeter(App):
greeter = None greeter = None # type: ClassVar[BridgeObj]
greeter_config = None greeter_config = None # type: ClassVar[BridgeObj]
theme_utils = None theme_utils = None # type: ClassVar[BridgeObj]
user_config = AttributeDict({})
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__('WebGreeter', config_file=CONFIG_FILE, debug=True, *args, **kwargs) super().__init__('WebGreeter', *args, **kwargs)
self.get_and_save_user_config()
self.greeter = Greeter(self.config.themes_dir) self.greeter = Greeter(self.config.themes_dir)
self.greeter_config = Config(self.user_config) self.greeter_config = Config(self.config)
self.theme_utils = ThemeUtils(self.greeter, self.config, self.user_config) self.theme_utils = ThemeUtils(self.greeter, self.config)
self._web_container.bridge_objects = (self.greeter, self.greeter_config, self.theme_utils) self._web_container.bridge_objects = (self.greeter, self.greeter_config, self.theme_utils)
self._web_container.initialize_bridge_objects() self._web_container.initialize_bridge_objects()
self._web_container.load_script(':/_greeter/js/bundle.js', 'Web Greeter Bundle') self._web_container.load_script(':/_greeter/js/bundle.js', 'Web Greeter Bundle')
self.load_theme() self.load_theme()
def get_and_save_user_config(self): def _before_web_container_init(self):
config = configparser.ConfigParser() self.get_and_apply_user_config()
config.read('/etc/lightdm/web-greeter.conf') def get_and_apply_user_config(self):
config_file = os.path.join(self.config.config_dir, 'web-greeter.yml')
branding_config = ConfigLoader('branding', config_file).config
greeter_config = ConfigLoader('greeter', config_file).config
for section in config.sections(): self.config.branding.update(branding_config)
self.user_config[section] = {} self.config.greeter.update(greeter_config)
for key in config[section]:
self.user_config[section][key] = config[section][key]
def load_theme(self): def load_theme(self):
theme_url = 'file://{0}/{1}/index.html'.format( theme_url = f'/{self.config.themes_dir}/{self.config.greeter.theme}/index.html'
self.config.themes_dir,
'antergos'
#self.user_config.greeter.webkit_theme
)
self._web_container.load(theme_url) self._web_container.load(theme_url)

6
web-greeter/resources/js/ThemeUtils.js

@ -35,9 +35,9 @@ let localized_invalid_date = null,
function _set_allowed_dirs() { function _set_allowed_dirs() {
allowed_dirs = { allowed_dirs = {
themes_dir: lightdm.themes_directory, themes_dir: lightdm.themes_dir,
backgrounds_dir: greeter_config.branding.background_images, backgrounds_dir: greeter_config.branding.background_images_dir,
lightdm_data_dir: lightdm.shared_data_directory, lightdm_data_dir: lightdm.shared_data_dir,
tmpdir: '/tmp', tmpdir: '/tmp',
}; };
} }

42
web-greeter/whither.yml

@ -4,34 +4,42 @@
WebGreeter: WebGreeter:
# Whither's Config # Whither's Config
whither: whither:
allow_remote_urls: False
app_id: com.antergos.web-greeter app_id: com.antergos.web-greeter
toolkit: auto debug_mode: '@debug_mode@'
entry_point: entry_point:
autoload: False autoload: False
url: '' toolbar:
enabled: False
toolkit: auto
window: window:
width: decorated: '@decorated@'
height:
initial_state: maximized initial_state: maximized
decorated: False stays_on_top: '@stays_on_top@'
stays_on_top: True
title: Web Greeter for LightDM title: Web Greeter for LightDM
icon:
no_desktop_env: False
toolbar:
enabled: False
# App's Config # App's Config
app: app:
background_images_dir: '@background_images_dir@' branding:
background_images_dir: '@background_images_dir@'
logo_image: '@logo_image@'
user_image: '@user_image@'
config_dir: '@config_dir@' config_dir: '@config_dir@'
greeter:
debug_mode: '@debug_mode@'
detect_theme_errors: True
screensaver_timeout: 300
secure_mode: True
theme: default
time_format: LT
time_language: auto
greeters_dir: '@greeters_dir@' greeters_dir: '@greeters_dir@'
locale_dir: '@locale_dir@' locale_dir: '@locale_dir@'
logo_image: '@logo_image@'
themes_dir: '@themes_dir@' themes_dir: '@themes_dir@'
user_image: '@user_image@'
version: version:
full: '3.0.0alpha3' full: '3.0.0alpha4'
major: '3' major: 3
minor: '0' minor: 0
micro: '0alpha3' micro: 0
alpha: 4
beta: False

Loading…
Cancel
Save