forked from Mirrors/apostrophe
initial theme stylesheets support
parent
5618ff38b6
commit
fb47539dd8
|
@ -0,0 +1,4 @@
|
||||||
|
@define-color dark_bg #353535;
|
||||||
|
@define-color light_bg #F6F5F4;
|
||||||
|
|
||||||
|
@import url("style.css");
|
|
@ -0,0 +1,4 @@
|
||||||
|
@define-color dark_bg #31373D;
|
||||||
|
@define-color light_bg #EDEDED;
|
||||||
|
|
||||||
|
@import url("style.css");
|
|
@ -4,9 +4,6 @@
|
||||||
inclusion in templates
|
inclusion in templates
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@define-color dark_bg #31373D;
|
|
||||||
@define-color light_bg #EDEDED;
|
|
||||||
|
|
||||||
@binding-set window-bindings {
|
@binding-set window-bindings {
|
||||||
bind "<ctl>w" { "close-window" () };
|
bind "<ctl>w" { "close-window" () };
|
||||||
bind "<ctl><shift>b" { "toggle-bibtex" () };
|
bind "<ctl><shift>b" { "toggle-bibtex" () };
|
||||||
|
|
|
@ -177,13 +177,13 @@ class UberwriterWindow(Gtk.ApplicationWindow):
|
||||||
# Init file name with None
|
# Init file name with None
|
||||||
self.set_filename()
|
self.set_filename()
|
||||||
|
|
||||||
self.style_provider = Gtk.CssProvider()
|
# self.style_provider = Gtk.CssProvider()
|
||||||
self.style_provider.load_from_path(helpers.get_media_path('style.css'))
|
# self.style_provider.load_from_path(helpers.get_media_path('arc_style.css'))
|
||||||
|
|
||||||
Gtk.StyleContext.add_provider_for_screen(
|
# Gtk.StyleContext.add_provider_for_screen(
|
||||||
Gdk.Screen.get_default(), self.style_provider,
|
# Gdk.Screen.get_default(), self.style_provider,
|
||||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
# Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||||
)
|
# )
|
||||||
|
|
||||||
# Markup and Shortcuts for the TextBuffer
|
# Markup and Shortcuts for the TextBuffer
|
||||||
self.markup_buffer = MarkupBuffer(
|
self.markup_buffer = MarkupBuffer(
|
||||||
|
|
|
@ -16,11 +16,12 @@ from gettext import gettext as _
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0') # pylint: disable=wrong-import-position
|
gi.require_version('Gtk', '3.0') # pylint: disable=wrong-import-position
|
||||||
from gi.repository import GLib, Gio, Gtk, GdkPixbuf
|
from gi.repository import GLib, Gio, Gtk, Gdk, GdkPixbuf
|
||||||
|
|
||||||
from uberwriter import UberwriterWindow
|
from uberwriter import UberwriterWindow
|
||||||
from uberwriter.Settings import Settings
|
from uberwriter.Settings import Settings
|
||||||
from uberwriter_lib import set_up_logging
|
from uberwriter_lib import set_up_logging
|
||||||
|
from uberwriter_lib import helpers
|
||||||
from uberwriter_lib.PreferencesDialog import PreferencesDialog
|
from uberwriter_lib.PreferencesDialog import PreferencesDialog
|
||||||
from . helpers import get_builder, get_media_path
|
from . helpers import get_builder, get_media_path
|
||||||
|
|
||||||
|
@ -36,9 +37,27 @@ class Application(Gtk.Application):
|
||||||
def init(self):
|
def init(self):
|
||||||
"""Init main application"""
|
"""Init main application"""
|
||||||
|
|
||||||
|
# set theme variant (dark/light)
|
||||||
dark = self.settings.get_value("dark-mode")
|
dark = self.settings.get_value("dark-mode")
|
||||||
Gtk.Settings.get_default().set_property("gtk-application-prefer-dark-theme", dark)
|
Gtk.Settings.get_default().set_property("gtk-application-prefer-dark-theme", dark)
|
||||||
|
|
||||||
|
# set css for current theme
|
||||||
|
self.style_provider = Gtk.CssProvider()
|
||||||
|
|
||||||
|
themes = {
|
||||||
|
"Arc": "arc_style.css",
|
||||||
|
"Arc-Dark": "arc_style.css",
|
||||||
|
"Arc-Darker": "arc_style.css",
|
||||||
|
}
|
||||||
|
|
||||||
|
theme = Gtk.Settings.get_default().get_property("gtk-theme-name")
|
||||||
|
self.style_provider.load_from_path(helpers.get_media_path(themes.get(theme,"adwaita_style.css")))
|
||||||
|
|
||||||
|
Gtk.StyleContext.add_provider_for_screen(
|
||||||
|
Gdk.Screen.get_default(), self.style_provider,
|
||||||
|
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def do_startup(self, *args, **kwargs):
|
def do_startup(self, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue