Comments (15)
This is actually a very simple plugin, to just toggle the GtkSettings flag. It's much neater and easier to design the user interface by adding a plugin rather than remaking the preferences and connecting different parts of the app. I'm partial to this as a solution to this issue of “Prefer Dark Theme Variant” toggle.
__kupfer_name__ = _("Prefer Dark Theme")
__description__ = ""
__version__ = "2017.1"
__author__ = ""
from gi.repository import Gtk
from kupfer import plugin_support, pretty
__kupfer_settings__ = plugin_support.PluginSettings(
{
"key" : "prefer_dark",
"label": _("Prefer Dark Theme"),
"type": bool,
"value": True,
},
)
def initialize_plugin(name):
use_theme(__kupfer_settings__['prefer_dark'])
__kupfer_settings__.connect_settings_changed_cb(on_change_theme)
def finalize_plugin(name):
use_theme(None)
def on_change_theme(sender, key, value):
use_theme(value)
PREFER_DARK = "gtk-application-prefer-dark-theme"
def use_theme(enabled):
pretty.print_debug(__name__, "updating setting to", enabled)
s = Gtk.Settings.get_default()
if enabled is None:
s.reset_property(PREFER_DARK)
else:
s.set_property(PREFER_DARK, enabled)
from kupfer.
Since kupfer has already named its window and widgets, it should be possible to put specific css for it in the user's gtk.css file. Some theme support is needed if themes should be able to change position/orientation of some widgets or have a theme selector in preferences.
from kupfer.
I have made a PR with partial support to dark theme (only using CSS).
If needed, I can make changes to incorporate any other colour theme (using colorpicker) as well.
from kupfer.
Right, this makes sense.
Educate me, I'm new to Gtk 3. Does every theme have "the dark variant" of itself? How would it be selected?
from kupfer.
I'm just a curious end user, but my understading is that you can bundle a dark variant of your theme and it will be used in applications that specifically request it (media-heavy applications, like GNOME Photos or Totem, do it). If an application requests a dark theme variant and the current theme does not have it, it falls back to the regular variant.
GNOME default theme, Elementary, and other popular community themes have dark variants.
from kupfer.
Indeed, there seems to be no more mystery than this: https://lazka.github.io/pgi-docs/index.html#Gtk-3.0/classes/Settings.html#Gtk.Settings.props.gtk_application_prefer_dark_theme
I would prefer to load a kupfer-specific gtk 3 settings.ini for this. It would solve most of the issues of user theme customization.
from kupfer.
Yes custom-theme-plugin is missing from new kupfer. In old kupfer user can choose light or dark version from preference. And I wouldn't want to depend on gtk-application-prefer-dark-theme
as not every theme provide a proper dark-scheme (it theme doesn't have a dark-scheme, it will fall back to default dark-scheme which may not look good).
Here is my suggestion:
-
Provide a dark-theme-mode in plugins/preference like before. It can be hardcoded.
-
In addition, Kupfer should also provide ability to theme it using css. It will overwrite the default (light or dark) theme.
@chaitanya-lakkundi opened a pull-request before (#49) regarding this. I think his last couple of commits (which doesn't change the layout) are exactly what we are looking for. He commented that he would create another PR only for css-capability without changing the layout or adding anything extra.
from kupfer.
On the topic of theming, rounded corners of the window were lost in the migration to Gtk 3. It looks like the Apis for cairo regions is not properly exposed in gi, so there is no way to call shape_combine_region to have rounded corners.
from kupfer.
Since kupfer has already named its window and widgets, it should be possible to put specific css for it in the user's gtk.css file.
Are you referring to something like this?
#kupfer {
background: @theme_bg_color;
}
.matchview {
border-radius: 25px;
}
#kupfer-preedit {
}
#kupfer-object-pane {
}
#kupfer-action-pane {
}
#kupfer-indirect-object-pane {
}
#kupfer-list {
}
#kupfer-list-view {
}
*:selected .matchview {
font-size: 25px;
}
from kupfer.
I know next to nothing about css theming, but yes, those are the widget names. It should be possible to scope the rules even tighter so they only apply to windows named #kupfer
or so.
Start of doc is https://kupferlauncher.github.io/Documentation/GTKTheming.html
from kupfer.
For example using window#kupfer .matchview { border-radius: 45px; }
. I'm unsure myself how the nesting rules work.
from kupfer.
Yes. It would work. I am testing if it is working as intended.
Btw, is there any specific reason to set gtk requirement so high (3.22)? If it is because of themming, we can theme it for both gtk-3.18 and >=gtk-3.20.
from kupfer.
The reason given in the README was honest: With a new port, I have never tried any Gtk version other than 3.22, and thus I don't know anything more than that 3.22 works.
I've tried 3.20 by now and it seems to work fine.
from kupfer.
A very good and neat solution indeed !
Just another idea (related to the issue of changing layout ).
We can separate the view and controller by providing a separate XML file for the Layout (hbox and vbox etc. ) and then load that file using a function. In this way we can provide multiple layout functionality for the user.
A new layout would just mean creating a new xml file. We can extend the xml file to provide options to hide panes, change font size, alter height and width etc.
Please suggest your opinions on this thought.
from kupfer.
The simple toggle is in kupfer 319, it's a new plugin. Note that it can be used to prefer the GTK light theme if the global default is prefer dark, too.
Now for more specific kupfer themeing, that's a different thing.
from kupfer.
Related Issues (20)
- ../po/it.po:1189: 'msgid' and 'msgstr' entries do not both end with '\n'
- XFCE session management does not lock screen HOT 3
- Version "undefined" in About HOT 3
- mate-dictionary support missing HOT 1
- Suggestion on helping to find third-party plugins
- Kuper launches Catfish search instead of folders HOT 2
- Bring back bash aliases and functions in commands plugin HOT 1
- Firefox Bookmarks plugin error, solved by adding uri=True to line 59 in firefox.py HOT 1
- Accessibility: check at-spi & speech output HOT 6
- Enable show/hide of kupfer without keybinder HOT 7
- Implement drag files from kupfer's window
- Enhancement: Facilitate quitting Application processes if running HOT 2
- Firefox plugins not functional HOT 2
- Cannot set launch keys on Ubuntu 21.10 after Upgrade HOT 2
- Add SECURITY.md / Insecure ConservativeUnpickler HOT 6
- thunderbird_support.py throws SQL error: cards table absent HOT 3
- Segfaults under Wayland with new libwnck HOT 8
- [Cinnamon] Super+space requires 2 space presses HOT 2
- About shows version undefined and copyright only until 2017 HOT 1
- Prevent Kupfer from being pushed to swap, make Kupfer more responsive with HDD HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kupfer.