update: fixed issues and update flake inputs
This commit is contained in:
parent
4b6183f0ec
commit
b3c5ad2880
80 changed files with 3307 additions and 2059 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
settings ? [ ],
|
||||
matchByDesc ? false,
|
||||
}:
|
||||
{
|
||||
osConfig,
|
||||
|
|
@ -11,7 +12,15 @@
|
|||
}:
|
||||
let
|
||||
inherit (helper) mkToggleScript;
|
||||
inherit (lib) optionalString;
|
||||
inherit (lib)
|
||||
optionalString
|
||||
imap0
|
||||
getExe
|
||||
concatStringsSep
|
||||
map
|
||||
;
|
||||
|
||||
wmName = if osConfig.programs.hyprland.enable then "hyprland" else "niri";
|
||||
|
||||
gamemodeToggle = mkToggleScript {
|
||||
service = "gamemodedr";
|
||||
|
|
@ -77,6 +86,35 @@ let
|
|||
rbwSelector = import ../scripts/rbwSelector.nix { inherit pkgs; };
|
||||
|
||||
toggleRecord = pkgs.callPackage ../scripts/record.nix { };
|
||||
|
||||
includePath = "${config.home.homeDirectory}/.config/waybar";
|
||||
|
||||
mkMatchByDesc =
|
||||
settings:
|
||||
let
|
||||
# Config will generated by systemd
|
||||
descs = map (v: "${v.output}") settings;
|
||||
descString = concatStringsSep ";" descs;
|
||||
in
|
||||
(pkgs.writeShellScript "config-match-by-desc" ''
|
||||
FILE_PATH="${includePath}"
|
||||
IFS=";" read -r -a DESCS <<< "${descString}"
|
||||
monitors_json=$(${getExe pkgs.wlr-randr} --json)
|
||||
|
||||
i=0
|
||||
|
||||
for desc in "''\${DESCS[@]}"; do
|
||||
name=$(${getExe pkgs.jq} -r --arg d "$desc" '
|
||||
.[] | select((.make + " " + .model + " " + .serial) == $d) | .name
|
||||
' <<< "$monitors_json")
|
||||
|
||||
file="monitor-$i.json"
|
||||
printf '{ "output": "%s" }\n' "$name" > "$FILE_PATH/$file"
|
||||
echo "$file Generated."
|
||||
|
||||
i=$((i+1))
|
||||
done
|
||||
'');
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
|
|
@ -97,6 +135,14 @@ in
|
|||
PartOf = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service.ExecStartPre =
|
||||
let
|
||||
matchScript = mkMatchByDesc settings;
|
||||
in
|
||||
[
|
||||
"${matchScript}"
|
||||
];
|
||||
};
|
||||
|
||||
programs.waybar =
|
||||
|
|
@ -264,63 +310,27 @@ in
|
|||
margin-bottom = 0;
|
||||
|
||||
modules-center = [
|
||||
"hyprland/window"
|
||||
"${wmName}/window"
|
||||
];
|
||||
};
|
||||
|
||||
modulesConfig =
|
||||
let
|
||||
terminalRun = "${config.programs.ghostty.package}/bin/ghostty -e";
|
||||
in
|
||||
{
|
||||
"hyprland/workspaces" = {
|
||||
active-only = false;
|
||||
commonWorkspace = {
|
||||
all-outputs = true;
|
||||
format = "{icon}";
|
||||
show-special = false;
|
||||
on-click = "activate";
|
||||
on-scroll-up = "hyprctl dispatch workspace e+1";
|
||||
on-scroll-down = "hyprctl dispatch workspace e-1";
|
||||
persistent-workspaces = {
|
||||
"1" = [ ];
|
||||
"2" = [ ];
|
||||
"3" = [ ];
|
||||
"4" = [ ];
|
||||
};
|
||||
format-icons = {
|
||||
active = "";
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
clock = {
|
||||
format = "<b> {:%H:%M %d/%m}</b>";
|
||||
tooltip-format = "{:%A %d %B %Y}";
|
||||
};
|
||||
actions = {
|
||||
on-click-right = "mode";
|
||||
on-click-forward = "tz_up";
|
||||
on-click-backward = "tz_down";
|
||||
on-scroll-up = "shift_up";
|
||||
on-scroll-down = "shift_down";
|
||||
};
|
||||
"custom/os" = {
|
||||
format = "";
|
||||
on-click = "wlogout --protocol layer-shell";
|
||||
};
|
||||
cpu = {
|
||||
format = " {usage}%";
|
||||
max-length = 20;
|
||||
interval = 5;
|
||||
on-click-right = "${terminalRun} btop";
|
||||
};
|
||||
"hyprland/window" = {
|
||||
commonWindow = {
|
||||
format = "{}";
|
||||
max-length = 40;
|
||||
separate-outputs = true;
|
||||
offscreen-css = true;
|
||||
offscreen-css-text = "(inactive)";
|
||||
rewrite = {
|
||||
"nvim . (.*)" = " $1";
|
||||
"(.*) \\| nvim (.*)" = " $1";
|
||||
"(.*) \\| vi (.*)" = " $1";
|
||||
"(.*) - Visual Studio Code" = " $1";
|
||||
"\\(\\d+\\) Discord (.*)" = " $1";
|
||||
|
||||
|
|
@ -344,6 +354,60 @@ in
|
|||
"(.*) - VLC media player" = " $1";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
# ==== Niri ==== #
|
||||
"niri/workspaces" = commonWorkspace // {
|
||||
format-icons = {
|
||||
focused = "";
|
||||
game = "";
|
||||
browser = "";
|
||||
};
|
||||
};
|
||||
"niri/window" = commonWindow // {
|
||||
};
|
||||
|
||||
# ==== Hyprland ==== #
|
||||
"hyprland/workspaces" = commonWorkspace // {
|
||||
active-only = false;
|
||||
show-special = false;
|
||||
on-click = "activate";
|
||||
on-scroll-up = "hyprctl dispatch workspace e+1";
|
||||
on-scroll-down = "hyprctl dispatch workspace e-1";
|
||||
persistent-workspaces = {
|
||||
"1" = [ ];
|
||||
"2" = [ ];
|
||||
"3" = [ ];
|
||||
"4" = [ ];
|
||||
};
|
||||
};
|
||||
"hyprland/window" = commonWindow // {
|
||||
max-length = 40;
|
||||
offscreen-css = true;
|
||||
offscreen-css-text = "(inactive)";
|
||||
};
|
||||
|
||||
clock = {
|
||||
format = "<b> {:%H:%M %d/%m}</b>";
|
||||
tooltip-format = "{:%A %d %B %Y}";
|
||||
};
|
||||
actions = {
|
||||
on-click-right = "mode";
|
||||
on-click-forward = "tz_up";
|
||||
on-click-backward = "tz_down";
|
||||
on-scroll-up = "shift_up";
|
||||
on-scroll-down = "shift_down";
|
||||
};
|
||||
"custom/os" = {
|
||||
format = "";
|
||||
on-click = "wlogout --protocol layer-shell";
|
||||
};
|
||||
cpu = {
|
||||
format = " {usage}%";
|
||||
max-length = 20;
|
||||
interval = 5;
|
||||
on-click-right = "${terminalRun} btop";
|
||||
};
|
||||
memory = {
|
||||
interval = 30;
|
||||
format = " {used:0.1f}GB/{total:0.1f}G";
|
||||
|
|
@ -383,7 +447,7 @@ in
|
|||
];
|
||||
};
|
||||
scroll-step = 5.0;
|
||||
on-click = "pavucontrol -t 3";
|
||||
on-click = "pwvucontrol -t 4";
|
||||
tooltip-format = "{icon} {desc} | {volume}%";
|
||||
smooth-scrolling-threshold = 1;
|
||||
};
|
||||
|
|
@ -455,6 +519,7 @@ in
|
|||
"custom/cava" = {
|
||||
exec = "${pkgs.writeShellScript "cava-wave" ''
|
||||
#Taken from JaKoolit's dotfiles
|
||||
PATH="$PATH:${pkgs.cava}/bin"
|
||||
|
||||
bar="▁▂▃▄▅▆▇█"
|
||||
dict="s/;//g"
|
||||
|
|
@ -487,7 +552,7 @@ in
|
|||
cava -p "$config_file" | sed -u "$dict"
|
||||
''}";
|
||||
format = "{}";
|
||||
on-click = "${terminalRun} cava";
|
||||
on-click = "${terminalRun} ${getExe pkgs.cava}";
|
||||
};
|
||||
battery =
|
||||
let
|
||||
|
|
@ -602,7 +667,7 @@ in
|
|||
otherConfig = {
|
||||
modules-left = [
|
||||
"custom/os"
|
||||
"hyprland/workspaces"
|
||||
"${wmName}/workspaces"
|
||||
"clock"
|
||||
"mpris"
|
||||
"custom/cava"
|
||||
|
|
@ -622,7 +687,27 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
finalList = if ((builtins.length settings) == 0) then [ otherConfig ] else settings;
|
||||
finalList =
|
||||
if ((builtins.length settings) == 0) then
|
||||
# Use default configuration
|
||||
[ otherConfig ]
|
||||
else
|
||||
(
|
||||
if matchByDesc then
|
||||
# Config will generated by systemd
|
||||
(imap0 (
|
||||
i: v:
|
||||
let
|
||||
outputRemoved = removeAttrs v [ "output" ];
|
||||
includeAdded = outputRemoved // {
|
||||
include = [ "${includePath}/monitor-${toString i}.json" ];
|
||||
};
|
||||
in
|
||||
includeAdded
|
||||
) settings)
|
||||
else
|
||||
settings
|
||||
);
|
||||
in
|
||||
map (dev: dev // modulesConfig // commonConfig) finalList;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue