Merge branch 'hyprland'

This commit is contained in:
Bryan Ramos 2024-06-03 21:29:07 -04:00
commit 24cb3b855f
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
17 changed files with 741 additions and 46 deletions

View file

@ -1,9 +1,17 @@
{ lib, ... }:
{ lib, config, ... }:
with lib;
let
gui = config.modules.user.gui.wm;
wm = {
enable = builtins.any (mod: mod.enable or false) (builtins.attrValues gui);
};
in
{
cd = "cd -L";
grep = "grep --color";
tree = "eza --tree --icons=never";
lt = mkForce "eza --tree --icons=never";
open = mkIf wm.enable "xdg-open";
}

View file

@ -0,0 +1,37 @@
{ lib, config, ... }:
with lib;
let
tmux = config.modules.user.tmux;
gui = config.modules.user.gui.wm;
sway = config.modules.user.gui.wm.sway;
hyprland = config.modules.user.gui.wm.hyprland;
wm = {
enable = builtins.any (mod: mod.enable or false) (builtins.attrValues gui);
};
in
''
case $- in
*i*)
${optionalString wm.enable ''
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
${optionalString sway.enable ''
exec sway
''
}
${optionalString hyprland.enable ''
exec Hyprland
''
}
fi
''}
${optionalString tmux.enable ''
if [ -z "$DISPLAY" ] && [ -z "$TMUX" ]; then
exec tmux
fi
''}
;;
esac
''

View file

@ -13,7 +13,8 @@ in
initExtra = import ./config/prompt.nix { inherit lib config; };
bashrcExtra = import ./config/bashrc.nix;
shellAliases = import ./config/alias.nix { inherit lib; };
shellAliases = import ./config/alias.nix { inherit lib config; };
profileExtra = import ./config/shellHook.nix { inherit lib config; };
};
programs = {

View file

@ -1,5 +1,6 @@
{
imports = [
./sway
./hyprland
];
}

View file

@ -0,0 +1,78 @@
{ config, lib, pkgs, ... }:
with pkgs;
{
enable = true;
xwayland.enable = true;
settings = {
"$mod" = "ALT";
"$terminal" = "${alacritty}";
"$menu" = "${rofi} -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'";
monitor = [
"HDMI-A-1, 1920X1080, 0x0, 1"
"DP-1, 1080x1920, 1920x0, 1, transform, 1"
];
exec-once = [
"waybar"
];
bind = [
"$mod, Enter, exec, $terminal"
"$mod, q, killactive"
"$mod, J, swapwindow, d"
"$mod, K, swapwindow, u"
"$mod, H, swapwindow, l"
"$mod, L, swapwindow, r"
"$mod, F, fullscreen"
", Print, exec, ${grim} ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"
"SHIFT, Print, exec, ${grim} -g \"$(${slurp})\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"
"$mod&SHIFT, F, exec, ${alacritty} -e sh -c 'EDITOR=nvim ${ranger}'"
#''$mod&SHIFT, Print, exec, sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png'"''
"$mod, D, exec, $menu"
"$mod&SHIFT, D, exec, ${rofi} -modi emoji -show emoji"
] ++ ( builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in
[
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
])
10)
);
bindm = [
"$mod, mouse:272, movewindow"
];
windowrulev2 = [
"float, title:(Android Emulator)"
];
input = {
kb_layout = "us";
follow_mouse = 0;
accel_profile = "flat";
sensitivity = 0.65;
};
env = [
"HYPRCURSOR_SIZE, 24"
"GTK_THEME, Qogir"
];
gaps_in = 10;
border_size = 0;
no_border_on_floating = true;
};
}

View file

@ -0,0 +1,7 @@
configuration {
font: "SF Pro Rounded 10";
show-icons: true;
kb-cancel: "Escape,Alt+F1";
}
@theme "~/.config/rofi/material-ocean.rasi"

View file

@ -0,0 +1,95 @@
* {
background: #0f111a;
foreground: #f1f1f1;
selected: #ff4151;
}
window {
transparency: "real";
background-color: @background;
text-color: @foreground;
}
prompt {
enabled: true;
padding: 4px 4px 6px 6px;
background-color: @background;
text-color: @foreground;
}
textbox-prompt-colon {
expand: false;
background-color: @background;
padding: 4px 0px 0px 6px;
}
inputbar {
children: [ textbox-prompt-colon, entry ];
background-color: @background;
text-color: @foreground;
expand: false;
border: 0px 0px 0px 0px;
border-radius: 0px;
border-color: @selected;
margin: 0px 0px 0px 0px;
padding: 0px 0px 4px 0px;
position: center;
}
entry {
background-color: @background;
text-color: @foreground;
placeholder-color: @foreground;
expand: true;
horizontal-align: 0;
blink: true;
padding: 4px 0px 0px 4px;
}
case-indicator {
background-color: @background;
text-color: @foreground;
spacing: 0;
}
listview {
background-color: @background;
columns: 1;
spacing: 5px;
cycle: true;
dynamic: true;
layout: vertical;
}
mainbox {
background-color: @background;
children: [ inputbar, listview ];
spacing: 5px;
padding: 5px 5px 5px 5px;
}
element {
background-color: @background;
text-color: @foreground;
orientation: horizontal;
border-radius: 4px;
padding: 6px 6px 6px 6px;
}
element-text, element-icon {
background-color: inherit;
text-color: inherit;
}
element-icon {
size: 18px;
border: 4px;
}
element selected {
background-color: @selected;
text-color: @background;
border: 0px;
border-radius: 0px;
border-color: @selected;
}

View file

@ -0,0 +1,183 @@
{ pkgs, config, ... }:
let
inherit (config.lib.formats.rasi) mkLiteral;
in
{
enable = true;
package = pkgs.rofi-wayland;
location = "center";
terminal = "\${pkgs.alacritty}/bin/alacritty";
plugins = with pkgs; [
rofi-emoji
];
#theme = {
# "*" = {
# nord0 = mkLiteral "#2e3440";
# nord1 = mkLiteral "#3b4252";
# nord2 = mkLiteral "#434c5e";
# nord3 = mkLiteral "#4c566a";
# nord4 = mkLiteral "#d8dee9";
# nord5 = mkLiteral "#e5e9f0";
# nord6 = mkLiteral "#eceff4";
# nord7 = mkLiteral "#8fbcbb";
# nord8 = mkLiteral "#88c0d0";
# nord9 = mkLiteral "#81a1c1";
# nord10 = mkLiteral "#5e81ac";
# nord11 = mkLiteral "#bf616a";
# nord12 = mkLiteral "#d08770";
# nord13 = mkLiteral "#ebcb8b";
# nord14 = mkLiteral "#a3be8c";
# nord15 = mkLiteral "#b48ead";
# spacing = 2;
# background-color = mkLiteral "var(nord1)";
# background = mkLiteral "var(nord1)";
# foreground = mkLiteral "var(nord4)";
# normal-background = mkLiteral "var(background)";
# normal-foreground = mkLiteral "var(foreground)";
# alternate-normal-background = mkLiteral "var(background)";
# alternate-normal-foreground = mkLiteral "var(foreground)";
# selected-normal-background = mkLiteral "var(nord8)";
# selected-normal-foreground = mkLiteral "var(background)";
# active-background = mkLiteral "var(background)";
# active-foreground = mkLiteral "var(nord10)";
# alternate-active-background = mkLiteral "var(background)";
# alternate-active-foreground = mkLiteral "var(nord10)";
# selected-active-background = mkLiteral "var(nord10)";
# selected-active-foreground = mkLiteral "var(background)";
# urgent-background = mkLiteral "var(background)";
# urgent-foreground = mkLiteral "var(nord11)";
# alternate-urgent-background = mkLiteral "var(background)";
# alternate-urgent-foreground = mkLiteral "var(nord11)";
# selected-urgent-background = mkLiteral "var(nord11)";
# selected-urgent-foreground = mkLiteral "var(background)";
# };
#
# element = {
# padding = mkLiteral "0px 0px 0px 7px";
# spacing = mkLiteral "5px";
# border = 0;
# cursor = mkLiteral "pointer";
# };
# "element normal.normal" = {
# background-color = mkLiteral "var(normal-background)";
# text-color = mkLiteral "var(normal-foreground)";
# };
# "element normal.urgent" = {
# background-color = mkLiteral "var(urgent-background)";
# text-color = mkLiteral "var(urgent-foreground)";
# };
# "element normal.active" = {
# background-color = mkLiteral "var(active-background)";
# text-color = mkLiteral "var(active-foreground)";
# };
# "element selected.normal" = {
# background-color = mkLiteral "var(selected-normal-background)";
# text-color = mkLiteral "var(selected-normal-foreground)";
# };
# "element selected.urgent" = {
# background-color = mkLiteral "var(selected-urgent-background)";
# text-color = mkLiteral "var(selected-urgent-foreground)";
# };
# "element selected.active" = {
# background-color = mkLiteral "var(selected-active-background)";
# text-color = mkLiteral "var(selected-active-foreground)";
# };
# "element alternate.normal" = {
# background-color = mkLiteral "var(alternate-normal-background)";
# text-color = mkLiteral "var(alternate-normal-foreground)";
# };
# "element alternate.urgent" = {
# background-color = mkLiteral "var(alternate-urgent-background)";
# text-color = mkLiteral "var(alternate-urgent-foreground)";
# };
# "element alternate.active" = {
# background-color = mkLiteral "var(alternate-active-background)";
# text-color = mkLiteral "var(alternate-active-foreground)";
# };
# "element-text" = {
# background-color = mkLiteral "rgba(0, 0, 0, 0%)";
# text-color = mkLiteral "inherit";
# highlight = mkLiteral "inherit";
# cursor = mkLiteral "inherit";
# };
# "element-icon" = {
# background-color = mkLiteral "rgba(0, 0, 0, 0%)";
# size = mkLiteral "1.0000em";
# text-color = mkLiteral "inherit";
# cursor = mkLiteral "inherit";
# };
# window = {
# padding = 0;
# border = 0;
# background-color = mkLiteral "var(background)";
# };
# mainbox = {
# padding = 0;
# border = 0;
# };
# message = {
# margin = mkLiteral "0px 7px";
# };
# textbox = {
# text-color = mkLiteral "var(foreground)";
# };
# listview = {
# margin = mkLiteral "0px 0px 5px";
# scrollbar = true;
# spacing = mkLiteral "2px";
# fixed-height = 0;
# };
# scrollbar = {
# padding = 0;
# handle-width = mkLiteral "14px";
# border = 0;
# handle-color = mkLiteral "var(nord3)";
# };
# button = {
# spacing = 0;
# text-color = mkLiteral "var(normal-foreground)";
# cursor = mkLiteral "pointer";
# };
# "button selected" = {
# background-color = mkLiteral "var(selected-normal-background)";
# text-color = mkLiteral "var(selected-normal-foreground)";
# };
# inputbar = {
# padding = mkLiteral "7px";
# margin = mkLiteral "7px";
# spacing = 0;
# text-color = mkLiteral "var(normal-foreground)";
# background-color = mkLiteral "var(nord3)";
# children = [ "entry" ];
# };
# entry = {
# spacing = 0;
# cursor = mkLiteral "text";
# text-color = mkLiteral "var(normal-foreground)";
# background-color = mkLiteral "var(nord3)";
# };
#};
}

View file

@ -0,0 +1 @@
../../../../../../configs/wallpapers/

View file

@ -0,0 +1,79 @@
{ config, lib, pkgs, ... }:
{
enable = true;
settings = [
{
mainBar = {
font-family = "Terminus";
font-size = 12;
background-color = "rgba(10, 14, 20, 1)";
color = "#FFFFFF";
layer = "top";
output = [
"HDMI-A-1"
];
position = "top";
height = 10;
modules-left = [
"hyprland/workspaces"
"wlr/taskbar"
];
modules-center = [
"clock"
];
modules-right = [
"memory"
"network"
"tray"
];
"hyprland/workspaces" = {
active-only = true;
format = "{name}";
};
"wlr/taskbar" = {
format = "{icon}";
icon_size = 14;
icon-theme = "Qogir";
tooltip-format = "{title}";
on-click = "minimize-raise";
ignore-list = [
"Alacritty"
"rofi"
];
rewrite = {
"Firefox Web Browser" = "Firefox";
};
};
"clock" = {
format = "%I:%M:%S %p | %m-%d-%Y";
interval = 60;
};
"memory" = {
format = "RAM: {percentage}%";
interval = 30;
};
"network" = {
format-disconnected = "<span color=\"#FF0000\">󰜺</span>";
format-wifi = "<span color=\"##00FF00\">󰖩</span>{essid}({signalStrength}%)";
format-ethernet = "<span color=\"##00FF00\">󰈁</span>{cidr}";
};
"tray" = {
icon_size = 16;
spacing = 10;
};
};
}
];
}

View file

@ -0,0 +1,246 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.modules.user.gui.wm.hyprland;
wallpapers = builtins.path {
path = ./config/wallpapers;
name = "wallpapers";
};
in
{ options.modules.user.gui.wm.hyprland = { enable = mkEnableOption "Enable hyprland wm module"; };
config = mkIf cfg.enable {
wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
settings = {
"$mod" = "ALT";
"$terminal" = "${pkgs.alacritty}/bin/alacritty";
"$menu" = "rofi -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'";
monitor = [
"HDMI-A-1, 1920X1080, 0x0, 1"
"DP-1, 1080x1920, 1920x0, 1, transform, 1"
];
exec-once = [
"waybar"
];
bind = [
"$mod, Enter, $terminal"
"$mod, q, killactive"
"$mod, J, swapwindow, d"
"$mod, K, swapwindow, u"
"$mod, H, swapwindow, l"
"$mod, L, swapwindow, r"
"$mod, F, fullscreen"
", Print, exec, grim ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"
"SHIFT, Print, exec, grim -g \"$slurp)\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"
"$mod&SHIFT, F, exec, alacritty -e sh -c 'EDITOR=nvim ranger'"
#''$mod&SHIFT, Print, exec, sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png'"''
"$mod, D, exec, $menu"
"$mod&SHIFT, D, exec, rofi -modi emoji -show emoji"
] ++ ( builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in
[
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
])
10)
);
bindm = [
"$mod, mouse:272, movewindow"
];
windowrulev2 = [
"float, title:(Android Emulator)"
];
input = {
kb_layout = "us";
follow_mouse = 0;
accel_profile = "flat";
sensitivity = 0.65;
};
env = [
"HYPRCURSOR_SIZE, 24"
"GTK_THEME, Qogir"
#"LIBVA_DRIVER_NAME, nvidia"
#"XDG_SESSION_TYPE, wayland"
#"GBM_BACKEND, nvidia-drm"
#"__GLX_VENDOR_LIBRARY_NAME, nvidia"
#"NVD_BACKEND, direct"
];
};
};
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
location = "center";
terminal = "alacritty";
plugins = with pkgs; [
rofi-emoji
];
};
home.file.".config/rofi" = {
source = ./config/rofi/config;
recursive = true;
};
programs.waybar = {
enable = true;
settings = [
{
mainBar = {
font-family = "Terminus";
font-size = 12;
background-color = "rgba(10, 14, 20, 1)";
color = "#FFFFFF";
layer = "top";
output = [
"HDMI-A-1"
];
position = "top";
height = 10;
modules-left = [
"hyprland/workspaces"
"wlr/taskbar"
];
modules-center = [
"clock"
];
modules-right = [
"memory"
"network"
"tray"
];
"hyprland/workspaces" = {
active-only = true;
format = "{name}";
};
"wlr/taskbar" = {
format = "{icon}";
icon_size = 14;
icon-theme = "Qogir";
tooltip-format = "{title}";
on-click = "minimize-raise";
ignore-list = [
"Alacritty"
"rofi"
];
rewrite = {
"Firefox Web Browser" = "Firefox";
};
};
"clock" = {
format = "%I:%M:%S %p | %m-%d-%Y";
interval = 60;
};
"memory" = {
format = "RAM: {percentage}%";
interval = 30;
};
"network" = {
format-disconnected = "<span color=\"#FF0000\">󰜺</span>";
format-wifi = "<span color=\"##00FF00\">󰖩</span>{essid}({signalStrength}%)";
format-ethernet = "<span color=\"##00FF00\">󰈁</span>{cidr}";
};
"tray" = {
icon_size = 16;
spacing = 10;
};
};
}
];
};
services.hyprpaper = {
enable = true;
settings = {
ipc = "on";
splash = false;
splash_offset = 2.0;
preload =
[ "${wallpapers}/${config.user.wallpaper}" ];
wallpaper = [
",${wallpapers}/${config.user.wallpaper}"
];
};
};
gtk = {
enable = true;
theme = {
package = pkgs.juno-theme;
name = "Juno-ocean";
};
iconTheme = {
package = pkgs.qogir-icon-theme;
name = "Qogir";
};
};
qt = {
enable = true;
style.package = pkgs.juno-theme;
platformTheme.name = "gtk";
};
home.packages = with pkgs; [
pavucontrol
xdg-utils
wl-clipboard
xdg-desktop-portal-hyprland
dconf
grim
jq
slurp
ranger
highlight
terminus-nerdfont
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
];
programs = {
imv.enable = true;
};
fonts.fontconfig.enable = true;
};
}

View file

@ -1,22 +0,0 @@
{ lib, config, ... }:
with lib;
let
tmux = config.modules.user.tmux;
in
''
case $- in
*i*)
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec sway
fi
${optionalString tmux.enable ''
if [ -z "$DISPLAY" ] && [ -z "$TMUX" ]; then
exec tmux
fi
''}
;;
esac
''

View file

@ -15,13 +15,6 @@ in
recursive = true;
};
programs.bash = {
profileExtra = import ./config/shellHook.nix { inherit config lib; };
shellAliases = {
open = "xdg-open";
};
};
#gtk = {
# enable = true;
# theme.package = pkgs.juno-theme;

View file

@ -1,9 +0,0 @@
''
case $- in
*i*)
if [ -z "$DISPLAY" ] && [ -z "$TMUX" ]; then
exec tmux
fi
;;
esac
''

View file

@ -12,10 +12,6 @@ let
in
{ options.modules.user.tmux = { enable = mkEnableOption "Enable tmux module"; };
config = mkIf cfg.enable {
programs.bash = mkIf (!wm.enable) {
profileExtra = import ./config/shellHook.nix;
};
programs.tmux = {
enable = true;
newSession = true;