Add back more functions from Sway into Niri, add a standard naming scheme

This commit is contained in:
Jimbo 2024-12-04 02:54:40 -05:00
parent f3d5ff594a
commit cbd69206a3
18 changed files with 128 additions and 117 deletions

View file

@ -6,24 +6,24 @@
};
config.ws = {
w0 = ''0:0'';
w1 = ''1:1'';
w2 = ''2:2'';
w3 = ''3:3'';
w4 = ''4:4'';
w5 = ''5:5'';
w6 = ''6:6'';
w7 = ''7:7'';
w8 = ''8:8'';
w9 = ''9:9'';
w1a = ''11:I'';
w2a = ''22:II'';
w3a = ''33:III'';
w4a = ''44:IV'';
w5a = ''55:V'';
w6a = ''66:VI'';
w7a = ''77:VII'';
w8a = ''88:VIII'';
w9a = ''99:IX'';
w0 = ''0'';
w1 = ''1'';
w2 = ''2'';
w3 = ''3'';
w4 = ''4'';
w5 = ''5'';
w6 = ''6'';
w7 = ''7'';
w8 = ''8'';
w9 = ''9'';
w1a = ''I'';
w2a = ''II'';
w3a = ''III'';
w4a = ''IV'';
w5a = ''V'';
w6a = ''VI'';
w7a = ''VII'';
w8a = ''VIII'';
w9a = ''IX'';
};
}

View file

@ -143,7 +143,7 @@
case $POWER in
Shutdown) poweroff;;
Reboot) reboot;;
Sleep) swaysleep &;;
Sleep) sleep-$XDG_CURRENT_DESKTOP &;;
Lock) swaylock &;;
Kill) pkill -9 $XDG_CURRENT_DESKTOP;;
esac

View file

@ -6,12 +6,12 @@
// Daemons and tray apps
spawn-at-startup "hyprpaper"
spawn-at-startup "wl-paste" "-t" "text --watch clipman store -P"
spawn-at-startup "wl-paste" "-t" "text" "--watch" "clipman" "store" "-P"
spawn-at-startup "wl-copy"
spawn-at-startup "mako"
spawn-at-startup "sunshine"
spawn-at-startup "xwayland-satellite"
spawn-at-startup "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"
spawn-at-startup "${pkgs.xwayland-satellite}/bin/xwayland-satellite"
// Foreground apps
spawn-at-startup "librewolf" "-p" "Misc" "--name" "MiscBrowser"

View file

@ -5,8 +5,8 @@
./hotkeys
./inputs
./outputs
./programs
./rules
./settings
./theme
];
@ -16,7 +16,6 @@
${builtins.readFile config.home.niri.settings.inputs}
${builtins.readFile config.home.niri.settings.outputs}
${builtins.readFile config.home.niri.settings.rules}
${builtins.readFile config.home.niri.settings.settings}
${builtins.readFile config.home.niri.settings.theme}
'';
}

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
imports = [
./sleep-niri
];
}

View file

@ -0,0 +1,10 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "sleep-niri" ''
swaylock & ${pkgs.swayidle}/bin/swayidle -w \
timeout 1 'niri msg action power-off-monitors' \
resume 'niri msg action power-on-monitors; pkill -9 swayidle'
'')
];
}

View file

@ -38,5 +38,15 @@
match app-id="com.obsproject.Studio"
open-on-workspace "${config.ws.w4a}"
}
screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
hotkey-overlay {
skip-at-startup
}
environment {
DISPLAY ":0"
}
'';
}

View file

@ -1,14 +0,0 @@
{ pkgs, ... }:
{
config.home.niri.settings.settings = pkgs.writeText "settings" ''
screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
hotkey-overlay {
skip-at-startup
}
environment {
DISPLAY ":0"
}
'';
}

View file

@ -16,6 +16,7 @@
slurp
wl-clipboard
wdisplays
xwayland-satellite
jq
];
}

View file

@ -15,8 +15,7 @@
{ command = "wl-copy"; }
{ command = "mako"; }
{ command = "sunshine"; }
# Polkit agent
{ command = "xwayland-satellite"; }
{ command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"; }
# Foreground apps

View file

@ -26,7 +26,7 @@
"${primeMod}+x" = ''exec rofiscripts --power'';
"${primeMod}+b" = ''exec pkill -USR1 waybar'';
"${primeMod}+Return" = ''exec foot'';
"${primeMod}+Escape" = ''exec swaytools --kill'';
"${primeMod}+Escape" = ''exec tools-sway --kill'';
# Mod + shift + key
"${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history'';
@ -36,7 +36,7 @@
"${primeMod}+Shift+Return" = ''exec foot ranger'';
# Mod + ctrl + key
"${primeMod}+Ctrl+x" = ''exec swaytools --prop'';
"${primeMod}+Ctrl+x" = ''exec tools-sway --prop'';
"${primeMod}+Ctrl+s" = ''exec rofiscripts --scratchpads'';
"${primeMod}+Ctrl+c" = ''exec wlpicker && notify-send "Color copied to clipboard"'';
@ -61,8 +61,8 @@
"${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a'';
# Screenshots
"${secMod}+f" = ''exec swayshot --swappy'';
"${secMod}+Shift+f" = ''exec swayshot --screen'';
"${secMod}+f" = ''exec screen-sway --swappy'';
"${secMod}+Shift+f" = ''exec screen-sway --screen'';
# Display and keyboard brightness
"${primeMod}+equal" = ''exec light -A 5'';
@ -77,50 +77,50 @@
"${primeMod}+Shift+r" = ''reload'';
# Switch to workspaces
"${primeMod}+grave" = ''workspace ${config.ws.w0}'';
"${primeMod}+1" = ''workspace ${config.ws.w1}'';
"${primeMod}+2" = ''workspace ${config.ws.w2}'';
"${primeMod}+3" = ''workspace ${config.ws.w3}'';
"${primeMod}+4" = ''workspace ${config.ws.w4}'';
"${primeMod}+5" = ''workspace ${config.ws.w5}'';
"${primeMod}+6" = ''workspace ${config.ws.w6}'';
"${primeMod}+7" = ''workspace ${config.ws.w7}'';
"${primeMod}+8" = ''workspace ${config.ws.w8}'';
"${primeMod}+9" = ''workspace ${config.ws.w9}'';
"${primeMod}+grave" = ''workspace 0:${config.ws.w0}'';
"${primeMod}+1" = ''workspace 1:${config.ws.w1}'';
"${primeMod}+2" = ''workspace 2:${config.ws.w2}'';
"${primeMod}+3" = ''workspace 3:${config.ws.w3}'';
"${primeMod}+4" = ''workspace 4:${config.ws.w4}'';
"${primeMod}+5" = ''workspace 5:${config.ws.w5}'';
"${primeMod}+6" = ''workspace 6:${config.ws.w6}'';
"${primeMod}+7" = ''workspace 7:${config.ws.w7}'';
"${primeMod}+8" = ''workspace 8:${config.ws.w8}'';
"${primeMod}+9" = ''workspace 9:${config.ws.w9}'';
# Switch to alternate workspaces
"${secMod}+F1" = ''workspace ${config.ws.w1a}'';
"${secMod}+F2" = ''workspace ${config.ws.w2a}'';
"${secMod}+F3" = ''workspace ${config.ws.w3a}'';
"${secMod}+F4" = ''workspace ${config.ws.w4a}'';
"${secMod}+F5" = ''workspace ${config.ws.w5a}'';
"${secMod}+F6" = ''workspace ${config.ws.w6a}'';
"${secMod}+F7" = ''workspace ${config.ws.w7a}'';
"${secMod}+F8" = ''workspace ${config.ws.w8a}'';
"${secMod}+F9" = ''workspace ${config.ws.w9a}'';
"${secMod}+F1" = ''workspace 11:${config.ws.w1a}'';
"${secMod}+F2" = ''workspace 22:${config.ws.w2a}'';
"${secMod}+F3" = ''workspace 33:${config.ws.w3a}'';
"${secMod}+F4" = ''workspace 44:${config.ws.w4a}'';
"${secMod}+F5" = ''workspace 55:${config.ws.w5a}'';
"${secMod}+F6" = ''workspace 66:${config.ws.w6a}'';
"${secMod}+F7" = ''workspace 77:${config.ws.w7a}'';
"${secMod}+F8" = ''workspace 88:${config.ws.w8a}'';
"${secMod}+F9" = ''workspace 99:${config.ws.w9a}'';
# Move window to and focus workspace
"${primeMod}+Shift+grave" = ''move container to workspace ${config.ws.w0}; workspace ${config.ws.w0}'';
"${primeMod}+Shift+1" = ''move container to workspace ${config.ws.w1}; workspace ${config.ws.w1}'';
"${primeMod}+Shift+2" = ''move container to workspace ${config.ws.w2}; workspace ${config.ws.w2}'';
"${primeMod}+Shift+3" = ''move container to workspace ${config.ws.w3}; workspace ${config.ws.w3}'';
"${primeMod}+Shift+4" = ''move container to workspace ${config.ws.w4}; workspace ${config.ws.w4}'';
"${primeMod}+Shift+5" = ''move container to workspace ${config.ws.w5}; workspace ${config.ws.w5}'';
"${primeMod}+Shift+6" = ''move container to workspace ${config.ws.w6}; workspace ${config.ws.w6}'';
"${primeMod}+Shift+7" = ''move container to workspace ${config.ws.w7}; workspace ${config.ws.w7}'';
"${primeMod}+Shift+8" = ''move container to workspace ${config.ws.w8}; workspace ${config.ws.w8}'';
"${primeMod}+Shift+9" = ''move container to workspace ${config.ws.w9}; workspace ${config.ws.w9}'';
"${primeMod}+Shift+grave" = ''move container to workspace 0:${config.ws.w0}; workspace 0:${config.ws.w0}'';
"${primeMod}+Shift+1" = ''move container to workspace 1:${config.ws.w1}; workspace 1:${config.ws.w1}'';
"${primeMod}+Shift+2" = ''move container to workspace 2:${config.ws.w2}; workspace 2:${config.ws.w2}'';
"${primeMod}+Shift+3" = ''move container to workspace 3:${config.ws.w3}; workspace 3:${config.ws.w3}'';
"${primeMod}+Shift+4" = ''move container to workspace 4:${config.ws.w4}; workspace 4:${config.ws.w4}'';
"${primeMod}+Shift+5" = ''move container to workspace 5:${config.ws.w5}; workspace 5:${config.ws.w5}'';
"${primeMod}+Shift+6" = ''move container to workspace 6:${config.ws.w6}; workspace 6:${config.ws.w6}'';
"${primeMod}+Shift+7" = ''move container to workspace 7:${config.ws.w7}; workspace 7:${config.ws.w7}'';
"${primeMod}+Shift+8" = ''move container to workspace 8:${config.ws.w8}; workspace 8:${config.ws.w8}'';
"${primeMod}+Shift+9" = ''move container to workspace 9:${config.ws.w9}; workspace 9:${config.ws.w9}'';
# Move window to and focus alternate workspace
"${secMod}+Shift+F1" = ''move container to workspace ${config.ws.w1a}; workspace ${config.ws.w1a}'';
"${secMod}+Shift+F2" = ''move container to workspace ${config.ws.w2a}; workspace ${config.ws.w2a}'';
"${secMod}+Shift+F3" = ''move container to workspace ${config.ws.w3a}; workspace ${config.ws.w3a}'';
"${secMod}+Shift+F4" = ''move container to workspace ${config.ws.w4a}; workspace ${config.ws.w4a}'';
"${secMod}+Shift+F5" = ''move container to workspace ${config.ws.w5a}; workspace ${config.ws.w5a}'';
"${secMod}+Shift+F6" = ''move container to workspace ${config.ws.w6a}; workspace ${config.ws.w6a}'';
"${secMod}+Shift+F7" = ''move container to workspace ${config.ws.w7a}; workspace ${config.ws.w7a}'';
"${secMod}+Shift+F8" = ''move container to workspace ${config.ws.w8a}; workspace ${config.ws.w8a}'';
"${secMod}+Shift+F9" = ''move container to workspace ${config.ws.w9a}; workspace ${config.ws.w9a}'';
"${secMod}+Shift+F1" = ''move container to workspace 11:${config.ws.w1a}; workspace 11:${config.ws.w1a}'';
"${secMod}+Shift+F2" = ''move container to workspace 22:${config.ws.w2a}; workspace 22:${config.ws.w2a}'';
"${secMod}+Shift+F3" = ''move container to workspace 33:${config.ws.w3a}; workspace 33:${config.ws.w3a}'';
"${secMod}+Shift+F4" = ''move container to workspace 44:${config.ws.w4a}; workspace 44:${config.ws.w4a}'';
"${secMod}+Shift+F5" = ''move container to workspace 55:${config.ws.w5a}; workspace 55:${config.ws.w5a}'';
"${secMod}+Shift+F6" = ''move container to workspace 66:${config.ws.w6a}; workspace 66:${config.ws.w6a}'';
"${secMod}+Shift+F7" = ''move container to workspace 77:${config.ws.w7a}; workspace 77:${config.ws.w7a}'';
"${secMod}+Shift+F8" = ''move container to workspace 88:${config.ws.w8a}; workspace 88:${config.ws.w8a}'';
"${secMod}+Shift+F9" = ''move container to workspace 99:${config.ws.w9a}; workspace 99:${config.ws.w9a}'';
# Change focused window
"${primeMod}+h" = ''focus left'';

View file

@ -4,31 +4,31 @@
wayland.windowManager.sway.config = {
workspaceOutputAssign = let
workspaces1 = [
"${config.ws.w0}"
"${config.ws.w1}"
"${config.ws.w2}"
"${config.ws.w3}"
"${config.ws.w1a}"
"${config.ws.w2a}"
"${config.ws.w3a}"
"0:${config.ws.w0}"
"1:${config.ws.w1}"
"2:${config.ws.w2}"
"3:${config.ws.w3}"
"11:${config.ws.w1a}"
"22:${config.ws.w2a}"
"33:${config.ws.w3a}"
];
workspaces2 = [
"${config.ws.w4}"
"${config.ws.w5}"
"${config.ws.w6}"
"${config.ws.w4a}"
"${config.ws.w5a}"
"4:${config.ws.w4}"
"5:${config.ws.w5}"
"6:${config.ws.w6}"
"44:${config.ws.w4a}"
"55:${config.ws.w5a}"
];
workspaces3 = [
"${config.ws.w7}"
"${config.ws.w8}"
"${config.ws.w9}"
"${config.ws.w7a}"
"${config.ws.w8a}"
"7:${config.ws.w7}"
"8:${config.ws.w8}"
"9:${config.ws.w9}"
"77:${config.ws.w7a}"
"88:${config.ws.w8a}"
];
workspaces4 = [
"${config.ws.w6a}"
"${config.ws.w9a}"
"66:${config.ws.w6a}"
"99:${config.ws.w9a}"
];
assign = output: workspaces:
map (workspace: {

View file

@ -1,8 +1,8 @@
{ pkgs, ... }:
{
imports = [
./swayshot
./swaysleep
./swaytools
./screen-sway
./sleep-sway
./tools-sway
];
}

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swayshot" ''
(pkgs.writeScriptBin "screen-sway" ''
swappy() {
# Create an imv window to act as a static screen
grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$!

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swaysleep" ''
(pkgs.writeScriptBin "sleep-sway" ''
swaylock & ${pkgs.swayidle}/bin/swayidle -w \
timeout 1 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"; pkill -9 swayidle'

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swaytools" ''
(pkgs.writeScriptBin "tools-sway" ''
# List the app name and whether or not it uses wayland
prop() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)

View file

@ -1,7 +1,7 @@
{ config, ... }:
{
wayland.windowManager.sway.config = {
defaultWorkspace = config.ws.w1;
defaultWorkspace = "1:${config.ws.w1}";
window = {
border = config.look.border.int;
@ -64,28 +64,28 @@
};
assigns = {
# Browsers
"${config.ws.w1}" = [{ app_id = "MainBrowser"; }];
"${config.ws.w1a}" = [{ app_id = "AltBrowser"; }];
"1:${config.ws.w1}" = [{ app_id = "MainBrowser"; }];
"11:${config.ws.w1a}" = [{ app_id = "AltBrowser"; }];
# Communication
"${config.ws.w7}" = [
"7:${config.ws.w7}" = [
{ app_id = "MiscBrowser"; }
{ app_id = "vesktop"; }
{ class = "vesktop"; }
];
"${config.ws.w8}" = [
"8:${config.ws.w8}" = [
{ app_id = "org.gnome.Fractal"; }
{ app_id = "org.telegram.desktop"; }
];
"${config.ws.w9}" = [{ app_id = "thunderbird"; }];
"9:${config.ws.w9}" = [{ app_id = "thunderbird"; }];
# Etc
"${config.ws.w2}" = [
"2:${config.ws.w2}" = [
{ class = "steam"; }
{ app_id = "heroic"; }
];
"${config.ws.w2a}" = [{ app_id = "looking-glass-client"; }];
"${config.ws.w4a}" = [{ app_id = "com.obsproject.Studio"; }];
"22:${config.ws.w2a}" = [{ app_id = "looking-glass-client"; }];
"44:${config.ws.w4a}" = [{ app_id = "com.obsproject.Studio"; }];
};
focus.newWindow = "focus";
};

View file

@ -3,7 +3,7 @@
programs = {
sway.enable = config.system.desktop.enable;
niri.enable = config.system.desktop.enable;
xwayland.enable = lib.mkForce config.system.desktop.enable;
xwayland.enable = false;
};
services.dbus.enable = config.system.desktop.enable;