From 2c2669697fdeaf7316feed3449d2082d255de5af Mon Sep 17 00:00:00 2001 From: "beeb5k (Vivek Tiwari)" Date: Thu, 4 Jun 2026 23:45:29 +0530 Subject: Debloat --- common/modules/window_managers/default.nix | 12 +- common/modules/window_managers/dwm/default.nix | 176 ---------- common/modules/window_managers/dwm/picom.nix | 63 ---- common/modules/window_managers/dwm/scripts.nix | 113 ------ .../modules/window_managers/hyprland/default.nix | 322 ----------------- common/modules/window_managers/mango/default.nix | 105 +++--- common/modules/window_managers/scripts.nix | 387 ++++++++++++++++++++- 7 files changed, 433 insertions(+), 745 deletions(-) delete mode 100644 common/modules/window_managers/dwm/default.nix delete mode 100644 common/modules/window_managers/dwm/picom.nix delete mode 100644 common/modules/window_managers/dwm/scripts.nix delete mode 100644 common/modules/window_managers/hyprland/default.nix (limited to 'common/modules/window_managers') diff --git a/common/modules/window_managers/default.nix b/common/modules/window_managers/default.nix index bc93e35..1c66f63 100644 --- a/common/modules/window_managers/default.nix +++ b/common/modules/window_managers/default.nix @@ -15,18 +15,15 @@ let moduleNameSpace = "beeMods"; inherit inputs homeManager; }; + scripts = import ./scripts.nix { inherit pkgs config; }; in { imports = [ (import ./mango args) - (import ./hyprland args) - (import ./dwm args) ]; options.${moduleNameSpace}.windowManagers = { mango.enable = lib.mkEnableOption "Enable mangowm"; - dwm.enable = lib.mkEnableOption "Enable dwm"; - hyprland.enable = lib.mkEnableOption "Enable hyprland"; eyeCandy = { animations.enable = lib.mkEnableOption "Uiiiiiiiiiii"; window = { @@ -62,8 +59,11 @@ in wl-clipboard cliphist brightnessctl - maim - wtype + playerctl + matugen + awww + waybar + scripts.dotfiles ]; } else diff --git a/common/modules/window_managers/dwm/default.nix b/common/modules/window_managers/dwm/default.nix deleted file mode 100644 index 49537a2..0000000 --- a/common/modules/window_managers/dwm/default.nix +++ /dev/null @@ -1,176 +0,0 @@ -{ - homeManager, - inputs, - moduleNameSpace, - ... -}: -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.${moduleNameSpace}.windowManagers; - st-patched = - (pkgs.st.override { - extraLibs = [ pkgs.libXcursor ]; - }).overrideAttrs - (oldAttrs: rec { - patches = map pkgs.fetchpatch [ - { - url = "https://st.suckless.org/patches/xresources/st-xresources-20230320-45a15676.diff"; - sha256 = "sha256-WcL9IeyanXFiOFDGGRU0QNT8DU7wSo2o+3n+TaqASUY="; - } - { - url = "https://st.suckless.org/patches/vertcenter/st-vertcenter-20231003-eb3b894.diff"; - sha256 = "sha256-RbFNdGNi5HLAp1s8QOX3qsfxpkLcp1p/vksyZORN/uc="; - } - { - url = "https://st.suckless.org/patches/anysize/st-anysize-20220718-baa9357.diff"; - hash = "sha256-yx9VSwmPACx3EN3CAdQkxeoJKJxQ6ziC9tpBcoWuWHc="; - } - { - url = "https://st.suckless.org/patches/csi_22_23/st-csi_22_23-0.8.5.diff"; - hash = "sha256-+izEkGVkLCbhZNBD2WN4uX5j+YMmou7JaMVmPG0mrYk="; - } - { - url = "https://st.suckless.org/patches/sync/st-appsync-20200618-b27a383.diff"; - sha256 = "sha256-lys7/nup7a+GcmW+CutX0kjmbbOis2stkuhw02beuPs="; - } - { - url = "https://st.suckless.org/patches/fix_keyboard_input/st-fix-keyboard-input-20180605-dc3b5ba.diff"; - sha256 = "sha256-h5ZrCj4IrkMQanLSMmgXaRd7qZYqvbzqUnuFt/axsMI="; - } - { - url = "https://st.suckless.org/patches/boxdraw/st-boxdraw_v2-0.8.5.diff"; - sha256 = "sha256-WN/R6dPuw1eviHOvVVBw2VBSMDtfi1LCkXyX36EJKi4="; - } - { - url = "https://st.suckless.org/patches/bold-is-not-bright/st-bold-is-not-bright-20190127-3be4cf1.diff"; - sha256 = "sha256-IhrTgZ8K3tcf5HqSlHm3GTacVJLOhO7QPho6SCGXTHw="; - } - ]; - - postPatch = oldAttrs.postPatch or "" + '' - sed -i 's/const int boxdraw = 0;/const int boxdraw = 1;/g' config.def.h - sed -i 's/const int boxdraw_bold = 0;/const int boxdraw_bold = 1;/g' config.def.h - - grep -q Xcursor x.c || sed -i '/#include /a #include ' x.c - - sed -i 's/XCreateFontCursor/XcursorLibraryLoadCursor/g' x.c - - sed -i 's/static unsigned int mouseshape/static char *mouseshape/' config.def.h - sed -i 's/XC_xterm/"ibeam"/' config.def.h - - sed -i 's/-lXft/-lXft -lXcursor/g' config.mk - ''; - }); -in -{ - imports = [ - # (import ./picom.nix homeManager) - (import ./scripts.nix homeManager) - ]; - - config = lib.mkIf cfg.dwm.enable ( - if !homeManager then - { - services.xserver = { - enable = true; - windowManager.dwm = { - enable = true; - package = inputs.mydwm.packages.${pkgs.stdenv.hostPlatform.system}.default; - }; - autoRepeatDelay = 300; - autoRepeatInterval = 20; - excludePackages = with pkgs; [ xterm ]; - displayManager.sessionCommands = '' - ${pkgs.systemd}/bin/systemctl --user import-environment DISPLAY XAUTHORITY XDG_SESSION_TYPE - ${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY XAUTHORITY XDG_SESSION_TYPE - ''; - }; - - programs.ssh.askPassword = ""; - } - else - { - xdg.dataFile."dwm/autostart.sh" = { - executable = true; - text = '' - #!${pkgs.bash}/bin/bash - - gnome-keyring-daemon --start --components=secrets,ssh,pkcs11 & - ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 & - - [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources - xrandr --output eDP --set TearFree on - - sync_dms - systemctl --user restart xidlehook.service xautolock-session.service xss-lock.service clipcat.service - ''; - }; - - home.packages = with pkgs; [ - st-patched - xdotool - xclip - (pkgs.dmenu.overrideAttrs (oldAttrs: { - patches = (oldAttrs.patches or [ ]) ++ [ - (pkgs.fetchpatch { - url = "https://tools.suckless.org/dmenu/patches/xresources/dmenu-xresources-4.9.diff"; - sha256 = "sha256-Np9I8hhnwmGA3W5v4tSrBN9Or8Q2Ag9x8H3yf8L9jDI="; - }) - ]; - })) - ]; - - services.clipcat = { - enable = false; - daemonSettings = { - daemonize = false; - max_history = 50; - desktop_notification = { - enable = false; - }; - }; - menuSettings = { - server_endpoint = "/run/user/1000/clipcat/grpc.sock"; - finder = "rofi"; - - rofi = { - menu_length = 10; - line_length = 100; - menu_prompt = "Clipboard"; - extra_arguments = [ ]; - }; - }; - }; - - systemd.user.services.clipcat = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - }; - - xresources.extraConfig = lib.mkIf config.beeMods.matugen.enable '' - #include "${config.xdg.configHome}/x11/matugen.Xresources" - ''; - - xresources.properties = { - "Xft.dpi" = 96; - "Xft.autohint" = 0; - "Xft.antialias" = true; - "Xft.hinting" = true; - "Xft.lcdfilter" = "lcddefault"; - "Xft.hintstyle" = "hintfull"; - "Xft.rgba" = "rgb"; - "st.font" = - "JetBrainsMono Nerd Font:size=${toString config.beeMods.terminal.font.size}:antialias=true:autohint=true"; - "dmenu.font" = - "${config.beeMods.terminal.font.family}:size=${toString config.beeMods.terminal.font.size}"; - # "st.borderpx" = 2; - }; - } - ); -} diff --git a/common/modules/window_managers/dwm/picom.nix b/common/modules/window_managers/dwm/picom.nix deleted file mode 100644 index f0b8d17..0000000 --- a/common/modules/window_managers/dwm/picom.nix +++ /dev/null @@ -1,63 +0,0 @@ -homeManager: -{ config, lib, ... }: -let - cfg = config.beeMods.windowManagers; -in -{ - config = lib.mkIf cfg.enable ( - lib.optionalAttrs homeManager { - services.picom = { - enable = true; - backend = "glx"; - vSync = true; - - activeOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.active; - inactiveOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.inactive; - - opacityRules = [ - "100:fullscreen" - "100:_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'" - ]; - settings = { - blur = { - method = "dual_kawase"; - strength = cfg.window.blur.strength; - size = cfg.window.blur.size; - }; - blur-background = cfg.window.blur.enable; - blur-background-exclude = [ - "window_type = 'dock'" - "window_type = 'desktop'" - "class_g = 'slop'" - "class_g = 'dwm'" - "_GTK_FRAME_EXTENTS@" - "fullscreen" - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'" - ]; - - # xrender-sync-fence = true; - use-damage = true; - - unredir-if-possible = true; - - detect-transient = true; - detect-client-opacity = true; - mark-wmwin-focused = true; - mark-ovredir-focused = true; - detect-rounded-corners = true; - - shadow = cfg.shadow; - fading = false; - animations = cfg.animations; - }; - }; - - # systemd.user.services.picom.Install.wantedBy = lib.mkForce [ ]; - systemd.user.services.picom = { - Unit = { - ConditionEnvironment = "XDG_SESSION_TYPE=x11"; - }; - }; - } - ); -} diff --git a/common/modules/window_managers/dwm/scripts.nix b/common/modules/window_managers/dwm/scripts.nix deleted file mode 100644 index 25ecc19..0000000 --- a/common/modules/window_managers/dwm/scripts.nix +++ /dev/null @@ -1,113 +0,0 @@ -homeManager: -{ pkgs, lib, ... }: -let - sync_dms = pkgs.writeShellScriptBin "sync_dms" '' - jq=${pkgs.jq}/bin/jq - SETTINGS_FILE="$HOME/.config/noctalia/settings.json" - WALLPAPER_FILE="$HOME/.cache/noctalia/wallpapers.json" - - # --- Helpers --- - - get_setting() { - $jq -r "$1" "$SETTINGS_FILE" - } - - toggle_nightlight_state() { - local tmp=$(mktemp) - # Flips the boolean cleanly without changing it to a string - $jq '.nightLight.enabled = (.nightLight.enabled | not)' "$SETTINGS_FILE" > "$tmp" && mv "$tmp" "$SETTINGS_FILE" - } - - # --- Modules --- - - apply_wallpaper() { - # Read dark mode and monitor preferences from settings.json - local is_dark=$(get_setting '.colorSchemes.darkMode') - local monitor=$(get_setting '.colorSchemes.monitorForColors') - - # Default to eDP-1 if monitor setting is missing - if [[ "$monitor" == "null" || -z "$monitor" ]]; then - monitor="eDP-1" - fi - - local mode="light" - if [[ "$is_dark" == "true" ]]; then - mode="dark" - fi - - # Use jq variables to safely parse the nested monitor and mode keys - local wall=$($jq -r --arg mon "$monitor" --arg mode "$mode" '.wallpapers[$mon][$mode]' "$WALLPAPER_FILE") - - if [[ "$wall" != "null" && -n "$wall" ]]; then - ${pkgs.xwallpaper}/bin/xwallpaper --zoom "$wall" - fi - } - - apply_nightlight() { - local is_night_mode=$(get_setting '.nightLight.enabled') - local night_temp=$(get_setting '.nightLight.nightTemp') - - if [[ "$is_night_mode" == "true" ]]; then - echo "bitch $is_night_mode" - # -P resets prior adjustments, -O applies one-shot manual temperature - ${pkgs.redshift}/bin/redshift -P -O "$night_temp" - else - # -x clears all redshift adjustments - ${pkgs.redshift}/bin/redshift -x - fi - } - - sync_all() { - apply_wallpaper - apply_nightlight - } - - dmenu_settings() { - local is_night_mode=$(get_setting '.nightLight.enabled') - local options="Toggle NightMode (Currently $is_night_mode)\nSync Now" - - local choice=$(echo -e "$options" | dmenu -p "Settings:") - - case "$choice" in - *"NightMode"*) - toggle_nightlight_state - # Immediately apply the new state after toggling - apply_nightlight - ;; - "Sync Now") - sync_all - ;; - esac - } - - # --- Main --- - - case "$1" in - settings) dmenu_settings ;; - *) sync_all ;; - esac - ''; - logout_dmenu = pkgs.writeShellScriptBin "logout_dmenu" '' - options="Lock\nLogout\nReboot\nShutdown" - - choice=$(echo -e "$options" | dmenu -p "System:") - - case "$choice" in - Lock) slock ;; - Logout) pkill dwm ;; - Reboot) reboot ;; - Shutdown) poweroff ;; - *) exit 1 ;; - esac - ''; -in -{ - config = lib.mkIf homeManager ( - lib.optionalAttrs homeManager { - home.packages = with pkgs; [ - sync_dms - logout_dmenu - ]; - } - ); -} diff --git a/common/modules/window_managers/hyprland/default.nix b/common/modules/window_managers/hyprland/default.nix deleted file mode 100644 index fea9db6..0000000 --- a/common/modules/window_managers/hyprland/default.nix +++ /dev/null @@ -1,322 +0,0 @@ -{ - homeManager, - inputs, - moduleNameSpace, - ... -}: -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.${moduleNameSpace}.windowManagers; - scripts = import ../scripts.nix { inherit pkgs config; }; -in -{ - config = lib.mkIf cfg.hyprland.enable ( - if homeManager then - { - wayland.windowManager.hyprland = { - enable = true; - systemd.enable = true; - systemd.variables = [ "--all" ]; - xwayland.enable = true; - systemd.enableXdgAutostart = false; - extraConfig = '' - layerrule { - name = noctalia - match:namespace = noctalia-background-.*$ - ignore_alpha = 0.5 - blur = true - blur_popups = true - } - ''; - - settings = { - monitor = [ ",1920x1080@120,auto,1.0" ]; - - source = - [ ] ++ lib.optional (config.beeMods.matugen.enable) "~/.config/hypr/noctalia/noctalia-colors.conf"; - - "$mainMod" = "SUPER"; - - env = [ - "NIXOS_OZONE_WL,1" - "QT_AUTO_SCREEN_SCALE_FACTOR,1" - "ELECTRON_OZONE_PLATFORM_HINT,auto" - "QT_QPA_PLATFORM,wayland;xcb" - "XDG_SESSION_TYPE,wayland" - "GDK_BACKEND,wayland,x11" - "GDK_SCALE,1" - ]; - - exec-once = [ - # "dbus-update-activation-environment --all" - "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "gnome-keyring-daemon --start --components=secrets" - "noctalia-shell" - ] - ++ lib.optionals config.beeMods.windowManagers.dwm.enable [ - "systemctl --user stop xidlehook.service" - "systemctl --user stop xautolock-session.service" - "systemctl --user stop xss-lock.service" - "systemctl --user stop clipcat.service" - ]; - - xwayland = { - force_zero_scaling = true; - }; - - input = { - follow_mouse = 1; - kb_layout = "us"; - repeat_delay = 300; - repeat_rate = 50; - sensitivity = 0; - numlock_by_default = false; - left_handed = false; - - touchpad = { - natural_scroll = true; - tap-to-click = true; - drag_lock = true; - disable_while_typing = true; - middle_button_emulation = false; - }; - }; - - general = { - layout = "master"; - gaps_in = 4; - gaps_out = 4; - border_size = 2; - - resize_on_border = true; - no_focus_fallback = true; - allow_tearing = true; - }; - - master = { - allow_small_split = true; - new_on_top = false; - mfact = 0.56; - }; - - scrolling = { - column_width = 0.55; - follow_focus = true; - }; - - decoration = { - rounding = cfg.eyeCandy.window.borderRadius; - - blur = { - enabled = cfg.eyeCandy.window.blur.enable; - size = cfg.eyeCandy.window.blur.radius; - passes = cfg.eyeCandy.window.blur.passes; - brightness = 0.9; - contrast = 0.9; - noise = 0.02; - vibrancy = 1.2; - popups = true; - popups_ignorealpha = 0.6; - }; - - shadow = { - enabled = cfg.eyeCandy.window.shadows.enable; - ignore_window = true; - range = 10; - render_power = 3; - offset = "0 0"; - color = "rgba(00000044)"; - }; - - # Apply opacity logic utilizing cfg.eyeCandy.options - active_opacity = - if (cfg.eyeCandy.window.blur.enable && cfg.eyeCandy.window.opacity == 1.0) then - 0.87 - else - cfg.eyeCandy.window.opacity; - inactive_opacity = - if (cfg.eyeCandy.window.blur.enable && cfg.eyeCandy.window.opacity == 1.0) then - 0.87 - else - cfg.eyeCandy.window.opacity; - fullscreen_opacity = 1.0; - - dim_inactive = false; - }; - - animations = { - enabled = cfg.eyeCandy.animations.enable; - - bezier = [ - "openCurve, 0.05, 0.7, 0.1, 1.0" - "closeCurve, 0.0, 0.0, 1.0, 1.0" - "moveCurve, 0.46, 1.0, 0.29, 1.0" - ]; - - animation = [ - "windowsIn, 1, 2.8, openCurve, slide" - "windowsOut, 1, 6.5, closeCurve, popin 80%" - "windowsMove, 1, 2.2, moveCurve" - "fadeIn, 0, 3.0, fadeCurve" - "fadeOut, 1, 2.5, moveCurve" - "workspaces, 1, 2.5, moveCurve, slide" - ]; - }; - - misc = { - vfr = true; - vrr = 0; - mouse_move_enables_dpms = true; - key_press_enables_dpms = true; - disable_splash_rendering = true; - animate_manual_resizes = true; - animate_mouse_windowdragging = false; - enable_swallow = false; - swallow_regex = "(foot|kitty|alacritty|Alacritty|com.mitchellh.ghostty|)"; - disable_hyprland_logo = true; - force_default_wallpaper = 0; - focus_on_activate = true; - }; - - binds = { - scroll_event_delay = 0; - focus_preferred_method = 1; - }; - - windowrule = [ - "workspace 1, match:class ^(foot|footclient|Alacritty|com.mitchellh.ghostty)$" - "workspace 2, match:class ^(zen|firefox|obsidian)$" - "workspace 3, match:class ^(vesktop|discord|thunderbird|Element|equibop)$" - "workspace 4, match:class ^(steam)$" - "float on, match:class ^(org.gnome.Calculator|org.pulseaudio.pavucontrol)$" - "stay_focused on, match:class ^(pinentry-)(.*)$" - ]; - - layerrule = [ - "no_anim on, match:namespace ^rofi$" - "no_anim on, match:namespace ^(dms)$" - "no_anim on, match:namespace .*dms.*" - "no_anim on, match:namespace .*noctalia.*" - ]; - - workspace = [ "2, layout:scrolling" ]; - - bind = [ - "$mainMod, r, exec, hyprctl reload" - "$mainMod, Return, exec, ${scripts.terminal}" - "$mainMod, a, exec,noctalia-shell ipc call launcher toggle" - "$mainMod, y, exec,noctalia-shell ipc call wallpaper toggle" - "$mainMod, v, exec,noctalia-shell ipc call launcher clipboard" - "$mainMod, n, exec,noctalia-shell ipc call notifications toggleHistory" - - "$mainMod, comma, exec,noctalia-shell ipc call settings toggle" - "$mainMod, Period, exec,noctalia-shell ipc call launcher emoji" - - "ALT, F4, exec,noctalia-shell ipc call sessionMenu toggle" - "$mainMod, F12, exec, gnome-calculator" - "$mainMod, b, exec, zen" - "$mainMod, e, exec, nautilus" - - "$mainMod, m, exit," - "$mainMod, q, killactive," - - "$mainMod, h, movefocus, l" - "$mainMod, l, movefocus, r" - "$mainMod, k, movefocus, u" - "$mainMod, j, movefocus, d" - - ", Print, exec, ${pkgs.grimblast}/bin/grimblast copy screen" - "$mainMod, Print, exec, ${pkgs.grimblast}/bin/grimblast copy area" - - "$mainMod SHIFT, k, swapwindow, u" - "$mainMod SHIFT, j, swapwindow, d" - "$mainMod SHIFT, h, swapwindow, l" - "$mainMod SHIFT, l, swapwindow, r" - - "$mainMod, g, pin," - "ALT, Tab, workspace, previous" - "$mainMod, space, togglefloating," - "ALT, a, fullscreen, 1" - "ALT, f, fullscreen, 0" - "$mainMod, i, togglespecialworkspace, minimized" - "$mainMod, i, movetoworkspacesilent, special:minimized" - "$mainMod SHIFT, i, togglespecialworkspace, minimized" - "$mainMod SHIFT, i, movetoworkspace, +0" - "ALT, z, togglespecialworkspace, scratchpad" - - "$mainMod, n, exec, beesettings layout" - - "$mainMod, 1, workspace, 1" - "$mainMod, 2, workspace, 2" - "$mainMod, 3, workspace, 3" - "$mainMod, 4, workspace, 4" - "$mainMod, 5, workspace, 5" - "$mainMod, 6, workspace, 6" - "$mainMod, 7, workspace, 7" - "$mainMod, 8, workspace, 8" - "$mainMod, 9, workspace, 9" - - "$mainMod SHIFT, 1, movetoworkspace, 1" - "$mainMod SHIFT, 2, movetoworkspace, 2" - "$mainMod SHIFT, 3, movetoworkspace, 3" - "$mainMod SHIFT, 4, movetoworkspace, 4" - "$mainMod SHIFT, 5, movetoworkspace, 5" - "$mainMod SHIFT, 6, movetoworkspace, 6" - "$mainMod SHIFT, 7, movetoworkspace, 7" - "$mainMod SHIFT, 8, movetoworkspace, 8" - "$mainMod SHIFT, 9, movetoworkspace, 9" - - "ALT SHIFT, Left, focusmonitor, l" - "ALT SHIFT, Right, focusmonitor, r" - "$mainMod ALT, Left, movecurrentworkspacetomonitor, l" - "$mainMod ALT, Right, movecurrentworkspacetomonitor, r" - ]; - - binde = [ - "$mainMod, Up, moveactive, 0 -50" - "$mainMod, Down, moveactive, 0 50" - "$mainMod, Left, moveactive, -50 0" - "$mainMod, Right, moveactive, 50 0" - - "ALT, k, resizeactive, 0 -50" - "ALT, j, resizeactive, 0 50" - "ALT, h, resizeactive, -50 0" - "ALT, l, resizeactive, 50 0" - ]; - - bindel = [ - ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" - ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - ", XF86AudioMute, exec,wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ", XF86AudioMicMute, exec,wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" - - ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioNext, exec, playerctl next" - ", XF86AudioPrev, exec, playerctl previous" - ", XF86AudioStop, exec, playerctl stop" - - ", XF86MonBrightnessUp, exec,brightnessctl set +5%" - ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" - ]; - - bindm = [ - "$mainMod, mouse:272, movewindow" - "$mainMod, mouse:273, resizewindow" - ]; - }; - }; - } - else - { - programs.hyprland = { - enable = true; - withUWSM = false; - }; - } - ); -} diff --git a/common/modules/window_managers/mango/default.nix b/common/modules/window_managers/mango/default.nix index 11ac08f..94c83c5 100644 --- a/common/modules/window_managers/mango/default.nix +++ b/common/modules/window_managers/mango/default.nix @@ -13,26 +13,6 @@ let cfg = config.${moduleNameSpace}.windowManagers; scripts = import ../scripts.nix { inherit pkgs config; }; - snip = pkgs.writeShellScript "snip" '' - case $1 in - full) - ${pkgs.grim}/bin/grim - | wl-copy - ;; - selection) - GEOM=$(${pkgs.slurp}/bin/slurp) || exit - ${pkgs.grim}/bin/grim -g "$GEOM" - | wl-copy - ;; - window) - ${pkgs.grim}/bin/grim -g "$(mmsg -x | awk ' - / x / {x=$3} - / y / {y=$3} - / width / {w=$3} - / height / {h=$3} - END {print x "," y " " w "x" h} - ')" - | wl-copy - ;; - esac - ''; in { imports = @@ -50,28 +30,29 @@ in source = ~/.config/mango/colors.conf ''} - # blur=1 - # blur_layer=0 - # blur_optimized=1 - # blur_params_num_passes = 3 - # blur_params_radius = 12 - # blur_params_noise = 0.02 - # blur_params_brightness = 0.9 - # blur_params_contrast = 0.9 - # blur_params_saturation = 1.1 - # - # shadows=0 - # layer_shadows = 0 - # shadow_only_floating = 1 - # shadows_size = 10 - # shadows_blur = 15 - # shadows_position_x = 0 - # shadows_position_y = 0 - # - # border_radius=0 - # no_radius_when_single=0 - # focused_opacity=0.90 - # unfocused_opacity=0.90 + blur=${if cfg.eyeCandy.window.blur.enable then "1" else "0"} + blur_layer=0 + blur_optimized=1 + blur_params_num_passes = ${toString cfg.eyeCandy.window.blur.passes} + blur_params_radius = ${toString cfg.eyeCandy.window.blur.radius} + blur_params_noise = 0.02 + blur_params_brightness = 0.9 + blur_params_contrast = 0.9 + blur_params_saturation = 1.1 + + shadows=${if cfg.eyeCandy.window.shadows.enable then "1" else "0"} + layer_shadows = 0 + shadow_only_floating = 1 + shadows_size = 10 + shadows_blur = 15 + shadows_position_x = 0 + shadows_position_y = 0 + + border_radius=${toString cfg.eyeCandy.window.borderRadius} + + no_radius_when_single=0 + focused_opacity=${toString cfg.eyeCandy.window.opacity} + unfocused_opacity=${toString cfg.eyeCandy.window.opacity} # Scroller configuration scroller_structs=15 @@ -142,11 +123,11 @@ in #Keymaps bind=SUPER,r,reload_config - bind=SUPER,Return,spawn,foot - bind=SUPER,y,spawn,/home/beeb5k/.local/share/bee/dostuff wall + bind=SUPER,Return,spawn,${config.beeMods.terminal.default} + bind=SUPER,y,spawn,${scripts.dostuff} wall bind=SUPER,a,spawn,rofi -show drun bind=SUPER,c,spawn,sh -c 'dunstify "$(date)"' - bind=SUPER,comma,spawn,/home/beeb5k/.local/share/bee/dostuff settings + bind=SUPER,comma,spawn,${scripts.dostuff} settings bind=SUPER,F12,spawn,gnome-calculator bind=SUPER,b,spawn,librewolf @@ -160,9 +141,9 @@ in bind=SUPER,k,focusdir,up bind=SUPER,j,focusdir,down - bind=NONE,Print,spawn,/home/beeb5k/.config/mango/screenshot full - bind=SUPER,Print,spawn,/home/beeb5k/.config/mango/screenshot selection - bind=SUPER+SHIFT,Print,spawn,/home/beeb5k/.config/mango/screenshot window + bind=NONE,Print,spawn,${scripts.screenshot} full + bind=SUPER,Print,spawn,${scripts.screenshot} selection + bind=SUPER+SHIFT,Print,spawn,${scripts.screenshot} window bind=SUPER+SHIFT,k,exchange_client,up bind=SUPER+SHIFT,j,exchange_client,down @@ -218,19 +199,19 @@ in bind=ALT,h,resizewin,-50,+0 bind=ALT,l,resizewin,+50,+0 - bind=NONE,XF86AudioRaiseVolume,spawn,/home/beeb5k/.local/share/bee/dostuff volume up - bind=NONE,XF86AudioLowerVolume,spawn,/home/beeb5k/.local/share/bee/dostuff volume down - bind=NONE,XF86AudioMute,spawn,/home/beeb5k/.local/share/bee/dostuff volume mute + bind=NONE,XF86AudioRaiseVolume,spawn,${scripts.volume} up + bind=NONE,XF86AudioLowerVolume,spawn,${scripts.volume} down + bind=NONE,XF86AudioMute,spawn,${scripts.volume} toggle bind=NONE,XF86AudioPlay,spawn,playerctl play-pause bind=NONE,XF86AudioNext,spawn,playerctl next bind=NONE,XF86AudioPrev,spawn,playerctl previous bind=NONE,XF86AudioStop,spawn,playerctl stop - bind=NONE,XF86AudioMicMute,spawn,/home/beeb5k/.local/share/bee/dostuff mic toggle + bind=NONE,XF86AudioMicMute,spawn,${scripts.micToggle} - bind=NONE,XF86MonBrightnessUp,spawn,/home/beeb5k/.local/share/bee/dostuff brightness up - bind=NONE,XF86MonBrightnessDown,spawn,/home/beeb5k/.local/share/bee/dostuff brightness down + bind=NONE,XF86MonBrightnessUp,spawn,${scripts.brightness} up + bind=NONE,XF86MonBrightnessDown,spawn,${scripts.brightness} down mousebind=SUPER,btn_left,moveresize,curmove mousebind=NONE,btn_middle,togglemaximizescreen,0 @@ -261,8 +242,8 @@ in tagrule=id:8,layout_name:tile tagrule=id:9,layout_name:tile - env=XCURSOR_THEME, Bibata-Modern-Ice - env=XCURSOR_SIZE, 24 + # env=XCURSOR_THEME, Bibata-Modern-Ice + # env=XCURSOR_SIZE, 24 env=ELECTRON_OZONE_PLATFORM_HINT,auto env=QT_QPA_PLATFORMTHEME,qt6ct env=QT_QPA_PLATFORM,wayland @@ -270,7 +251,7 @@ in env=XDG_SESSION_TYPE,wayland env=GDK_BACKEND,wayland,x11 env=GDK_SCALE,1 - env=XCURSOR_PATH,/usr/share/icons + # env=XCURSOR_PATH,/usr/share/icons env=NVD_BACKEND,direct animations=0 @@ -300,13 +281,9 @@ in autostart_sh = '' wl-paste --type text --watch cliphist store & gnome-keyring-daemon --start --components=secrets,ssh,pkcs11 & - - ${lib.optionalString (config.beeMods.windowManagers.dwm.enable) '' - systemctl --user stop xidlehook.service - systemctl --user stop xautolock-session.service - systemctl --user stop xss-lock.service - systemctl --user stop clipcat.service - ''} + awww-daemon & + waybar & + dunst & ''; }; } diff --git a/common/modules/window_managers/scripts.nix b/common/modules/window_managers/scripts.nix index 1d854ae..4a93928 100644 --- a/common/modules/window_managers/scripts.nix +++ b/common/modules/window_managers/scripts.nix @@ -1,6 +1,6 @@ { pkgs, config }: -{ +rec { terminal = pkgs.writeShellScript "terminal" '' TERM="${config.beeMods.terminal.default}" SESSION="_main" @@ -20,4 +20,389 @@ fi fi ''; + dotfiles = pkgs.writeShellScriptBin "dotfiles" '' + case "$1" in + cd) + cd "$HOME/.config/beeSystems" + ;; + edit) + "$EDITOR" "$HOME/.config/beeSystems" + ;; + flake) + case "$2" in + update) + ( + cd "$HOME/.config/beeSystems" || exit 1 + nix flake update + ) + ;; + esac + ;; + esac + ''; + update_gtk_theme = pkgs.writeShellScript "update_gtk_theme" '' + if [ "$1" = "dark" ]; then + dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'" + else + dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" + fi + + dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$1'" + systemctl --user restart xdg-desktop-portal-gtk + ''; + volume = pkgs.writeShellScript "volume" '' + TAG="audio-volume" + case $1 in + up) wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+ ;; + down) wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- ;; + toggle) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; + esac + + status=$(wpctl get-volume @DEFAULT_AUDIO_SINK@) + vol=$(awk '{print int($2 * 100)}' <<< "$status") + + case "$status" in + *MUTED*) + dunstify -a "Volume" -u low \ + -h string:x-canonical-private-synchronous:$TAG \ + "Volume: Muted" + ;; + *) + dunstify -a "Volume" -u low \ + -h string:x-canonical-private-synchronous:$TAG \ + -h int:value:"$vol" \ + "Volume: $vol%" + ;; + esac + ''; + micToggle = pkgs.writeShellScript "micToggle" '' + TAG="audio-mic" + + wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle + + status=$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@) + + if [[ "$status" == *MUTED* ]]; then + dunstify -a "Microphone" -u low \ + -h string:x-canonical-private-synchronous:$TAG \ + "Microphone: Muted" + else + dunstify -a "Microphone" -u low \ + -h string:x-canonical-private-synchronous:$TAG \ + "Microphone: On" + fi + ''; + brightness = pkgs.writeShellScript "brightness" '' + TAG="screen-brightness" + + case "$1" in + up) brightnessctl set +5% > /dev/null ;; + down) brightnessctl set 5%- > /dev/null ;; + esac + + current=$(brightnessctl -m | cut -d, -f4 | tr -d '%') + + dunstify -a "Brightness" -u low \ + -h string:x-canonical-private-synchronous:$TAG \ + -h int:value:"$current" \ + "Brightness: $current%" + ''; + screenshot = pkgs.writeShellScript "screenshot" '' + case $1 in + full) + ${pkgs.grim}/bin/grim - | wl-copy + ;; + selection) + GEOM=$(${pkgs.slurp}/bin/slurp) || exit + ${pkgs.grim}/bin/grim -g "$GEOM" - | wl-copy + ;; + window) + ${pkgs.grim}/bin/grim -g "$(mmsg -x | awk ' + / x / {x=$3} + / y / {y=$3} + / width / {w=$3} + / height / {h=$3} + END {print x "," y " " w "x" h} + ')" - | wl-copy + ;; + esac + ''; + dostuff = pkgs.writeShellScript "dostuff" '' + exec 2>/dev/null + : "''${CONFIG_FILE:=$HOME/.config/beestuff/conf}" + : "''${WALL_DIR:=$HOME/Pictures/Wallpapers}" + : "''${THUMB_DIR:=$HOME/.cache/beestuff/thumbnails}" + + init_settings() { + [ -f "$CONFIG_FILE" ] && return 0 + + local config_dir + config_dir=$(dirname -- "$CONFIG_FILE") + + mkdir -p -- "$config_dir" + + cat > "$CONFIG_FILE" </dev/null 2>&1; then + magick "$img" \ + -resize 400x300^ \ + -gravity center \ + -extent 400x300 \ + "$thumb" + + elif command -v convert >/dev/null 2>&1; then + convert "$img" \ + -resize 400x300^ \ + -gravity center \ + -extent 400x300 \ + "$thumb" + + elif command -v ffmpeg >/dev/null 2>&1; then + ffmpeg -hide_banner -loglevel error \ + -i "$img" \ + -vf "scale=400:300:force_original_aspect_ratio=cover,crop=400:300" \ + -frames:v 1 \ + "$thumb" + + else + printf '%s' "$img" + return 0 + fi + + [ -f "$thumb" ] || thumb="$img" + + printf '%s' "$thumb" + } + + list_walls() { + local wall + + for wall in "$WALL_DIR"/*.{jpg,jpeg,png,webp}; do + [ -f "$wall" ] || continue + + printf '%s\0icon\x1f%s\n' \ + "''${wall##*/}" \ + "$(ensure_thumb "$wall")" + done + } + + apply_all() { + local theme=$(get_val "theme") + local wall=$(get_val "wallpaper") + local color_type=$(get_val "color_type") + local mode_flag="dark" + + mode_flag="dark" + [ "$theme" = "light" ] && mode_flag="light" + + matugen image "$wall" \ + -r lanczos3 \ + --continue-on-error \ + -m "$mode_flag" \ + -t "$color_type" \ + --source-color-index 0 + + + "${update_gtk_theme}" "$mode_flag" + + if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$DISPLAY" ]; then + xrdb -merge "$HOME/.Xresources" + fi + + local seq_file="$HOME/.local/share/bee/sequences" + [ -f "$seq_file" ] && sh "$seq_file" + } + + cmd_wall() { + local selected full_path + + selected=$( + list_walls | + rofi -dmenu -i -p "Wallpaper" \ + -show-icons \ + -theme-str 'element { orientation: vertical; padding: 15px; }' \ + -theme-str 'element-icon { size: 10em; horizontal-align: 0.5; }' \ + -theme-str 'listview { columns: 4; lines: 2; }' \ + -theme-str 'window { width: 50%; }' + ) + + [ -n "$selected" ] || return 0 + + full_path="$WALL_DIR/$selected" + set_val "wallpaper" "$full_path" + + if [ -n "$WAYLAND_DISPLAY" ]; then + if command -v awww >/dev/null 2>&1; then + awww img "$full_path" \ + --transition-type grow \ + --transition-fps 120 \ + --transition-step 60 \ + --transition-duration 1.5 + else + pkill swaybg + swaybg -i "$full_path" -m fill & + fi + else + feh --no-fehbg --bg-fill "$full_path" + fi + + apply_all + } + + clr_type() { + local schemes selection + + schemes=( + "scheme-tonal-spot" + "scheme-content" + "scheme-expressive" + "scheme-fidelity" + "scheme-fruit-salad" + "scheme-monochrome" + "scheme-neutral" + "scheme-rainbow" + "scheme-vibrant" + ) + + selection=$( + printf '%s\n' "''${schemes[@]}" | + rofi -dmenu -i -p "Colorscheme Types" + ) + + [ -n "$selection" ] || return 0 + + set_val "color_type" "$selection" + apply_all + } + + cmd_layout() { + local layouts selection + + layouts=( + tile + monocle + scroller + fair + dwindle + grid + deck + center_tile + right_tile + vertical_scroller + vertical_tile + vertical_grid + vertical_fair + vertical_deck + ) + + selection=$( + printf '%s\n' "''${layouts[@]}" | + rofi -dmenu -i -p "Layout" + ) + + [ -n "$selection" ] || return 0 + + set_layout "$selection" + } + + cmd_settings() { + local theme nl ct choice + + theme=$(get_val "theme") + nl=$(get_val "nightlight") + ct=$(get_val "color_type") + + choice=$( + printf '%s\n' \ + "Mode: $theme" \ + "Night Light: $nl" \ + "Wallpaper" \ + "Colorscheme Type: $ct" \ + "Layouts" | + rofi -dmenu -p "Settings" -i + ) + + case "$choice" in + "Mode: "*) + if [ "$theme" = "dark" ]; then + set_val "theme" "light" + else + set_val "theme" "dark" + fi + apply_all + ;; + + "Night Light: "*) + if [ "$nl" = "on" ]; then + set_val "nightlight" "off" + pkill wlsunset + else + set_val "nightlight" "on" + exec wlsunset -T 4500 + fi + ;; + + "Wallpaper") + cmd_wall + ;; + + "Colorscheme Type:"*) + clr_type + ;; + + "Layouts") + cmd_layout + ;; + esac + } + + init_settings + + case "$1" in + wall) cmd_wall ;; + settings) cmd_settings ;; + layout) cmd_layout ;; + apply) apply_all ;; + *) + printf '%s\n' "Usage: bee {wall|settings|layout|apply}" + ;; + esac + ''; + } -- cgit v1.3.1