setup niri
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
config,
|
||||
osConfig,
|
||||
lib,
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
@@ -42,7 +43,9 @@
|
||||
source-sans-pro
|
||||
mosh
|
||||
docker-compose
|
||||
signal-desktop
|
||||
(signal-desktop.override {
|
||||
commandLineArgs = "--password-store=gnome-libsecret";
|
||||
})
|
||||
cargo
|
||||
blanket
|
||||
wl-clipboard
|
||||
@@ -96,6 +99,8 @@
|
||||
'')
|
||||
pkgs-unstable.tidal-hifi
|
||||
inputs.tonearm.packages.${pkgs.stdenv.hostPlatform.system}.tonearm
|
||||
blueman
|
||||
pavucontrol
|
||||
(writeShellScriptBin "voxtoggle" ''
|
||||
status=$(${lib.getExe config.programs.voxtype.package} status)
|
||||
pid=$(cat ''${XDG_RUNTIME_DIR}/voxtype/pid)
|
||||
@@ -109,8 +114,86 @@
|
||||
fi
|
||||
'')
|
||||
];
|
||||
++ lib.optional osConfig.programs.niri.enable (
|
||||
pkgs.writeShellScriptBin "handle-lid-close" ''
|
||||
alias niri=${lib.getExe osConfig.programs.niri.package}
|
||||
|
||||
output_count=$(niri outputs | ${lib.getExe jq} -r 'length')
|
||||
if [ "$output_count" -eq 1 ]; then
|
||||
niri msg action spawn hyprlock
|
||||
systemctl suspend
|
||||
fi
|
||||
''
|
||||
);
|
||||
|
||||
programs = {
|
||||
ashell = {
|
||||
enable = true;
|
||||
package = pkgs-unstable.ashell;
|
||||
systemd = {
|
||||
enable = true;
|
||||
target = "graphical-session.target";
|
||||
};
|
||||
settings = {
|
||||
modules = {
|
||||
left = [ "Workspaces" ];
|
||||
center = [ "WindowTitle" ];
|
||||
right = [
|
||||
"CustomNotifications"
|
||||
"SystemInfo"
|
||||
[
|
||||
"Clock"
|
||||
"Privacy"
|
||||
"Settings"
|
||||
]
|
||||
];
|
||||
};
|
||||
settings = {
|
||||
lock_cmd = "hyprlock &";
|
||||
logout_cmd = "niri msg action quit";
|
||||
audio_sinks_more_cmd = "pavucontrol -t 3";
|
||||
audio_sources_more_cmd = "pavucontrol -t 4";
|
||||
bluetooth_more_cmd = "blueman-manager";
|
||||
CustomButton =
|
||||
let
|
||||
isDark = lib.getExe (
|
||||
pkgs.writeShellScriptBin "is-dark" ''
|
||||
gsettings get org.gnome.desktop.interface color-scheme | grep -q dark
|
||||
''
|
||||
);
|
||||
toggleDark = lib.getExe (
|
||||
pkgs.writeShellScriptBin "toggle-dark" ''
|
||||
if ${isDark}; then
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
fi
|
||||
''
|
||||
);
|
||||
in
|
||||
[
|
||||
{
|
||||
name = "Dark Mode";
|
||||
icon = " ";
|
||||
command = toggleDark;
|
||||
status_command = isDark;
|
||||
}
|
||||
];
|
||||
};
|
||||
CustomModule = [
|
||||
{
|
||||
name = "CustomNotifications";
|
||||
type = "Button";
|
||||
icon = " ";
|
||||
command = "swaync-client -t -sw";
|
||||
listen_cmd = "swaync-client -swb";
|
||||
icons."dnd.*" = " ";
|
||||
alert = ".*notification";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nh = {
|
||||
enable = true;
|
||||
flake = self;
|
||||
@@ -441,6 +524,36 @@
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
hyprlock = {
|
||||
enable = true;
|
||||
package = pkgs-unstable.hyprlock;
|
||||
settings = {
|
||||
general = {
|
||||
hide_cursor = true;
|
||||
ignore_empty_input = true;
|
||||
};
|
||||
background = {
|
||||
monitor = "";
|
||||
path = "screenshot";
|
||||
blur_passes = 3;
|
||||
};
|
||||
input-field = {
|
||||
size = "20%, 5%";
|
||||
monitor = "";
|
||||
dots_center = true;
|
||||
fade_on_empty = false;
|
||||
rounding = 15;
|
||||
shadow_passes = 2;
|
||||
outline_thickness = 2;
|
||||
placeholder_text = "Password...";
|
||||
fail_text = "$PAMFAIL";
|
||||
dots_spacing = "0.3";
|
||||
position = "0, -20";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
voxtype = {
|
||||
enable = true;
|
||||
@@ -633,7 +746,8 @@
|
||||
#
|
||||
# /etc/profiles/per-user/jokke/etc/profile.d/hm-session-vars.sh
|
||||
#
|
||||
systemd.user.sessionVariables = {
|
||||
|
||||
home.sessionVariables = {
|
||||
NIXOS_OZONE_WL = 1;
|
||||
NVIM_LISTEN_ADDRESS = "$XDG_RUNTIME_DIR/nvimsocket";
|
||||
PAGER = "bat --paging=always --style=plain";
|
||||
@@ -642,6 +756,9 @@
|
||||
DO_NOT_TRACK = 1;
|
||||
};
|
||||
|
||||
systemd.user.sessionVariables = lib.mapAttrs (_: v: toString v) config.home.sessionVariables;
|
||||
programs.zsh.sessionVariables = config.home.sessionVariables;
|
||||
|
||||
home.shellAliases = {
|
||||
_ = "sudo";
|
||||
icr = "crystal i";
|
||||
@@ -652,7 +769,55 @@
|
||||
ls = "ls --color=auto";
|
||||
};
|
||||
|
||||
services.gpg-agent = with pkgs; {
|
||||
services = {
|
||||
swaync = {
|
||||
enable = true;
|
||||
package = pkgs-unstable.swaynotificationcenter;
|
||||
settings = {
|
||||
scripts = {
|
||||
focus-window =
|
||||
let
|
||||
jq = lib.getExe pkgs.jq;
|
||||
niri = lib.getExe osConfig.programs.niri.package;
|
||||
script = pkgs.writeShellScriptBin "swaync-focus-window" ''
|
||||
set -e
|
||||
|
||||
APP_NAME="''${SWAYNC_APP_NAME:-}"
|
||||
DESKTOP_ENTRY="''${SWAYNC_DESKTOP_ENTRY:-}"
|
||||
|
||||
APP_ID=""
|
||||
if [[ -n "$DESKTOP_ENTRY" ]]; then
|
||||
APP_ID="$DESKTOP_ENTRY"
|
||||
elif [[ -n "$APP_NAME" ]]; then
|
||||
APP_ID=$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/ //g')
|
||||
fi
|
||||
|
||||
[[ -z "$APP_ID" ]] && exit
|
||||
|
||||
# Find window ID for this app in niri and focus it
|
||||
${jq} -r --arg app_id "$APP_ID" '.[] | select(.app_id | ascii_downcase | contains($app_id)) | .id' \
|
||||
<(${niri} msg --json windows 2>/dev/null) | head -n1 | while read -r WINDOW_ID; do
|
||||
if [[ -n "$WINDOW_ID" && "$WINDOW_ID" != "null" ]]; then
|
||||
${niri} msg action focus-window --id "$WINDOW_ID"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
exec = lib.getExe script;
|
||||
run-on = "action";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
gpg-agent = with pkgs; {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
pinentry.package = pinentry-gnome3;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
services.walker = {
|
||||
enable = true;
|
||||
@@ -791,6 +956,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile."niri/config.kdl".source = ./dotfiles/niri.kdl;
|
||||
|
||||
gnome.automaticTimeZone = true;
|
||||
gtk.enable = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user