181 lines
6.2 KiB
Nix
181 lines
6.2 KiB
Nix
{ config, lib, pkgs, inputs, ... }:
|
|
|
|
let
|
|
pip-handler = pkgs.writeShellScriptBin "pip-handler" ''
|
|
# Listen to Niri window events continuously
|
|
niri msg event-stream | while read -r line; do
|
|
# Check if a new window event fired
|
|
if echo "$line" | grep -q '"WindowOpened"'; then
|
|
|
|
# Give the window a split second to populate its title metadata
|
|
sleep 0.1
|
|
|
|
# Use nirius or niri msg to evaluate the currently focused window title
|
|
# If it matches Picture-in-Picture, invoke nirius toggle-follow-mode
|
|
WINDOW_TITLE=$(niri msg focused-window | grep "Title:" | sed 's/Title: //')
|
|
|
|
if [[ "$WINDOW_TITLE" =~ [Pp]icture[-\ ]in[-\ ][Pp]icture ]]; then
|
|
# Executes nirius follow mode trigger
|
|
nirius toggle-follow-mode --policy always
|
|
fi
|
|
fi
|
|
done
|
|
'';
|
|
|
|
launch-lisgd = pkgs.writeShellScriptBin "launch-lisgd" ''
|
|
# Search for the capacitive touch layer and extract its event number.
|
|
# UPDATE 'Touchscreen' below to match the unique word you found in step 1.
|
|
TOUCH_EVENT=$(grep -i -E 'name=".*Finger.*"' -A 5 /proc/bus/input/devices | grep -o 'event[0-9]\+' | head -n 1)
|
|
|
|
if [ -n "$TOUCH_EVENT" ]; then
|
|
# Start lisgd locked exclusively to the finger digitizer
|
|
${pkgs.lisgd}/bin/lisgd -t 30 -m 150 -r 45 -d "/dev/input/$TOUCH_EVENT" \
|
|
-g "3,LR,*,*,P,niri msg action focus-column-left && sleep 0.4" \
|
|
-g "3,RL,*,*,P,niri msg action focus-column-right && sleep 0.4" \
|
|
-g "3,UD,*,*,P,niri msg action focus-workspace-up && sleep 0.4" \
|
|
-g "3,DU,*,*,P,niri msg action focus-workspace-down && sleep 0.4" \
|
|
-g "4,DU,*,*,P,dms ipc spotlight toggle && sleep 0.4" \
|
|
-g "1,DU,B,*,pkill -u jashton -RTMIN wvkbd-mobintl && sleep 0.4" \
|
|
-g "1,UD,T,*,P,niri msg action maximize-window-to-edges && sleep 0.4"
|
|
fi
|
|
'';
|
|
|
|
launch-wvkbd = pkgs.writeShellScriptBin "launch-wvkbd" ''
|
|
THEME_CACHE="$HOME/.cache/DankMaterialShell/dms-colors.json"
|
|
|
|
if [ -f "$THEME_CACHE" ]; then
|
|
BG=$(jq -r '.["colors"]["dark"]["background"]' "$THEME_CACHE" | tr -d '#')
|
|
FG=$(jq -r '.["colors"]["dark"]["surface_container_lowest"]' "$THEME_CACHE" | tr -d '#')
|
|
TXT=$(jq -r '.["colors"]["dark"]["on_background"]' "$THEME_CACHE" | tr -d '#')
|
|
PRIMARY=$(jq -r '.["colors"]["dark"]["surface_container_lowest"]' "$THEME_CACHE" | tr -d '#')
|
|
ON_PRIMARY=$(jq -r '.["colors"]["dark"]["on_background"]' "$THEME_CACHE" | tr -d '#')
|
|
|
|
wvkbd-mobintl --hidden --no-popup --bg "$BG" --press "$BG" --fg "$FG" --text "$TXT" --fg-sp "$PRIMARY" --text-sp "$ON_PRIMARY" -L 300
|
|
else
|
|
wvkbd-mobintl --hidden --no-popup
|
|
fi
|
|
'';
|
|
in
|
|
|
|
{
|
|
|
|
xdg.portal = {
|
|
enable = true;
|
|
config.niri = {
|
|
default = [ "gnome" "gtk" ];
|
|
"org.freedesktop.impl.portal.FileChooser" = [ "gtk" ];
|
|
};
|
|
extraPortals = [
|
|
pkgs.xdg-desktop-portal-gnome
|
|
pkgs.xdg-desktop-portal-gtk
|
|
];
|
|
};
|
|
|
|
#programs.niri.enable = true;
|
|
xdg.configFile."niri/config.kdl".text = lib.mkForce ''
|
|
input {
|
|
keyboard {
|
|
xkb {
|
|
layout "us"
|
|
model ""
|
|
rules ""
|
|
variant ""
|
|
}
|
|
repeat-delay 600
|
|
repeat-rate 25
|
|
track-layout "global"
|
|
}
|
|
touchpad {
|
|
tap
|
|
natural-scroll
|
|
}
|
|
}
|
|
screenshot-path "~/media/pics/screenshots/%Y-%m-%d %H-%M-%S.png"
|
|
prefer-no-csd
|
|
layout {
|
|
gaps 8
|
|
struts {
|
|
left 0
|
|
right 0
|
|
top 0
|
|
bottom 0
|
|
}
|
|
focus-ring { off; }
|
|
border { off; }
|
|
default-column-width { proportion 1.000000; }
|
|
center-focused-column "never"
|
|
}
|
|
cursor {
|
|
xcursor-theme "default"
|
|
xcursor-size 24
|
|
}
|
|
hotkey-overlay { skip-at-startup; }
|
|
binds {
|
|
Ctrl+Print { screenshot-screen; }
|
|
Mod+F { fullscreen-window; }
|
|
Mod+H { focus-column-left; }
|
|
Mod+J { focus-window-down; }
|
|
Mod+K { focus-window-up; }
|
|
Mod+L { focus-column-right; }
|
|
Mod+N { focus-workspace-down; }
|
|
Mod+V { toggle-window-floating; }
|
|
Mod+P { spawn "pkill" "-RTMIN" "wvkbd-mobintl"; }
|
|
Mod+Return { spawn "alacritty"; }
|
|
Mod+Shift+E { quit; }
|
|
Mod+Shift+H { move-column-left; }
|
|
Mod+Shift+J { move-column-to-workspace-down; }
|
|
Mod+Shift+K { move-column-to-workspace-up; }
|
|
Mod+Shift+L { move-column-right; }
|
|
Mod+Shift+P { toggle-overview; }
|
|
Mod+Space { spawn "dms" "ipc" "spotlight" "toggle"; }
|
|
Mod+U { focus-workspace-up; }
|
|
Mod+X { close-window; }
|
|
Print { screenshot; }
|
|
XF86AudioLowerVolume { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05-"; }
|
|
XF86AudioMute { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
|
|
XF86AudioRaiseVolume { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05+"; }
|
|
XF86MonBrightnessDown { spawn "dms" "ipc" "call" "brightness" "decrement" "5" ""; }
|
|
XF86MonBrightnessUp { spawn "dms" "ipc" "call" "brightness" "increment" "5" ""; }
|
|
}
|
|
spawn-at-startup "/nix/store/b1kxyzg5r6644mcmjh8jwsb8rinqzsw8-launch-wvkbd/bin/launch-wvkbd"
|
|
spawn-at-startup "/nix/store/l9k161qcs6ypzzbicjhkn8b203r610j6-launch-lisgd/bin/launch-lisgd"
|
|
|
|
window-rule {
|
|
draw-border-with-background true
|
|
geometry-corner-radius 25.000000 25.000000 25.000000 25.000000
|
|
clip-to-geometry true
|
|
}
|
|
|
|
window-rule {
|
|
match title="(?i)picture.in.picture"
|
|
open-floating true
|
|
default-column-width { fixed 240; }
|
|
default-window-height { fixed 185; }
|
|
default-floating-position x=8 y=8 relative-to="top-right"
|
|
}
|
|
|
|
window-rule {
|
|
match app-id="^Alacritty$"
|
|
|
|
background-effect {
|
|
blur true
|
|
}
|
|
}
|
|
|
|
overview {
|
|
backdrop-color "#987CA7"
|
|
}
|
|
|
|
gestures {
|
|
hot-corners {
|
|
off
|
|
}
|
|
}
|
|
|
|
include "/home/jashton/.config/niri/dms/outputs.kdl"
|
|
include "/home/jashton/.config/niri/dms/binds.kdl"
|
|
include "/home/jashton/.config/niri/dms/cursor.kdl"
|
|
include "/home/jashton/.config/niri/dms/windowrules.kdl"
|
|
'';
|
|
}
|