Palette library integrated + polybar and alacritty
This commit is contained in:
parent
a61bfe3c50
commit
ef5b48d142
17 changed files with 1090 additions and 214 deletions
303
extra/color/default.nix
Normal file
303
extra/color/default.nix
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
{ pkgs, lib ? pkgs.lib, hex, float, ... }:
|
||||
let
|
||||
inherit (builtins) isInt isString isFloat trace div isAttrs hasAttr;
|
||||
inherit (lib.trivial) min max;
|
||||
inherit (lib.lists) head tail drop last;
|
||||
inherit (lib.strings) concatMapStrings fixedWidthString match toLower toInt;
|
||||
|
||||
## OPERATORS
|
||||
# Module operator implementation for floats
|
||||
div' = n: d: float.floor (div (float.ensureFloat n) (float.ensureFloat d));
|
||||
mod' = n: d:
|
||||
let
|
||||
f = div' n d;
|
||||
in
|
||||
n - (float.fromInt f) * d;
|
||||
|
||||
# Absolute operator implementation
|
||||
_abs = v: if v < 0 then (-v) else v;
|
||||
|
||||
# Check if `v` is between `a` and `b`
|
||||
_inRange = a: b: v: (v <= max a b) && (v >= min a b);
|
||||
|
||||
# Clamp `v` between `a` and `v`
|
||||
_clamp = a: b: v: min (max v (min a b)) (max a b);
|
||||
|
||||
## 8BIT
|
||||
# Check if `v` is in 8Bit format
|
||||
_is8Bit = v: _inRange 0.0 255.0 v;
|
||||
|
||||
# Clamp 8bit value
|
||||
_clamp8Bit = _clamp 0.0 255.0;
|
||||
|
||||
# Apply function to 8bit value and clamp the result
|
||||
_tclamp8Bit = f: v: _clamp8Bit (f v);
|
||||
|
||||
## UNARY
|
||||
# Check if input is in [0, 1]
|
||||
_isUnary = _inRange 0.0 1.0;
|
||||
|
||||
# Clamp input to [0, 1]
|
||||
_clampUnary = _clamp 0.0 1.0;
|
||||
|
||||
# Apply function to unary value and clamp the result
|
||||
_tclampUnary = f: v: _clampUnary (f v);
|
||||
|
||||
|
||||
# Check if input is in [0, 360]
|
||||
_isHue = _inRange 0.0 360.0;
|
||||
|
||||
# Apply function to hue value and map the result in [0, 360)
|
||||
_tHue = f: v: mod' (f v) 360.0;
|
||||
|
||||
# RGB constructor
|
||||
_rgba = { r, g, b, a ? 255.0 }:
|
||||
assert (_is8Bit r);
|
||||
assert (_is8Bit g);
|
||||
assert (_is8Bit b);
|
||||
{ inherit r g b a; };
|
||||
|
||||
# HSLA constructor
|
||||
_hsla = { h, l, s ? 1.0, a ? 255.0 }:
|
||||
assert (_inRange 0.0 360.0 h);
|
||||
assert (_isUnary s);
|
||||
assert (_isUnary l);
|
||||
assert (_isUnary a);
|
||||
{ inherit h s l a; };
|
||||
|
||||
in
|
||||
rec {
|
||||
|
||||
inherit div' mod' _abs _inRange _clamp _is8Bit _clamp8Bit _tclamp8Bit _isUnary _clampUnary _tclampUnary _tHue _rgba _hsla;
|
||||
|
||||
rgba = _rgba;
|
||||
|
||||
isRgba = c: if isAttrs c && hasAttr "r" c && hasAttr "g" c && hasAttr "b" c && hasAttr "a" c then
|
||||
0 <= c.r && c.r <= 255 && 0 <= c.g && c.g <= 255 && 0 <= c.b && c.b <= 255 && 0 <= c.a && c.a <= 255
|
||||
else false;
|
||||
|
||||
hsla = _hsla;
|
||||
|
||||
isHsla = c: if isAttrs c hasAttr "h" c && hasAttr "s" c && hasAttr "l" c && hasAttr "a" c then
|
||||
0 <= c.h && c.h <= 255 && 0 <= c.s && c.s <= 255 && 0 <= c.l && c.l <= 255 && 0 <= c.a && c.a <= 255
|
||||
else false;
|
||||
|
||||
## CONVERSION
|
||||
# RGB to HSL
|
||||
rgbaToHsla = color:
|
||||
let
|
||||
c_color = _rgba color;
|
||||
r = c_color.r / 255.0;
|
||||
g = c_color.g / 255.0;
|
||||
b = c_color.b / 255.0;
|
||||
a = c_color.a / 255.0;
|
||||
c_min = min (min r g) b;
|
||||
c_max = max (max r g) b;
|
||||
delta = c_max - c_min;
|
||||
|
||||
hue = (
|
||||
if delta == 0.0 then 0.0 else
|
||||
if r == c_max then (mod' (((g - b) / delta) + 6) 6) else
|
||||
if g == c_max then (b - r) / delta + 2 else
|
||||
assert b == c_max; (r - g) / delta + 4
|
||||
) * 60;
|
||||
lightness = (c_min + c_max) / 2.0;
|
||||
saturation =
|
||||
if delta == 0.0 then 0.0 else
|
||||
delta / (1 - _abs (2.0 * lightness - 1.0));
|
||||
in
|
||||
assert (isRgba color);
|
||||
_hsla {
|
||||
l = _clampUnary lightness;
|
||||
s = _clampUnary saturation;
|
||||
h = mod' hue 360.0;
|
||||
a = _clampUnary a;
|
||||
};
|
||||
|
||||
# HSL to RGB
|
||||
hslToRgb = color:
|
||||
let
|
||||
# check if `v` is in [a, b)
|
||||
_checkRange = a: b: v: a <= v && v < b;
|
||||
c_color = _hsla color;
|
||||
h = c_color.h;
|
||||
s = c_color.s;
|
||||
l = c_color.l;
|
||||
a = c_color.a;
|
||||
c = (1 - (_abs (2 * l - 1))) * s;
|
||||
x = c * (1 - _abs ((mod' (h / 60) 2) - 1));
|
||||
m = l - (c / 2.0);
|
||||
|
||||
r' = if _inRange 120 240 h then 0 else
|
||||
if _inRange 60 300 h then x else
|
||||
c;
|
||||
g' = if _inRange 60 180 h then c else
|
||||
if _inRange 0 240 h then x else
|
||||
0;
|
||||
b' = if _inRange 180 300 h then c else
|
||||
if _inRange 120 360 h then x else
|
||||
0;
|
||||
in
|
||||
assert (isHsla);
|
||||
_rgba {
|
||||
r = _clamp8Bit ((r' + m) * 255.0);
|
||||
g = _clamp8Bit ((g' + m) * 255.0);
|
||||
b = _clamp8Bit ((b' + m) * 255.0);
|
||||
a = _clamp8Bit (a * 255.0);
|
||||
};
|
||||
|
||||
## TRANSFORM
|
||||
|
||||
tRedRgba = f: color: assert (isRgba color); color // { r = _tclamp8Bit f color.r; };
|
||||
tGreenRgba = f: color: assert (isRgba color); color // { g = _tclamp8Bit f color.g; };
|
||||
tBlueRgba = f: color: assert (isRgba color); color // { b = _tclamp8Bit f color.b; };
|
||||
tAlphaRgba = f: color: assert (isRgba color); color // { a = _tclamp8Bit f color.a; };
|
||||
|
||||
setRedRgba = r: color: tGreenRgba (v: r) color;
|
||||
setGreenRgba = g: color: tBlueRgba (v: g) color;
|
||||
setBlueRgba = b: color: tAlphaRgba (v: b) color;
|
||||
setAlphaRgba = a: color: tRedRgba (v: a) color;
|
||||
|
||||
tRedHsla = f: color: assert (isHsla color); color // { h = _tHue f color.h; };
|
||||
tGreenHsla = f: color: assert (isHsla color); color // { s = _tclampUnary f color.s; };
|
||||
tBlueHsla = f: color: assert (isHsla color); color // { l = _tclampUnary f color.l; };
|
||||
tAlphaHsla = f: color: assert (isHsla color); color // { a = _tclampUnary f color.a; };
|
||||
|
||||
setRedHsla = h: color: tGreenHsla (v: h) color;
|
||||
setGreenHsla = s: color: tBlueHsla (v: s) color;
|
||||
setBlueHsla = l: color: tAlphaHsla (v: l) color;
|
||||
setAlphaHsla = a: color: tRedHsla (v: a) color;
|
||||
|
||||
## RGB TRANSFORM
|
||||
# Add brightness value as integer value or percent value
|
||||
brighten = color: value:
|
||||
let
|
||||
directValue = if isInt value || isFloat value then value else null;
|
||||
positiveMatches = match "([[:digit:]]+)%" value;
|
||||
negativeMatches = match "-([[:digit:]]+)%" value;
|
||||
percentValue =
|
||||
if positiveMatches != null then toInt (head positiveMatches)
|
||||
else if negativeMatches != null then (-toInt (head negativeMatches))
|
||||
else null;
|
||||
valueTransform = v:
|
||||
if directValue != null then _clamp8Bit (v + directValue)
|
||||
else _clamp8Bit (v * (100.0 + percentValue) / 100.0);
|
||||
in
|
||||
tBlueRgba valueTransform (tGreenRgba valueTransform (tRedRgba valueTransform color));
|
||||
|
||||
darken = color: value:
|
||||
let
|
||||
directValue = if isInt value || isFloat value then value else null;
|
||||
positiveMatches = match "([[:digit:]]+)%" value;
|
||||
negativeMatches = match "-([[:digit:]]+)%" value;
|
||||
percentValue =
|
||||
if positiveMatches != null then toInt (head positiveMatches)
|
||||
else if negativeMatches != null then (-toInt (head negativeMatches))
|
||||
else null;
|
||||
valueTransform = v:
|
||||
if directValue != null then _clamp8Bit (v - directValue)
|
||||
else _clamp8Bit (v * (100.0 - percentValue) / 100.0);
|
||||
in
|
||||
tBlueRgba valueTransform (tGreenRgba valueTransform (tRedRgba valueTransform color));
|
||||
|
||||
## DESERIALIZATION
|
||||
# Parse a hex color string to a RGBA color
|
||||
hexToRgba = s:
|
||||
let
|
||||
rgba = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
||||
rgb = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
||||
hex_list = (if isNull rgb then rgba else rgb ++ [ "FF" ]);
|
||||
values = map (s: float.fromInt (hex.toDec s)) hex_list;
|
||||
in
|
||||
_rgba {
|
||||
r = head values;
|
||||
g = head (tail values);
|
||||
b = head (drop 2 values);
|
||||
a = last values;
|
||||
};
|
||||
|
||||
# Parse a hex color string to a HSLA color
|
||||
hexToHsla = s:
|
||||
let
|
||||
hsla = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
||||
hsl = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
||||
hex_list = (if isNull hsl then hsla else hsl ++ [ "FF" ]);
|
||||
values = map (s: float.fromInt (hex.toDec s)) hex_list;
|
||||
in
|
||||
_hsla {
|
||||
h = head values;
|
||||
s = head (tail values);
|
||||
l = head (drop 2 values);
|
||||
a = last values;
|
||||
};
|
||||
|
||||
|
||||
## SERIALIZATION
|
||||
# Print RGB color as uppercase hex string
|
||||
toRGBHex = color:
|
||||
let
|
||||
inherit (color) r g b;
|
||||
in
|
||||
assert (isRgba color);
|
||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ r g b ]}'';
|
||||
|
||||
# Print RGBA color as uppercase hex string
|
||||
toRGBAHex = color:
|
||||
let
|
||||
inherit (color) r g b a;
|
||||
in
|
||||
assert (isRgba color);
|
||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ r g b a ]}'';
|
||||
|
||||
# Print RGBA color as uppercase hex string in the form ARGB (Polybar uses this format)
|
||||
toARGBHex = color:
|
||||
let
|
||||
inherit (color) r g b a;
|
||||
in
|
||||
assert (isRgba color);
|
||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ a r g b ]}'';
|
||||
|
||||
|
||||
# Print RGB color as lowercase hex string
|
||||
toRgbHex = color: toLower (toRGBHex color);
|
||||
|
||||
# Print RGBA color as lowercase hex string
|
||||
toRgbaHex = color: toLower (toRGBAHex color);
|
||||
|
||||
# Print RGBA color as lowercase hex string in the form argb (Polybar uses this format)
|
||||
toArgbHex = color: toLower (toArgbHex color);
|
||||
|
||||
# Print RGB color as uppercase hex string
|
||||
toHSLHex = color:
|
||||
let
|
||||
inherit (color) h s l;
|
||||
in
|
||||
assert (isHsla color);
|
||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ h s l ]}'';
|
||||
|
||||
# Print HSLA color as uppercase hex string
|
||||
toHSLAHex = color:
|
||||
let
|
||||
inherit (color) h s l a;
|
||||
in
|
||||
assert (isHsla color);
|
||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ h s l a ]}'';
|
||||
|
||||
# Print HSL color as lowercase hex string
|
||||
toHslHex = color: toLower (toHSLHex color);
|
||||
|
||||
# Print HSLA color as lowercase hex string
|
||||
toHslaHex = color: toLower (toHSLAHex color);
|
||||
|
||||
|
||||
## CONSTANTS
|
||||
black = hexToRgba "#000000"; # RGB (0,0,0) HSL (0°,0%,0%)
|
||||
white = hexToRgba "#FFFFFF"; # RGB (255,255,255) HSL (0°,0%,100%)
|
||||
red = hexToRgba "#FF0000"; # RGB (255,0,0) HSL (0°,100%,50%)
|
||||
green = hexToRgba "#00FF00"; # RGB (0,255,0) HSL (120°,100%,50%)
|
||||
blue = hexToRgba "#0000FF"; # RGB (0,0,255) HSL (240°,100%,50%)
|
||||
yellow = hexToRgba "#FFFF00"; # RGB (255,255,0) HSL (60°,100%,50%)
|
||||
cyan = hexToRgba "#00FFFF"; # RGB (0,255,255) HSL (180°,100%,50%)
|
||||
magenta = hexToRgba "#FF00FF"; # RGB (255,0,255) HSL (300°,100%,50%)
|
||||
transparent = hexToRgba "#00000000"; # RGBA (0,0,0,0) HSLA (0°,0%,0%,0%)
|
||||
}
|
||||
15
extra/default.nix
Normal file
15
extra/default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ system ? builtins.currentSystem
|
||||
, pkgs ? import <nixpkgs> {}
|
||||
, lib ? pkgs.lib
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
callPackage = lib.callPackageWith (pkgs // self);
|
||||
self = rec {
|
||||
float = callPackage ./float {};
|
||||
hex = callPackage ./hex {};
|
||||
color = callPackage ./color {};
|
||||
palette = callPackage ./palette {};
|
||||
};
|
||||
in
|
||||
(self)
|
||||
45
extra/float/default.nix
Normal file
45
extra/float/default.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{ pkgs, lib ? pkgs.lib, ... }:
|
||||
let
|
||||
inherit (builtins) head tail isFloat isInt;
|
||||
inherit (lib.strings) toInt match splitString;
|
||||
floatComponents = f: splitString "." (toString f);
|
||||
in
|
||||
rec {
|
||||
|
||||
# Force a number to be a float (hacky but works)
|
||||
ensureFloat = v:
|
||||
assert (isInt v || isFloat v);
|
||||
v + 0.1 - 0.1;
|
||||
|
||||
# Convert integer to float (hacky but it works)
|
||||
fromInt = i:
|
||||
assert isInt i;
|
||||
ensureFloat i;
|
||||
|
||||
# Round float to upper integer
|
||||
ceil = f:
|
||||
let
|
||||
comp = floatComponents f;
|
||||
int = toInt (head comp);
|
||||
inc = if match "[1-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0;
|
||||
in
|
||||
assert(isFloat f);
|
||||
int + inc;
|
||||
|
||||
# Round float to lower integer
|
||||
floor = f:
|
||||
let
|
||||
int = toInt (head (floatComponents f));
|
||||
in
|
||||
assert(isFloat f);
|
||||
int;
|
||||
|
||||
# Round float to closest integer
|
||||
round = f:
|
||||
let
|
||||
comp = floatComponents (ensureFloat f);
|
||||
int = toInt (head comp);
|
||||
inc = if match "[5-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0;
|
||||
in
|
||||
int + inc;
|
||||
}
|
||||
46
extra/hex/default.nix
Normal file
46
extra/hex/default.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{ pkgs, lib ? pkgs.lib, ... }:
|
||||
let
|
||||
inherit (lib.trivial) toHexString;
|
||||
inherit (lib.strings) match toUpper stringToCharacters;
|
||||
inherit (lib.lists) foldl;
|
||||
|
||||
# Parse a single hexadecimal digit to an integer
|
||||
_parseDigit = c:
|
||||
let
|
||||
v = toUpper c;
|
||||
in
|
||||
assert(match "[0-9A-F]" v != null);
|
||||
{
|
||||
"0" = 0;
|
||||
"1" = 1;
|
||||
"2" = 2;
|
||||
"3" = 3;
|
||||
"4" = 4;
|
||||
"5" = 5;
|
||||
"6" = 6;
|
||||
"7" = 7;
|
||||
"8" = 8;
|
||||
"9" = 9;
|
||||
"A" = 10;
|
||||
"B" = 11;
|
||||
"C" = 12;
|
||||
"D" = 13;
|
||||
"E" = 14;
|
||||
"F" = 15;
|
||||
}."${v}";
|
||||
|
||||
in
|
||||
rec {
|
||||
|
||||
# Convert an hexadecimal string to an integer
|
||||
toDec = s:
|
||||
let
|
||||
characters = stringToCharacters s;
|
||||
values = map _parseDigit characters;
|
||||
in
|
||||
foldl (acc: n: acc * 16 + n) 0 values;
|
||||
|
||||
# Convert an integer to a decimal string
|
||||
fromDec = toHexString;
|
||||
|
||||
}
|
||||
111
extra/palette/default.nix
Normal file
111
extra/palette/default.nix
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
{ pkgs, color, lib, ... }:
|
||||
let
|
||||
inherit (builtins) isString;
|
||||
inherit (lib.attrsets) mapAttrsRecursiveCond;
|
||||
in
|
||||
rec{
|
||||
|
||||
# Palette constructor
|
||||
# Produces a palette of colors starting from sane defaults
|
||||
# Override the inputs with your favorite colors
|
||||
palette =
|
||||
{ black ? color.black
|
||||
, red ? color.red
|
||||
, green ? color.green
|
||||
, yellow ? color.yellow
|
||||
, blue ? color.blue
|
||||
, magenta ? color.magenta
|
||||
, cyan ? color.cyan
|
||||
, white ? color.white
|
||||
, bright-black ? color.brighten black "10%"
|
||||
, bright-red ? color.brighten red "10%"
|
||||
, bright-green ? color.brighten green "10%"
|
||||
, bright-yellow ? color.brighten yellow "10%"
|
||||
, bright-blue ? color.brighten blue "10%"
|
||||
, bright-magenta ? color.brighten magenta "10%"
|
||||
, bright-cyan ? color.brighten cyan "10%"
|
||||
, bright-white ? color.brighten white "10%"
|
||||
, dim-black ? color.darken black "10%"
|
||||
, dim-red ? color.darken red "10%"
|
||||
, dim-green ? color.darken green "10%"
|
||||
, dim-yellow ? color.darken yellow "10%"
|
||||
, dim-blue ? color.darken blue "10%"
|
||||
, dim-magenta ? color.darken magenta "10%"
|
||||
, dim-cyan ? color.darken cyan "10%"
|
||||
, dim-white ? color.darken white "10%"
|
||||
, primary-background ? black
|
||||
, primary-foreground ? white
|
||||
, primary-dim_foreground ? color.darken primary-foreground "10%"
|
||||
, cursor-text ? primary-background
|
||||
, cursor-cursor ? primary-foreground
|
||||
, vi-cursor-text ? cursor-text
|
||||
, vi-cursor-cursor ? cursor-cursor
|
||||
}: {
|
||||
normal = {
|
||||
black = assert(color.isRgba black); black;
|
||||
red = assert(color.isRgba red); red;
|
||||
green = assert(color.isRgba green); green;
|
||||
yellow = assert(color.isRgba yellow); yellow;
|
||||
blue = assert(color.isRgba blue); blue;
|
||||
magenta = assert(color.isRgba magenta); magenta;
|
||||
cyan = assert(color.isRgba cyan); cyan;
|
||||
white = assert(color.isRgba white); white;
|
||||
};
|
||||
bright = {
|
||||
black = assert(color.isRgba bright-black); bright-black;
|
||||
red = assert(color.isRgba bright-red); bright-red;
|
||||
green = assert(color.isRgba bright-green); bright-green;
|
||||
yellow = assert(color.isRgba bright-yellow); bright-yellow;
|
||||
blue = assert(color.isRgba bright-blue); bright-blue;
|
||||
magenta = assert(color.isRgba bright-magenta); bright-magenta;
|
||||
cyan = assert(color.isRgba bright-cyan); bright-cyan;
|
||||
white = assert(color.isRgba bright-white); bright-white;
|
||||
};
|
||||
dim = {
|
||||
black = assert(color.isRgba dim-black); dim-black;
|
||||
red = assert(color.isRgba dim-red); dim-red;
|
||||
green = assert(color.isRgba dim-green); dim-green;
|
||||
yellow = assert(color.isRgba dim-yellow); dim-yellow;
|
||||
blue = assert(color.isRgba dim-blue); dim-blue;
|
||||
magenta = assert(color.isRgba dim-magenta); dim-magenta;
|
||||
cyan = assert(color.isRgba dim-cyan); dim-cyan;
|
||||
white = assert(color.isRgba dim-white); dim-white;
|
||||
};
|
||||
primary = {
|
||||
background = assert(color.isRgba primary-background); primary-background;
|
||||
foreground = assert(color.isRgba primary-foreground); primary-foreground;
|
||||
dim_foreground = assert(color.isRgba primary-dim_foreground);primary-dim_foreground;
|
||||
};
|
||||
cursor = {
|
||||
cursor = assert(color.isRgba cursor-cursor); cursor-cursor;
|
||||
text = assert(color.isRgba cursor-text); cursor-text;
|
||||
};
|
||||
vi_mode_cursor = {
|
||||
cursor = assert(color.isRgba cursor-cursor); cursor-cursor;
|
||||
text = assert(color.isRgba cursor-text); cursor-text;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
## TRANSFORM
|
||||
tPalette = f: p: mapAttrsRecursiveCond (v: !color.isRgba v) (a: v: f v) p;
|
||||
|
||||
## SERIALIZATION
|
||||
# Try to convert input colors to a lowercase hex encoded RGBA color
|
||||
toRgbaHex = tPalette color.toRgbaHex;
|
||||
|
||||
# Try to convert input colors to a uppercase hex encoded RGBA color
|
||||
toRGBAHex = tPalette color.toRGBAHex;
|
||||
|
||||
# Try to convert input colors to a lowercase hex encoded RGB color
|
||||
toRgbHex = tPalette color.toRgbHex;
|
||||
|
||||
# Try to convert input colors to a lowercase hex encoded RGB color
|
||||
toRGBHex = tPalette color.toRGBHex;
|
||||
|
||||
# Try to convert input colors to a uppercase hex encoded RGB color in the form ARGB (Polybar uses this format)
|
||||
toARGBHex = tPalette color.toARGBHex;
|
||||
|
||||
# Try to convert input colors to a lowercase hex encoded RGB color in the form argb (Polybar uses this format)
|
||||
toArgbHex = tPalette color.toArgbHex;
|
||||
}
|
||||
69
home.nix
69
home.nix
|
|
@ -2,19 +2,47 @@
|
|||
|
||||
let
|
||||
callPackage = pkgs.lib.callPackageWith pkgs;
|
||||
nixpkgs = import <nixpkgs> {};
|
||||
custom = import ./custom/default.nix {};
|
||||
colorscheme.theme = import ./packages/nord.nix;
|
||||
in {
|
||||
nord = import ./configs/themes/nord.nix;
|
||||
extra = callPackage ./extra/default.nix {};
|
||||
in
|
||||
{
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: { extra = (prev.lib.callPackageWith prev) ./extra/default.nix {}; })
|
||||
(
|
||||
final: prev: {
|
||||
extra = prev.extra // {
|
||||
colorTheme = import ./configs/themes/nord.nix;
|
||||
colorPalette = with extra; palette.palette {
|
||||
black = color.hexToRgba nord.n0;
|
||||
red = color.hexToRgba nord.n11;
|
||||
green = color.hexToRgba nord.n14;
|
||||
yellow = color.hexToRgba nord.n13;
|
||||
blue = color.hexToRgba nord.n10;
|
||||
magenta = color.hexToRgba nord.n15;
|
||||
cyan = color.hexToRgba nord.n8;
|
||||
white = color.hexToRgba nord.n4;
|
||||
|
||||
bright-white = color.hexToRgba nord.n6;
|
||||
bright-red = color.hexToRgba nord.n12;
|
||||
cursor-cursor = color.hexToRgba nord.n4;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
|
||||
home = {
|
||||
language.base = "it_IT.UTF-8";
|
||||
keyboard.layout = "it";
|
||||
keyboard.options = [ "terminate:ctrl_alt_bksp" "compose:rctrl" ];
|
||||
packages = (with pkgs; [
|
||||
packages = (
|
||||
with pkgs; [
|
||||
audacity
|
||||
authy
|
||||
blender
|
||||
discord
|
||||
|
|
@ -34,6 +62,7 @@ in {
|
|||
gnome3.nautilus
|
||||
gnome3.seahorse
|
||||
gnome3.sushi
|
||||
google-chrome
|
||||
htop
|
||||
jetbrains.datagrip
|
||||
keepassxc
|
||||
|
|
@ -50,29 +79,29 @@ in {
|
|||
pavucontrol
|
||||
pcmanfm
|
||||
pentablet-driver
|
||||
polybarFull
|
||||
# polybarFull
|
||||
procps-ng
|
||||
shotwell
|
||||
skypeforlinux
|
||||
slack
|
||||
spotify
|
||||
tdesktop
|
||||
teams
|
||||
transmission-gtk
|
||||
wireguard
|
||||
zoom-us
|
||||
zotero
|
||||
]) ++ (with nixpkgs; [
|
||||
# steam
|
||||
skypeforlinux
|
||||
]) ++ (with custom; [
|
||||
]
|
||||
) ++ (
|
||||
with custom; [
|
||||
gallery-tagger
|
||||
]);
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
imports = [
|
||||
./extralib.nix
|
||||
|
||||
./modules/configurations.nix
|
||||
|
||||
./modules/alacritty.nix
|
||||
|
|
@ -81,23 +110,27 @@ in {
|
|||
./modules/bottom.nix
|
||||
./modules/broot.nix
|
||||
./modules/dircolors.nix
|
||||
./modules/direnv.nix
|
||||
./modules/dunst.nix
|
||||
# ./modules/fzf.nix
|
||||
./modules/git.nix
|
||||
./modules/go.nix
|
||||
./modules/gpg.nix
|
||||
./modules/grobi.nix
|
||||
./modules/info.nix
|
||||
./modules/jq.nix
|
||||
./modules/kakoune.nix
|
||||
./modules/keychain.nix
|
||||
# ./modules/kitty.nix
|
||||
./modules/lf.nix
|
||||
./modules/lorri.nix
|
||||
./modules/man.nix
|
||||
# ./modules/nix-index.nix
|
||||
./modules/noti.nix
|
||||
./modules/obs-studio.nix
|
||||
# ./modules/pazi.nix
|
||||
./modules/picom.nix
|
||||
./modules/polybar.nix
|
||||
./modules/qogir_theme.nix
|
||||
./modules/rofi.nix
|
||||
./modules/screen_locker.nix
|
||||
|
|
@ -123,9 +156,13 @@ in {
|
|||
# };
|
||||
};
|
||||
|
||||
services.gnome-keyring.enable = true;
|
||||
services.blueman-applet.enable = true;
|
||||
services.network-manager-applet.enable = true;
|
||||
services = {
|
||||
blueman-applet.enable = true;
|
||||
caffeine.enable = true;
|
||||
cbatticon.enable = true;
|
||||
gnome-keyring.enable = true;
|
||||
playerctld.enable = true;
|
||||
network-manager-applet.enable = true;
|
||||
};
|
||||
xsession.numlock.enable = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
nord = import ../configs/themes/nord.nix;
|
||||
in {
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
# Include fonts packages
|
||||
home.packages = with pkgs; [ nerdfonts ];
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
env.TERM = "xterm-256color";
|
||||
scrolling.history = 3000;
|
||||
font = {
|
||||
normal.family = "FuraCode Nerd Font Mono";
|
||||
|
|
@ -18,65 +17,28 @@ in {
|
|||
hints.modifiers = "Control";
|
||||
};
|
||||
|
||||
# NORD Theme: https://github.com/arcticicestudio/nord-alacritty
|
||||
colors = {
|
||||
primary = {
|
||||
background = nord.n0;
|
||||
foreground = nord.n6;
|
||||
dim_foreground = nord.n4;
|
||||
};
|
||||
cursor = {
|
||||
text = nord.n0;
|
||||
cursor = nord.n4;
|
||||
};
|
||||
vi_mode_cursor = {
|
||||
text = nord.n0;
|
||||
cursor = nord.n4;
|
||||
};
|
||||
colors = with pkgs.extra; {
|
||||
|
||||
primary = palette.toRgbHex colorPalette.primary;
|
||||
cursor = palette.toRgbHex colorPalette.cursor;
|
||||
vi_mode_cursor = palette.toRgbHex colorPalette.vi_mode_cursor;
|
||||
selection = {
|
||||
text = "CellForeground";
|
||||
background = nord.n3;
|
||||
background = color.toRgbHex colorPalette.dim.blue;
|
||||
};
|
||||
search = {
|
||||
matches = {
|
||||
foreground = "CellForeground";
|
||||
background = nord.n8;
|
||||
background = color.toRgbHex colorPalette.dim.cyan;
|
||||
};
|
||||
bar = {
|
||||
background = nord.n2;
|
||||
foreground = nord.n4;
|
||||
# foreground = "CellForeground";
|
||||
background = color.toRgbHex colorPalette.dim.yellow;
|
||||
};
|
||||
};
|
||||
normal = {
|
||||
black = nord.n0;
|
||||
red = nord.n11;
|
||||
green = nord.n14;
|
||||
yellow = nord.n13;
|
||||
blue = nord.n9;
|
||||
magenta = nord.n15;
|
||||
cyan = nord.n9;
|
||||
white = nord.n5;
|
||||
};
|
||||
bright = {
|
||||
black = nord.n3;
|
||||
red = nord.n11;
|
||||
green = nord.n14;
|
||||
yellow = nord.n13;
|
||||
blue = nord.n9;
|
||||
magenta = nord.n15;
|
||||
cyan = nord.n8;
|
||||
white = nord.n6;
|
||||
};
|
||||
dim = {
|
||||
black = "#373e4d";
|
||||
red = "#94545d";
|
||||
green = "#809575";
|
||||
yellow = "#b29e75";
|
||||
blue = "#68809a";
|
||||
magenta = "#8c738c";
|
||||
cyan = "#6d96a5";
|
||||
white = nord.n4;
|
||||
};
|
||||
normal = palette.toRgbHex colorPalette.normal;
|
||||
bright = palette.toRgbHex colorPalette.bright;
|
||||
dim = palette.toRgbHex colorPalette.dim;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,5 +3,6 @@
|
|||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
enableNixDirenvIntegration = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
19
modules/grobi.nix
Normal file
19
modules/grobi.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.grobi = {
|
||||
enable = true;
|
||||
rules = [
|
||||
{
|
||||
name = "Home";
|
||||
outputs_connected = [ "HDMI-0" "eDP-1-1" ];
|
||||
configure_row = [ "eDP-1-1" "HDMI-0" ];
|
||||
primary = "HDMI-0";
|
||||
}
|
||||
{
|
||||
name = "Fallback";
|
||||
configure_single = "eDP-1-1";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,34 @@
|
|||
let
|
||||
nixpkgs = import <nixpkgs> {};
|
||||
kakCmd = "kak";
|
||||
in {
|
||||
|
||||
rustPlugins = with pkgs; [
|
||||
cargo
|
||||
cargo-watch
|
||||
clippy
|
||||
rust-analyzer
|
||||
rustup
|
||||
];
|
||||
pythonPlugins = with pkgs.python38Packages; [
|
||||
pyls-black
|
||||
python-language-server
|
||||
];
|
||||
nixPlugins = with pkgs; [
|
||||
rnix-lsp
|
||||
];
|
||||
spellingPlugins = with pkgs; [
|
||||
aspell
|
||||
aspellDicts.en
|
||||
aspellDicts.en-computers
|
||||
aspellDicts.en-science
|
||||
aspellDicts.it
|
||||
];
|
||||
dataFormats = with pkgs; [
|
||||
# yaml-language-server
|
||||
];
|
||||
|
||||
in
|
||||
{
|
||||
home.sessionVariables = {
|
||||
EDITOR = kakCmd;
|
||||
VISUAL = kakCmd;
|
||||
|
|
@ -36,27 +63,27 @@ in {
|
|||
};
|
||||
keyMappings = [
|
||||
{ mode = "normal"; docstring = "Open file"; key = "<c-o>"; effect = ":edit<space>"; }
|
||||
{ mode = "user"; docstring = "Code actions"; key = "a"; effect = ":lsp-code-actions<ret>"; }
|
||||
{ mode = "user"; docstring = "Comment block"; key = "b"; effect = ":comment-block<ret>"; }
|
||||
{ mode = "user"; docstring = "Comment line"; key = "l"; effect = ":comment-line<ret>"; }
|
||||
{ mode = "user"; docstring = "Show hover info"; key = "q"; effect = ":lsp-hover<ret>"; }
|
||||
{ mode = "user"; docstring = "Jump to definition"; key = "d"; effect = ":lsp-definition<ret>"; }
|
||||
{ mode = "user"; docstring = "List project diagnostics"; key = "i"; effect = ":lsp-diagnostics<ret>"; }
|
||||
{ mode = "user"; docstring = "Jump to type definition"; key = "t"; effect = ":lsp-type-definition<ret>"; }
|
||||
{ mode = "user"; docstring = "Code actions"; key = "a"; effect = ":lsp-code-actions<ret>"; }
|
||||
{ mode = "user"; docstring = "Format code"; key = "F"; effect = ":lsp-formatting-sync<ret>"; }
|
||||
{ mode = "user"; docstring = "Spellcheck"; key = "s"; effect = ":spell "; }
|
||||
{ mode = "user"; docstring = "Spellcheck English"; key = "S"; effect = ":spell en<ret>"; }
|
||||
{ mode = "user"; docstring = "Copy to clipboard"; key = "y"; effect = "<a-|>${pkgs.xclip}/bin/xclip -i -selection clipboard<ret>"; }
|
||||
{ mode = "user"; docstring = "Paste from clipboard (before)"; key = "p"; effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>"; }
|
||||
{ mode = "user"; docstring = "Format code"; key = "F"; effect = ":lsp-formatting-sync<ret>"; }
|
||||
{ mode = "user"; docstring = "Jump to definition"; key = "d"; effect = ":lsp-definition<ret>"; }
|
||||
{ mode = "user"; docstring = "Jump to type definition"; key = "t"; effect = ":lsp-type-definition<ret>"; }
|
||||
{ mode = "user"; docstring = "List project diagnostics"; key = "i"; effect = ":lsp-diagnostics<ret>"; }
|
||||
{ mode = "user"; docstring = "Paste from clipboard (after)"; key = "P"; effect = "<a-!>${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>"; }
|
||||
{ mode = "user"; docstring = "Paste from clipboard (before)"; key = "p"; effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>"; }
|
||||
{ mode = "user"; docstring = "Show hover info"; key = "q"; effect = ":lsp-hover<ret>"; }
|
||||
{ mode = "user"; docstring = "Spellcheck English"; key = "S"; effect = ":spell en<ret>"; }
|
||||
{ mode = "user"; docstring = "Spellcheck"; key = "s"; effect = ":spell "; }
|
||||
];
|
||||
hooks = [
|
||||
{ name = "WinSetOption"; option = "filetype=(rust|python|c|cpp|latex|javascript|go|nix)"; commands = builtins.concatStringsSep "\n" [ "lsp-enable-window" ]; }
|
||||
# { name = "BufCreate"; option = ".*"; commands = "editorconfig-load"; }
|
||||
{ name = "ModuleLoaded"; option = "powerline"; commands = builtins.concatStringsSep "\n" [ "powerline-enable" ]; }
|
||||
{ name = "ModuleLoaded"; option = "auto-pairs"; commands = "auto-pairs-enable"; }
|
||||
{ name = "InsertCompletionShow"; option = ".*"; commands = builtins.concatStringsSep "\n" [ "map window insert <tab> <c-n>" "map window insert <s-tab> <c-p>" ]; }
|
||||
{ name = "BufCreate"; option = ".*"; commands = "editorconfig-load"; }
|
||||
{ name = "InsertCompletionHide"; option = ".*"; commands = builtins.concatStringsSep "\n" [ "unmap window insert <tab> <c-n>" "unmap window insert <s-tab> <c-p>" ]; }
|
||||
{ name = "InsertCompletionShow"; option = ".*"; commands = builtins.concatStringsSep "\n" [ "map window insert <tab> <c-n>" "map window insert <s-tab> <c-p>" ]; }
|
||||
{ name = "ModuleLoaded"; option = "auto-pairs"; commands = "auto-pairs-enable"; }
|
||||
{ name = "ModuleLoaded"; option = "powerline"; commands = builtins.concatStringsSep "\n" [ "powerline-enable" ]; }
|
||||
{ name = "WinSetOption"; option = "filetype=(rust|python|c|cpp|latex|javascript|go|nix)"; commands = builtins.concatStringsSep "\n" [ "lsp-enable-window" ]; }
|
||||
];
|
||||
};
|
||||
extraConfig = builtins.concatStringsSep "\n" [
|
||||
|
|
@ -64,26 +91,30 @@ in {
|
|||
"define-command -docstring 'save and quit' x 'write-all; quit' # Save and quit with 'x'"
|
||||
"add-highlighter global/ regex \\h+$ 0:Error # Highlight trailing spaces"
|
||||
"eval %sh{kak-lsp --kakoune -s \$kak_session} # Start kak-lsp"
|
||||
"require-module prelude"
|
||||
"# require-module auto-pairs"
|
||||
"require-module connect"
|
||||
"require-module connect-broot"
|
||||
"require-module connect-lf"
|
||||
"require-module connect-rofi"
|
||||
"require-module powerline"
|
||||
];
|
||||
plugins = (with pkgs; [
|
||||
aspell
|
||||
aspellDicts.en
|
||||
aspellDicts.en-computers
|
||||
aspellDicts.en-science
|
||||
aspellDicts.it
|
||||
kak-lsp
|
||||
plugins = (
|
||||
with pkgs; [
|
||||
broot
|
||||
lf
|
||||
editorconfig-core-c
|
||||
kakounePlugins.auto-pairs-kak
|
||||
kakounePlugins.kak-lsp
|
||||
kakounePlugins.powerline-kak
|
||||
rnix-lsp
|
||||
]) ++ (with nixpkgs; [
|
||||
# kakounePlugins.kak-lsp
|
||||
# kakounePlugins.prelude-kak
|
||||
# kakounePlugins.auto-pairs-kak
|
||||
]);
|
||||
kakounePlugins.prelude-kak
|
||||
]
|
||||
) ++ (
|
||||
with nixpkgs; [
|
||||
kakounePlugins.connect-kak
|
||||
]
|
||||
) ++ rustPlugins ++ pythonPlugins ++ nixPlugins ++ spellingPlugins ++ dataFormats;
|
||||
};
|
||||
|
||||
xdg.configFile."kak-lsp/kak-lsp.toml".source = ../configs/kak-lsp/kak-lsp.toml;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,5 +13,8 @@ in {
|
|||
# };
|
||||
font = "FuraCode Nerd Font Mono 10";
|
||||
};
|
||||
extraConfig = ''
|
||||
backround_opacity = 0.95;
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
3
modules/lorri.nix
Normal file
3
modules/lorri.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
services.lorri.enable = true;
|
||||
}
|
||||
307
modules/polybar.nix
Normal file
307
modules/polybar.nix
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
grep = "${pkgs.gnugrep}/bin/grep";
|
||||
cut = "${pkgs.coreutils}/bin/cut";
|
||||
pavucontrol = "${pkgs.pavucontrol}/bin/pavucontrol";
|
||||
pgrep = "${pkgs.procps}/bin/pgrep";
|
||||
pkill = "${pkgs.procps}/bin/pkill";
|
||||
playerCtl = "${pkgs.playerctl}/bin/playerctl";
|
||||
playerStatus = "${playerCtl} -f '{{emoji(status)}} {{title}} - {{artist}}' metadata";
|
||||
colors = with pkgs.extra; palette.toARGBHex rec {
|
||||
|
||||
normal = {
|
||||
foreground = colorPalette.normal.white;
|
||||
background = color.tAlphaRgba (v: 240) colorPalette.normal.black;
|
||||
underline = colorPalette.normal.blue;
|
||||
};
|
||||
|
||||
active = palette.tPalette (c: color.brighten c "50%") normal;
|
||||
|
||||
selected = {
|
||||
foreground = colorPalette.bright.white;
|
||||
background = color.tAlphaRgba (v: 240) colorPalette.dim.blue;
|
||||
underline = colorPalette.dim.white;
|
||||
};
|
||||
|
||||
alert = colorPalette.bright.red;
|
||||
|
||||
green = colorPalette.normal.green;
|
||||
yellow = colorPalette.normal.yellow;
|
||||
orange = colorPalette.bright.red;
|
||||
red = colorPalette.normal.red;
|
||||
|
||||
transparent = color.transparent;
|
||||
};
|
||||
|
||||
commonBar = {
|
||||
locale = config.home.language.base;
|
||||
monitor = "\${env:MONITOR}";
|
||||
width = "100%";
|
||||
height = 20;
|
||||
radius = 6.0;
|
||||
fixed-center = false;
|
||||
background = colors.normal.background;
|
||||
foreground = colors.normal.foreground;
|
||||
line-size = 2;
|
||||
line-color = colors.normal.underline;
|
||||
padding = {
|
||||
left = 0;
|
||||
right = 0;
|
||||
};
|
||||
module.margin = { left = 0; right = 0; };
|
||||
separator = " ";
|
||||
border = {
|
||||
color = colors.transparent;
|
||||
left.size = 2;
|
||||
righ.sizet = 2;
|
||||
top.size = 2;
|
||||
bottom.size = 0;
|
||||
};
|
||||
font = [ "FuraCode Nerd Font Mono:pixelsize=10;2" "unifont:fontformat=truetype:size=8:antialias=false;0" "siji:pixelsize=10;1" ];
|
||||
tray = {
|
||||
position = "right";
|
||||
padding = 0;
|
||||
};
|
||||
wm-restack = "bspwm";
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [ nerdfonts ];
|
||||
services.polybar = {
|
||||
enable = true;
|
||||
package = pkgs.polybarFull;
|
||||
script =
|
||||
''
|
||||
monitor=`polybar -m | ${grep} primary | ${cut} -d":" -f1`
|
||||
MONITOR=$monitor polybar primary &
|
||||
monitors=(`polybar -m | ${grep} -v primary | ${cut} -d":" -f1`)
|
||||
for monitor in "''${monitors[@]}"; do
|
||||
MONITOR=$monitor polybar secondary &
|
||||
done
|
||||
'';
|
||||
|
||||
settings = {
|
||||
"settings" = {
|
||||
screenchange-reload = false;
|
||||
};
|
||||
|
||||
"bar/primary" = commonBar // {
|
||||
modules-left = "bspwm";
|
||||
# modules-center =
|
||||
modules-right = "player pulseaudio temperature cpu memory battery date powermenu";
|
||||
enable-ipc = true;
|
||||
};
|
||||
|
||||
"bar/secondary" = commonBar // {
|
||||
modules-left = "bspwm";
|
||||
# modules-center =
|
||||
modules-right = "player pulseaudio temperature cpu memory battery date powermenu";
|
||||
enable-ipc = true;
|
||||
};
|
||||
|
||||
"module/battery" = {
|
||||
type = "internal/battery";
|
||||
|
||||
adapter = "AC";
|
||||
battery = "BAT0";
|
||||
full.at = 98;
|
||||
|
||||
animation = {
|
||||
charging = {
|
||||
text = [ "" "" "" ];
|
||||
framerate = "750";
|
||||
};
|
||||
discharging = {
|
||||
text = [ "" "" "" ];
|
||||
framerate = "750";
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
charging = colors.selected // {
|
||||
text = "<animation-charging> <label-charging>";
|
||||
};
|
||||
discharging = colors.active // {
|
||||
text = "<animation-discharging> <label-discharging>";
|
||||
};
|
||||
full = colors.normal // {
|
||||
text = " <label-full>";
|
||||
};
|
||||
};
|
||||
|
||||
label = {
|
||||
chargin = "%percentage%%";
|
||||
dischargin = "%percentage%%";
|
||||
full = "%percentage%%";
|
||||
};
|
||||
};
|
||||
|
||||
"module/bspwm" = {
|
||||
type = "internal/bspwm";
|
||||
format = "<label-state>";
|
||||
|
||||
label = let
|
||||
common = {
|
||||
padding = 1;
|
||||
separator = " ";
|
||||
text = "%name%";
|
||||
};
|
||||
in
|
||||
{
|
||||
focused = colors.selected // common;
|
||||
occupied = colors.active // common;
|
||||
urgent = colors.active // common // { background = colors.alert; };
|
||||
empty = colors.normal // common;
|
||||
};
|
||||
};
|
||||
|
||||
"module/cpu" = {
|
||||
type = "internal/cpu";
|
||||
format = colors.normal // {
|
||||
prefix = "▣ ";
|
||||
padding = 1;
|
||||
};
|
||||
interval = 2;
|
||||
label = "%percentage-sum%%";
|
||||
};
|
||||
|
||||
"module/date" = {
|
||||
type = "internal/date";
|
||||
date = {
|
||||
alt = "%Y-%m-%d";
|
||||
text = "%a %d/%m/%y";
|
||||
};
|
||||
interval = "1";
|
||||
label = "%date% %time%";
|
||||
time = {
|
||||
alt = "%H:%M:%S";
|
||||
text = "%H:%M";
|
||||
};
|
||||
format = colors.normal // {
|
||||
padding = 1;
|
||||
};
|
||||
};
|
||||
|
||||
"module/memory" = {
|
||||
type = "internal/memory";
|
||||
format = colors.normal // {
|
||||
prefix = "▨ ";
|
||||
padding = 1;
|
||||
};
|
||||
interval = 2;
|
||||
label = "%percentage_used%% ~ %percentage_swap_used%%";
|
||||
};
|
||||
|
||||
"module/pulseaudio" = {
|
||||
bar.volume = {
|
||||
empty = {
|
||||
font = "2";
|
||||
text = "─";
|
||||
};
|
||||
fill = {
|
||||
text = "─";
|
||||
font = "2";
|
||||
};
|
||||
foreground = [
|
||||
colors.green
|
||||
colors.green
|
||||
colors.green
|
||||
colors.green
|
||||
colors.green
|
||||
colors.yellow
|
||||
colors.orange
|
||||
colors.red
|
||||
];
|
||||
indicator = {
|
||||
text = "|";
|
||||
font = "2";
|
||||
};
|
||||
width = "10";
|
||||
};
|
||||
click.right = "${pgrep} pavucontrol && ${pkill} pavucontrol || ${pavucontrol}";
|
||||
format = {
|
||||
padding = 1;
|
||||
muted = colors.active;
|
||||
volume = colors.normal // {
|
||||
text = "<label-volume> <bar-volume>";
|
||||
};
|
||||
};
|
||||
label.muted = {
|
||||
text = "VOL muted";
|
||||
};
|
||||
label.volume = {
|
||||
text = "VOL %percentage%%";
|
||||
};
|
||||
type = "internal/pulseaudio";
|
||||
};
|
||||
|
||||
"module/temperature" = {
|
||||
format = colors.normal // {
|
||||
padding = 1;
|
||||
text = "<ramp> <label>";
|
||||
warn = {
|
||||
text = "<ramp> <label-warn>";
|
||||
underline = colors.alert;
|
||||
};
|
||||
};
|
||||
hwmon.path = "/sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input";
|
||||
label = {
|
||||
text = "%temperature-c%";
|
||||
warn = "%temperature-c%";
|
||||
};
|
||||
ramp = {
|
||||
text = [ "○" "◒" "●" ];
|
||||
};
|
||||
thermal.zone = "0";
|
||||
type = "internal/temperature";
|
||||
warn.temperature = "90";
|
||||
};
|
||||
|
||||
"module/powermenu" = {
|
||||
type = "custom/menu";
|
||||
expand.right = true;
|
||||
format = {
|
||||
spacing = 1;
|
||||
suffix = " ";
|
||||
};
|
||||
label = {
|
||||
open = colors.normal // {
|
||||
text = " ⏻ ";
|
||||
};
|
||||
close = colors.normal // {
|
||||
text = "Cancel";
|
||||
};
|
||||
separator = {
|
||||
text = "|";
|
||||
};
|
||||
};
|
||||
menu = [
|
||||
[
|
||||
({ text = "Reboot"; exec = "menu-open-1"; })
|
||||
({ text = "Power off"; exec = "menu-open-2"; })
|
||||
]
|
||||
[
|
||||
({ text = "Reboot"; exec = "reboot"; })
|
||||
]
|
||||
[
|
||||
({ text = "Power off"; exec = "poweroff"; })
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
"module/player" = {
|
||||
type = "custom/script";
|
||||
format = colors.normal // {
|
||||
padding = 1;
|
||||
};
|
||||
exec = "${playerStatus}";
|
||||
click.left = "${playerCtl} play-pause";
|
||||
scroll = {
|
||||
up = "${playerCtl} previous";
|
||||
down = "${playerCtl} next";
|
||||
};
|
||||
interval = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
i3lock-color = "${pkgs.i3lock-color}/bin/i3lock-color";
|
||||
in
|
||||
{
|
||||
services.screen-locker = {
|
||||
enable = true;
|
||||
lockCmd = ''i3lock-color -B 10 --greetertext="Welcome back $USER"'';
|
||||
lockCmd = '' ${i3lock-color} -B 10 --greeter-text="Welcome back $USER" --greeter-color="#ffffff" --date-color="#ffffff" --time-color="#ffffff" '';
|
||||
inactiveInterval = 10; # miutes
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,5 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
alacritty
|
||||
bash
|
||||
betterlockscreen
|
||||
bspwm
|
||||
# dunst
|
||||
findutils
|
||||
gnome3.nautilus
|
||||
rofi
|
||||
sxhkd
|
||||
terminator
|
||||
i3lock-color
|
||||
];
|
||||
|
||||
services.sxhkd = let
|
||||
alacritty = "${pkgs.alacritty}/bin/alacritty";
|
||||
bspc = "${pkgs.bspwm}/bin/bspc";
|
||||
|
|
@ -23,39 +9,39 @@
|
|||
pulseaudio-ctl = "${pkgs.pulseaudio-ctl}/bin/pulseaudio-ctl";
|
||||
rofi = "${pkgs.rofi}/bin/rofi";
|
||||
terminator = "${pkgs.terminator}/bin/terminator";
|
||||
in {
|
||||
nautilus = "${pkgs.gnome.nautilus}/bin/nautilus";
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
keybindings = {
|
||||
"super + alt + {h,j,k,l}" = "bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
|
||||
"super + alt + {q,r}" = "bspc {quit,wm -r}";
|
||||
"super + alt + shift + {h,j,k,l}" = "bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}";
|
||||
"super + alt + m" = ''i3lock-color -B 10 --greetertext="Welcome back $USER"'';
|
||||
"super + bracket{left,right}" = "bspc desktop -f {prev,next}.local";
|
||||
"super + ctrl + {1-9}" = "bspc node -o 0.{1-9}";
|
||||
"super + ctrl + {h,j,k,l}" = "bspc node -p {west,south,north,east}";
|
||||
"super + ctrl + {m,x,y,z}" = "bspc node -g {marked,locked,sticky,private}";
|
||||
"super + ctrl + shift + space" = "bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel";
|
||||
"super + ctrl + space" = "bspc node -p cancel";
|
||||
"super + e" = "nautilus -w";
|
||||
"super + alt + {h,j,k,l}" = "${bspc} node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
|
||||
"super + alt + {q,r}" = "${bspc} {quit,wm -r}";
|
||||
"super + alt + shift + {h,j,k,l}" = "${bspc} node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}";
|
||||
"super + alt + m" = '' ${i3lock-color} -B 10 --greeter-text="Welcome back $USER" --greeter-color="#ffffff" --date-color="#ffffff" --time-color="#ffffff" '';
|
||||
"super + bracket{left,right}" = "${bspc} desktop -f {prev,next}.local";
|
||||
"super + ctrl + {1-9}" = "${bspc} node -o 0.{1-9}";
|
||||
"super + ctrl + {h,j,k,l}" = "${bspc} node -p {west,south,north,east}";
|
||||
"super + ctrl + {m,x,y,z}" = "${bspc} node -g {marked,locked,sticky,private}";
|
||||
"super + ctrl + shift + space" = "${bspc} query -N -d | xargs -I id -n 1 ${bspc} node id -p cancel";
|
||||
"super + ctrl + space" = "${bspc} node -p cancel";
|
||||
"super + e" = "${nautilus} -w";
|
||||
"super + Escape" = "pkill -USR1 -x sxhkd";
|
||||
"super + g" = "bspc node -s biggest";
|
||||
"super + {grave,Tab}" = "bspc {node,desktop} -f last";
|
||||
"super + {Left,Down,Up,Right}" = "bspc node -v {-20 0,0 20,0 -20,20 0}";
|
||||
"super + m" = "bspc desktop -l next";
|
||||
"super + {o,i}" = "bspc wm -h off;bspc node {older,newer} -f;bspc wm -h on";
|
||||
"super + {p,b,comma,period}" = "bspc node -f @{parent,brother,first,second}";
|
||||
"super + {_,shift + } Return" = "{alacritty,terminator}";
|
||||
"super + {_,shift + }{1-9,0}" = "bspc {desktop -f,node -d} 'focused:^{1-9,10}'";
|
||||
"super + {_,shift + }c" = "bspc node -f {next,prev}.local";
|
||||
"super + {_,shift + }{h,j,k,l}" = "bspc node -{f,s} {west,south,north,east}";
|
||||
"super + {_,shift + }w" = "bspc node -{c,k}";
|
||||
"super + g" = "${bspc} node -s biggest";
|
||||
"super + {grave,Tab}" = "${bspc} {node,desktop} -f last";
|
||||
"super + {Left,Down,Up,Right}" = "${bspc} node -v {-20 0,0 20,0 -20,20 0}";
|
||||
"super + m" = "${bspc} desktop -l next";
|
||||
"super + {o,i}" = "${bspc} wm -h off;${bspc} node {older,newer} -f;${bspc} wm -h on";
|
||||
"super + {p,b,comma,period}" = "${bspc} node -f @{parent,brother,first,second}";
|
||||
"super + {_,shift + } Return" = "{${alacritty} , ${terminator}}";
|
||||
"super + {_,shift + }{1-9,0}" = "${bspc} {desktop -f,node -d} 'focused:^{1-9,10}'";
|
||||
"super + {_,shift + }c" = "${bspc} node -f {next,prev}.local";
|
||||
"super + {_,shift + }{h,j,k,l}" = "${bspc} node -{f,s} {west,south,north,east}";
|
||||
"super + {_,shift + }w" = "${bspc} node -{c,k}";
|
||||
"super + @space" = "rofi -show drun";
|
||||
"super + {t,shift + t,s,f}" = "bspc node -t {tiled,pseudo_tiled,floating,fullscreen}";
|
||||
"super + y" = "bspc node newest.marked.local -n newest.!automatic.local";
|
||||
"{XF86AudioLowerVolume,XF86AudioMute,XF86AudioRaiseVolume}" = "${dunstify} ${pulseaudio-ctl} {down,mute,up}";
|
||||
# "XF86Audio{LowerVolume,Mute,RaiseVolume}" = "${pulseaudio-ctl} {down,mute,up}";
|
||||
"super + {t,shift + t,s,f}" = "${bspc} node -t {tiled,pseudo_tiled,floating,fullscreen}";
|
||||
"super + y" = "${bspc} node newest.marked.local -n newest.!automatic.local";
|
||||
"{XF86AudioLowerVolume,XF86AudioMute,XF86AudioRaiseVolume}" = "${pulseaudio-ctl} {down,mute,up}";
|
||||
"XF86Audio{Next,Play,Prev}" = "${playerctl} {next,play-pause,previous}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
enable = true;
|
||||
clock24 = true;
|
||||
escapeTime = 25;
|
||||
terminal = "screen-256color";
|
||||
plugins = with pkgs; [
|
||||
tmuxPlugins.continuum
|
||||
tmuxPlugins.prefix-highlight
|
||||
|
|
@ -12,9 +13,5 @@
|
|||
extraConfig = ''
|
||||
set -g mouse on
|
||||
'';
|
||||
|
||||
# set -g default-terminal "screen"
|
||||
# set -ga terminal-overrides ",col:Tc"
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
nix-zsh-completions
|
||||
zsh-completions
|
||||
];
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
|
|
@ -8,9 +13,13 @@
|
|||
# src = pkgs.zsh-powerlevel10k;
|
||||
# file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
||||
# }];
|
||||
# initExtraBeforeCompInit = ''
|
||||
# source $HOME/.p10k.zsh
|
||||
# '';
|
||||
initExtraBeforeCompInit = ''
|
||||
zstyle ':completion:*' menu select
|
||||
setopt CORRECT
|
||||
setopt AUTO_CD
|
||||
setopt CHASE_LINKS
|
||||
setopt PUSHD_TO_HOME
|
||||
'';
|
||||
# localVariables = {
|
||||
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS = [ "os_icon" "dir" "vcs" "prompt_char" ];
|
||||
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS = [ "status" "command_execution_time" "background_jobs" "direnv" "nix_shell" "time" "vpn_ip" ]
|
||||
|
|
@ -21,8 +30,6 @@
|
|||
enableBashIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
settings = {
|
||||
# format = "[$all](inverted)";
|
||||
|
||||
directory.truncation_symbol = "…/";
|
||||
hostname.format = "[$hostname]($style) ";
|
||||
line_break.disabled = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue