Merge pull request #182580 from linsui/qgnomeplatform

This commit is contained in:
Sandro 2023-01-10 17:01:22 +01:00 committed by GitHub
commit 0c7cc93361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 79 additions and 34 deletions

View File

@ -199,9 +199,9 @@ GTK themes can be installed either to user profile or system-wide (via
GTK ones, you can use the following configuration:
```nix
qt5.enable = true;
qt5.platformTheme = "gtk2";
qt5.style = "gtk2";
qt.enable = true;
qt.platformTheme = "gtk2";
qt.style = "gtk2";
```
## Custom XKB layouts {#custom-xkb-layouts .unnumbered}

View File

@ -223,9 +223,9 @@ services.xserver.libinput.touchpad.tapping = false;
configuration:
</para>
<programlisting language="nix">
qt5.enable = true;
qt5.platformTheme = &quot;gtk2&quot;;
qt5.style = &quot;gtk2&quot;;
qt.enable = true;
qt.platformTheme = &quot;gtk2&quot;;
qt.style = &quot;gtk2&quot;;
</programlisting>
</section>
<section xml:id="custom-xkb-layouts">

View File

@ -4,7 +4,7 @@ with lib;
let
cfg = config.qt5;
cfg = config.qt;
isQGnome = cfg.platformTheme == "gnome" && builtins.elem cfg.style ["adwaita" "adwaita-dark"];
isQtStyle = cfg.platformTheme == "gtk2" && !(builtins.elem cfg.style ["adwaita" "adwaita-dark"]);
@ -12,22 +12,34 @@ let
isLxqt = cfg.platformTheme == "lxqt";
isKde = cfg.platformTheme == "kde";
packages = if isQGnome then [ pkgs.qgnomeplatform pkgs.adwaita-qt ]
packages =
if isQGnome then [
pkgs.qgnomeplatform
pkgs.adwaita-qt
pkgs.qgnomeplatform-qt6
pkgs.adwaita-qt6
]
else if isQtStyle then [ pkgs.libsForQt5.qtstyleplugins ]
else if isQt5ct then [ pkgs.libsForQt5.qt5ct ]
else if isLxqt then [ pkgs.lxqt.lxqt-qtplugin pkgs.lxqt.lxqt-config ]
else if isKde then [ pkgs.libsForQt5.plasma-integration pkgs.libsForQt5.systemsettings ]
else throw "`qt5.platformTheme` ${cfg.platformTheme} and `qt5.style` ${cfg.style} are not compatible.";
else throw "`qt.platformTheme` ${cfg.platformTheme} and `qt.style` ${cfg.style} are not compatible.";
in
{
meta.maintainers = [ maintainers.romildo ];
options = {
qt5 = {
imports = [
(mkRenamedOptionModule ["qt5" "enable" ] ["qt" "enable" ])
(mkRenamedOptionModule ["qt5" "platformTheme" ] ["qt" "platformTheme" ])
(mkRenamedOptionModule ["qt5" "style" ] ["qt" "style" ])
];
enable = mkEnableOption (lib.mdDoc "Qt5 theming configuration");
options = {
qt = {
enable = mkEnableOption (lib.mdDoc "Qt theming configuration");
platformTheme = mkOption {
type = types.enum [
@ -40,13 +52,14 @@ in
example = "gnome";
relatedPackages = [
"qgnomeplatform"
"qgnomeplatform-qt6"
["libsForQt5" "qtstyleplugins"]
["libsForQt5" "qt5ct"]
["lxqt" "lxqt-qtplugin"]
["libsForQt5" "plasma-integration"]
];
description = lib.mdDoc ''
Selects the platform theme to use for Qt5 applications.
Selects the platform theme to use for Qt applications.
The options are
- `gtk`: Use GTK theme with [qtstyleplugins](https://github.com/qt/qtstyleplugins)
@ -71,10 +84,11 @@ in
example = "adwaita";
relatedPackages = [
"adwaita-qt"
"adwaita-qt6"
["libsForQt5" "qtstyleplugins"]
];
description = lib.mdDoc ''
Selects the style to use for Qt5 applications.
Selects the style to use for Qt applications.
The options are
- `adwaita`, `adwaita-dark`: Use Adwaita Qt style with

View File

@ -31,7 +31,7 @@
};
# Theme calamares with GNOME theme
qt5 = {
qt = {
enable = true;
platformTheme = "gnome";
};

View File

@ -20,7 +20,7 @@
./config/nsswitch.nix
./config/power-management.nix
./config/pulseaudio.nix
./config/qt5.nix
./config/qt.nix
./config/resolvconf.nix
./config/shells-environment.nix
./config/swap.nix

View File

@ -198,10 +198,10 @@ in
programs.bash.vteIntegration = mkDefault true;
programs.zsh.vteIntegration = mkDefault true;
# Harmonize Qt5 applications under Cinnamon
qt5.enable = true;
qt5.platformTheme = "gnome";
qt5.style = "adwaita";
# Harmonize Qt applications under Cinnamon
qt.enable = true;
qt.platformTheme = "gnome";
qt.style = "adwaita";
# Default Fonts
fonts.fonts = with pkgs; [

View File

@ -352,8 +352,8 @@ in
})
];
# Harmonize Qt5 application style and also make them use the portal for file chooser dialog.
qt5 = {
# Harmonize Qt application style and also make them use the portal for file chooser dialog.
qt = {
enable = mkDefault true;
platformTheme = mkDefault "gnome";
style = mkDefault "adwaita";

View File

@ -250,10 +250,10 @@ in
programs.bash.vteIntegration = mkDefault true;
programs.zsh.vteIntegration = mkDefault true;
# Harmonize Qt5 applications under Pantheon
qt5.enable = true;
qt5.platformTheme = "gnome";
qt5.style = "adwaita";
# Harmonize Qt applications under Pantheon
qt.enable = true;
qt.platformTheme = "gnome";
qt.style = "adwaita";
# Default Fonts
fonts.fonts = with pkgs; [

View File

@ -17,7 +17,7 @@ import ./make-test-python.nix ({ pkgs, ...} :
services.xserver.enable = true;
# Regression test for https://github.com/NixOS/nixpkgs/issues/163482
qt5 = {
qt = {
enable = true;
platformTheme = "gnome";
style = "adwaita-dark";

View File

@ -1,16 +1,17 @@
{ mkDerivation
, stdenv
{ stdenv
, lib
, fetchFromGitHub
, nix-update-script
, cmake
, ninja
, qtbase
, qtwayland
, qt5
, xorg
, useQt6 ? false
}:
mkDerivation rec {
stdenv.mkDerivation rec {
pname = "adwaita-qt";
version = "1.4.1";
@ -30,9 +31,19 @@ mkDerivation rec {
buildInputs = [
qtbase
qt5.qtx11extras
] ++ lib.optionals stdenv.isLinux [
xorg.libxcb
] ++ lib.optionals (!useQt6) [
qt5.qtx11extras
] ++ lib.optionals useQt6 [
qtwayland
];
# Qt setup hook complains about missing `wrapQtAppsHook` otherwise.
dontWrapQtApps = true;
cmakeFlags = lib.optionals useQt6 [
"-DUSE_QT6=true"
];
postPatch = ''

View File

@ -1,19 +1,22 @@
{ mkDerivation
{ stdenv
, lib
, fetchFromGitHub
, nix-update-script
, cmake
, pkg-config
, adwaita-qt
, adwaita-qt6
, glib
, gtk3
, qtbase
, qtwayland
, pantheon
, substituteAll
, gsettings-desktop-schemas
, useQt6 ? false
}:
mkDerivation rec {
stdenv.mkDerivation rec {
pname = "qgnomeplatform";
version = "0.8.4";
@ -38,15 +41,24 @@ mkDerivation rec {
];
buildInputs = [
adwaita-qt
glib
gtk3
qtbase
] ++ lib.optionals (!useQt6) [
adwaita-qt
] ++ lib.optionals useQt6 [
adwaita-qt6
qtwayland
];
# Qt setup hook complains about missing `wrapQtAppsHook` otherwise.
dontWrapQtApps = true;
cmakeFlags = [
"-DGLIB_SCHEMAS_DIR=${glib.getSchemaPath gsettings-desktop-schemas}"
"-DQT_PLUGINS_DIR=${placeholder "out"}/${qtbase.qtPluginPrefix}"
] ++ lib.optionals useQt6 [
"-DUSE_QT6=true"
];
passthru = {

View File

@ -22562,6 +22562,10 @@ with pkgs;
qgnomeplatform = libsForQt5.callPackage ../development/libraries/qgnomeplatform { };
qgnomeplatform-qt6 = qt6Packages.callPackage ../development/libraries/qgnomeplatform {
useQt6 = true;
};
randomx = darwin.apple_sdk_11_0.callPackage ../development/libraries/randomx { };
remodel = callPackage ../development/tools/remodel {
@ -26435,6 +26439,10 @@ with pkgs;
adwaita-qt = libsForQt5.callPackage ../data/themes/adwaita-qt { };
adwaita-qt6 = qt6Packages.callPackage ../data/themes/adwaita-qt {
useQt6 = true;
};
adw-gtk3 = callPackage ../data/themes/adw-gtk3 { };
agave = callPackage ../data/fonts/agave { };