feat: modular hyprland's configurations

This commit is contained in:
Ryan Yin
2023-12-24 22:09:18 +08:00
parent 55e12cddaf
commit 3aaaeb49ca
50 changed files with 71 additions and 76 deletions
@@ -0,0 +1,84 @@
{
pkgs,
anyrun,
...
}: {
programs.anyrun = {
enable = true;
config = {
plugins = with anyrun.packages.${pkgs.system}; [
applications
randr
rink
shell
symbols
translate
];
width.fraction = 0.3;
y.absolute = 15;
hidePluginInfo = true;
closeOnClick = true;
};
# custom css for anyrun, based on catppuccin-mocha
extraCss = ''
@define-color bg-col rgba(30, 30, 46, 0.7);
@define-color bg-col-light rgba(150, 220, 235, 0.7);
@define-color border-col rgba(30, 30, 46, 0.7);
@define-color selected-col rgba(150, 205, 251, 0.7);
@define-color fg-col #D9E0EE;
@define-color fg-col2 #F28FAD;
* {
transition: 200ms ease;
font-family: "JetBrainsMono Nerd Font";
font-size: 1.3rem;
}
#window {
background: transparent;
}
#plugin,
#main {
border: 3px solid @border-col;
color: @fg-col;
background-color: @bg-col;
}
/* anyrun's input window - Text */
#entry {
color: @fg-col;
background-color: @bg-col;
}
/* anyrun's ouput matches entries - Base */
#match {
color: @fg-col;
background: @bg-col;
}
/* anyrun's selected entry - Red */
#match:selected {
color: @fg-col2;
background: @selected-col;
}
#match {
padding: 3px;
border-radius: 16px;
}
#entry, #plugin:hover {
border-radius: 16px;
}
box#main {
background: rgba(30, 30, 46, 0.7);
border: 1px solid @border-col;
border-radius: 15px;
padding: 5px;
}
'';
};
}
@@ -0,0 +1,4 @@
{mylib, ...} @ args:
map
(path: import path args)
(mylib.scanPaths ./.)
@@ -0,0 +1,70 @@
{
pkgs,
lib,
hyprland,
nur-ryan4yin,
...
}: {
# NOTE:
# We have to enable hyprland/i3's systemd user service in home-manager,
# so that gammastep/wallpaper-switcher's user service can be start correctly!
# they are all depending on hyprland/i3's user graphical-session
wayland.windowManager.hyprland = {
enable = true;
settings = {
source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes/mocha.conf";
};
package = hyprland.packages.${pkgs.system}.hyprland;
extraConfig = builtins.readFile ../conf/hyprland.conf;
# gammastep/wallpaper-switcher need this to be enabled.
systemd.enable = true;
};
# NOTE: this executable is used by greetd to start a wayland session when system boot up
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config in NixOS module
home.file.".wayland-session" = {
source = "${pkgs.hyprland}/bin/Hyprland";
executable = true;
};
# hyprland configs, based on https://github.com/notwidow/hyprland
xdg.configFile = {
"hypr/mako" = {
source = ../conf/mako;
recursive = true;
};
"hypr/scripts" = {
source = ../conf/scripts;
recursive = true;
};
"hypr/waybar" = {
source = ../conf/waybar;
recursive = true;
};
"hypr/wlogout" = {
source = ../conf/wlogout;
recursive = true;
};
# music player - mpd
"mpd" = {
source = ../conf/mpd;
recursive = true;
};
};
# allow fontconfig to discover fonts and configurations installed through home.packages
fonts.fontconfig.enable = true;
systemd.user.sessionVariables = {
NIXOS_OZONE_WL = "1"; # for any ozone-based browser & electron apps to run on wayland
MOZ_ENABLE_WAYLAND = "1"; # for firefox to run on wayland
MOZ_WEBRENDER = "1";
# toolkit-specific scale
GDK_SCALE = "2";
XCURSOR_SIZE = "32";
# misc
_JAVA_AWT_WM_NONREPARENTING = "1";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
};
}
@@ -0,0 +1,27 @@
{pkgs, ...}: {
home.packages = with pkgs; [
waybar # the status bar
swaybg # the wallpaper
swayidle # the idle timeout
swaylock # locking the screen
wlogout # logout menu
wl-clipboard # copying and pasting
hyprpicker # color picker
wf-recorder # creen recording
grim # taking screenshots
slurp # selecting a region to screenshot
# TODO replace by `flameshot gui --raw | wl-copy`
mako # the notification daemon, the same as dunst
yad # a fork of zenity, for creating dialogs
# audio
alsa-utils # provides amixer/alsamixer/...
mpd # for playing system sounds
mpc-cli # command-line mpd client
ncmpcpp # a mpd client with a UI
networkmanagerapplet # provide GUI app: nm-connection-editor
];
}
@@ -0,0 +1,28 @@
{pkgs, ...}: {
# TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it.
programs = {
# source code: https://github.com/nix-community/home-manager/blob/master/modules/programs/chromium.nix
google-chrome = {
enable = true;
commandLineArgs = [
# make it use GTK_IM_MODULE if it runs with Gtk4, so fcitx5 can work with it.
# (only supported by chromium/chrome at this time, not electron)
"--gtk-version=4"
"--enable-features=UseOzonePlatform"
"--ozone-platform=wayland"
# make it use text-input-v1, which works for kwin 5.27 and weston
"--enable-wayland-ime"
# enable hardware acceleration - vulkan api
# "--enable-features=Vulkan"
];
};
firefox = {
enable = true;
enableGnomeExtensions = false;
package = pkgs.firefox-wayland; # firefox with wayland support
};
};
}