From b3d9d2f396aaf1028fda88fa9a75a0aed86d317c Mon Sep 17 00:00:00 2001 From: Jimbo Date: Tue, 3 Dec 2024 16:50:23 -0500 Subject: [PATCH] Add Niri, a scrolling tiling window manager. --- modules/home/programs/gui/default.nix | 1 - modules/home/programs/gui/pcmanfm/default.nix | 75 ++++----- modules/home/programs/gui/rofi/default.nix | 31 +--- .../home/programs/terminal/neovim/default.nix | 3 + .../home/programs/terminal/ranger/default.nix | 8 +- modules/home/user/default.nix | 1 + modules/home/wms/default.nix | 26 ++- modules/home/wms/niri/autostart/default.nix | 23 +++ modules/home/wms/niri/default.nix | 22 +++ modules/home/wms/niri/hotkeys/default.nix | 151 ++++++++++++++++++ modules/home/wms/niri/inputs/default.nix | 20 +++ modules/home/wms/niri/outputs/default.nix | 88 ++++++++++ modules/home/wms/niri/rules/default.nix | 42 +++++ modules/home/wms/niri/settings/default.nix | 14 ++ modules/home/wms/niri/theme/default.nix | 22 +++ modules/home/wms/programs/default.nix | 21 +++ .../home/wms/programs/hyprpaper/default.nix | 21 +++ modules/home/wms/programs/mako/default.nix | 28 ++++ .../programs/mako/makotoggle}/default.nix | 24 +-- .../wms/{ => programs}/swaylock/default.nix | 0 .../wms/{ => programs}/waybar/default.nix | 24 ++- .../home/wms/programs/wlpicker/default.nix | 15 ++ modules/home/wms/sway/autostart/default.nix | 5 +- modules/home/wms/sway/default.nix | 3 +- modules/home/wms/sway/hardware/default.nix | 54 ------- modules/home/wms/sway/hotkeys/default.nix | 122 ++++---------- modules/home/wms/sway/inputs/default.nix | 20 +++ modules/home/wms/sway/outputs/default.nix | 70 ++++++++ modules/home/wms/sway/programs/default.nix | 12 +- .../wms/sway/programs/swayshot/default.nix | 8 +- .../wms/sway/programs/swaytools/default.nix | 33 ++++ modules/home/wms/sway/rules/default.nix | 47 ------ modules/system/programs/default.nix | 4 +- modules/system/programs/desktops/default.nix | 11 ++ .../programs/{sway => }/greetd/default.nix | 48 +++--- modules/system/programs/qt/default.nix | 8 - modules/system/programs/sway/default.nix | 12 -- .../services/general/portals/default.nix | 17 +- 38 files changed, 758 insertions(+), 376 deletions(-) create mode 100644 modules/home/wms/niri/autostart/default.nix create mode 100644 modules/home/wms/niri/default.nix create mode 100644 modules/home/wms/niri/hotkeys/default.nix create mode 100644 modules/home/wms/niri/inputs/default.nix create mode 100644 modules/home/wms/niri/outputs/default.nix create mode 100644 modules/home/wms/niri/rules/default.nix create mode 100644 modules/home/wms/niri/settings/default.nix create mode 100644 modules/home/wms/niri/theme/default.nix create mode 100644 modules/home/wms/programs/default.nix create mode 100644 modules/home/wms/programs/hyprpaper/default.nix create mode 100644 modules/home/wms/programs/mako/default.nix rename modules/home/{programs/gui/mako => wms/programs/mako/makotoggle}/default.nix (54%) rename modules/home/wms/{ => programs}/swaylock/default.nix (100%) rename modules/home/wms/{ => programs}/waybar/default.nix (94%) create mode 100644 modules/home/wms/programs/wlpicker/default.nix delete mode 100644 modules/home/wms/sway/hardware/default.nix create mode 100644 modules/home/wms/sway/inputs/default.nix create mode 100644 modules/home/wms/sway/outputs/default.nix create mode 100644 modules/home/wms/sway/programs/swaytools/default.nix create mode 100644 modules/system/programs/desktops/default.nix rename modules/system/programs/{sway => }/greetd/default.nix (55%) delete mode 100644 modules/system/programs/qt/default.nix delete mode 100644 modules/system/programs/sway/default.nix diff --git a/modules/home/programs/gui/default.nix b/modules/home/programs/gui/default.nix index 35536f5..b8d20ab 100644 --- a/modules/home/programs/gui/default.nix +++ b/modules/home/programs/gui/default.nix @@ -4,7 +4,6 @@ ./easyeffects ./foot ./librewolf - ./mako ./mangohud ./mpv ./pcmanfm diff --git a/modules/home/programs/gui/pcmanfm/default.nix b/modules/home/programs/gui/pcmanfm/default.nix index 5a668dc..2adddc3 100644 --- a/modules/home/programs/gui/pcmanfm/default.nix +++ b/modules/home/programs/gui/pcmanfm/default.nix @@ -2,56 +2,37 @@ { home = { packages = with pkgs; [ - pcmanfm-qt + pcmanfm file-roller ]; file = { - ".config/pcmanfm-qt/default/settings.conf".text = '' - [Behavior] - BookmarkOpenMethod=current_tab - ConfirmDelete=true - RecentFilesNumber=0 - - [Desktop] - HideItems=false - SortColumn=name - SortFolderFirst=true - SortHiddenLast=false - SortOrder=ascending - - [FolderView] - Mode=icon - ScrollPerPixel=true - ShadowHidden=true - ShowFilter=false - ShowFullNames=true - ShowHidden=true - SortCaseSensitive=false - SortColumn=mtime - SortFolderFirst=true - SortHiddenLast=false - SortOrder=descending - - [Places] - HiddenPlaces=menu://applications/, network:///, computer:///, /home/${config.home.username}/Desktop - - [System] - Archiver=file-roller - Terminal=foot - - [Thumbnail] - MaxExternalThumbnailFileSize=-1 - MaxThumbnailFileSize=4096 - ShowThumbnails=true - ThumbnailLocalFilesOnly=false - - [Window] - AlwaysShowTabs=false - PathBarButtons=true - ShowMenuBar=true - ShowTabClose=true - SwitchToNewTab=true - TabPaths=@Invalid() + ".config/pcmanfm/default/pcmanfm.conf".text = '' + [config] + bm_open_method=0 + + [volume] + mount_on_startup=0 + mount_removable=1 + autorun=0 + + [ui] + always_show_tabs=0 + max_tab_chars=32 + win_width=943 + win_height=1039 + splitter_pos=150 + media_in_new_tab=0 + desktop_folder_new_win=0 + change_tab_on_drop=1 + close_on_unmount=1 + focus_previous=0 + side_pane_mode=places + view_mode=icon + show_hidden=1 + sort=name;ascending; + toolbar=newtab;navigation;home; + show_statusbar=1 + pathbar_mode_buttons=0 ''; }; }; diff --git a/modules/home/programs/gui/rofi/default.nix b/modules/home/programs/gui/rofi/default.nix index acd636a..eff39cc 100644 --- a/modules/home/programs/gui/rofi/default.nix +++ b/modules/home/programs/gui/rofi/default.nix @@ -127,7 +127,7 @@ home.packages = with pkgs; [ (pkgs.writeScriptBin "rofiscripts" '' # Scratchpad function - handle_scratchpads() { + scratchpads() { SCRATCHPADS=$(echo -e "Gotop\nMusic\nSound\nEasyEffects" | rofi -dmenu -i -p "Scratchpads") case $SCRATCHPADS in Gotop) foot -a gotop -T Gotop gotop;; @@ -138,43 +138,24 @@ } # Lock menu - handle_power() { + power() { POWER=$(echo -e "Shutdown\nReboot\nSleep\nLock\nKill" | rofi -dmenu -i -p "Power") case $POWER in Shutdown) poweroff;; Reboot) reboot;; Sleep) swaysleep &;; Lock) swaylock &;; - Kill) pkill -9 sway;; - 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 - ";; + Kill) pkill -9 $XDG_CURRENT_DESKTOP;; esac } # Check for command-line arguments if [ "$1" == "--scratchpads" ]; then - handle_scratchpads + scratchpads elif [ "$1" == "--power" ]; then - handle_power - elif [ "$1" == "--resolutions" ]; then - handle_resolutions + power else - echo "Please use a valid argument." + echo "Please --scratchpads or --power." fi '') rofi-bluetooth diff --git a/modules/home/programs/terminal/neovim/default.nix b/modules/home/programs/terminal/neovim/default.nix index 9573332..ed8cd57 100644 --- a/modules/home/programs/terminal/neovim/default.nix +++ b/modules/home/programs/terminal/neovim/default.nix @@ -34,6 +34,9 @@ # Nerdtree nerdtree vim-nerdtree-syntax-highlight + + # Misc languages + kdl-vim ]; extraConfig = '' lua < /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 { + services.greetd = { enable = config.system.desktop.enable; restart = true; settings = { @@ -24,10 +8,32 @@ vt = 2; switch = true; }; - default_session = { - command = "${startSway}"; - user = "jimbo"; - }; + default_session.command = "${pkgs.cage}/bin/cage -d -m last ${pkgs.greetd.gtkgreet}/bin/gtkgreet"; }; }; + + 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 + ''} + ''; } diff --git a/modules/system/programs/qt/default.nix b/modules/system/programs/qt/default.nix deleted file mode 100644 index f887517..0000000 --- a/modules/system/programs/qt/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, ... }: -{ - qt = { - enable = config.system.desktop.enable; - style = "gtk2"; - platformTheme = "gtk2"; - }; -} diff --git a/modules/system/programs/sway/default.nix b/modules/system/programs/sway/default.nix deleted file mode 100644 index 872674c..0000000 --- a/modules/system/programs/sway/default.nix +++ /dev/null @@ -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 = {}; -} diff --git a/modules/system/services/general/portals/default.nix b/modules/system/services/general/portals/default.nix index 6554b68..67b03e0 100644 --- a/modules/system/services/general/portals/default.nix +++ b/modules/system/services/general/portals/default.nix @@ -1,11 +1,14 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { - xdg.portal.wlr = { - enable = config.system.desktop.enable; - settings.screencast = { - max_fps = 60; - chooser_type = "simple"; - chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099"; + xdg.portal = { + wlr = { + enable = lib.mkForce config.system.desktop.enable; + settings.screencast = { + max_fps = 60; + chooser_type = "simple"; + chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099"; + }; }; + extraPortals = with pkgs; [ xdg-desktop-portal-gnome ]; }; }