Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for KDE / Qt apps #51

Closed
danth opened this issue Mar 1, 2023 · 16 comments
Closed

Support for KDE / Qt apps #51

danth opened this issue Mar 1, 2023 · 16 comments
Labels
feature A new feature or a feature request

Comments

@danth
Copy link
Owner

danth commented Mar 1, 2023

Kvantum might be relevant.

@danth danth added the feature A new feature or a feature request label Mar 1, 2023
@CRTified
Copy link
Contributor

plasma-manager might be helpful here, as well.

@baduhai
Copy link
Contributor

baduhai commented Mar 18, 2023

Actually enabling the colour scheme could be as simple as a user systemd oneshot service, triggered on login and on system rebuild, that calls plasma-apply-colorscheme and the path to the colour scheme. Actually generating a qt colour scheme from a base 16 template is another story though, maybe this project would be able to help.

@ca5ua1
Copy link
Contributor

ca5ua1 commented May 6, 2023

Btw Themix/Oomox can theme QT apps by exporting base16 colors to ~/.config/Trolltech.conf. Themix -> in right-upper corner arrow down -> Base16... -> Application: kde -> export path: ~/.config/Trolltech.conf

@ca5ua1
Copy link
Contributor

ca5ua1 commented May 9, 2023

Folks, I've spend time and have ALMOST perfect QT solution. Hope you will help me out.

First we have following in home-manager user config

home.file = {
	".config/qt5ct/colors/oomox-current.conf".source = config.lib.stylix.colors {
	        template = builtins.readFile ./dotfiles/qt5ct/oomox-current.conf.mustache;
	        extension = ".conf";
	      };
    ".config/qt5ct/qt5ct.conf".text = pkgs.lib.mkBefore (builtins.readFile ./dotfiles/qt5ct/qt5ct.conf);
    ".config/kdeglobals".source = ./dotfiles/kdeglobals;
};
home.packages = with pkgs; [
     qt5ct pkgs.libsForQt5.breeze-qt5
];
home.sessionVariables = {
    QT_QPA_PLATFORMTHEME="qt5ct";
  };
qt = {
    enable = true;
      style.package = pkgs.libsForQt5.breeze-qt5;
      style.name = "breeze-dark";
  };

kdeglobals


[Colors:Header]
BackgroundAlternate=42,46,50
BackgroundNormal=49,54,59
DecorationFocus=61,174,233
DecorationHover=61,174,233
ForegroundActive=61,174,233
ForegroundInactive=161,169,177
ForegroundLink=29,153,243
ForegroundNegative=218,68,83
ForegroundNeutral=246,116,0
ForegroundNormal=252,252,252
ForegroundPositive=39,174,96
ForegroundVisited=155,89,182

[KDE]
LookAndFeelPackage=org.kde.breezedark.desktop



[Colors:View]
BackgroundAlternate=35,38,41
BackgroundNormal=27,30,32
DecorationFocus=61,174,233
DecorationHover=61,174,233
ForegroundActive=61,174,233
ForegroundInactive=161,169,177
ForegroundLink=29,153,243
ForegroundNegative=218,68,83
ForegroundNeutral=246,116,0
ForegroundNormal=252,252,252
ForegroundPositive=39,174,96
ForegroundVisited=155,89,182

oomox-current.conf.mustache

#               FG              BTN_BG bright less brdark        less da     txt fg               br text              btn fg           txt bg     bg     shadow   sel bg     sel fg     link       visited           alt bg default          tooltip bg  tooltip_fg
[ColorScheme]
  active_colors=#{{base0F-hex}},          #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base0F-hex}},           #{{base0F-hex}},           #{{base0F-hex}},           #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base01-hex}}, #{{base00-hex}}, #{{base01-hex}}, #{{base0F-hex}},            #{{base00-hex}}, #{{base0F-hex}},           181b24,  #{{base0F-hex}}
disabled_colors=#767081, #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #767081,  #767081,  #767081,  #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base01-hex}}, #{{base00-hex}}, #{{base01-hex}}, #767081,   #{{base00-hex}}, #767081,  #{{base00-hex}}, #767081
inactive_colors=#{{base0F-hex}},          #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base0F-hex}},           #{{base0F-hex}},           #{{base0F-hex}},           #{{base00-hex}}, #{{base00-hex}}, #{{base00-hex}}, #{{base01-hex}}, #{{base00-hex}}, #{{base01-hex}}, #{{base0F-hex}},            #{{base00-hex}}, #{{base0F-hex}},           #{{base00-hex}}, #{{base0F-hex}}

#               FG              BTN_BG     bright   less br  dark     less da  txt fg               br text  btn fg     txt bg     bg     shadow   sel bg     sel fg     link       visite alt bg default  tooltip bg  tooltip_fg
#  active_colors=#{{base0F-hex}},          #{{base02-hex}}, #{{base00-hex}}, #cbc7c4, #9f9d9a, #b8b5b2, #{{base0F-hex}},           #ff0000, #{{base0F-hex}}, #{{base00-hex}}, #{{base00-hex}}, #767472, #{{base01-hex}}, #{{base00-hex}}, #{{base01-hex}}, #{{base0F-hex}},            #{{base00-hex}}, #{{base0F-hex}},           181b24, #{{base0F-hex}}
#disabled_colors=#767081, #{{base02-hex}}, #{{base00-hex}}, #cbc7c4, #9f9d9a, #b8b5b2, #767081,  #ffec17, #{{base0F-hex}}, #{{base00-hex}}, #{{base00-hex}}, #767472, #{{base01-hex}}, #{{base00-hex}}, #{{base01-hex}}, #767081,   #{{base00-hex}}, #767081,  #{{base00-hex}}, #767081
#inactive_colors=#{{base0F-hex}},          #{{base02-hex}}, #{{base00-hex}}, #cbc7c4, #9f9d9a, #b8b5b2, #{{base0F-hex}},           #ff9040, #{{base0F-hex}}, #{{base00-hex}}, #{{base00-hex}}, #767472, #{{base01-hex}}, #{{base00-hex}}, #{{base01-hex}}, #{{base0F-hex}},            #{{base00-hex}}, #{{base0F-hex}},           #{{base00-hex}}, #{{base0F-hex}}

qt5ct.conf

[Appearance]
color_scheme_path=~/.config/qt5ct/colors/oomox-current.conf
custom_palette=true
icon_theme=oomox-current
standard_dialogs=kde
style=Breeze

#[Fonts]
#fixed="Noto Sans,10,-1,0,50,0,0,0,0,0"
#general="Noto Sans,10,-1,0,50,0,0,0,0,0"

[Interface]
activate_item_on_single_click=1
buttonbox_layout=2
cursor_flash_time=1000
dialog_buttons_have_icons=1
double_click_interval=400
gui_effects=@Invalid()
keyboard_scheme=2
menus_have_icons=true
show_shortcuts_in_context_menus=true
stylesheets=@Invalid()
toolbutton_style=4
underline_shortcut=1
wheel_scroll_lines=3

#[PaletteEditor]
#geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x1t\0\0\x1\x83\0\0\x4\x7f\0\0\x4\x9c\0\0\x1t\0\0\x1\x83\0\0\x3\xea\0\0\x3\x93\0\0\0\0\x2\0\0\0\n\0\0\0\x1t\0\0\x1\x83\0\0\x4\x7f\0\0\x4\x9c)

#[SettingsWindow]
#geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\x6\x9a\0\0\x5\x65\0\0\0\0\0\0\0\0\0\0\x2\xde\0\0\x2\xbb\0\0\0\0\x2\0\0\0\n\0\0\0\0\0\0\0\0\0\0\0\x6\x9a\0\0\x5\x65)

[Troubleshooting]
force_raster_widgets=1
ignored_applications=@Invalid()

Main problem as you may guess is kdeglobals - It have hardcoded RGB colors and I have no idea how to get RGB background color from Stylix. Have any ideas?
Besides that tooltip icons black instead of white.

Btw - It's for QT apps, not entire KDE Plasma (thou should work in some extent)

@danth
Copy link
Owner Author

danth commented May 10, 2023

This is looking great! Please do create a pull request.

Something like {{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}} should work for kdeglobals.

https://github.com/tinted-theming/home/blob/main/builder.md#template-variables

@ca5ua1
Copy link
Contributor

ca5ua1 commented May 14, 2023

Thanks!

It was great help and thank to theemix team for making this - https://github.com/themix-project/themix-plugin-base16/blob/master/templates_extra/kde/templates/default.mustache

So I just pasted close to appropriate values:

Trolltech.conf.mustache

[ColorEffects:Disabled]
Color=56,56,56
ColorAmount=0
ColorEffect=0
ContrastAmount=0.65
ContrastEffect=1
IntensityAmount=0.1
IntensityEffect=2

[ColorEffects:Inactive]
ChangeSelectionColor=true
Color=112,111,110
ColorAmount=0.025
ColorEffect=2
ContrastAmount=0.1
ContrastEffect=2
Enable=false
IntensityAmount=0
IntensityEffect=0

[Colors:Button]
BackgroundNormal={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNormal={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
BackgroundAlternate={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationFocus={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationHover={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundActive={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundInactive=127,140,141
ForegroundLink={{base03-rgb-r}},{{base03-rgb-g}},{{base03-rgb-b}}
ForegroundNegative={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNeutral={{base02-rgb-r}},{{base02-rgb-g}},{{base02-rgb-b}}
ForegroundPositive={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundVisited=127,140,141

[Colors:Complementary]
BackgroundAlternate=59,64,69
BackgroundNormal=49,54,59
DecorationFocus={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationHover={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundActive={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundInactive=175,176,179
ForegroundLink={{base03-rgb-r}},{{base03-rgb-g}},{{base03-rgb-b}}
ForegroundNegative={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNeutral={{base02-rgb-r}},{{base02-rgb-g}},{{base02-rgb-b}}
ForegroundNormal=239,240,241
ForegroundPositive={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundVisited=61,174,230

[Colors:Selection]
BackgroundNormal={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNormal={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
BackgroundAlternate=255,0,0
DecorationFocus=0,255,0
DecorationHover=0,0,255
ForegroundActive=252,0,0
ForegroundInactive=0,240,0
ForegroundLink={{base03-rgb-r}},{{base03-rgb-g}},{{base03-rgb-b}}
ForegroundNegative={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNeutral={{base02-rgb-r}},{{base02-rgb-g}},{{base02-rgb-b}}
ForegroundPositive={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundVisited=189,195,0

[Colors:Tooltip]
BackgroundAlternate={{themix_BG-rgb-r}},{{themix_BG-rgb-g}},{{themix_BG-rgb-b}}
BackgroundNormal={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationFocus={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationHover={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundActive={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundInactive=189,195,199
ForegroundLink={{base03-rgb-r}},{{base03-rgb-g}},{{base03-rgb-b}}
ForegroundNegative={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNeutral={{base02-rgb-r}},{{base02-rgb-g}},{{base02-rgb-b}}
BackgroundNormal={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundPositive={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundVisited=127,140,141

[Colors:View]
BackgroundAlternate={{themix_BG-rgb-r}},{{themix_BG-rgb-g}},{{themix_BG-rgb-b}}
BackgroundNormal={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationFocus={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationHover={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundActive={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundInactive=127,140,141
ForegroundLink={{base03-rgb-r}},{{base03-rgb-g}},{{base03-rgb-b}}
ForegroundNegative={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNeutral={{base02-rgb-r}},{{base02-rgb-g}},{{base02-rgb-b}}
ForegroundNormal={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundPositive={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundVisited=127,140,141

[Colors:Window]
BackgroundAlternate={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
BackgroundNormal={{themix_BG-rgb-r}},{{themix_BG-rgb-g}},{{themix_BG-rgb-b}}
DecorationFocus={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
DecorationHover={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundActive={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundInactive=127,140,141
ForegroundLink={{base03-rgb-r}},{{base03-rgb-g}},{{base03-rgb-b}}
ForegroundNegative={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
ForegroundNeutral={{base02-rgb-r}},{{base02-rgb-g}},{{base02-rgb-b}}
ForegroundNormal={{themix_FG-rgb-r}},{{themix_FG-rgb-g}},{{themix_FG-rgb-b}}
ForegroundPositive={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
ForegroundVisited=127,140,141

[General]
ColorScheme=Breeze
Name={{scheme-name}}
shadeSortColumn=true

[KDE]
contrast=4

[WM]
activeBlend={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
activeBackground={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
activeForeground={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}
inactiveBlend={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
inactiveBackground={{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}}
inactiveForeground={{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}}

and in home.nix:

home.file = {
	".config/qt5ct/colors/oomox-current.conf".source = config.lib.stylix.colors {
	        template = builtins.readFile ./dotfiles/qt5ct/oomox-current.conf.mustache;
	        extension = ".conf";
	      };
    ".config/Trolltech.conf".source = config.lib.stylix.colors {
	        template = builtins.readFile ./dotfiles/Trolltech.conf.mustache;
	        extension = ".conf";
	      };
    ".config/kdeglobals".source = config.lib.stylix.colors {
	        template = builtins.readFile ./dotfiles/Trolltech.conf.mustache;
	        extension = "";
	      };
    ".config/qt5ct/qt5ct.conf".text = pkgs.lib.mkBefore (builtins.readFile ./dotfiles/qt5ct/qt5ct.conf);
};
home.packages = with pkgs; [
     qt5ct pkgs.libsForQt5.breeze-qt5
];
home.sessionVariables = {
    QT_QPA_PLATFORMTHEME="qt5ct";
  };
qt = {
    enable = true;
      style.package = pkgs.libsForQt5.breeze-qt5;
      style.name = "breeze-dark";
  };

Thou it still isn't proper solution because kate for some reason don't like this approach and ends in having semi-breeze semi-base16 colors. I guess that's because kate (as far as I know) was updated with with newer qt6 libraries and I have no idea why they doesn't like qt5ct... I guess I should place proper "breeze"-base16 theme as prescribed in Trolltech.conf. So, there is still things to do

@SomeGuyNamedMay
Copy link
Contributor

@Casul51 any progress on this if you dont mind me asking?

@ca5ua1
Copy link
Contributor

ca5ua1 commented Jun 4, 2023

@Casul51 any progress on this if you dont mind me asking?

Don't have time right now :(

@danth danth closed this as completed in f5c5e02 Jul 8, 2023
@danth
Copy link
Owner Author

danth commented Jul 8, 2023

@Casul51 Thanks for your work on this - I found it looks better if we remove qt5ct and configure everything through kdeglobals. I tweaked the colour choices to match the new style guide and it's now available on master.

Kate is still missing some styles as you mentioned - I think it needs a separate configuration file.

@lovesegfault
Copy link
Contributor

This broke eval for my config:

 error:
       … while evaluating a branch condition

         at /nix/store/b6028bvfc4fvg8qvlqvvj4ldqwalc9cs-source/lib/attrsets.nix:600:13:

          599|             name: value:
          600|             if isAttrs value && cond value
             |             ^
          601|               then recurse (path ++ [name]) value

       … in the left operand of the AND (&&) operator

         at /nix/store/b6028bvfc4fvg8qvlqvvj4ldqwalc9cs-source/lib/attrsets.nix:600:30:

          599|             name: value:
          600|             if isAttrs value && cond value
             |                              ^
          601|               then recurse (path ++ [name]) value

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: The option `home-manager.users.bemeurer.qt.style.name' has conflicting definition values:
       - In `/nix/store/ws9a0ar7k27zfg4ljx2j92pfglkl7645-modules/kde/hm.nix': "breeze"
       - In `/home/runner/work/nix-config/nix-config/users/bemeurer/graphical/linux.nix': "adwaita"
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.
       ```

I know I can solve it with `mkForce`, but it's not clear to my why that attr is being set at all when I do not use KDE.

@ca5ua1
Copy link
Contributor

ca5ua1 commented Jul 9, 2023

It works for me but most of my apps aren't using theme or using it partially.qt5ct is more ugly but more reliable thou I don't want switch it back :D

Gonna try to combine with breeze-dark to don't kill my eyes with so much white

@danth
Copy link
Owner Author

danth commented Jul 9, 2023

it's not clear to my why that attr is being set at all when I do not use KDE

Within Home Manager there's no way to detect which desktop environment is in use, so it's enabled by default.

most of my apps aren't using theme or using it partially

Maybe one of us has some imperative config left over in our home directory.

@ca5ua1
Copy link
Contributor

ca5ua1 commented Jul 10, 2023

For me it's like on picture:

image
okular fits theme + keepass don't fit at all (isn't on picture)

I've tried to delete all QT / KDE relative config files and it didn't helped at all. I will try to run on separate user when I have more time

@ca5ua1
Copy link
Contributor

ca5ua1 commented Sep 5, 2023

I found out my culprit: kdeglobals - file doesn't exist. And I have no idea why...

@NovaViper
Copy link

Hey is there integration for SDDM, KDE's lockscreen manager?

@danth
Copy link
Owner Author

danth commented Mar 20, 2024

@NovaViper see #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature or a feature request
Projects
None yet
Development

No branches or pull requests

7 participants