Add niri startup layout script

This commit is contained in:
2026-02-15 12:15:56 +11:00
parent 1b7ad9651e
commit 76b3df02be
5 changed files with 172 additions and 61 deletions

View File

@@ -1,48 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
spawn() {
# Detach; avoid blocking.
( "$@" >/dev/null 2>&1 & )
}
# Give niri a moment to finish bringing up IPC.
for _ in $(seq 1 50); do
niri msg version >/dev/null 2>&1 && break
sleep 0.1
done
# Ensure we start from the leftmost monitor (DP-6 in your layout).
for _ in $(seq 1 6); do
niri msg action focus-monitor-left >/dev/null 2>&1 || true
done
# DP-6 -> workspace 6: 2 kitty terminals
niri msg action focus-workspace 6
spawn kitty --directory "$HOME/organizer"
spawn kitty --directory /etc/nixos
sleep 1
# DP-7 -> workspace 7: 2 firefox windows
niri msg action focus-monitor-right
niri msg action focus-workspace 7
spawn firefox --new-window "https://x.com/"
sleep 1
spawn firefox --new-window "https://www.youtube.com/"
sleep 1
# DP-4 -> workspace 4: firefox with tabs
niri msg action focus-monitor-right
niri msg action focus-workspace 4
spawn firefox \
--new-window "https://gitea.lab.audasmedia.com.au/" \
--new-tab "https://t3.chat/" \
--new-tab "https://grok.com/" \
--new-tab "https://gemini.google.com/"
sleep 1
# DP-5 -> workspace 5: kitty + thunar
niri msg action focus-monitor-right
niri msg action focus-workspace 5
spawn kitty --directory /etc/nixos
spawn thunar "$HOME"

View File

@@ -77,7 +77,9 @@ input {
// Remember to uncomment the node by removing "/-"! // Remember to uncomment the node by removing "/-"!
environment {
MOZ_DBUS_REMOTE "1"
}
output "DP-6" { mode "1680x1050@60"; position x=0 y=230; } output "DP-6" { mode "1680x1050@60"; position x=0 y=230; }
output "DP-7" { mode "1680x1050@60"; position x=1680 y=0; transform "90"; } output "DP-7" { mode "1680x1050@60"; position x=1680 y=0; transform "90"; }
@@ -121,7 +123,7 @@ layout {
// preset-window-heights { } // preset-window-heights { }
// You can change the default width of the new windows. // You can change the default width of the new windows.
default-column-width { proportion 0.5; } default-column-width { proportion 1.0; }
// If you leave the brackets empty, the windows themselves will decide their initial width. // If you leave the brackets empty, the windows themselves will decide their initial width.
// default-column-width {} // default-column-width {}
@@ -252,7 +254,58 @@ layout {
// This line starts waybar, a commonly used bar for Wayland compositors. // This line starts waybar, a commonly used bar for Wayland compositors.
spawn-at-startup "/run/current-system/sw/bin/waybar" spawn-at-startup "/run/current-system/sw/bin/waybar"
spawn-at-startup "kitty"
// DP-6 (2 kitty)
spawn-at-startup "kitty" "--directory" "/home/sam/organizer" "--app-id" "kitty-organizer"
spawn-at-startup "kitty" "--directory" "/etc/nixos" "--app-id" "kitt-yazi"
// spawn-sh-at-startup "swaybg -i /home/sam/Downloads/wph-1.jpg -m fill -o DP-6 > /tmp/swaybg-dp6.log 2>&1 &"
// spawn-sh-at-startup "sleep 1 && swaybg -i /home/sam/Downloads/wpv-1.jpg -m fill -o DP-7 > /tmp/swaybg-dp7.log 2>&1 &"
// spawn-sh-at-startup "sleep 2 && swaybg -i /home/sam/Downloads/wph-2.jpg -m fill -o DP-4 > /tmp/swaybg-dp4.log 2>&1 &"
// spawn-sh-at-startup "sleep 3 && swaybg -i /home/sam/Downloads/wpv-2.jpg -m fill -o DP-5 > /tmp/swaybg-dp5.log 2>&1 &"
spawn-sh-at-startup "swww-daemon"
spawn-sh-at-startup "sleep 1 && swww img -o DP-6 /home/sam/Downloads/wph-1.jpg"
spawn-sh-at-startup "swww img -o DP-7 /home/sam/Downloads/wpv-1.jpg"
spawn-sh-at-startup "swww img -o DP-4 /home/sam/Downloads/wph-2.jpg"
spawn-sh-at-startup "swww img -o DP-5 /home/sam/Downloads/wpv-2.jpg"
spawn-sh-at-startup "swayimg --fullscreen --class cs-vim /home/sam/Downloads/vim.png &"
spawn-sh-at-startup "swayimg --fullscreen --class cs-tmux /home/sam/Downloads/tmux.png &"
// DP-7
// spawn-at-startup "env" "MOZ_DBUS_REMOTE=1" "firefox" "--new-instance" "--name" "ff-dp7-x" "--new-window" "https://x.com/"
// spawn-sh-at-startup "sleep 2 && MOZ_DBUS_REMOTE=1 firefox --name ff-dp7-youtube --new-window https://www.youtube.com/"
// // DP-4
// spawn-sh-at-startup "sleep 2 && MOZ_DBUS_REMOTE=1 firefox --name ff-dp4-gitea --new-window https://gitea.lab.audasmedia.com.au/"
// spawn-sh-at-startup "sleep 2 && MOZ_DBUS_REMOTE=1 firefox --name ff-dp4-t3 --new-window https://t3.chat/"
// spawn-sh-at-startup "sleep 2 && MOZ_DBUS_REMOTE=1 firefox --name ff-dp4-grok --new-window https://grok.com/"
// spawn-sh-at-startup "sleep 2 && MOZ_DBUS_REMOTE=1 firefox --name ff-dp4-gemini --new-window https://gemini.google.com/"
// All Firefox instances — separate processes, same profile, unique app-ids
spawn-sh-at-startup "env MOZ_DBUS_REMOTE=1 firefox -no-remote --name ff-dp7-x --new-window https://x.com/"
spawn-sh-at-startup "sleep 1.5 && env MOZ_DBUS_REMOTE=1 firefox -no-remote --name ff-dp7-youtube --new-window https://www.youtube.com/"
spawn-sh-at-startup "sleep 3 && google-chrome --profile-directory=Default -no-default-browser-check --new-window --app=https://gitea.lab.audasmedia.com.au/"
spawn-sh-at-startup "sleep 4.5 && google-chrome --profile-directory=Default --app=https://t3.chat/"
spawn-sh-at-startup "sleep 6 && google-chrome --profile-directory=Default --app=https://grok.com/"
spawn-sh-at-startup "sleep 7.5 && google-chrome --profile-directory=Default --app=https://gemini.google.com/"
// DP-5 (kitty + thunar)
spawn-at-startup "kitty" "--directory" "/etc/nixos" "--app-id" "kitty-terminal"
spawn-at-startup "thunar" "/home/sam" "--name" "thunar"
//spawn-at-startup "kitty"
// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup: // To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup:
// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell" // spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell"
@@ -293,6 +346,97 @@ animations {
// Work around WezTerm's initial configure bug // Work around WezTerm's initial configure bug
// by setting an empty default-column-width. // by setting an empty default-column-width.
window-rule {
match app-id="cs-vim" // or match title=".*keycodes.*" if no class set
open-on-output "DP-4"
open-floating true
open-fullscreen true
// optional: no focus ring, etc.
focus-ring { off; }
}
window-rule {
match app-id="cs-tmux" // or match title=".*keycodes.*" if no class set
open-on-output "DP-6"
open-floating true
open-fullscreen true
// optional: no focus ring, etc.
focus-ring { off; }
}
window-rule {
match at-startup=true app-id="kitty-organizer"
open-on-output "DP-6"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true app-id="kitty-yazi"
open-on-output "DP-6"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true app-id="ff-dp7-x"
open-on-output "DP-7"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true app-id="ff-dp7-youtube"
open-on-output "DP-7"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true title="(?i)gitea"
open-on-output "DP-4"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true title="(?i)t3"
open-on-output "DP-4"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true title="(?i)grok"
open-on-output "DP-4"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true title="(?i)gemini"
open-on-output "DP-4"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true app-id="kitty-terminal"
open-on-output "DP-5"
default-column-width { proportion 1.0; }
}
window-rule {
match at-startup=true app-id="thunar"
open-on-output "DP-5"
default-column-width { proportion 1.0; }
}
window-rule { window-rule {
// This regular expression is intentionally made as specific as possible, // This regular expression is intentionally made as specific as possible,
// since this is the default config, and we want no false positives. // since this is the default config, and we want no false positives.

View File

@@ -1,11 +1,11 @@
export PATH="$HOME/.cargo/bin:$HOME/.atuin/bin:$HOME/.local/bin:$HOME/.fzf/bin:$PATH" export PATH="$HOME/.cargo/bin:$HOME/.atuin/bin:$HOME/.local/bin:$HOME/.fzf/bin:$PATH"
#
export OPENAI_API_KEY="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" # export OPENAI_API_KEY="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"
#
export TAVILY_API_KEY="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" # export TAVILY_API_KEY="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"
#
#export GEMINI_API_KEY="AIzaSyAoCOjfPH3HigI6aFFAmg9eVhaHMimM7ak" # #export GEMINI_API_KEY="AIzaSyAoCOjfPH3HigI6aFFAmg9eVhaHMimM7ak"
export DEEPSEEK_API_KEY="sk-26c66e4dd5b34017bd66f7aef748c625" # export DEEPSEEK_API_KEY="sk-26c66e4dd5b34017bd66f7aef748c625"
@@ -93,3 +93,9 @@ export PATH=/home/sam/.opencode/bin:$PATH
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [ -f "$HOME/.config/environment.d/10-secrets.conf" ]; then
set -a
source "$HOME/.config/environment.d/10-secrets.conf"
set +a
fi

View File

@@ -24,6 +24,7 @@ home.homeDirectory = "/home/sam";
home.stateVersion = "25.11"; home.stateVersion = "25.11";
systemd.user.services.kdeconnect-indicator = { systemd.user.services.kdeconnect-indicator = {
Unit = { Unit = {
Description = "KDE Connect indicator"; Description = "KDE Connect indicator";
@@ -139,6 +140,14 @@ dconf.settings."org/gnome/desktop/interface" = {
# Packages (NOW list + a few safe essentials) # Packages (NOW list + a few safe essentials)
# --- # ---
home.packages = with pkgs; [ home.packages = with pkgs; [
glow
pandoc
texlive.combined.scheme-small
swaybg
zathura
zathuraPkgs.zathura_pdf_mupdf
swayimg
qimgv
tmux tmux
vorta vorta
borgbackup borgbackup
@@ -165,7 +174,7 @@ dconf.settings."org/gnome/desktop/interface" = {
bat bat
ripgrep ripgrep
fd fd
ticker
btop btop
lazygit lazygit
zellij zellij

View File

@@ -327,6 +327,7 @@ fonts.packages = with pkgs; [
# Minimal system packages needed for the session and core usability # Minimal system packages needed for the session and core usability
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
swww
uv uv
(pkgs.callPackage ../../pkgs/agentpipe.nix { }) (pkgs.callPackage ../../pkgs/agentpipe.nix { })
(pkgs.callPackage ../../pkgs/sidecar-bin.nix { }) (pkgs.callPackage ../../pkgs/sidecar-bin.nix { })
@@ -351,7 +352,6 @@ fonts.packages = with pkgs; [
spotify spotify
vlc vlc
telegram-desktop telegram-desktop
flameshot
waybar waybar
firefox firefox
google-chrome google-chrome