add hyprland and eww config

This commit is contained in:
Leonardo Eugênio 2022-08-20 17:46:03 -03:00
parent 30abda4469
commit 0b6fb9ddca
9 changed files with 341 additions and 7 deletions

View File

@ -94,6 +94,27 @@
"type": "github"
}
},
"hyprland": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
],
"wlroots": "wlroots"
},
"locked": {
"lastModified": 1661019364,
"narHash": "sha256-syJlCuf3idpfdgvYPkWJMgaixGhJPcVeYx8Bl3Z1CvY=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "08e874bcf91e524059ceaf8a757c463d412b7136",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"material-wifi-icons": {
"flake": false,
"locked": {
@ -192,6 +213,7 @@
"alacritty-sixel": "alacritty-sixel",
"dhist": "dhist",
"home-manager": "home-manager",
"hyprland": "hyprland",
"material-wifi-icons": "material-wifi-icons",
"nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable",
@ -215,6 +237,24 @@
"repo": "rust-analyzer",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1660930713,
"narHash": "sha256-bY7q1NqG/sjCUAWPn/Ne9NCigLlPlH5Lk1WCMqv3rTU=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "7c575922c05e4d5fd9a403c2aa631a54c7531d44",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
}
},
"root": "root",

View File

@ -7,6 +7,11 @@
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
alacritty-sixel.url = "github:microo8/alacritty-sixel";
alacritty-sixel.flake = false;
@ -19,8 +24,7 @@
# my stuff
dhist.url = "github:lelgenio/dhist";
};
outputs = { nixpkgs, nixpkgs-unstable, home-manager, alacritty-sixel
, ranger-sixel, material-wifi-icons, nur, dhist, ... }:
outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager, nur, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
@ -39,16 +43,21 @@
common_modules = [
./system/configuration.nix
# nur.nixosModules.nur
inputs.hyprland.nixosModules.default
{
programs.hyprland.enable = true;
# programs.hyprland.package = null;
}
({ config, pkgs, ... }: {
nixpkgs.overlays = [
overlay-unstable
nur.overlay
(_: old-pkgs: {
uservars = import ./user/variables.nix;
dhist = dhist.packages.${system}.dhist;
dhist = inputs.dhist.packages.${system}.dhist;
alacritty = (old-pkgs.alacritty.overrideAttrs
(old-alacritty: rec {
src = alacritty-sixel;
src = inputs.alacritty-sixel;
cargoDeps = old-alacritty.cargoDeps.overrideAttrs
(old-pkgs.lib.const {
inherit src;
@ -57,14 +66,14 @@
});
}));
ranger = (old-pkgs.ranger.overridePythonAttrs (old-ranger: rec {
src = ranger-sixel;
src = inputs.ranger-sixel;
checkInputs = [ ];
propagatedBuildInputs = with old-pkgs.python3Packages;
old-ranger.propagatedBuildInputs ++ [ astroid pylint pytest ];
}));
material-wifi-icons = pkgs.stdenv.mkDerivation rec {
name = "material-wifi-icons";
src = material-wifi-icons;
src = inputs.material-wifi-icons;
installPhase = let dest = "$out/share/fonts/${name}";
in ''
mkdir -p ${dest}
@ -83,6 +92,9 @@
home-manager.backupFileExtension = "bkp";
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
home-manager.extraSpecialArgs = {
inherit inputs;
};
}
];
in {

View File

@ -237,6 +237,10 @@ in {
networking.firewall.enable = false;
security.sudo.wheelNeedsPassword = false;
nix = {
settings = {
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
};
package = pkgs.nixFlakes; # or versioned attributes like nixVersions.nix_2_8
extraOptions = ''
experimental-features = nix-command flakes

61
user/eww/eww.scss Normal file
View File

@ -0,0 +1,61 @@
* {
all: unset; //Unsets everything so you can style everything from scratch
}
//Global Styles
.bar {
background-color: #202020;
color: #b0b4bc;
padding: 10px;
}
// Styles on classes (see eww.yuck for more information)
.sidestuff slider {
all: unset;
color: #cc5757;
}
.metric scale trough highlight {
all: unset;
background-color: #D35D6E;
color: #000000;
border-radius: 10px;
}
.metric scale trough {
all: unset;
background-color: #4e4e4e;
border-radius: 50px;
min-height: 3px;
min-width: 50px;
margin-left: 10px;
margin-right: 20px;
}
.metric scale trough highlight {
all: unset;
background-color: #D35D6E;
color: #000000;
border-radius: 10px;
}
.metric scale trough {
all: unset;
background-color: #4e4e4e;
border-radius: 50px;
min-height: 3px;
min-width: 50px;
margin-left: 10px;
margin-right: 20px;
}
.label-ram {
font-size: large;
}
.workspaces button:hover {
color: #D35D6E;
}
.workspaces button.active {
color: #D35D6E;
}

80
user/eww/eww.yuck Normal file
View File

@ -0,0 +1,80 @@
(defwidget bar []
(centerbox :orientation "h"
(workspaces)
(music)
(sidestuff)))
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
; (metric :label "🔊"
; :value volume
; :onchange "amixer -D pulse sset Master {}%")
(metric :label ""
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
time))
(defwidget workspaces []
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
:spacing 10
(button :class "${active_workspace == 1 ? 'active' : '' }" :onclick "wmctrl -s 0" 1)
(button :class "${active_workspace == 2 ? 'active' : '' }" :onclick "wmctrl -s 1" 2)
(button :class "${active_workspace == 3 ? 'active' : '' }" :onclick "wmctrl -s 2" 3)
(button :class "${active_workspace == 4 ? 'active' : '' }" :onclick "wmctrl -s 3" 4)
(button :class "${active_workspace == 5 ? 'active' : '' }" :onclick "wmctrl -s 4" 5)
(button :class "${active_workspace == 6 ? 'active' : '' }" :onclick "wmctrl -s 5" 6)
(button :class "${active_workspace == 7 ? 'active' : '' }" :onclick "wmctrl -s 6" 7)
(button :class "${active_workspace == 8 ? 'active' : '' }" :onclick "wmctrl -s 7" 8)
(button :class "${active_workspace == 9 ? 'active' : '' }" :onclick "wmctrl -s 8" 9)))
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{music != "" ? "🎵${music}" : ""}))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
; (defpoll volume :interval "1s"
; "scripts/getvol")
(defpoll time :interval "10s"
"date '+%H:%M %b %d, %Y'")
(defpoll active_workspace :interval "10ms"
"hyprctl monitors -j | jq '.[]|.activeWorkspace.id'")
(defwindow bar
:monitor 0
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
:exclusive true
(bar))

2
user/eww/scripts/getram Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')

2
user/eww/scripts/getvol Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%' | head -1

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, inputs,... }:
let
inherit (import ./variables.nix) key theme color accent font;
@ -15,11 +15,13 @@ in {
./helix.nix
./kakoune.nix
./sway.nix
./hyprland.nix
./git.nix
./qutebrowser
./gpg.nix
./rofi.nix
./rnnoise.nix
inputs.hyprland.homeManagerModules.default
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
@ -39,6 +41,7 @@ in {
home.packages = with pkgs; [
alacritty
terminal # see flake.nix
waybar
exa
fd
_diffr

130
user/hyprland.nix Normal file
View File

@ -0,0 +1,130 @@
{ config, pkgs, lib, ... }: {
config = {
wayland.windowManager.hyprland = {
enable = false;
extraConfig = ''
monitor=,preferred,auto,1
input {
kb_file=
kb_layout=us(colemak)
kb_variant=
kb_model=
kb_options=
kb_rules=
follow_mouse=1
touchpad {
natural_scroll=no
}
}
general {
sensitivity=1.0 # for mouse cursor
main_mod=SUPER
gaps_in=5
gaps_out=10
border_size=2
col.active_border=0xffF44336
col.inactive_border=0x66333333
apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer
}
decoration {
rounding=5
blur=1
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
}
animations {
enabled=1
animation=windows,1,7,default
animation=border,1,10,default
animation=fade,1,10,default
animation=workspaces,1,6,default
}
dwindle {
pseudotile=0 # enable pseudotiling on dwindle
}
gestures {
workspace_swipe=no
}
# example window rules
# for windows named/classed as abc and xyz
#windowrule=move 69 420,abc
#windowrule=size 420 69,abc
#windowrule=tile,xyz
#windowrule=float,abc
#windowrule=pseudo,abc
#windowrule=monitor 0,xyz
# example binds
bind=SUPER,Q,exec,kitty
bind=SUPER,RETURN,exec,alacritty
bind=SUPER,x,killactive,
bind=SUPER,M,exit,
# bind=SUPER,E,exec,dolphin
bind=SUPER,V,togglefloating,
bind=SUPER,s,exec,wlauncher
bind=SUPER,P,pseudo,
bind=SUPER,f,fullscreen
bind=SUPER,n,movefocus,l
bind=SUPER,o,movefocus,r
bind=SUPER,i,movefocus,u
bind=SUPER,e,movefocus,d
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
bind=ALT,1,movetoworkspace,1
bind=ALT,2,movetoworkspace,2
bind=ALT,3,movetoworkspace,3
bind=ALT,4,movetoworkspace,4
bind=ALT,5,movetoworkspace,5
bind=ALT,6,movetoworkspace,6
bind=ALT,7,movetoworkspace,7
bind=ALT,8,movetoworkspace,8
bind=ALT,9,movetoworkspace,9
bind=ALT,0,movetoworkspace,10
bind=SUPER,u,workspace,e-1
bind=SUPER,y,workspace,e+1
bind=SUPER,mouse_down,workspace,e-1
bind=SUPER,mouse_up,workspace,e+1
'';
};
home.file.".config/eww".source = ./eww;
home.packages = with pkgs; [
eww-wayland
jq
];
};
}