// This config is in the KDL format: https://kdl.dev
// "/-" comments out the following node.
// Check the wiki for a full description of the configuration:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Overview

// Input device configuration.
// Find the full list of options on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Input
input {
    keyboard {
        xkb {
            layout "us"
        }
    }
    touchpad {
        tap
        natural-scroll
    }
    focus-follows-mouse
}

// Monitor configuration.
// Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs
output "eDP-1" {
    // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
    mode "2880x1800@90"
    scale 1.5
    transform "normal"
    position x=0 y=0
}
output "HDMI-A-1" {
    // Transform allows to rotate the output counter-clockwise, valid values are:
    // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270.
    transform "normal"
    // left
    // position x=-1920 y=0
    // right
    position x=1920 y=0
    // top
    // the value would be based on the connected monitor
    //position x=0 y=-1080
}
output "DP-1" {
    transform "normal"
    // left
    // position x=-1920 y=0
    // right
    position x=1920 y=0
    // top
    // the value would be based on the connected monitor
    // position x=0 y=-1080
}
output "DP-2" {
    transform "normal"
    // left
    // position x=-1920 y=0
    // right
    position x=1920 y=0
    // top
    // the value would be based on the connected monitor
    // position x=0 y=-1080
}

// Settings that influence how windows are positioned and sized.
// Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout
layout {
    gaps 14
    center-focused-column "never"
    preset-column-widths {
        proportion 0.33333
        proportion 0.5
        proportion 0.66667
        proportion 1.0
    }
    preset-window-heights {
        proportion 0.33333
        proportion 0.5
        proportion 0.66667
        proportion 1.0
    }
    default-column-width { proportion 0.5; }
    focus-ring {
        width 2
        active-color "#d8dadd"
        inactive-color "#0b0b0c"
    }
    border {
        off
    }
    struts {
        left 0
        right 0
        top 0
        bottom 0
    }
    background-color "transparent"

}

// startup processes
spawn-at-startup "mako"
spawn-at-startup "xwayland-satellite"
spawn-at-startup "/usr/libexec/polkit-gnome-authentication-agent-1"
spawn-at-startup "wl-paste" "--watch" "cliphist" "store"
spawn-sh-at-startup "waybar -c ~/.config/waybar/config -s ~/.config/waybar/style.css"
spawn-at-startup "dunst" "-conf" "$NIRICONF/dunst/dunstrc"
spawn-at-startup "sleep 20 && foot --server" #

// workspace background and backdrop
spawn-at-startup "wawa" "fill" "~/.nunewall"


// Animation settings.
// The wiki explains how to configure individual animations:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Animations
animations {}

// Window rules let you adjust behavior for individual windows.
// Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules
window-rule {
    geometry-corner-radius 10
    clip-to-geometry true
}
window-rule {
    match app-id="firefox"
    default-column-width { proportion 1.0; }
}

binds {
    // Applications
    Mod+Return      { spawn "footclient"; }
    Mod+Ctrl+Return { spawn "fuzzel" "--config" "$NIRICONF/fuzzel/fuzzel.ini"; }
    Mod+B           { spawn "firefox"; }
    Mod+E           { spawn "dolphin"; }

    // Backlight and Audio
    XF86MonBrightnessUp   allow-when-locked=true { spawn "brightnessctl" "set" "+5%" ; }
    XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "set" "5%-" ; }
    XF86AudioRaiseVolume  allow-when-locked=true { spawn "pactl" "set-sink-volume" "@DEFAULT_SINK@" "+5%"; }
    XF86AudioLowerVolume  allow-when-locked=true { spawn "pactl" "set-sink-volume" "@DEFAULT_SINK@" "-5%"; }
    XF86AudioMute         allow-when-locked=true { spawn "pactl" "set-sink-mute"  "@DEFAULT_SINK@" "toggle"; }
    XF86AudioPlay         allow-when-locked=true { spawn "playerctl" "play-pause"; }
    XF86AudioPause        allow-when-locked=true { spawn "playerctl" "pause"; }
    XF86AudioNext         allow-when-locked=true { spawn "playerctl" "next"; }
    XF86AudioPrev         allow-when-locked=true { spawn "playerctl" "previous"; }

    // Windows and Columns
    Mod+Q                { close-window; }
    Mod+W                { switch-preset-column-width; }
    Mod+H                { switch-preset-window-height; }
    Mod+T                { toggle-window-floating; }
    Mod+M                { maximize-column; }
    Mod+F                { fullscreen-window; }
    Mod+Left             { focus-column-left; }
    Mod+Right            { focus-column-right; }
    Mod+Down             { focus-window-down; }
    Mod+Up               { focus-window-up; }
    Mod+Ctrl+Left        { move-column-left; }
    Mod+Ctrl+Right       { move-column-right; }
    Mod+Ctrl+Down        { move-window-down; }
    Mod+Ctrl+Up          { move-window-up; }
    Mod+Home             { focus-column-first; }
    Mod+End              { focus-column-last; }
    Mod+Ctrl+Home        { move-column-to-first; }
    Mod+Ctrl+End         { move-column-to-last; }
    Mod+Shift+Left       { set-column-width "-10%"; }
    Mod+Shift+Right      { set-column-width "+10%"; }
    Mod+Shift+Up         { set-window-height "+10%"; }
    Mod+Shift+Down       { set-window-height "-10%"; }
    Mod+BracketLeft      { consume-or-expel-window-left; }
    Mod+BracketRight     { consume-or-expel-window-right; }
    Mod+Comma            { consume-window-into-column; }
    Mod+Period           { expel-window-from-column; }

    // Workspaces
    Mod+Page_Down      { focus-workspace-down; }
    Mod+Page_Up        { focus-workspace-up; }
    Mod+Ctrl+Page_Down { move-column-to-workspace-down; }
    Mod+Ctrl+Page_Up   { move-column-to-workspace-up; }
    Mod+Ctrl+1         { move-column-to-workspace 1; }
    Mod+Ctrl+2         { move-column-to-workspace 2; }
    Mod+Ctrl+3         { move-column-to-workspace 3; }
    Mod+Ctrl+4         { move-column-to-workspace 4; }
    Mod+Ctrl+5         { move-column-to-workspace 5; }
    Mod+Ctrl+6         { move-column-to-workspace 6; }
    Mod+Ctrl+7         { move-column-to-workspace 7; }
    Mod+Ctrl+8         { move-column-to-workspace 8; }
    Mod+Ctrl+9         { move-column-to-workspace 9; }
    Mod+Ctrl+0         { move-column-to-workspace 10; }
    Mod+A              { toggle-overview; }

    // Screenshots
    Print       { screenshot; }
    Ctrl+Print  { screenshot-window; }
    Shift+Print { screenshot-screen; }
}

// misc configuration
screenshot-path "~/Pictures/Screenshots/Screenshot From %Y-%m-%d %H-%M-%S.png"
prefer-no-csd
environment {
    DISPLAY ":0"
}
hotkey-overlay {
    skip-at-startup
}