diff options
| author | brustybee <beebeeb5k@gmail.com> | 2026-04-13 03:04:59 +0530 |
|---|---|---|
| committer | brustybee <beebeeb5k@gmail.com> | 2026-04-13 03:04:59 +0530 |
| commit | 1bb49481dbec223e68df4f60fa1d425525e16cff (patch) | |
| tree | 66e87c01c39054b7abb51d04bfc50f63b201aaf4 /common/modules/x11 | |
| parent | f5b78ff561eff75c803ed1ef6e736a6c991cd135 (diff) | |
This is like that one dream you don't know how to describe
Diffstat (limited to 'common/modules/x11')
| -rw-r--r-- | common/modules/x11/bspwm/default.nix | 185 | ||||
| -rw-r--r-- | common/modules/x11/default.nix | 268 | ||||
| -rw-r--r-- | common/modules/x11/dwm/default.nix | 68 | ||||
| -rw-r--r-- | common/modules/x11/picom.nix | 63 |
4 files changed, 0 insertions, 584 deletions
diff --git a/common/modules/x11/bspwm/default.nix b/common/modules/x11/bspwm/default.nix deleted file mode 100644 index 62e7e63..0000000 --- a/common/modules/x11/bspwm/default.nix +++ /dev/null @@ -1,185 +0,0 @@ -{ - homeManager, - inputs, - moduleNameSpace, - settings-persist, - ... -}: -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.${moduleNameSpace}.x11.bspwm; - snip = pkgs.writeShellScript "snip" '' - case $1 in - full) - ${pkgs.maim}/bin/maim | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png - ;; - selection) - ${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png - ;; - window) - ${pkgs.maim}/bin/maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png - ;; - esac - ''; - - smart-alacritty = pkgs.writeShellScript "smart-alacritty" '' - alacritty msg create-window || exec alacritty - ''; - - smart-ghostty = pkgs.writeShellScript "smart-ghostty" '' - ghostty +new-window || exec ghostty - ''; - - terminal = - if config.beeMods.terminal.default == "alacritty" then - "${smart-alacritty}" - else if config.beeMods.terminal.default == "ghostty" then - "${smart-ghostty}" - else - "st"; -in -{ - options.${moduleNameSpace}.x11.bspwm = { - enable = lib.mkEnableOption "bspwm setup"; - }; - - config = lib.mkIf cfg.enable ( - if homeManager then - { - xsession.windowManager.bspwm = { - enable = true; - monitors = { - "eDP" = [ - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" - ]; - }; - - rules = { - "Alacritty" = { - desktop = "^1"; - follow = true; - }; - "ghostty" = { - desktop = "^1"; - follow = true; - }; - "zen" = { - desktop = "^2"; - follow = true; - }; - "firefox" = { - desktop = "^2"; - follow = true; - }; - "vesktop" = { - desktop = "^3"; - follow = true; - }; - "discord" = { - desktop = "^3"; - follow = true; - }; - "steam" = { - desktop = "^4"; - follow = true; - }; - }; - - settings = { - border_width = 2; - window_gap = 5; - split_ratio = 0.55; - click_to_focus = "any"; - pointer_modifier = "mod4"; - pointer_action1 = "move"; - pointer_action2 = "resize_side"; - pointer_action3 = "resize_corner"; - focus_follows_pointer = true; - }; - - extraConfig = lib.optionalString config.beeMods.matugen.enable '' - [ -f ~/.config/bspwm/colors ] && . ~/.config/bspwm/colors - ''; - - startupPrograms = [ - "feh --no-fehbg --bg-fill $(rg wallpaper ~/.config/beeSettings | cut -d'=' -f2)" - "xsetroot -cursor_name left_ptr" - "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" - "gnome-keyring-daemon --start --components=secrets,ssh,pkcs11" - "xrandr --output eDP --set TearFree on" - "${settings-persist}" - ]; - }; - - services.sxhkd = { - enable = true; - keybindings = { - "super + Return" = terminal; - "super + r" = "pkill -USR1 -x sxhkd; bspc wm -r"; - "super + q" = "bspc node -c"; - "super + m" = "bspc quit"; - - "super + a" = "rofi -show drun"; - "super + period" = "rofi -show emoji -modi emoji"; - "alt + F4" = "rofi -show power-menu -modi power-menu:rofi-power-menu"; - "super + y" = "beesettings wall"; - "super + comma" = "beesettings settings"; - "super + b" = "zen"; - "super + e" = "nautilus"; - "super + F12" = "gnome-calculator"; - - "Print" = "${snip} full"; - "super + Print" = "${snip} selection"; - "super + shift + Print" = "${snip} window"; - - "super + {h,j,k,l}" = "bspc node -f {west,south,north,east}"; - "super + shift + {h,j,k,l}" = "bspc node -s {west,south,north,east}"; - "super + {Left,Down,Up,Right}" = "bspc node -v {-50 0,0 50,0 -50,50 0}"; - - "super + space" = "bspc node -t ~floating"; - "alt + f" = "bspc node -t ~fullscreen"; - "super + i" = "bspc node -g hidden=on"; - - "super + shift + i" = "bspc node any.hidden.local -g hidden=off"; - - "super + {1-9}" = "bspc desktop -f '^{1-9}'"; - "super + shift + {1-9}" = "bspc node -d '^{1-9}'"; - - "XF86AudioRaiseVolume" = "volume-control up"; - "XF86AudioLowerVolume" = "volume-control down"; - "XF86AudioMute" = "volume-control mute"; - "XF86AudioMicMute" = "mic-control toggle"; - "XF86MonBrightnessUp" = "brightness-control up"; - "XF86MonBrightnessDown" = "brightness-control down"; - - "XF86Audio{Play,Next,Prev,Stop}" = "playerctl {play-pause,next,previous,stop}"; - - "alt + h" = "bspc node -z left -50 0 || bspc node -z right -50 0"; - "alt + j" = "bspc node -z bottom 0 50 || bspc node -z top 0 50"; - "alt + k" = "bspc node -z top 0 -50 || bspc node -z bottom 0 -50"; - "alt + l" = "bspc node -z right 50 0 || bspc node -z left 50 0"; - "alt + a" = "bspc desktop -l next"; - }; - }; - } - else - { - services.xserver = { - windowManager.bspwm.enable = true; - }; - } - ); -} diff --git a/common/modules/x11/default.nix b/common/modules/x11/default.nix deleted file mode 100644 index 547d648..0000000 --- a/common/modules/x11/default.nix +++ /dev/null @@ -1,268 +0,0 @@ -{ - homeManager, - inputs, - moduleNameSpace, - ... -}: -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.${moduleNameSpace}.x11; - args = { - inherit - inputs - homeManager - moduleNameSpace - settings-persist - ; - }; - settings-persist = pkgs.writeShellScript "settings-persist" '' - SETTINGS_FILE="$HOME/.config/beeSettings" - - if [[ -f "$SETTINGS_FILE" ]]; then - IS_NIGHTMODE=$(${pkgs.ripgrep}/bin/rg "nightlight" "$SETTINGS_FILE" | cut -d"=" -f2) - - if [[ "$IS_NIGHTMODE" == "on" ]]; then - redshift -O 4500 - fi - fi - ''; - st-patched = - (pkgs.st.override { - extraLibs = [ pkgs.libXcursor ]; - }).overrideAttrs - (oldAttrs: rec { - patches = map pkgs.fetchpatch [ - { - url = "https://st.suckless.org/patches/scrollback/st-scrollback-0.9.2.diff"; - sha256 = "sha256-ZypvRONAHS//wnZjivmqpWIqZlKTqAQ0Q8DhQpZVaqU="; - } - { - url = "https://st.suckless.org/patches/scrollback/st-scrollback-mouse-0.9.2.diff"; - sha256 = "sha256-CuNJ5FdKmAtEjwbgKeBKPJTdEfJvIdmeSAphbz0u3Uk="; - } - { - url = "https://st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20220127-2c5edf2.diff"; - sha256 = "sha256-8oVLgbsYCfMhNEOGadb5DFajdDKPxwgf3P/4vOXfUFo="; - } - { - 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/themed_cursor/st-themed_cursor-0.8.1.diff"; - # sha256 = "sha256-Q/6VN9oCrdJiZPPjKMpw3UB09tIs4eJ1Hi5c8k7O7uo="; - # } - ]; - - postPatch = oldAttrs.postPatch or "" + '' - sed -i 's/Button4, *kscrollup, *{.i = 1}/Button4, kscrollup, {.i = 10}/g' config.def.h - sed -i 's/Button5, *kscrolldown, *{.i = 1}/Button5, kscrolldown, {.i = 10}/g' config.def.h - - 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 <X11\/XKBlib.h>/a #include <X11/Xcursor/Xcursor.h>' 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 ./bspwm args) - (import ./dwm args) - (import ./picom.nix homeManager) - ]; - - options.${moduleNameSpace}.x11 = { - picom = { - enable = lib.mkEnableOption "enable picom compositor"; - animations = lib.mkEnableOption "enable animations"; - shadow = lib.mkEnableOption "enable shadows"; - window = { - opacity = { - active = lib.mkOption { - type = lib.types.float; - default = 1.0; - }; - inactive = lib.mkOption { - type = lib.types.float; - default = 1.0; - }; - }; - blur = { - enable = lib.mkEnableOption "Enable window blur"; - strength = lib.mkOption { - type = lib.types.int; - default = 1; - }; - size = lib.mkOption { - type = lib.types.int; - default = 10; - }; - }; - }; - }; - }; - - config = lib.mkIf (cfg.dwm.enable || cfg.bspwm.enable) ( - if !homeManager then - { - services.xserver = { - enable = true; - 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 = ""; - security.pam.services.betterlockscreen = { }; - security.pam.services.i3lock = { }; - - programs.i3lock = { - enable = true; - package = pkgs.i3lock-color; - }; - } - else - { - home.packages = with pkgs; [ - st-patched - feh - maim - slop - xdotool - xclip - redshift - ]; - - services.clipcat = { - enable = true; - 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 = [ ]; - }; - }; - }; - - services.screen-locker = { - enable = true; - inactiveInterval = 5; - lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen -l"; - - xss-lock.extraOptions = [ - "-n" - "--transfer-sleep-lock" - ]; - }; - - services.xidlehook = { - enable = true; - timers = [ - { - delay = 270; - command = "${pkgs.brightnessctl}/bin/brightnessctl g > /tmp/brightness_prev && ${pkgs.brightnessctl}/bin/brightnessctl set 10%"; - canceller = "${pkgs.brightnessctl}/bin/brightnessctl set $(${pkgs.coreutils}/bin/cat /tmp/brightness_prev 2>/dev/null || echo 100%)"; - } - { - delay = 900; - command = "systemctl suspend"; - canceller = ""; - } - ]; - }; - - systemd.user.services.clipcat = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - - }; - systemd.user.services.xidlehook = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - }; - - systemd.user.services.xautolock-session = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - }; - - systemd.user.services.xss-lock = { - 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" = - "${config.beeMods.terminal.font.family}:size=${toString config.beeMods.terminal.font.size}:antialias=true:autohint=true"; - "st.borderpx" = 5; - }; - } - ); -} diff --git a/common/modules/x11/dwm/default.nix b/common/modules/x11/dwm/default.nix deleted file mode 100644 index fc943ef..0000000 --- a/common/modules/x11/dwm/default.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ - homeManager, - inputs, - moduleNameSpace, - settings-persist, - ... -}: -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.${moduleNameSpace}.x11.dwm; -in -{ - options.${moduleNameSpace}.x11.dwm = { - enable = lib.mkEnableOption "dwm setup"; - }; - - config = lib.mkIf cfg.enable ( - if !homeManager then - { - services.xserver = { - windowManager.dwm = { - enable = true; - package = inputs.mydwm.packages.${pkgs.stdenv.hostPlatform.system}.default; - }; - }; - } - 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 & - - feh --no-fehbg --bg-fill "$(rg wallpaper ~/.config/beeSettings | cut -d"=" -f2)" - [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources - - dunst & - clipcatd & - slstatus & - ${lib.optionalString (!config.beeMods.x11.picom.enable) '' - xrandr --output eDP --set TearFree on - ''} - ${lib.optionalString (config.beeMods.x11.picom.enable) '' - systemctl --user restart picom.service - ''} - - systemctl --user restart xidlehook.service xautolock-session.service xss-lock.service clipcat.service - ${lib.optionalString (config.beeMods.mango.waybar) '' - systemctl --user stop waybar.service - ''} - ${lib.optionalString (config.beeMods.mango.enable) '' - systemctl --user stop swayidle.service - ''} - - ${settings-persist} - ''; - }; - } - ); -} diff --git a/common/modules/x11/picom.nix b/common/modules/x11/picom.nix deleted file mode 100644 index c1683eb..0000000 --- a/common/modules/x11/picom.nix +++ /dev/null @@ -1,63 +0,0 @@ -homeManager: -{ config, lib, ... }: -let - cfg = config.beeMods.x11.picom; -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"; - }; - }; - } - ); -} |
