Add dim colours to qmltermwidget

This commit is contained in:
Alexander Bantyev 2023-02-18 22:57:44 +04:00
parent 4bca58e145
commit e52dcef401
No known key found for this signature in database
GPG Key ID: 48ABA304F3A30FE9
9 changed files with 226 additions and 21 deletions

View File

@ -635,11 +635,11 @@
"nixpkgs-regression": "nixpkgs-regression" "nixpkgs-regression": "nixpkgs-regression"
}, },
"locked": { "locked": {
"lastModified": 1676450680, "lastModified": 1676289739,
"narHash": "sha256-wOd+EPkY6VpxeIf+bCuV2lHleSoK0hI/hTsvJ6Ntf6Q=", "narHash": "sha256-bF7At5pQq1ggxwbYRSAgB36p+dzwDVpHpggl/xcWvaA=",
"owner": "nixos", "owner": "NixOS",
"repo": "nix", "repo": "nix",
"rev": "601849b95afc3d173ea34ff5dba6353f9b71b495", "rev": "c205d10c669137da90c176669838a6c6d9158939",
"type": "github" "type": "github"
}, },
"original": { "original": {

25
lib.nix
View File

@ -49,11 +49,36 @@ lib: rec {
F = f; F = f;
}; };
dec2hexDigits = lib.mapAttrs' (lib.flip lib.nameValuePair)
(builtins.mapAttrs (_: toString) hex2decDigits);
doubleDigitHexToDec = hex: doubleDigitHexToDec = hex:
16 * hex2decDigits."${builtins.substring 0 1 hex}" 16 * hex2decDigits."${builtins.substring 0 1 hex}"
+ hex2decDigits."${builtins.substring 1 2 hex}"; + hex2decDigits."${builtins.substring 1 2 hex}";
decToHex = n: dec2hexDigits.${toString (builtins.div n 16)} + dec2hexDigits.${toString (builtins.mod n 16)};
thmDec = builtins.mapAttrs (name: color: colorHex2Dec color); thmDec = builtins.mapAttrs (name: color: colorHex2Dec color);
thmHash = builtins.mapAttrs (name: color: "#${color}"); thmHash = builtins.mapAttrs (name: color: "#${color}");
triplet2RGB = lst: {
r = builtins.elemAt lst 0;
g = builtins.elemAt lst 1;
b = builtins.elemAt lst 2;
};
hex2RGB = color: triplet2RGB (map doubleDigitHexToDec (splitHex color));
dec2RGB = color: triplet2RGB (map (builtins.fromJSON) (lib.splitString "," color));
RGB2hex = { r, g, b }: decToHex r + decToHex g + decToHex b;
RGB2dec = { r, g, b }: lib.concatMapStringsSep "," toString [ r g b ];
mulRGB = factor: builtins.mapAttrs (_: x: builtins.floor (x * factor));
mulHex = factor: color: RGB2hex (mulRGB factor (hex2RGB color));
mulDec = factor: color: RGB2dec (mulRGB factor (dec2RGB color));
colorHex2Dec = color: colorHex2Dec = color:
builtins.concatStringsSep "," builtins.concatStringsSep ","
(map (x: toString (doubleDigitHexToDec x)) (splitHex color)); (map (x: toString (doubleDigitHexToDec x)) (splitHex color));

View File

@ -21,6 +21,7 @@
helix helix
angelfish angelfish
nix nix
qmlkonsole
kdeconnect kdeconnect
cursor cursor

View File

@ -139,11 +139,49 @@ in rec {
helix = inputs.helix.packages.${final.system}.default; helix = inputs.helix.packages.${final.system}.default;
plasma5Packages = prev.plasma5Packages.overrideScope' (final': _: { plasma5Packages = prev.plasma5Packages.overrideScope' (final': prev': {
qmlkonsole = final'.callPackage (final.fetchurl { qmltermwidget = prev'.qmltermwidget.overrideAttrs (_: {
url = src = final.fetchFromGitHub {
"https://raw.githubusercontent.com/NixOS/nixpkgs/551245d6c4636862f91ba4a0e94b8120b7e8d4d4/pkgs/applications/plasma-mobile/qmlkonsole.nix"; owner = "balsoft";
sha256 = "04vy12x0wjhr1c77dlhvghmlkb6aaq5dfqg1fwc5p6ma9nxqdwic"; repo = "qmltermwidget";
}) { }; rev = "39911727b7ce70a100aad84c1cdae9ab0ead1d6b";
hash = "sha256-Y+e9WjkXl38tbJq5D2BH0wJ0157yBiQ3vfRYO6rwnoU=";
};
patches = [ ];
});
qmlkonsole = final'.callPackage ({ lib, mkDerivation, cmake
, extra-cmake-modules, kconfig, ki18n, kirigami-addons, kirigami2
, kcoreaddons, qtquickcontrols2, kwindowsystem, qmltermwidget }:
mkDerivation {
pname = "qmlkonsole";
inherit ((final.callPackage
"${inputs.nixpkgs}/pkgs/applications/plasma-mobile/srcs.nix" {
mirror = "mirror://kde";
}).qmlkonsole)
version src;
nativeBuildInputs = [ cmake extra-cmake-modules ];
buildInputs = [
kconfig
ki18n
kirigami-addons
kirigami2
qtquickcontrols2
kcoreaddons
kwindowsystem
qmltermwidget
];
meta = with lib; {
description = "Terminal app for Plasma Mobile";
homepage = "https://invent.kde.org/plasma-mobile/qmlkonsole";
license = with licenses; [ gpl2Plus gpl3Plus cc0 ];
maintainers = with maintainers; [ balsoft ];
};
}) { };
}); });
} }

View File

@ -7,8 +7,6 @@
home-manager.users.balsoft = { home-manager.users.balsoft = {
xdg.configFile.angelfishrc.text = pkgs.lib.generators.toGitINI { xdg.configFile.angelfishrc.text = pkgs.lib.generators.toGitINI {
NavigationBar = { NavigationBar = {
navBarBack = true;
navBarForward = true;
navBarReload = true; navBarReload = true;
}; };
}; };

View File

@ -0,0 +1,142 @@
{ config, pkgs, lib, ... }: {
environment.systemPackages = [ pkgs.plasma5Packages.qmlkonsole ];
defaultApplications.term = {
cmd = "${pkgs.plasma5Packages.qmlkonsole}/bin/qmlkonsole";
desktop = "org.kde.qmlkonsole";
};
environment.variables.COLORSCHEMES_DIRS = pkgs.writeTextFile {
name = "qmlkonsole-generated-theme";
destination = "/Generated.colorscheme";
text = with pkgs.my-lib;
with (thmDec config.themes.colors);
let dim = mulDec 0.66;
in lib.generators.toGitINI {
General.Description = "Generated Color Scheme";
Background = {
Bold = false;
Color = base00;
};
BackgroundIntense = {
Bold = false;
Color = base03;
};
Color0 = {
Bold = false;
Color = base00;
};
Color1 = {
Bold = false;
Color = base08;
};
Color2 = {
Bold = false;
Color = base0B;
};
Color3 = {
Bold = false;
Color = base0A;
};
Color4 = {
Bold = false;
Color = base0D;
};
Color5 = {
Bold = false;
Color = base0E;
};
Color6 = {
Bold = false;
Color = base0C;
};
Color7 = {
Bold = false;
Color = base07;
};
Foreground = {
Bold = false;
Color = base05;
};
Color0Faint = {
Bold = false;
Color = dim base00;
};
Color1Faint = {
Bold = false;
Color = dim base08;
};
Color2Faint = {
Bold = false;
Color = dim base0B;
};
Color3Faint = {
Bold = false;
Color = dim base0A;
};
Color4Faint = {
Bold = false;
Color = dim base0D;
};
Color5Faint = {
Bold = false;
Color = dim base0E;
};
Color6Faint = {
Bold = false;
Color = dim base0C;
};
Color7Faint = {
Bold = false;
Color = dim base07;
};
ForegroundFaint = {
Bold = false;
Color = dim base05;
};
Color0Intense = {
Bold = false;
Color = base00;
};
Color1Intense = {
Bold = false;
Color = base08;
};
Color2Intense = {
Bold = false;
Color = base0B;
};
Color3Intense = {
Bold = false;
Color = base0A;
};
Color4Intense = {
Bold = false;
Color = base0D;
};
Color5Intense = {
Bold = false;
Color = base0E;
};
Color6Intense = {
Bold = false;
Color = base0C;
};
Color7Intense = {
Bold = false;
Color = base07;
};
ForegroundIntense = {
Bold = false;
Color = base05;
};
};
};
home-manager.users.balsoft = {
xdg.configFile.qmlkonsolerc.text = lib.generators.toGitINI {
General = {
colorScheme = "Generated";
fontFamily = config.themes.fonts.mono.family;
fontSize = config.themes.fonts.mono.size;
};
};
};
}

View File

@ -8,16 +8,11 @@
optimise.automatic = true; optimise.automatic = true;
extraOptions = ''
builders-use-substitutes = true
# Enable flakes
experimental-features = nix-command flakes
# Prevent Nix from fetching the registry every time
flake-registry = ${inputs.flake-registry}/flake-registry.json
'';
settings = { settings = {
use-xdg-base-directories = true; use-xdg-base-directories = true;
builders-use-substitutes = true;
flake-registry = "${inputs.flake-registry}/flake-registry.json";
experimental-features = [ "nix-command" "flakes" ];
trusted-users = [ "root" "balsoft" "@wheel" ]; trusted-users = [ "root" "balsoft" "@wheel" ];
trusted-public-keys = [ trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="

View File

@ -25,6 +25,12 @@
powerManagement.enable = true; powerManagement.enable = true;
home-manager.users.balsoft = { home-manager.users.balsoft = {
home.activation.removeGtkRc = {
data = "rm $HOME/.gtkrc-2.0";
before = [ "checkLinkTargets" ];
after = [];
};
xdg.configFile."autostart/org_kde_powerdevil.desktop".text = '' xdg.configFile."autostart/org_kde_powerdevil.desktop".text = ''
[Desktop Entry] [Desktop Entry]
DBusActivatable=true DBusActivatable=true

View File

@ -156,7 +156,7 @@
if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then
# The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE # The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE
# ornaments defined above. # ornaments defined above.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=238 typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=8
# Start filler from the edge of the screen if there are no left segments on the first line. # Start filler from the edge of the screen if there are no left segments on the first line.
typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}'
# End filler on the edge of the screen if there are no right segments on the first line. # End filler on the edge of the screen if there are no right segments on the first line.