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

View file

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

View file

@ -6,12 +6,12 @@
// Daemons and tray apps // Daemons and tray apps
spawn-at-startup "hyprpaper" 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 "wl-copy"
spawn-at-startup "mako" spawn-at-startup "mako"
spawn-at-startup "sunshine" 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.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"
spawn-at-startup "${pkgs.xwayland-satellite}/bin/xwayland-satellite"
// Foreground apps // Foreground apps
spawn-at-startup "librewolf" "-p" "Misc" "--name" "MiscBrowser" spawn-at-startup "librewolf" "-p" "Misc" "--name" "MiscBrowser"

View file

@ -5,8 +5,8 @@
./hotkeys ./hotkeys
./inputs ./inputs
./outputs ./outputs
./programs
./rules ./rules
./settings
./theme ./theme
]; ];
@ -16,7 +16,6 @@
${builtins.readFile config.home.niri.settings.inputs} ${builtins.readFile config.home.niri.settings.inputs}
${builtins.readFile config.home.niri.settings.outputs} ${builtins.readFile config.home.niri.settings.outputs}
${builtins.readFile config.home.niri.settings.rules} ${builtins.readFile config.home.niri.settings.rules}
${builtins.readFile config.home.niri.settings.settings}
${builtins.readFile config.home.niri.settings.theme} ${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" match app-id="com.obsproject.Studio"
open-on-workspace "${config.ws.w4a}" 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 slurp
wl-clipboard wl-clipboard
wdisplays wdisplays
xwayland-satellite
jq jq
]; ];
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.writeScriptBin "swaytools" '' (pkgs.writeScriptBin "tools-sway" ''
# List the app name and whether or not it uses wayland # List the app name and whether or not it uses wayland
prop() { 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) 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, ... }: { config, ... }:
{ {
wayland.windowManager.sway.config = { wayland.windowManager.sway.config = {
defaultWorkspace = config.ws.w1; defaultWorkspace = "1:${config.ws.w1}";
window = { window = {
border = config.look.border.int; border = config.look.border.int;
@ -64,28 +64,28 @@
}; };
assigns = { assigns = {
# Browsers # Browsers
"${config.ws.w1}" = [{ app_id = "MainBrowser"; }]; "1:${config.ws.w1}" = [{ app_id = "MainBrowser"; }];
"${config.ws.w1a}" = [{ app_id = "AltBrowser"; }]; "11:${config.ws.w1a}" = [{ app_id = "AltBrowser"; }];
# Communication # Communication
"${config.ws.w7}" = [ "7:${config.ws.w7}" = [
{ app_id = "MiscBrowser"; } { app_id = "MiscBrowser"; }
{ app_id = "vesktop"; } { app_id = "vesktop"; }
{ class = "vesktop"; } { class = "vesktop"; }
]; ];
"${config.ws.w8}" = [ "8:${config.ws.w8}" = [
{ app_id = "org.gnome.Fractal"; } { app_id = "org.gnome.Fractal"; }
{ app_id = "org.telegram.desktop"; } { app_id = "org.telegram.desktop"; }
]; ];
"${config.ws.w9}" = [{ app_id = "thunderbird"; }]; "9:${config.ws.w9}" = [{ app_id = "thunderbird"; }];
# Etc # Etc
"${config.ws.w2}" = [ "2:${config.ws.w2}" = [
{ class = "steam"; } { class = "steam"; }
{ app_id = "heroic"; } { app_id = "heroic"; }
]; ];
"${config.ws.w2a}" = [{ app_id = "looking-glass-client"; }]; "22:${config.ws.w2a}" = [{ app_id = "looking-glass-client"; }];
"${config.ws.w4a}" = [{ app_id = "com.obsproject.Studio"; }]; "44:${config.ws.w4a}" = [{ app_id = "com.obsproject.Studio"; }];
}; };
focus.newWindow = "focus"; focus.newWindow = "focus";
}; };

View file

@ -3,7 +3,7 @@
programs = { programs = {
sway.enable = config.system.desktop.enable; sway.enable = config.system.desktop.enable;
niri.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; services.dbus.enable = config.system.desktop.enable;