feat(home-manager): service defs and fmt

fmt: reformatted using nixpkgs-fmt prettifier
mpd: created configuration
hypr: add window rules
commons: add usingMusicPlayerDaemon variable
This commit is contained in:
Zhongheng Liu 2025-01-08 14:12:29 +02:00
commit 7d88765f5d
Signed by: steven
GPG key ID: 805A28B071DAD84B
67 changed files with 633 additions and 573 deletions

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
imports = [
./hyprland

View file

@ -1,6 +1,8 @@
{pkgs, ...}: let
{ pkgs, ... }:
let
timeoutSeconds = 600;
in {
in
{
services.hypridle = {
enable = true;
settings = {

View file

@ -1,60 +1,75 @@
{
config,
pkgs,
...
}: let
{ config
, pkgs
, ...
}:
let
terminalCmd = config.defaultApplications.terminal;
screenshotLocation = "/home/${config.myUserName}/Screenshots/$(date '+%Y-%m-%d-%H-%M-%S').png";
in
[
"$mod SHIFT, L, exec, ${pkgs.wlogout}/bin/wlogout"
[
"$mod SHIFT, L, exec, ${pkgs.wlogout}/bin/wlogout"
"$mod SHIFT, Print, exec, ${pkgs.grimblast}/bin/grimblast copysave output ${screenshotLocation}"
", Print, exec, ${pkgs.grimblast}/bin/grimblast copysave area ${screenshotLocation}"
"$mod, Print, exec, ${pkgs.grimblast}/bin/grimblast copy area"
"$mod SHIFT, Print, exec, ${pkgs.grimblast}/bin/grimblast copysave output ${screenshotLocation}"
", Print, exec, ${pkgs.grimblast}/bin/grimblast copysave area ${screenshotLocation}"
"$mod, Print, exec, ${pkgs.grimblast}/bin/grimblast copy area"
# special workspace keybinds
"$mod, S, togglespecialworkspace"
"$mod SHIFT, S, movetoworkspace, special"
# special workspace keybinds
"$mod, S, togglespecialworkspace"
"$mod SHIFT, S, movetoworkspace, special"
# keysyms for util functions
# Example volume button that allows press and hold, volume limited to 150%
"$mod, Q, killactive"
"$mod, D, exec, ${config.defaultApplications.appLauncher}"
"$mod, F, fullscreen"
"$mod, E, exec, ${config.defaultApplications.fileManager}"
# foot terminal
"$mod, Return, exec, ${terminalCmd} ${config.myShells.defaultShell}"
"$mod SHIFT, Return, exec, [float] ${terminalCmd} ${config.myShells.defaultShell}"
# keysyms for util functions
# Example volume button that allows press and hold, volume limited to 150%
"$mod, Q, killactive"
"$mod, D, exec, ${config.defaultApplications.appLauncher}"
"$mod, F, fullscreen"
"$mod, E, exec, ${config.defaultApplications.fileManager}"
# foot terminal
"$mod, Return, exec, ${terminalCmd} ${config.myShells.defaultShell}"
"$mod SHIFT, Return, exec, [float] ${terminalCmd} ${config.myShells.defaultShell}"
# cmdline utilities
/*
# cmdline utilities
/*
NOTE Replaced by network manager applet
nmtui interface is no longer needed
TODO Fix floating window rule
*/
# "$mod, N, exec, [float] ${terminalCmd} ${pkgs.networkmanager}/bin/nmtui"
"$mod, M, exec, [float] ${terminalCmd} ${pkgs.zenith}/bin/zenith"
# "$mod, N, exec, [float] ${terminalCmd} ${pkgs.networkmanager}/bin/nmtui"
#"$mod, M, exec, [float] ${terminalCmd} ${pkgs.zenith}/bin/zenith"
# vimkeys navigation
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
]
++ (
if config.services.swaync.enable
then ["$mod, N, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t"]
else []
)
++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (builtins.genList (x: let
# vimkeys navigation
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
]
++ (
if config.services.mpd.enable then [ "$mod, M, exec, ${terminalCmd} --title=ncmpc ${pkgs.ncmpc}/bin/ncmpc -h 127.0.0.1" ] else [ ]
)
++ (
if config.services.swaync.enable
then [ "$mod, N, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t" ]
else [ ]
)
++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (builtins.genList
(x:
let
ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10));
in [
in
[
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
])
10)
)
]) 10)
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
/*
builtins.concatLists (builtins.genList (x:
let ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10));
in [
"$mod M, ${ws}, workspace, ${toString (x + 10 + 1)}"
"$mod SHIFT M, ${ws}, movetoworkspace, ${toString (x + 10 + 1)}"
]) 10)
*/
)

View file

@ -1,28 +1,21 @@
{
inputs,
config,
pkgs,
lib,
...
}: {
home.packages = [
inputs.hyprland-qtutils.packages.x86_64-linux.default
pkgs.foot
];
{ inputs, config, pkgs, lib, ... }: {
home.packages =
[ inputs.hyprland-qtutils.packages.x86_64-linux.default pkgs.foot ];
wayland.windowManager.hyprland = {
# Whether to enable Hyprland wayland compositor
enable = true;
# The hyprland package to use
package = pkgs.hyprland;
plugins = with pkgs.hyprlandPlugins; [
# hyprfocus
# hycov
];
plugins = with pkgs.hyprlandPlugins;
[
# hyprfocus
# hycov
];
# Whether to enable XWayland
xwayland.enable = true;
settings = {
env = ["AQ_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0"];
xwayland = {force_zero_scaling = true;};
env = [ "AQ_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0" ];
xwayland = { force_zero_scaling = true; };
monitor = [
#"eDP-1, 1920x1080@165,0x0,1"
"desc:Xiaomi Corporation Mi 27 NFGL 3215000032603, 1920x1080@75, 2560x0, 1"
@ -37,8 +30,8 @@
gaps_out = 5;
allow_tearing = true;
};
windowrulev2 = ["immediate, class:^(cs2)$"];
decoration = {rounding = 5;};
windowrulev2 = import ./window_rules.nix;
decoration = { rounding = 5; };
input = {
# xset rate 250 50 replacement on wayland...
# FAST MODE LET'S GOOO
@ -46,13 +39,10 @@
repeat_delay = 250;
accel_profile = "flat";
};
exec-once =
config.myAutostartCommands
++ [
# future hyprland-specific exec commands
#"${config.programs.firefox.package}/bin/firefox"
#"${pkgs.thunderbird}/bin/thunderbird"
];
exec-once = config.myAutostartCommands ++ import ./hypr_autostart.nix {
inherit pkgs;
inherit config;
};
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
@ -78,7 +68,7 @@
};
# Optional
# Whether to enable hyprland-session.target on hyprland startup
systemd = {enable = true;};
systemd = { enable = true; };
};
# ...
}

View file

@ -0,0 +1,8 @@
{ pkgs, config }:
let
term = config.defaultApplications.terminal;
shell = config.myShells.defaultShell;
in
[
"${term} --title=autorun ${shell}"
]

View file

@ -0,0 +1,7 @@
[
"workspace special silent, class:^(foot.*)$, title:autorun"
"float, tag:floats"
"float, title:ncmpc"
"size 50% 50%, title:ncmpc"
"immediate, class:^(cs2)$"
]

View file

@ -1,6 +1,6 @@
{
pkgs,
config,
{ pkgs
, config
,
}: [
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
", XF86AudioStop, exec, ${pkgs.playerctl}/bin/playerctl stop"

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
programs.hyprlock = {
enable = true;

View file

@ -1,15 +1,14 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
services.hyprpaper = {
enable = true;
settings = {
ipc = "on";
splash = false;
preload = [config.myWallPaperPathString];
wallpaper = [",${config.myWallPaperPathString}"];
preload = [ config.myWallPaperPathString ];
wallpaper = [ ",${config.myWallPaperPathString}" ];
#preload = [/home/stvnliu/Downloads/mao-zedong.jpg];
#wallpaper = [",/home/stvnliu/Downloads/mao-zedong.jpg"];
};