Add Niri, a scrolling tiling window manager.

This commit is contained in:
Jimbo 2024-12-03 16:50:23 -05:00
parent 325c176464
commit b3d9d2f396
38 changed files with 758 additions and 376 deletions

View file

@ -4,7 +4,6 @@
./easyeffects ./easyeffects
./foot ./foot
./librewolf ./librewolf
./mako
./mangohud ./mangohud
./mpv ./mpv
./pcmanfm ./pcmanfm

View file

@ -2,56 +2,37 @@
{ {
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
pcmanfm-qt pcmanfm
file-roller file-roller
]; ];
file = { file = {
".config/pcmanfm-qt/default/settings.conf".text = '' ".config/pcmanfm/default/pcmanfm.conf".text = ''
[Behavior] [config]
BookmarkOpenMethod=current_tab bm_open_method=0
ConfirmDelete=true
RecentFilesNumber=0
[Desktop] [volume]
HideItems=false mount_on_startup=0
SortColumn=name mount_removable=1
SortFolderFirst=true autorun=0
SortHiddenLast=false
SortOrder=ascending
[FolderView] [ui]
Mode=icon always_show_tabs=0
ScrollPerPixel=true max_tab_chars=32
ShadowHidden=true win_width=943
ShowFilter=false win_height=1039
ShowFullNames=true splitter_pos=150
ShowHidden=true media_in_new_tab=0
SortCaseSensitive=false desktop_folder_new_win=0
SortColumn=mtime change_tab_on_drop=1
SortFolderFirst=true close_on_unmount=1
SortHiddenLast=false focus_previous=0
SortOrder=descending side_pane_mode=places
view_mode=icon
[Places] show_hidden=1
HiddenPlaces=menu://applications/, network:///, computer:///, /home/${config.home.username}/Desktop sort=name;ascending;
toolbar=newtab;navigation;home;
[System] show_statusbar=1
Archiver=file-roller pathbar_mode_buttons=0
Terminal=foot
[Thumbnail]
MaxExternalThumbnailFileSize=-1
MaxThumbnailFileSize=4096
ShowThumbnails=true
ThumbnailLocalFilesOnly=false
[Window]
AlwaysShowTabs=false
PathBarButtons=true
ShowMenuBar=true
ShowTabClose=true
SwitchToNewTab=true
TabPaths=@Invalid()
''; '';
}; };
}; };

View file

@ -127,7 +127,7 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.writeScriptBin "rofiscripts" '' (pkgs.writeScriptBin "rofiscripts" ''
# Scratchpad function # Scratchpad function
handle_scratchpads() { scratchpads() {
SCRATCHPADS=$(echo -e "Gotop\nMusic\nSound\nEasyEffects" | rofi -dmenu -i -p "Scratchpads") SCRATCHPADS=$(echo -e "Gotop\nMusic\nSound\nEasyEffects" | rofi -dmenu -i -p "Scratchpads")
case $SCRATCHPADS in case $SCRATCHPADS in
Gotop) foot -a gotop -T Gotop gotop;; Gotop) foot -a gotop -T Gotop gotop;;
@ -138,43 +138,24 @@
} }
# Lock menu # Lock menu
handle_power() { power() {
POWER=$(echo -e "Shutdown\nReboot\nSleep\nLock\nKill" | rofi -dmenu -i -p "Power") POWER=$(echo -e "Shutdown\nReboot\nSleep\nLock\nKill" | rofi -dmenu -i -p "Power")
case $POWER in case $POWER in
Shutdown) poweroff;; Shutdown) poweroff;;
Reboot) reboot;; Reboot) reboot;;
Sleep) swaysleep &;; Sleep) swaysleep &;;
Lock) swaylock &;; Lock) swaylock &;;
Kill) pkill -9 sway;; Kill) pkill -9 $XDG_CURRENT_DESKTOP;;
esac
}
# Resolutions
handle_resolutions() {
RET=$(echo -e "Default\nWide\nGPU2" | rofi -dmenu -i -p "Resolutions")
case $RET in
Default) swaymsg reload ;;
Wide) swaymsg "
output ${config.displays.d1} enable pos 1680 0 mode 1680x1050@59.954Hz
output ${config.displays.d2} enable pos 0 0 mode 1680x1050@59.954Hz
output ${config.displays.d3} enable pos 3360 0 transform 0
";;
GPU2) swaymsg "
output ${config.displays.d2} enable pos 1680 0 mode 1920x1080@60Hz
output ${config.displays.d3} enable pos 0 0 transform 0
";;
esac esac
} }
# Check for command-line arguments # Check for command-line arguments
if [ "$1" == "--scratchpads" ]; then if [ "$1" == "--scratchpads" ]; then
handle_scratchpads scratchpads
elif [ "$1" == "--power" ]; then elif [ "$1" == "--power" ]; then
handle_power power
elif [ "$1" == "--resolutions" ]; then
handle_resolutions
else else
echo "Please use a valid argument." echo "Please --scratchpads or --power."
fi fi
'') '')
rofi-bluetooth rofi-bluetooth

View file

@ -34,6 +34,9 @@
# Nerdtree # Nerdtree
nerdtree nerdtree
vim-nerdtree-syntax-highlight vim-nerdtree-syntax-highlight
# Misc languages
kdl-vim
]; ];
extraConfig = '' extraConfig = ''
lua <<EOF lua <<EOF

View file

@ -13,12 +13,6 @@
hidden_filter = ''^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$''; hidden_filter = ''^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$'';
}; };
rifle = [ rifle = [
# Text editing
{
condition = ''ext xml|json|jsonc|m3u|m3u8|csv|tex|py|pl|rb|js|sh|php|md|nix'';
command = ''vim -- "$@"'';
}
# Media # Media
{ {
condition = ''mime ^image, has imv, X, flag f''; condition = ''mime ^image, has imv, X, flag f'';
@ -82,7 +76,7 @@
} }
{ {
condition = ''label open, has xdg-open''; condition = ''label open, has xdg-open'';
command = ''xdg-open -- "$@"''; command = ''vim -- "$@"'';
} }
]; ];
plugins = [ plugins = [

View file

@ -8,6 +8,7 @@
MANPAGER = "nvim +Man!"; MANPAGER = "nvim +Man!";
LIBVIRT_DEFAULT_URI = "qemu:///system"; LIBVIRT_DEFAULT_URI = "qemu:///system";
HISTCONTROL = "ignoreboth"; HISTCONTROL = "ignoreboth";
QT_QPA_PLATFORMTHEME = "gtk3";
NIXPKGS_ALLOW_UNFREE = 1; NIXPKGS_ALLOW_UNFREE = 1;
}; };
}; };

View file

@ -1,14 +1,28 @@
{ lib, ... }: { lib, ... }:
{ {
options.home.sway.enable = lib.mkOption { options.home = {
sway.enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
description = "Enable SwayWM"; description = "Enable SwayWM";
}; };
niri = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable SwayWM";
};
settings = lib.mkOption {
type = lib.types.attrs;
default = {};
};
};
};
imports = [ imports = [
./niri
./programs
./sway ./sway
./swaylock
./waybar
]; ];
} }

View file

@ -0,0 +1,23 @@
{ pkgs, ... }:
{
config.home.niri.settings.autostart = pkgs.writeText "autostart" ''
// Everpresent bar
spawn-at-startup "waybar"
// Daemons and tray apps
spawn-at-startup "hyprpaper"
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 "${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"
spawn-at-startup "vesktop"
spawn-at-startup "fractal"
spawn-at-startup "telegram-desktop"
spawn-at-startup "thunderbird"
'';
}

View file

@ -0,0 +1,22 @@
{ config, ... }:
{
imports = [
./autostart
./hotkeys
./inputs
./outputs
./rules
./settings
./theme
];
home.file.".config/niri/config.kdl".text = ''
${builtins.readFile config.home.niri.settings.autostart}
${builtins.readFile config.home.niri.settings.hotkeys}
${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,151 @@
{ pkgs, config, ... }:
{
config.home.niri.settings.hotkeys = let
primeMod = "Mod";
secMod = "Alt";
resizeAmount = "5";
in pkgs.writeText "hotkeys" ''
binds {
//// Launchers
// Browser
${primeMod}+F1 { spawn "sh" "-c" "librewolf -p Main --name MainBrowser | notify-send \"Main Browser\""; }
${primeMod}+F2 { spawn "sh" "-c" "librewolf -p Alt --name AltBrowser | notify-send \"Alternate Browser\""; }
${primeMod}+F3 { spawn "sh" "-c" "librewolf -p Misc --name MiscBrowser | notify-send \"Miscellaneous Browser\""; }
// Virtual machines
${primeMod}+F4 { spawn "sh" "-c" "virt-manager | notify-send \"Virtual Machines\""; }
${primeMod}+F5 { spawn "sh" "-c" "looking-glass-client input:rawMouse=yes | notify-send \"Looking Glass\""; }
// ${primeMod} + key
${primeMod}+s { spawn "sh" "-c" "rofi -show run -p Command"; }
${primeMod}+c { spawn "sh" "-c" "clipman pick -t rofi"; }
${primeMod}+x { spawn "sh" "-c" "rofiscripts --power"; }
${primeMod}+b { spawn "sh" "-c" "pkill -USR1 waybar"; }
${primeMod}+Return { spawn "sh" "-c" "foot"; }
// ${primeMod} + shift + key
${primeMod}+Shift+s { spawn "sh" "-c" "rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history"; }
${primeMod}+Shift+t { spawn "sh" "-c" "pcmanfm"; }
${primeMod}+Shift+e { spawn "sh" "-c" "bemoji -n -P 0"; }
${primeMod}+Shift+b { spawn "sh" "-c" "rofi-bluetooth"; }
${primeMod}+Shift+Return { spawn "sh" "-c" "foot ranger"; }
// ${primeMod} + ctrl + key
${primeMod}+Ctrl+s { spawn "sh" "-c" "rofiscripts --scratchpads"; }
${primeMod}+Ctrl+c { spawn "sh" "-c" "wlpicker && notify-send \"Color copied to clipboard\""; }
//// Media
// Volume
${secMod}+j { spawn "sh" "-c" "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; }
${secMod}+k { spawn "sh" "-c" "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; }
// MPD
${primeMod}+Backslash { spawn "sh" "-c" "mpc toggle"; }
${secMod}+Shift+h { spawn "sh" "-c" "mpc prev"; }
${secMod}+Shift+j { spawn "sh" "-c" "mpc volume -3"; }
${secMod}+Shift+k { spawn "sh" "-c" "mpc volume +3"; }
${secMod}+Shift+l { spawn "sh" "-c" "mpc next"; }
//// Miscellaneous
// Notifications
${primeMod}+n { spawn "sh" "-c" "makotoggle"; }
${primeMod}+Shift+n { spawn "sh" "-c" "makoctl restore"; }
${primeMod}+Ctrl+n { spawn "sh" "-c" "makoctl dismiss -a"; }
// Screenshots
${secMod}+F { screenshot; }
${secMod}+Shift+F { screenshot-screen; }
${secMod}+Ctrl+F { screenshot-window; }
// Display and keyboard brightness
${primeMod}+equal { spawn "sh" "-c" "light -A 5"; }
${primeMod}+minus { spawn "sh" "-c" "light -U 5"; }
${primeMod}+Shift+equal { spawn "sh" "-c" "light -A 1"; }
${primeMod}+Shift+minus { spawn "sh" "-c" "light -U 1"; }
XF86KbdBrightnessUp { spawn "sh" "-c" "light -s sysfs/leds/smc::kbd_backlight -A 5"; }
XF86KbdBrightnessDown { spawn "sh" "-c" "light -s sysfs/leds/smc::kbd_backlight -U 5"; }
//// Window manager
${primeMod}+q { close-window; }
// Switch to workspaces
${primeMod}+grave { focus-workspace "${config.ws.w0}"; }
${primeMod}+1 { focus-workspace "${config.ws.w1}"; }
${primeMod}+2 { focus-workspace "${config.ws.w2}"; }
${primeMod}+3 { focus-workspace "${config.ws.w3}"; }
${primeMod}+4 { focus-workspace "${config.ws.w4}"; }
${primeMod}+5 { focus-workspace "${config.ws.w5}"; }
${primeMod}+6 { focus-workspace "${config.ws.w6}"; }
${primeMod}+7 { focus-workspace "${config.ws.w7}"; }
${primeMod}+8 { focus-workspace "${config.ws.w8}"; }
${primeMod}+9 { focus-workspace "${config.ws.w9}"; }
// Switch to alternate workspaces
${secMod}+F1 { focus-workspace "${config.ws.w1a}"; }
${secMod}+F2 { focus-workspace "${config.ws.w2a}"; }
${secMod}+F3 { focus-workspace "${config.ws.w3a}"; }
${secMod}+F4 { focus-workspace "${config.ws.w4a}"; }
${secMod}+F5 { focus-workspace "${config.ws.w5a}"; }
${secMod}+F6 { focus-workspace "${config.ws.w6a}"; }
${secMod}+F7 { focus-workspace "${config.ws.w7a}"; }
${secMod}+F8 { focus-workspace "${config.ws.w8a}"; }
${secMod}+F9 { focus-workspace "${config.ws.w9a}"; }
// Move window to and focus workspace
${primeMod}+Shift+grave { move-window-to-workspace "${config.ws.w0}"; }
${primeMod}+Shift+1 { move-window-to-workspace "${config.ws.w1}"; }
${primeMod}+Shift+2 { move-window-to-workspace "${config.ws.w2}"; }
${primeMod}+Shift+3 { move-window-to-workspace "${config.ws.w3}"; }
${primeMod}+Shift+4 { move-window-to-workspace "${config.ws.w4}"; }
${primeMod}+Shift+5 { move-window-to-workspace "${config.ws.w5}"; }
${primeMod}+Shift+6 { move-window-to-workspace "${config.ws.w6}"; }
${primeMod}+Shift+7 { move-window-to-workspace "${config.ws.w7}"; }
${primeMod}+Shift+8 { move-window-to-workspace "${config.ws.w8}"; }
${primeMod}+Shift+9 { move-window-to-workspace "${config.ws.w9}"; }
// Move window to and focus workspace
${secMod}+Shift+F1 { move-window-to-workspace "${config.ws.w1a}"; }
${secMod}+Shift+F2 { move-window-to-workspace "${config.ws.w2a}"; }
${secMod}+Shift+F3 { move-window-to-workspace "${config.ws.w3a}"; }
${secMod}+Shift+F4 { move-window-to-workspace "${config.ws.w4a}"; }
${secMod}+Shift+F5 { move-window-to-workspace "${config.ws.w5a}"; }
${secMod}+Shift+F6 { move-window-to-workspace "${config.ws.w6a}"; }
${secMod}+Shift+F7 { move-window-to-workspace "${config.ws.w7a}"; }
${secMod}+Shift+F8 { move-window-to-workspace "${config.ws.w8a}"; }
${secMod}+Shift+F9 { move-window-to-workspace "${config.ws.w9a}"; }
// Change focused window
${primeMod}+h { focus-column-or-monitor-left; }
${primeMod}+j { focus-window-down; }
${primeMod}+k { focus-window-up; }
${primeMod}+l { focus-column-or-monitor-right; }
// Move focused window
${primeMod}+Shift+h { move-column-left-or-to-monitor-left; }
${primeMod}+Shift+j { move-window-down; }
${primeMod}+Shift+k { move-window-up; }
${primeMod}+Shift+l { move-column-right-or-to-monitor-right; }
// Resize window
${primeMod}+${secMod}+h { set-column-width "-${resizeAmount}%"; }
${primeMod}+${secMod}+j { set-window-height "-${resizeAmount}%"; }
${primeMod}+${secMod}+k { set-window-height "+${resizeAmount}%"; }
${primeMod}+${secMod}+l { set-column-width "+${resizeAmount}%"; }
// There are also commands that consume or expel a single window to the side.
${primeMod}+Ctrl+h { consume-or-expel-window-left; }
${primeMod}+Ctrl+l { consume-or-expel-window-right; }
// Toggle fullscreen
${primeMod}+f { maximize-column; }
${primeMod}+Shift+f { fullscreen-window; }
// Niri specific
${primeMod}+Shift+r { reset-window-height; }
${primeMod}+Shift+c { center-column; }
}
'';
}

View file

@ -0,0 +1,20 @@
{ pkgs, ... }:
{
config.home.niri.settings.inputs = pkgs.writeText "inputs" ''
input {
mouse {
accel-profile "flat"
accel-speed -0.9
}
touchpad {
accel-profile "flat"
scroll-method "two-finger"
}
trackpoint {
off
}
warp-mouse-to-focus
focus-follows-mouse
}
'';
}

View file

@ -0,0 +1,88 @@
{ config, pkgs, ... }:
{
config.home.niri.settings.outputs = pkgs.writeText "outputs" ''
// Workspace 1
workspace "${config.ws.w0}" {
open-on-output "${config.displays.d1}"
}
workspace "${config.ws.w1}" {
open-on-output "${config.displays.d1}"
}
workspace "${config.ws.w2}" {
open-on-output "${config.displays.d1}"
}
workspace "${config.ws.w3}" {
open-on-output "${config.displays.d1}"
}
workspace "${config.ws.w1a}" {
open-on-output "${config.displays.d1}"
}
workspace "${config.ws.w2a}" {
open-on-output "${config.displays.d1}"
}
workspace "${config.ws.w3a}" {
open-on-output "${config.displays.d1}"
}
// Workspace 2
workspace "${config.ws.w4}" {
open-on-output "${config.displays.d2}"
}
workspace "${config.ws.w5}" {
open-on-output "${config.displays.d2}"
}
workspace "${config.ws.w6}" {
open-on-output "${config.displays.d2}"
}
workspace "${config.ws.w4a}" {
open-on-output "${config.displays.d2}"
}
workspace "${config.ws.w5a}" {
open-on-output "${config.displays.d2}"
}
// Workspace 3
workspace "${config.ws.w7}" {
open-on-output "${config.displays.d3}"
}
workspace "${config.ws.w8}" {
open-on-output "${config.displays.d3}"
}
workspace "${config.ws.w9}" {
open-on-output "${config.displays.d3}"
}
workspace "${config.ws.w7a}" {
open-on-output "${config.displays.d3}"
}
workspace "${config.ws.w8a}" {
open-on-output "${config.displays.d3}"
}
// Workspace 4
workspace "${config.ws.w6a}" {
open-on-output "${config.displays.d4}"
}
workspace "${config.ws.w9a}" {
open-on-output "${config.displays.d4}"
}
// Monitors
output "${config.displays.d1}" {
mode "1920x1080@143.980"
position x=3840 y=405
}
output "${config.displays.d2}" {
mode "1920x1080@60"
position x=1920 y=405
}
output "${config.displays.d3}" {
mode "1680x1050@59.883"
transform "90"
position x=5760 y=0
}
output "${config.displays.d4}" {
mode "1920x1080@60"
position x=0 y=405
}
'';
}

View file

@ -0,0 +1,42 @@
{ pkgs, config, ... }:
{
config.home.niri.settings.rules = pkgs.writeText "rules" ''
// Browsers
window-rule {
match app-id="MainBrowser"
open-on-workspace "${config.ws.w1}"
}
window-rule {
match app-id="AltBrowser"
open-on-workspace "${config.ws.w1a}"
}
// Communication
window-rule {
match app-id="MiscBrowser"
match app-id="vesktop"
block-out-from "screencast"
open-on-workspace "${config.ws.w7}"
}
window-rule {
match app-id="org.gnome.Fractal"
match app-id="org.telegram.desktop"
open-on-workspace "${config.ws.w8}"
}
window-rule {
match app-id="thunderbird"
open-maximized true
open-on-workspace "${config.ws.w9}"
}
// Etc
window-rule {
match app-id="looking-glass-client"
open-on-workspace "${config.ws.w2a}"
}
window-rule {
match app-id="com.obsproject.Studio"
open-on-workspace "${config.ws.w4a}"
}
'';
}

View file

@ -0,0 +1,14 @@
{ 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

@ -0,0 +1,22 @@
{ pkgs, config, ... }:
{
config.home.niri.settings.theme = pkgs.writeText "theme" ''
prefer-no-csd
layout {
gaps 7
center-focused-column "never"
default-column-width { proportion 0.5; }
focus-ring {
off
}
border {
width 3
active-color "#${config.look.colors.prime}"
inactive-color "#${config.look.colors.split}"
}
}
'';
}

View file

@ -0,0 +1,21 @@
{ pkgs, ... }:
{
imports = [
./hyprpaper
./mako
./swaylock
./waybar
./wlpicker
];
home.packages = with pkgs; [
clipman
hyprpicker
libnotify
grim
slurp
wl-clipboard
wdisplays
jq
];
}

View file

@ -0,0 +1,21 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [ hyprpaper ];
services.hyprpaper = {
enable = true;
settings = {
splash = false;
preload = [
"~/.assets/wallpapers/1.png"
"~/.assets/wallpapers/2.png"
"~/.assets/wallpapers/3.png"
];
wallpaper = [
",~/.assets/wallpapers/1.png"
"${config.displays.d2},~/.assets/wallpapers/2.png"
"${config.displays.d3},~/.assets/wallpapers/3.png"
];
};
};
}

View file

@ -0,0 +1,28 @@
{ config, ... }:
{
imports = [
./makotoggle
];
services.mako = {
enable = true;
borderColor = "#${config.look.colors.accent}";
backgroundColor = "#${config.look.colors.dark}D9";
output = "${config.displays.d1}";
sort = "+time";
layer = "overlay";
padding = "8";
margin = "0";
borderSize = config.look.border.int;
maxIconSize = 40;
defaultTimeout = 4500;
font = "${config.look.fonts.main} 12";
anchor = "bottom-right";
extraConfig = ''
on-button-right=dismiss-all
outer-margin=10
[mode=do-not-disturb]
invisible=1
'';
};
}

View file

@ -1,27 +1,5 @@
{ pkgs, config, ... }: { pkgs, ... }:
{ {
services.mako = {
enable = true;
borderColor = "#${config.look.colors.accent}";
backgroundColor = "#${config.look.colors.dark}D9";
output = "${config.displays.d1}";
sort = "+time";
layer = "overlay";
padding = "8";
margin = "0";
borderSize = config.look.border.int;
maxIconSize = 40;
defaultTimeout = 6000;
font = "${config.look.fonts.main} 12";
anchor = "bottom-right";
extraConfig = ''
on-button-right=dismiss-all
outer-margin=10
[mode=do-not-disturb]
invisible=1
'';
};
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.writeScriptBin "makotoggle" '' (pkgs.writeScriptBin "makotoggle" ''
# Run makoctl mode and store the output in a variable # Run makoctl mode and store the output in a variable

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
programs.waybar = let programs.waybar = let
swayWorkspacesModule = { swayWorkspaceModule = {
format = "{name}"; format = "{name}";
enable-bar-scroll = true; enable-bar-scroll = true;
warp-on-scroll = false; warp-on-scroll = false;
@ -207,6 +207,8 @@
modules-left = [ modules-left = [
"sway/workspaces" "sway/workspaces"
"sway/window" "sway/window"
"niri/workspaces"
"niri/window"
]; ];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
@ -220,8 +222,9 @@
"bluetooth" "bluetooth"
"network" "network"
]; ];
"sway/workspaces" = swayWorkspacesModule; "sway/workspaces" = swayWorkspaceModule;
"sway/window" = swayWindowsModule; "sway/window" = swayWindowsModule;
"niri/window" = swayWindowsModule;
"pulseaudio" = pulseModule; "pulseaudio" = pulseModule;
"cpu" = cpuModule; "cpu" = cpuModule;
"memory" = ramModule; "memory" = ramModule;
@ -241,6 +244,8 @@
modules-left = [ modules-left = [
"sway/workspaces" "sway/workspaces"
"sway/window" "sway/window"
"niri/workspaces"
"niri/window"
]; ];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
@ -251,8 +256,9 @@
"custom/vram" "custom/vram"
"custom/clock-long" "custom/clock-long"
]; ];
"sway/workspaces" = swayWorkspacesModule; "sway/workspaces" = swayWorkspaceModule;
"sway/window" = swayWindowsModule; "sway/window" = swayWindowsModule;
"niri/window" = swayWindowsModule;
"pulseaudio" = pulseModule; "pulseaudio" = pulseModule;
"mpd" = mediaModule; "mpd" = mediaModule;
"custom/notifs" = notificationModule; "custom/notifs" = notificationModule;
@ -269,6 +275,8 @@
modules-left = [ modules-left = [
"sway/workspaces" "sway/workspaces"
"sway/window" "sway/window"
"niri/workspaces"
"niri/window"
]; ];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
@ -278,8 +286,9 @@
"custom/vram" "custom/vram"
"custom/clock-short" "custom/clock-short"
]; ];
"sway/workspaces" = swayWorkspacesModule; "sway/workspaces" = swayWorkspaceModule;
"sway/window" = swayWindowsModule; "sway/window" = swayWindowsModule;
"niri/window" = swayWindowsModule;
"pulseaudio" = pulseModule; "pulseaudio" = pulseModule;
"custom/weather" = weatherModule; "custom/weather" = weatherModule;
"cpu" = cpuModule; "cpu" = cpuModule;
@ -300,6 +309,8 @@
modules-left = [ modules-left = [
"sway/workspaces" "sway/workspaces"
"sway/window" "sway/window"
"niri/workspaces"
"niri/window"
]; ];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
@ -318,8 +329,9 @@
"bluetooth" "bluetooth"
"network" "network"
]; ];
"sway/workspaces" = swayWorkspacesModule; "sway/workspaces" = swayWorkspaceModule;
"sway/window" = swayWindowsModule; "sway/window" = swayWindowsModule;
"niri/window" = swayWindowsModule;
"pulseaudio" = pulseModule; "pulseaudio" = pulseModule;
"mpd" = mediaModule; "mpd" = mediaModule;
"custom/notifs" = notificationModule; "custom/notifs" = notificationModule;
@ -370,7 +382,7 @@
border-bottom: 3px solid transparent; border-bottom: 3px solid transparent;
min-width: 20px; min-width: 20px;
} }
#workspaces button.visible { #workspaces button.visible, #workspaces button.active {
border-bottom: 3px solid #${config.look.colors.prime}; border-bottom: 3px solid #${config.look.colors.prime};
background: #${config.look.colors.mid}; background: #${config.look.colors.mid};
} }

View file

@ -0,0 +1,15 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "wlpicker" ''
# Get color position
position=$(slurp -b 00000000 -p)
# Sleep to prevet grim always returning improper color
sleep 1
# Store the hex color value using imagemagick
grim -g "$position" -t png - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n 1 | cut -d ' ' -f 4 | wl-copy -n
'')
];
}

View file

@ -4,16 +4,13 @@
bars = [{ command = "waybar"; }]; bars = [{ command = "waybar"; }];
startup = [ startup = [
# Lock on startup
{ command = "swaylock"; }
# Scratchpads # Scratchpads
{ command = "foot -a gotop -T Gotop gotop"; } { command = "foot -a gotop -T Gotop gotop"; }
{ command = "foot -a music -T Music ncmpcpp"; } { command = "foot -a music -T Music ncmpcpp"; }
{ command = "foot -a sound -T Sound pulsemixer"; } { command = "foot -a sound -T Sound pulsemixer"; }
{ command = "easyeffects"; }
# Daemons and tray apps # Daemons and tray apps
{ command = "hyprpaper"; }
{ command = "wl-paste -t text --watch clipman store -P"; } { command = "wl-paste -t text --watch clipman store -P"; }
{ command = "wl-copy"; } { command = "wl-copy"; }
{ command = "mako"; } { command = "mako"; }

View file

@ -2,8 +2,9 @@
{ {
imports = [ imports = [
./autostart ./autostart
./hardware
./hotkeys ./hotkeys
./inputs
./outputs
./programs ./programs
./rules ./rules
./theme ./theme

View file

@ -1,54 +0,0 @@
{ config, ... }:
{
wayland.windowManager.sway.config = {
# Define monitors
output = {
${config.displays.d1} = {
pos = "3840 405";
mode = "1920x1080@143.980Hz";
max_render_time = "3";
bg = "~/.assets/wallpapers/1.png fill";
adaptive_sync = "on";
};
${config.displays.d2} = {
pos = "1920 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
bg = "~/.assets/wallpapers/2.png fill";
};
${config.displays.d3} = {
pos = "5760 0";
mode = "1680x1050@59.883Hz";
transform = "270";
max_render_time = "3";
bg = "~/.assets/wallpapers/3.png fill";
};
${config.displays.d4} = {
pos = "0 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
};
"*" = {
bg = "~/.assets/wallpapers/1.png fill";
};
};
# HID device config
input = {
"9610:4103:SINOWEALTH_Game_Mouse" = {
pointer_accel = "-0.9";
};
"9639:64097:Compx_2.4G_Receiver_Mouse" = {
pointer_accel = "-0.82";
};
"1452:627:bcm5974" = {
scroll_factor = "0.3";
};
"*" = {
accel_profile = "flat";
dwt = "disabled";
natural_scroll = "disabled";
};
};
};
}

View file

@ -5,120 +5,66 @@
primeMod = "Mod4"; primeMod = "Mod4";
secMod = "Mod1"; secMod = "Mod1";
resizeAmount = "55"; resizeAmount = "55";
sendNotif = "notify-send --expire-time=1500";
in { in {
# Hotkeys # Hotkeys
modifier = "${primeMod}"; modifier = "${primeMod}";
keybindings = let keybindings = {
# Define scripts specific to Sway ## Launchers
pinWindow = pkgs.writeScript "pin-window" ''
# Get the current border style of the focused window
current_style=$(swaymsg -t get_tree | jq -r '.. | select(.focused?).border')
# Toggle between "normal" (default) and "pixel ${config.look.border.string}" border styles # Browser profiles
if [ "$current_style" == "none" ]; then "${primeMod}+F1" = ''exec librewolf -p Main --name MainBrowser | notify-send "Main Browser"'';
swaymsg "sticky disable, border pixel ${config.look.border.string}" "${primeMod}+F2" = ''exec librewolf -p Alt --name AltBrowser | notify-send "Alternate Browser"'';
else "${primeMod}+F3" = ''exec librewolf -p Misc --name MiscBrowser | notify-send "Miscellaneous Browser"'';
swaymsg "sticky enable, border none"
fi
'';
# Kill a window or probe it for info # Virtual machines
swayTools = pkgs.writeScript "swaytools" '' "${primeMod}+F4" = ''exec virt-manager | notify-send "Virtual Machines"'';
# List the app name and whether or not it uses wayland "${primeMod}+F5" = ''exec looking-glass-client input:rawMouse=yes | notify-send "Looking Glass"'';
swayprop() {
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)
if [ -n "$selected_window" ]; then
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
fi
}
# Kill a selected window # Mod + key
swaykill() {
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)
if [ -n "$selected_window" ]; then
pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid')
kill -9 "$pid"
fi
}
# Handle which tool we use
if [ "$1" == "--prop" ]; then
swayprop
elif [ "$1" == "--kill" ]; then
swaykill
fi
'';
in {
## Launcher keys
# LibreWolf profiles
"${primeMod}+F1" = ''exec librewolf -P Main --name=MainBrowser | ${sendNotif} "Main Browser"'';
"${primeMod}+F2" = ''exec librewolf -P Alt --name=AltBrowser | ${sendNotif} "Alternate Browser"'';
"${primeMod}+F3" = ''exec librewolf -P Misc --name=MiscBrowser | ${sendNotif} "Miscellaneous Browser"'';
# Virtual Machines
"${primeMod}+F4" = ''exec virt-manager | ${sendNotif} "Virtual Machines"'';
"${primeMod}+F5" = ''exec looking-glass-client input:rawMouse=yes | ${sendNotif} "Looking Glass"'';
# BeMenu scripts
"${primeMod}+${secMod}+s" = ''exec rofiscripts --scratchpads'';
"${primeMod}+${secMod}+r" = ''exec rofiscripts --resolutions'';
# Mod + Key
"${primeMod}+s" = ''exec rofi -show run -p Command''; "${primeMod}+s" = ''exec rofi -show run -p Command'';
"${primeMod}+c" = ''exec clipman pick -t rofi''; "${primeMod}+c" = ''exec clipman pick -t rofi'';
"${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 swaytools --kill'';
"${primeMod}+Delete" = ''exec foot ranger /etc/nixos | ${sendNotif} "Nix Config"'';
# 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'';
"${primeMod}+Shift+t" = ''exec pcmanfm-qt''; "${primeMod}+Shift+t" = ''exec pcmanfm'';
"${primeMod}+Shift+e" = ''exec BEMOJI_PICKER_CMD="rofi -dmenu -i -p Emoji" bemoji -n -P 0''; "${primeMod}+Shift+e" = ''exec bemoji -n -P 0'';
"${primeMod}+Shift+b" = ''exec rofi-bluetooth''; "${primeMod}+Shift+b" = ''exec rofi-bluetooth'';
"${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 swaytools --prop'';
"${primeMod}+Ctrl+c" = ''exec ${pkgs.hyprpicker}/bin/hyprpicker -an && ${sendNotif} "Color copied to clipboard"''; "${primeMod}+Ctrl+s" = ''exec rofiscripts --scratchpads'';
"${primeMod}+Ctrl+Prior" = ''exec ${pkgs.obs-cmd}/bin/obs-cmd scene switch "Main"''; "${primeMod}+Ctrl+c" = ''exec wlpicker && notify-send "Color copied to clipboard"'';
"${primeMod}+Ctrl+Next" = ''exec ${pkgs.obs-cmd}/bin/obs-cmd scene switch "Guest"'';
## Media keys ## Media
# Volume control # Volume
"${secMod}+j" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-''; "${secMod}+j" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'';
"${secMod}+k" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+''; "${secMod}+k" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+'';
# MPD Controls # MPD
"${primeMod}+Backslash" = ''exec mpc toggle''; "${primeMod}+Backslash" = ''exec mpc toggle'';
"${secMod}+Shift+h" = ''exec mpc prev''; "${secMod}+Shift+h" = ''exec mpc prev'';
"${secMod}+Shift+j" = ''exec mpc volume -3''; "${secMod}+Shift+j" = ''exec mpc volume -3'';
"${secMod}+Shift+k" = ''exec mpc volume +3''; "${secMod}+Shift+k" = ''exec mpc volume +3'';
"${secMod}+Shift+l" = ''exec mpc next''; "${secMod}+Shift+l" = ''exec mpc next'';
## Notification keys ## Miscellaneous
# Toggle mako # Notifications
"${primeMod}+n" = ''exec makotoggle''; "${primeMod}+n" = ''exec makotoggle'';
"${primeMod}+Shift+n" = ''exec makoctl restore''; "${primeMod}+Shift+n" = ''exec makoctl restore'';
"${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a''; "${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a'';
## Miscellaneous keys
# Screenshots # Screenshots
"${secMod}+f" = ''exec swayshot --swappy''; "${secMod}+f" = ''exec swayshot --swappy'';
"${secMod}+Shift+f" = ''exec swayshot --screen''; "${secMod}+Shift+f" = ''exec swayshot --screen'';
# SSH # Display and keyboard brightness
"${primeMod}+${secMod}+Return" = ''exec foot ssh ${config.ips.server}'';
# Display Brightness and Keyboard Brightness
"${primeMod}+equal" = ''exec light -A 5''; "${primeMod}+equal" = ''exec light -A 5'';
"${primeMod}+minus" = ''exec light -U 5''; "${primeMod}+minus" = ''exec light -U 5'';
"${primeMod}+Shift+equal" = ''exec light -A 1''; "${primeMod}+Shift+equal" = ''exec light -A 1'';
@ -126,7 +72,7 @@
"XF86KbdBrightnessUp" = ''exec light -s sysfs/leds/smc::kbd_backlight -A 5''; "XF86KbdBrightnessUp" = ''exec light -s sysfs/leds/smc::kbd_backlight -A 5'';
"XF86KbdBrightnessDown" = ''exec light -s sysfs/leds/smc::kbd_backlight -U 5''; "XF86KbdBrightnessDown" = ''exec light -s sysfs/leds/smc::kbd_backlight -U 5'';
## Window manager keys ## Window manager
"${primeMod}+q" = ''kill''; "${primeMod}+q" = ''kill'';
"${primeMod}+Shift+r" = ''reload''; "${primeMod}+Shift+r" = ''reload'';
@ -153,7 +99,7 @@
"${secMod}+F8" = ''workspace ${config.ws.w8a}''; "${secMod}+F8" = ''workspace ${config.ws.w8a}'';
"${secMod}+F9" = ''workspace ${config.ws.w9a}''; "${secMod}+F9" = ''workspace ${config.ws.w9a}'';
# Move window to and focus new 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 ${config.ws.w0}; workspace ${config.ws.w0}'';
"${primeMod}+Shift+1" = ''move container to workspace ${config.ws.w1}; workspace ${config.ws.w1}''; "${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+2" = ''move container to workspace ${config.ws.w2}; workspace ${config.ws.w2}'';
@ -165,7 +111,7 @@
"${primeMod}+Shift+8" = ''move container to workspace ${config.ws.w8}; workspace ${config.ws.w8}''; "${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+9" = ''move container to workspace ${config.ws.w9}; workspace ${config.ws.w9}'';
# Move window to and focus new 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 ${config.ws.w1a}; workspace ${config.ws.w1a}'';
"${secMod}+Shift+F2" = ''move container to workspace ${config.ws.w2a}; workspace ${config.ws.w2a}''; "${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+F3" = ''move container to workspace ${config.ws.w3a}; workspace ${config.ws.w3a}'';
@ -176,31 +122,28 @@
"${secMod}+Shift+F8" = ''move container to workspace ${config.ws.w8a}; workspace ${config.ws.w8a}''; "${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+F9" = ''move container to workspace ${config.ws.w9a}; workspace ${config.ws.w9a}'';
# Change focus across windows # Change focused window
"${primeMod}+h" = ''focus left''; "${primeMod}+h" = ''focus left'';
"${primeMod}+j" = ''focus down''; "${primeMod}+j" = ''focus down'';
"${primeMod}+k" = ''focus up''; "${primeMod}+k" = ''focus up'';
"${primeMod}+l" = ''focus right''; "${primeMod}+l" = ''focus right'';
# Resize windows
"${primeMod}+${secMod}+h" = ''resize shrink width ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+j" = ''resize shrink height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+k" = ''resize grow height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+l" = ''resize grow width ${resizeAmount} px or 5 ppt'';
# Move focused window # Move focused window
"${primeMod}+Shift+h" = ''move left ${resizeAmount} px''; "${primeMod}+Shift+h" = ''move left ${resizeAmount} px'';
"${primeMod}+Shift+j" = ''move down ${resizeAmount} px''; "${primeMod}+Shift+j" = ''move down ${resizeAmount} px'';
"${primeMod}+Shift+k" = ''move up ${resizeAmount} px''; "${primeMod}+Shift+k" = ''move up ${resizeAmount} px'';
"${primeMod}+Shift+l" = ''move right ${resizeAmount} px''; "${primeMod}+Shift+l" = ''move right ${resizeAmount} px'';
# Resize window
"${primeMod}+${secMod}+h" = ''resize shrink width ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+j" = ''resize shrink height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+k" = ''resize grow height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+l" = ''resize grow width ${resizeAmount} px or 5 ppt'';
# Change focus between floating/tiled, toggle floating # Change focus between floating/tiled, toggle floating
"${primeMod}+space" = ''focus mode_toggle''; "${primeMod}+space" = ''focus mode_toggle'';
"${primeMod}+Shift+space" = ''floating toggle''; "${primeMod}+Shift+space" = ''floating toggle'';
# Allow a window to be visible on all workspaces, toggle border
"${primeMod}+0" = ''exec ${pinWindow}'';
# Toggle fullscreen # Toggle fullscreen
"${primeMod}+f" = ''fullscreen toggle''; "${primeMod}+f" = ''fullscreen toggle'';
"${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global''; "${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global'';
@ -220,7 +163,6 @@
"Shift+Ctrl+Backslash" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888''; "Shift+Ctrl+Backslash" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888'';
"${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657''; "${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657'';
"${primeMod}+Shift+v" = ''[app_id="sound"] scratchpad show, move position center, resize set 1000 800''; "${primeMod}+Shift+v" = ''[app_id="sound"] scratchpad show, move position center, resize set 1000 800'';
"${primeMod}+Shift+Backslash" = ''[app_id="com.github.wwmm.easyeffects"] scratchpad show, move position center, resize set 1000 800'';
}; };
}; };
} }

View file

@ -0,0 +1,20 @@
{ config, ... }:
{
# HID devices
wayland.windowManager.sway.config.input = {
"9610:4103:SINOWEALTH_Game_Mouse" = {
pointer_accel = "-0.9";
};
"9639:64097:Compx_2.4G_Receiver_Mouse" = {
pointer_accel = "-0.82";
};
"1452:627:bcm5974" = {
scroll_factor = "0.3";
};
"*" = {
accel_profile = "flat";
dwt = "disabled";
natural_scroll = "disabled";
};
};
}

View file

@ -0,0 +1,70 @@
{ config, ... }:
{
# Monitors
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}"
];
workspaces2 = [
"${config.ws.w4}"
"${config.ws.w5}"
"${config.ws.w6}"
"${config.ws.w4a}"
"${config.ws.w5a}"
];
workspaces3 = [
"${config.ws.w7}"
"${config.ws.w8}"
"${config.ws.w9}"
"${config.ws.w7a}"
"${config.ws.w8a}"
];
workspaces4 = [
"${config.ws.w6a}"
"${config.ws.w9a}"
];
assign = output: workspaces:
map (workspace: {
inherit workspace;
inherit output;
})
workspaces;
in
(assign "${config.displays.d1}" workspaces1) ++
(assign "${config.displays.d2}" workspaces2) ++
(assign "${config.displays.d3}" workspaces3) ++
(assign "${config.displays.d4}" workspaces4);
output = {
${config.displays.d1} = {
pos = "3840 405";
mode = "1920x1080@143.980Hz";
max_render_time = "3";
adaptive_sync = "on";
};
${config.displays.d2} = {
pos = "1920 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
};
${config.displays.d3} = {
pos = "5760 0";
mode = "1680x1050@59.883Hz";
transform = "270";
max_render_time = "3";
};
${config.displays.d4} = {
pos = "0 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
};
};
};
}

View file

@ -3,16 +3,6 @@
imports = [ imports = [
./swayshot ./swayshot
./swaysleep ./swaysleep
]; ./swaytools
home.packages = with pkgs; [
clipman
swaybg
libnotify
grim
slurp
wl-clipboard
wdisplays
jq
]; ];
} }

View file

@ -2,7 +2,7 @@
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.writeScriptBin "swayshot" '' (pkgs.writeScriptBin "swayshot" ''
handle_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=$!
@ -18,7 +18,7 @@
rm "$temp_file" rm "$temp_file"
} }
handle_screen() { screen() {
temp_file=$(mktemp -u).png temp_file=$(mktemp -u).png
grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file" grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file"
@ -33,9 +33,9 @@
} }
if [ "$1" == "--swappy" ]; then if [ "$1" == "--swappy" ]; then
handle_swappy swappy
elif [ "$1" == "--screen" ]; then elif [ "$1" == "--screen" ]; then
handle_screen screen
else else
echo "Please use the arguments --swappy or --screen." echo "Please use the arguments --swappy or --screen."
fi fi

View file

@ -0,0 +1,33 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swaytools" ''
# 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)
if [ -n "$selected_window" ]; then
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
fi
}
# Kill a selected window
kill() {
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)
if [ -n "$selected_window" ]; then
pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid')
kill -9 "$pid"
fi
}
if [ "$1" == "--prop" ]; then
prop
elif [ "$1" == "--kill" ]; then
kill
else
echo "Please use the arguments --prop or --kill."
fi
'')
];
}

View file

@ -1,48 +1,6 @@
{ config, ... }: { config, ... }:
{ {
wayland.windowManager.sway.config = { wayland.windowManager.sway.config = {
# Assign workspaces to 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}"
];
workspaces2 = [
"${config.ws.w4}"
"${config.ws.w5}"
"${config.ws.w6}"
"${config.ws.w4a}"
"${config.ws.w5a}"
];
workspaces3 = [
"${config.ws.w7}"
"${config.ws.w8}"
"${config.ws.w9}"
"${config.ws.w7a}"
"${config.ws.w8a}"
];
workspaces4 = [
"${config.ws.w6a}"
"${config.ws.w9a}"
];
assign = output: workspaces:
map (workspace: {
inherit workspace;
inherit output;
})
workspaces;
in
(assign "${config.displays.d1}" workspaces1) ++
(assign "${config.displays.d2}" workspaces2) ++
(assign "${config.displays.d3}" workspaces3) ++
(assign "${config.displays.d4}" workspaces4);
# Rules
defaultWorkspace = config.ws.w1; defaultWorkspace = config.ws.w1;
window = { window = {
@ -66,10 +24,6 @@
criteria = { app_id = "sound"; }; criteria = { app_id = "sound"; };
command = ''mark scratchpad''; command = ''mark scratchpad'';
} }
{
criteria = { app_id = "com.github.wwmm.easyeffects"; };
command = ''mark scratchpad, opacity 0.9'';
}
# Give apps that don't have them borders # Give apps that don't have them borders
{ {
@ -114,7 +68,6 @@
"${config.ws.w1a}" = [{ app_id = "AltBrowser"; }]; "${config.ws.w1a}" = [{ app_id = "AltBrowser"; }];
# Communication # Communication
"${config.ws.w3a}" = [{ class = "zoom"; }];
"${config.ws.w7}" = [ "${config.ws.w7}" = [
{ app_id = "MiscBrowser"; } { app_id = "MiscBrowser"; }
{ app_id = "vesktop"; } { app_id = "vesktop"; }

View file

@ -3,12 +3,12 @@
imports = [ imports = [
./backlights ./backlights
./dconf ./dconf
./desktops
./gaming ./gaming
./git ./git
./greetd
./nh ./nh
./qt
./security ./security
./shells ./shells
./sway
]; ];
} }

View file

@ -0,0 +1,11 @@
{ config, lib, ... }:
{
programs = {
sway.enable = config.system.desktop.enable;
niri.enable = config.system.desktop.enable;
xwayland.enable = lib.mkForce config.system.desktop.enable;
};
services.dbus.enable = config.system.desktop.enable;
security.pam.services.swaylock = {};
}

View file

@ -1,22 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
# Configure greetd for login directly to Sway services.greetd = {
services.greetd = let
startSway = pkgs.writeScript "startsway" ''
if ${pkgs.pciutils}/bin/lspci -k | grep "in use: nvidia" &> /dev/null; then
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
else
:
fi
export XDG_CURRENT_DESKTOP=sway
export QT_QPA_PLATFORM="wayland;xcb"
sway --unsupported-gpu
'';
in {
enable = config.system.desktop.enable; enable = config.system.desktop.enable;
restart = true; restart = true;
settings = { settings = {
@ -24,10 +8,32 @@
vt = 2; vt = 2;
switch = true; switch = true;
}; };
default_session = { default_session.command = "${pkgs.cage}/bin/cage -d -m last ${pkgs.greetd.gtkgreet}/bin/gtkgreet";
command = "${startSway}";
user = "jimbo";
};
}; };
}; };
environment.etc."greetd/environments".text = let
initScript = ''
if ${pkgs.pciutils}/bin/lspci -k | grep "in use: nvidia" &> /dev/null; then
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
else
:
fi
'';
in ''
${pkgs.writeScript "startsway" ''
${initScript}
export QT_QPA_PLATFORM="wayland;xcb"
export XDG_CURRENT_DESKTOP=sway
sway --unsupported-gpu
''}
${pkgs.writeScript "startniri" ''
${initScript}
export QT_QPA_PLATFORM=wayland
export XDG_CURRENT_DESKTOP=niri
niri-session
''}
'';
} }

View file

@ -1,8 +0,0 @@
{ config, ... }:
{
qt = {
enable = config.system.desktop.enable;
style = "gtk2";
platformTheme = "gtk2";
};
}

View file

@ -1,12 +0,0 @@
{ config, pkgs, ... }:
{
imports = [ ./greetd ];
programs.sway = {
enable = config.system.desktop.enable;
extraPackages = with pkgs; [ swaylock ];
};
services.dbus.enable = config.system.desktop.enable;
security.pam.services.swaylock = {};
}

View file

@ -1,11 +1,14 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
xdg.portal.wlr = { xdg.portal = {
enable = config.system.desktop.enable; wlr = {
enable = lib.mkForce config.system.desktop.enable;
settings.screencast = { settings.screencast = {
max_fps = 60; max_fps = 60;
chooser_type = "simple"; chooser_type = "simple";
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099"; chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099";
}; };
}; };
extraPortals = with pkgs; [ xdg-desktop-portal-gnome ];
};
} }