367 lines
12 KiB
Nix
367 lines
12 KiB
Nix
{
|
||
config,
|
||
hostName,
|
||
launcher,
|
||
lockscreen,
|
||
...
|
||
}: let
|
||
inherit (config.lib.stylix) colors;
|
||
inherit (config.stylix) cursor;
|
||
keyboard =
|
||
if hostName == "eldrid"
|
||
then "chromeos"
|
||
else "platform";
|
||
xdgPics =
|
||
config.xdg.userDirs.pictures;
|
||
in {
|
||
target = "niri/config.kdl";
|
||
text = let
|
||
arrows = {
|
||
left = "Left";
|
||
down = "Down";
|
||
up = "Up";
|
||
right = "Right";
|
||
};
|
||
homerow-arrows = {
|
||
left = "n";
|
||
down = "e";
|
||
up = "i";
|
||
right = "o";
|
||
};
|
||
letters = {
|
||
first = "Q";
|
||
second = "W";
|
||
third = "F";
|
||
fourth = "P";
|
||
fifth = "B";
|
||
sixth = "J";
|
||
seventh = "L";
|
||
eighth = "U";
|
||
ninth = "Y";
|
||
};
|
||
numbers = {
|
||
first = "1";
|
||
second = "2";
|
||
third = "3";
|
||
fourth = "4";
|
||
fifth = "5";
|
||
sixth = "6";
|
||
seventh = "7";
|
||
eighth = "8";
|
||
ninth = "9";
|
||
};
|
||
genArrowNavigation = keys: ''
|
||
Mod+${keys.left} { focus-column-left; }
|
||
Mod+${keys.down} { focus-window-or-workspace-down; }
|
||
Mod+${keys.up} { focus-window-or-workspace-up; }
|
||
Mod+${keys.right} { focus-column-right; }
|
||
Mod+Ctrl+${keys.left} { move-column-left; }
|
||
Mod+Ctrl+${keys.down} { move-window-down-or-to-workspace-down; }
|
||
Mod+Ctrl+${keys.up} { move-window-up-or-to-workspace-up; }
|
||
Mod+Ctrl+${keys.right} { move-column-right; }
|
||
Mod+Shift+${keys.left} { focus-monitor-left; }
|
||
Mod+Shift+${keys.down} { focus-monitor-down; }
|
||
Mod+Shift+${keys.up} { focus-monitor-up; }
|
||
Mod+Shift+${keys.right} { focus-monitor-right; }
|
||
Mod+Shift+Ctrl+${keys.left} { move-column-to-monitor-left; }
|
||
Mod+Shift+Ctrl+${keys.down} { move-column-to-monitor-down; }
|
||
Mod+Shift+Ctrl+${keys.up} { move-column-to-monitor-up; }
|
||
Mod+Shift+Ctrl+${keys.right} { move-column-to-monitor-right; }
|
||
'';
|
||
genWorkspacesNavigation = keys: ''
|
||
Mod+${keys.first} { focus-workspace 1; }
|
||
Mod+${keys.second} { focus-workspace 2; }
|
||
Mod+${keys.third} { focus-workspace 3; }
|
||
Mod+${keys.fourth} { focus-workspace 4; }
|
||
Mod+${keys.fifth} { focus-workspace 5; }
|
||
Mod+${keys.sixth} { focus-workspace 6; }
|
||
Mod+${keys.seventh} { focus-workspace 7; }
|
||
Mod+${keys.eighth} { focus-workspace 8; }
|
||
Mod+${keys.ninth} { focus-workspace 9; }
|
||
Mod+Ctrl+Shift+${keys.first} { move-column-to-workspace 1; }
|
||
Mod+Ctrl+Shift+${keys.second} { move-column-to-workspace 2; }
|
||
Mod+Ctrl+Shift+${keys.third} { move-column-to-workspace 3; }
|
||
Mod+Ctrl+Shift+${keys.fourth} { move-column-to-workspace 4; }
|
||
Mod+Ctrl+Shift+${keys.fifth} { move-column-to-workspace 5; }
|
||
Mod+Ctrl+Shift+${keys.sixth} { move-column-to-workspace 6; }
|
||
Mod+Ctrl+Shift+${keys.seventh} { move-column-to-workspace 7; }
|
||
Mod+Ctrl+Shift+${keys.eighth} { move-column-to-workspace 8; }
|
||
Mod+Ctrl+Shift+${keys.ninth} { move-column-to-workspace 9; }
|
||
'';
|
||
in ''
|
||
environment {
|
||
DISPLAY ":123"
|
||
QT_QPA_PLATFORMTHEME "gtk3"
|
||
MOZ_ENABLE_WAYLAND "1"
|
||
MOZ_WEBRENDER "1"
|
||
GDK_BACKEND "wayland"
|
||
QT_QPA_PLATFORM "wayland"
|
||
XDG_SESSION_TYPE "wayland"
|
||
CLUTTER_BACKEND "wayland"
|
||
SDL_VIDEODRIVER "wayland"
|
||
}
|
||
|
||
input {
|
||
keyboard {
|
||
xkb {
|
||
layout "us,ua"
|
||
variant "colemak_dh_ortho,"
|
||
}
|
||
repeat-delay 200
|
||
repeat-rate 50
|
||
track-layout "window"
|
||
}
|
||
touchpad {
|
||
tap
|
||
natural-scroll
|
||
accel-speed 0.2
|
||
accel-profile "flat"
|
||
}
|
||
mouse {
|
||
accel-speed 0.0
|
||
accel-profile "flat"
|
||
}
|
||
touch {
|
||
map-to-output "eDP-1"
|
||
}
|
||
warp-mouse-to-focus
|
||
workspace-auto-back-and-forth
|
||
}
|
||
|
||
cursor {
|
||
xcursor-theme "${cursor.name}"
|
||
xcursor-size ${toString cursor.size}
|
||
}
|
||
|
||
hotkey-overlay {
|
||
skip-at-startup
|
||
}
|
||
|
||
prefer-no-csd
|
||
|
||
screenshot-path "${xdgPics}/screenshots/screenshot-%Y-%m-%d-%H-%M-%S.png"
|
||
|
||
animations {
|
||
slowdown 0.5
|
||
}
|
||
|
||
layout {
|
||
gaps 3
|
||
|
||
// background-color "#${colors.base02}"
|
||
background-color "transparent"
|
||
center-focused-column "never" // "on-overflow"
|
||
default-column-width { proportion 1.0; }
|
||
|
||
preset-column-widths {
|
||
proportion 0.33333
|
||
proportion 0.66667
|
||
}
|
||
|
||
struts {
|
||
left 33
|
||
right 33
|
||
}
|
||
|
||
tab-indicator {
|
||
active-color "#${colors.base04}"
|
||
inactive-color "#${colors.base03}"
|
||
corner-radius 4
|
||
gap 6
|
||
gaps-between-tabs 3
|
||
length total-proportion=0.3
|
||
place-within-column
|
||
position "left"
|
||
width 6
|
||
}
|
||
focus-ring {
|
||
off
|
||
width 3
|
||
active-gradient from="#${colors.base0D}" to="#${colors.base0F}" angle=40 relative-to="workspace-view"
|
||
inactive-color "#${colors.base03}"
|
||
}
|
||
border {
|
||
width 1
|
||
active-color "#${colors.base0D}"
|
||
inactive-color "#${colors.base03}"
|
||
urgent-color "#${colors.base08}"
|
||
}
|
||
}
|
||
|
||
window-rule {
|
||
geometry-corner-radius 18
|
||
clip-to-geometry true
|
||
}
|
||
window-rule {
|
||
match is-window-cast-target=true
|
||
focus-ring {
|
||
width 3
|
||
active-color "#${colors.base0F}"
|
||
inactive-color "#${colors.base03}"
|
||
}
|
||
border {
|
||
width 3
|
||
active-color "#${colors.base0F}"
|
||
inactive-color "#${colors.base03}"
|
||
}
|
||
}
|
||
|
||
layer-rule {
|
||
match namespace="^wpaperd.*$"
|
||
place-within-backdrop true
|
||
}
|
||
overview {
|
||
workspace-shadow {
|
||
off
|
||
}
|
||
}
|
||
layer-rule {
|
||
match namespace="waybar"
|
||
match at-startup=true
|
||
|
||
opacity 0.99 // fixes the black fill
|
||
}
|
||
|
||
window-rule {
|
||
match title="Картинка в картинці"
|
||
match title="Picture-in-Picture"
|
||
open-floating true
|
||
}
|
||
window-rule {
|
||
match app-id="org.wezfurlong.wezterm"
|
||
match app-id="com.mitchellh.ghostty"
|
||
default-column-width { proportion 1.0; }
|
||
}
|
||
window-rule {
|
||
match app-id="re.sonny.Junction"
|
||
match app-id="com.github.hluk.copyq"
|
||
open-floating true
|
||
open-focused true
|
||
}
|
||
|
||
window-rule {
|
||
match app-id="com.mitchellh.ghostty"
|
||
draw-border-with-background false
|
||
}
|
||
|
||
window-rule {
|
||
match app-id=r#"^org\.keepassxc\.KeePassXC$"#
|
||
match app-id=r#"^org\.gnome\.World\.Secrets$"#
|
||
match app-id=r#"^Bitwarden$"#
|
||
match app-id="io.github.kukuruzka165.materialgram"
|
||
match app-id="org.telegram.desktop"
|
||
match app-id="org.signal.Signal"
|
||
match app-id="WebCord"
|
||
// block-out-from "screen-capture"
|
||
block-out-from "screencast"
|
||
}
|
||
|
||
|
||
binds {
|
||
Mod+Shift+Slash { show-hotkey-overlay; }
|
||
|
||
Mod+Tab { focus-workspace-previous; }
|
||
Mod+C { center-column; }
|
||
Mod+M { maximize-column; }
|
||
Mod+H { set-column-width "50%"; }
|
||
Mod+T { set-column-width "33%"; }
|
||
Mod+Shift+T { set-column-width "67%"; }
|
||
Mod+V { toggle-column-tabbed-display; }
|
||
Mod+G { switch-focus-between-floating-and-tiling; }
|
||
Mod+X { spawn "pkill" "-SIGUSR1" "waybar"; } // hide/show waybar
|
||
|
||
Mod+Ctrl+Comma { consume-or-expel-window-left; }
|
||
Mod+Ctrl+Period { consume-or-expel-window-right; }
|
||
|
||
Mod+Ctrl+Q { close-window; }
|
||
Mod+Ctrl+M { fullscreen-window; }
|
||
Mod+Ctrl+G { toggle-window-floating; }
|
||
|
||
Mod+Ctrl+Shift+M { toggle-windowed-fullscreen; }
|
||
|
||
Mod+Minus { set-column-width "-10%"; }
|
||
Mod+Equal { set-column-width "+10%"; }
|
||
Mod+Comma { set-column-width "-10%"; }
|
||
Mod+Period { set-column-width "+10%"; }
|
||
Mod+Shift+Comma { set-window-height "-10%"; }
|
||
Mod+Shift+Period { set-window-height "+10%"; }
|
||
|
||
Mod+Space { switch-layout "next"; }
|
||
|
||
Mod+Ctrl+Space repeat=false { toggle-overview; }
|
||
|
||
Mod+Return repeat=false { spawn "sh" "-c" "$TERMINAL"; }
|
||
Mod+BackSpace repeat=false { spawn "${launcher}"; }
|
||
Mod+A repeat=false { spawn "${launcher}"; }
|
||
Mod+Ctrl+L repeat=false { spawn "${lockscreen}"; }
|
||
Mod+Ctrl+V repeat=false { spawn "copyq" "menu"; }
|
||
|
||
Mod+Shift+W repeat=false { spawn "walker" "-m" "windows"; }
|
||
|
||
Mod+Ctrl+Shift+BracketLeft { quit; }
|
||
Mod+Ctrl+Shift+BracketRight { power-off-monitors; }
|
||
|
||
Print { screenshot; }
|
||
Ctrl+Print { screenshot-screen; }
|
||
Shift+Print { screenshot-window; }
|
||
|
||
// Caps_Lock { spawn "swayosd-client" "--caps-lock"; }
|
||
// XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "-l" "1.0" "@DEFAULT_AUDIO_SINK@" "5%+"; }
|
||
// XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "-l" "1.0" "@DEFAULT_AUDIO_SINK@" "5%-"; }
|
||
// XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
|
||
// XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
|
||
XF86AudioRaiseVolume allow-when-locked=true { spawn "swayosd-client" "--output-volume" "raise"; }
|
||
XF86AudioLowerVolume allow-when-locked=true { spawn "swayosd-client" "--output-volume" "lower"; }
|
||
XF86AudioMute allow-when-locked=true { spawn "swayosd-client" "--output-volume" "mute-toggle"; }
|
||
XF86AudioMicMute allow-when-locked=true { spawn "swayosd-client" "--input-volume" "mute-toggle"; }
|
||
XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
|
||
XF86AudioPause allow-when-locked=true { spawn "playerctl" "pause"; }
|
||
XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
|
||
XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
|
||
|
||
XF86ScreenSaver allow-when-locked=true { spawn "${lockscreen}"; }
|
||
XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "s" "5%+"; }
|
||
XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "s" "5%-"; }
|
||
Alt+XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "s" "5%+" "-d" "${keyboard}::kbd_backlight"; }
|
||
Alt+XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "s" "5%-" "-d" "${keyboard}::kbd_backlight"; }
|
||
XF86KbdBrightnessUp allow-when-locked=true { spawn "brightnessctl" "s" "5%+" "-d" "${keyboard}::kbd_backlight"; }
|
||
XF86KbdBrightnessDown allow-when-locked=true { spawn "brightnessctl" "s" "5%-" "-d" "${keyboard}::kbd_backlight"; }
|
||
|
||
|
||
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+Next { focus-workspace-down; }
|
||
Mod+Prior { focus-workspace-up; }
|
||
Mod+Ctrl+Next { move-column-to-workspace-down; }
|
||
Mod+Ctrl+Prior { move-column-to-workspace-up; }
|
||
Mod+Shift+Next { move-workspace-down; }
|
||
Mod+Shift+Prior { move-workspace-up; }
|
||
|
||
Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
|
||
Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
|
||
Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
|
||
Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
|
||
|
||
Mod+WheelScrollRight { focus-column-right; }
|
||
Mod+WheelScrollLeft { focus-column-left; }
|
||
Mod+Ctrl+WheelScrollRight { move-column-right; }
|
||
Mod+Ctrl+WheelScrollLeft { move-column-left; }
|
||
Mod+Shift+WheelScrollDown { focus-column-right; }
|
||
Mod+Shift+WheelScrollUp { focus-column-left; }
|
||
Mod+Ctrl+Shift+WheelScrollDown { move-column-right; }
|
||
Mod+Ctrl+Shift+WheelScrollUp { move-column-left; }
|
||
|
||
Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; }
|
||
Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; }
|
||
|
||
${genArrowNavigation arrows}
|
||
${genArrowNavigation homerow-arrows}
|
||
${genWorkspacesNavigation letters}
|
||
${genWorkspacesNavigation numbers}
|
||
}
|
||
'';
|
||
}
|