Added wayland, hyprland and eww

This commit is contained in:
marc
2024-03-02 17:38:35 +01:00
parent 95944b2486
commit 466ddf2cd9
27 changed files with 591 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
let
cfg = config.samfelag.modules.app.alacritty;
i3Cfg = config.samfelag.modules.desktop.i3;
hyprCfg = config.samfelag.modules.desktop.hyprland;
in
{
options.samfelag.modules.app.alacritty = {
@@ -56,5 +57,11 @@ in
"${i3Cfg.mod}+Return" = "exec ${pkgs.alacritty}/bin/alacritty";
"${i3Cfg.mod}+Shift+Return" = "exec ${pkgs.alacritty}/bin/alacritty -t floating-term";
};
samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
"${hyprCfg.mod}, Return, exec, ${pkgs.alacritty}/bin/alacritty"
"${hyprCfg.mod} SHIFT, Return, exec, [float] ${pkgs.alacritty}/bin/alacritty"
];
};
}

View File

@@ -3,6 +3,7 @@
let
cfg = config.samfelag.modules.app.firefox;
i3Cfg = config.samfelag.modules.desktop.i3;
hyprCfg = config.samfelag.modules.desktop.hyprland;
in
{
options.samfelag.modules.app.firefox = {
@@ -13,10 +14,6 @@ in
firefox
];
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
"${i3Cfg.mod}+Shift+i" = "exec ${pkgs.firefox}/bin/firefox";
};
hm.programs.firefox = {
enable = true;
# extensions = with pkgs.nur.repos.rycee.firefox-addons; [
@@ -30,5 +27,12 @@ in
};
};
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
"${i3Cfg.mod}+Shift+i" = "exec ${pkgs.firefox}/bin/firefox";
};
samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
"${hyprCfg.mod} SHIFT, i, exec, ${pkgs.firefox}/bin/firefox"
];
};
}

View File

@@ -3,6 +3,7 @@
let
cfg = config.samfelag.modules.app.spotify;
i3Cfg = config.samfelag.modules.desktop.i3;
hyprCfg = config.samfelag.modules.desktop.hyprland;
in
{
options.samfelag.modules.app.spotify = {
@@ -16,5 +17,9 @@ in
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
"${i3Cfg.mod}+Shift+m" = "exec ${pkgs.spotify}/bin/spotify";
};
samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
"${hyprCfg.mod} SHIFT, m, exec, ${pkgs.spotify}/bin/spotify"
];
};
}

View File

@@ -53,12 +53,12 @@ in
samfelag.modules = {
app.alacritty.enable = true;
desktop.rofi.enable = true;
desktop.polybar.enable = true;
app.firefox.enable = true;
desktop.rofi.enable = true;
desktop.polybar.enable = true;
desktop.i3 = {
enable = true;
laptop = cfg.laptop;
extraStartup = [
@@ -71,7 +71,7 @@ in
"${cfg.i3.mod}+End" = "exec $HOME/.config/rofi/menus/powermenu/powermenu.sh";
};
};
};
};
};
}

56
modules/desktop/eww.nix Normal file
View File

@@ -0,0 +1,56 @@
{ config, lib, pkgs, ... }:
let
cfg = config.samfelag.modules.desktop.eww;
hyprCfg = config.samfelag.modules.desktop.hyprland;
# Paths
paths = {
};
in {
options.samfelag.modules.desktop.eww = {
enable = lib.mkEnableOption "eww";
};
config = lib.mkIf cfg.enable {
# - Configuration ----------------------------
environment.systemPackages = with pkgs; [
eww-wayland
# Scripts' dependencies
jq
socat
];
hm.xdg.configFile."eww/eww.yuck".source = ../../config/eww/eww.yuck;
hm.xdg.configFile."eww/eww.scss".source = ../../config/eww/eww.scss;
hm.xdg.configFile."eww/bars".source = ../../config/eww/bars;
hm.xdg.configFile."eww/widgets".source = ../../config/eww/widgets;
hm.xdg.configFile."eww/scripts".source = ../../config/eww/scripts;
# - Themeing ---------------------------------
hm.xdg.configFile."eww/colour-scheme.scss".text = ''
$base00: #${config.colorScheme.palette.base00};
$base01: #${config.colorScheme.palette.base01};
$base02: #${config.colorScheme.palette.base02};
$base03: #${config.colorScheme.palette.base03};
$base04: #${config.colorScheme.palette.base04};
$base05: #${config.colorScheme.palette.base05};
$base06: #${config.colorScheme.palette.base06};
$base07: #${config.colorScheme.palette.base07};
$base08: #${config.colorScheme.palette.base08};
$base09: #${config.colorScheme.palette.base09};
$base0A: #${config.colorScheme.palette.base0A};
$base0B: #${config.colorScheme.palette.base0B};
$base0C: #${config.colorScheme.palette.base0C};
$base0D: #${config.colorScheme.palette.base0D};
$base0E: #${config.colorScheme.palette.base0E};
$base0F: #${config.colorScheme.palette.base0F};
'';
# - Dependencies -----------------------------
samfelag.modules.desktop.rofi.enable = true;
};
}

View File

@@ -0,0 +1,148 @@
{ config, lib, pkgs, ... }:
let
cfg = config.samfelag.modules.desktop.hyprland;
mod = "Mod4";
in {
options.samfelag.modules.desktop.hyprland = with lib; {
enable = mkEnableOption "hyprland window manager";
mod = my.mkOpt' types.str "Mod4" "Main modifier key for hyprland";
laptop = mkEnableOption "Enable features for a laptop (trackpad, battery, etc...)";
extraKeybindings = my.mkOpt (types.listOf types.str) [ ];
extraStartup = my.mkOpt (types.listOf types.attrs) [ ];
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
# Wallpaper
hyprpaper
];
# - Dependencies -----------------------------
samfelag.modules.desktop.rofi.enable = true;
samfelag.modules.desktop.eww.enable = true;
# - Configuration -----------------------------
# Hyprpaper
hm.xdg.configFile."hypr/hyprpaper.conf".text = ''
preload = ${config.samfelag.modules.desktop.wallpaper}
wallpaper = ,${config.samfelag.modules.desktop.wallpaper}
'';
programs.hyprland = {
enable = true;
xwayland.enable = true;
enableNvidiaPatches = true;
};
hm.wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
enableNvidiaPatches = true;
package = pkgs.hyprland;
# Optional
# Whether to enable hyprland-session.target on hyprland startup
systemd.enable = true;
settings = {
input = {
kb_layout = "es";
};
monitor = ",highres,auto,1";
exec-once = [
"hyprpaper"
"eww open top-bar"
];
decoration = {
rounding = 10;
};
gestures = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = false;
};
bind = [
"${cfg.mod}, Q, killactive,"
"${cfg.mod}, F, fullscreen, 1"
"${cfg.mod} SHIFT, F, fullscreen, 0"
"${cfg.mod} SHIFT, SPACE, togglefloating"
# Move focus
"${cfg.mod}, left, movefocus, l"
"${cfg.mod}, right, movefocus, r"
"${cfg.mod}, up, movefocus, u"
"${cfg.mod}, down, movefocus, d"
"${cfg.mod}, h, movefocus, l"
"${cfg.mod}, l, movefocus, r"
"${cfg.mod}, k, movefocus, u"
"${cfg.mod}, j, movefocus, d"
# Move focus
"${cfg.mod} SHIFT, left, movewindow, l"
"${cfg.mod} SHIFT, right, movewindow, r"
"${cfg.mod} SHIFT, up, movewindow, u"
"${cfg.mod} SHIFT, down, movewindow, d"
"${cfg.mod} SHIFT, h, movewindow, l"
"${cfg.mod} SHIFT, l, movewindow, r"
"${cfg.mod} SHIFT, k, movewindow, u"
"${cfg.mod} SHIFT, j, movewindow, d"
# Switch workspace
"${cfg.mod}, 1, workspace, 1"
"${cfg.mod}, 2, workspace, 2"
"${cfg.mod}, 3, workspace, 3"
"${cfg.mod}, 4, workspace, 4"
"${cfg.mod}, 5, workspace, 5"
"${cfg.mod}, 0, workspace, 6"
# Move to workspace
"${cfg.mod} SHIFT, 1, movetoworkspace, 1"
"${cfg.mod} SHIFT, 2, movetoworkspace, 2"
"${cfg.mod} SHIFT, 3, movetoworkspace, 3"
"${cfg.mod} SHIFT, 4, movetoworkspace, 4"
"${cfg.mod} SHIFT, 5, movetoworkspace, 5"
"${cfg.mod} SHIFT, 0, movetoworkspace, 6"
# - Media ------------------------------
# Pulse Audio controls (mute)
", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
# Media player controls
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPause, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioStop, exec, playerctl stop"
] ++ cfg.extraKeybindings;
binde = [
# Pulse Audio controls (volume)
", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%"
", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%"
];
bindm = [
"${cfg.mod}, mouse:272, movewindow"
];
};
};
};
}

View File

@@ -2,6 +2,7 @@
let
cfg = config.samfelag.modules.desktop.rofi;
hyprCfg = config.samfelag.modules.desktop.hyprland;
nix-colors-lib = inputs.nix-colors.lib-contrib { inherit pkgs; };
in
{
@@ -34,5 +35,11 @@ in
}
'';
samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
"${hyprCfg.mod}, SPACE, exec, $HOME/.config/rofi/menus/launcher/launcher.sh"
"${hyprCfg.mod}, END, exec, $HOME/.config/rofi/menus/powermenu/powermenu.sh"
"${hyprCfg.mod} SHIFT, W, exec, $HOME/.config/rofi/menus/wifi/wifi.sh"
];
};
}

View File

@@ -4,6 +4,7 @@ with lib;
let
cfg = config.samfelag.modules.editors.emacs;
i3Cfg = config.samfelag.modules.desktop.i3;
hyprCfg = config.samfelag.modules.desktop.hyprland;
emacsPackages = epkgs: [
epkgs.vterm
];
@@ -106,5 +107,9 @@ in {
"${i3Cfg.mod}+Shift+e" = "exec ${emacsWithPackages}/bin/emacs";
};
samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
"${hyprCfg.mod} SHIFT, e, exec, ${emacsWithPackages}/bin/emacs"
];
};
}

View File

@@ -2,7 +2,8 @@
let
cfg = config.samfelag.modules.system.pass;
desktopCfg = config.samfelag.modules.desktop;
i3Cfg = config.samfelag.modules.desktop.i3;
hyprCfg = config.samfelag.modules.desktop.hyprland;
in
{
options.samfelag.modules.system.pass = {
@@ -16,6 +17,7 @@ in
hm.programs.rofi.pass = {
enable = true;
package = if hyprCfg.enable then pkgs.rofi-pass-wayland else pkgs.rofi-pass;
extraConfig = ''
default_user="sastrey@gmail.com"
default_user2="marc"
@@ -34,8 +36,12 @@ in
'';
};
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf desktopCfg.enable {
"${desktopCfg.i3.mod}+p" = "exec rofi-pass";
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
"${i3Cfg.mod}+p" = "exec rofi-pass";
};
samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
"${hyprCfg.mod}, P, exec, rofi-pass"
];
};
}