kinda works

This commit is contained in:
Primrose 2025-05-27 22:30:33 +02:00
parent f3198e035f
commit 1e3aea45f5
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
2 changed files with 217 additions and 21 deletions

View file

@ -7,6 +7,7 @@ in
{ {
config, config,
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib.modules) mkAliasOptionModule; inherit (lib.modules) mkAliasOptionModule;
@ -29,20 +30,12 @@ in
{ {
nixpkgs = { nixpkgs = {
overlays = map import [ overlays = map import [
../overlays/agenix.nix
../overlays/disko.nix
../overlays/nur.nix
../overlays/wired-notify.nix
../overlays/nix-tree.nix
../overlays/wallpapers.nix
../overlays/packages.nix ../overlays/packages.nix
./vanadium/overlay.nix
]; ];
config.allowUnfreePredicate = pkg:
# Set NIX_PATH and flake registry at the same time builtins.elem (lib.getName pkg) [
# https://github.com/NixOS/nixpkgs/pull/254405 "posy-cursors"
flake.source = sources.nixpkgs; ];
}; };
system.nixos.version = lib.substring 0 8 sources.nixpkgs.rev; system.nixos.version = lib.substring 0 8 sources.nixpkgs.rev;
@ -51,15 +44,30 @@ in
# #
# NixOS modules # NixOS modules
# #
./vanadium/nixos/gui.nix {
services.xserver.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
};
./vanadium/nixos/locale.nix services.xserver = {
./vanadium/nixos/unfree-predicate.nix enable = true;
autoRepeatDelay = 300;
autoRepeatInterval = 40;
};
services.xserver.displayManager.lightdm = {
enable = true;
background = "#000000";
# greeters.gtk.cursorTheme = {
# name = "Posy_Cursor_Black";
# package = pkgs.posy-cursors;
# size = 72;
# };
};
}
../nixosModules/extra/layouts ../nixosModules/extra/layouts
../nixosModules/extra/leana.nix
(import (sources.lix-module + "/module.nix") {lix = sources.lix;})
# #
# home-manager # home-manager
@ -81,10 +89,24 @@ in
# #
# home modules # home modules
# #
./vanadium/home/misc.nix ({nixosConfig, ...}: {
programs.kitty.enable = true;
programs.firefox.enable = true;
home.packages = with pkgs; [
dmenu
];
./vanadium/home/firefox.nix xdg.configFile = {
./vanadium/home/xmobar.nix "xmonad".source = "${./vm/home/xmonad}";
};
home.pointerCursor = {
x11.enable = true;
gtk.enable = true;
name = "Posy_Cursor_Black";
package = pkgs.posy-cursors;
size = 72;
};
})
]; ];
} }
@ -93,5 +115,21 @@ in
users.mutableUsers = false; users.mutableUsers = false;
me.password = ""; me.password = "";
} }
{
# Me
programs.fish.enable = true;
nix.settings.trusted-users = ["leana"];
users.users."leana" = {
isNormalUser = true;
home = "/home/leana";
description = "Leana";
group = "leana";
extraGroups = ["wheel"];
shell = pkgs.fish;
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
};
users.groups.leana = {};
}
]; ];
} }

View file

@ -0,0 +1,158 @@
{-# LANGUAGE NegativeLiterals #-}
{-# LANGUAGE LambdaCase #-}
import XMonad
import XMonad.Actions.SwapWorkspaces(swapWithCurrent)
import XMonad.Actions.Submap (submap)
import XMonad.Util.EZConfig (additionalKeys, removeKeys)
import XMonad.Util.NamedScratchpad (NamedScratchpad (NS),
customFloating,
namedScratchpadAction,
namedScratchpadManageHook, scratchpadWorkspaceTag)
import XMonad.Util.SpawnOnce (spawnOnce)
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.Reflect (reflectHoriz)
import XMonad.Layout.Spacing (smartSpacingWithEdge)
import XMonad.Layout.ResizableTile (ResizableTall(ResizableTall), MirrorResize (MirrorShrink, MirrorExpand))
import XMonad.Hooks.ManageHelpers (isFullscreen, (~?), composeOne, (-?>))
import XMonad.Hooks.FadeWindows (fadeWindowsLogHook, opaque, isUnfocused, transparency, isFloating)
import XMonad.Hooks.EwmhDesktops (ewmh, ewmhFullscreen)
import XMonad.Hooks.InsertPosition (insertPosition, Focus(Newer, Older), Position(Below, Above))
import XMonad.Hooks.RefocusLast (refocusLastLogHook)
import XMonad.Hooks.StatusBar (StatusBarConfig, statusBarProp, dynamicEasySBs)
import XMonad.Hooks.DynamicLog (PP(ppHiddenNoWindows, ppCurrent, ppSep), xmobarColor, filterOutWsPP, wrap)
import XMonad.Util.Hacks (javaHack)
import XMonad.StackSet qualified as W
import Data.Map.Strict qualified as M
import Graphics.X11.ExtraTypes.XF86
import System.Posix.Env (putEnv)
import Data.Char (chr, ord, toUpper)
import System.Exit (exitSuccess)
-- Note: `xmonad --restart` will make Firefox's fullscreen work duck the xmobar stop working
-- You need restart Firefox
main :: IO ()
main = do
xmonad
. javaHack
. dynamicEasySBs xmobar
. ewmhFullscreen . ewmh
$ def
{ modMask = superMask
, focusFollowsMouse = True
, workspaces = myWorkspaces
, terminal = myTerm
, startupHook = do
spawn "xterm"
, layoutHook =
let tallr = reflectHoriz
$ ResizableTall 1 (1/10) (3/7) []
in smartBorders
( smartSpacingWithEdge 5 tallr
||| Full
)
}
-- Only remove mappings that needs pass through (it's a map).
`removeKeys`
[ (superMask, xK_h)
, (superMask, xK_l)
, (superMask, xK_p)
-- It has been more than once that I actidently killed xmonad >:(
, (superMask .|. shiftMask, xK_q)
]
++ [ (superMask , n) | n <- [xK_1 .. xK_9] ]
++ [ (superMask .|. shiftMask, n) | n <- [xK_1 .. xK_9] ]
`additionalKeys`
[
-- Toggle fullscreen
((superMask, xK_Escape), sendMessage NextLayout)
-- Resize windows
, ((superMask, xK_equal ), sendMessage $ IncMasterN 1)
, ((superMask, xK_minus ), sendMessage $ IncMasterN -1)
, ((superMask, xK_comma ), sendMessage Shrink )
, ((superMask, xK_period ), sendMessage Expand )
, ((superMask .|. shiftMask, xK_comma ), sendMessage MirrorShrink )
, ((superMask .|. shiftMask, xK_period), sendMessage MirrorExpand )
]
-- Yeet
++ (let
workspaceKeys = [xK_h, xK_t, xK_n, xK_s, xK_m, xK_w, xK_v, xK_z]
in
[ ((superMask, k), windows $ W.greedyView space)
| (k, space) <- zip workspaceKeys myWorkspaces
]
++
[ ((superMask .|. altMask, k), windows $ W.greedyView space . W.shift space)
| (k, space) <- zip workspaceKeys myWorkspaces
]
++
[ ((superMask .|. controlMask, k), windows $ swapWithCurrent space)
| (k, space) <- zip workspaceKeys myWorkspaces
])
-- Launcher
++ (let
launchFirefox = "if type firefox; then firefox; else firefox-esr; fi"
launchDmenu = "dmenu_run -i -fn \"Iosevka Extended-17\" -nb \"#36363a\" -nf \"#e2e2e4\" -sb \"#f7f7f8\" -sf \"#36363a\" -l 10"
lock = "xscreensaver-command -lock"
in
[ ((controlMask .|. altMask, xK_b), spawn launchFirefox)
, ((superMask, xK_o), spawn launchDmenu )
, ((superMask, xK_l), spawn lock )
])
myTerm :: String
myTerm = "kitty"
superMask, altMask :: KeyMask
superMask = mod4Mask
altMask = mod1Mask
myWorkspaces :: [String]
myWorkspaces = map pure ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
xmobar :: ScreenId -> X StatusBarConfig
xmobar = \case
0 -> pure $ statusBarProp "xmobar -x 0" (pure myPrettyPrinter)
1 -> pure $ statusBarProp "xmobar -x 1" (pure myPrettyPrinter)
_ -> mempty
where
myPrettyPrinter =
filterOutWsPP [scratchpadWorkspaceTag]
$ def
{ ppCurrent = xmobarColor "#000000" "#ffffff" . wrap " " " " . fmap toUpper
, ppHiddenNoWindows = xmobarColor "#9c9c9c" "" . const ""
, ppSep = " | "
}
isFirefoxPIP :: Query Bool
isFirefoxPIP =
className =? "firefox"
<&&> title =? "Picture-in-Picture"
isFirefoxFullscreen :: Query Bool
isFirefoxFullscreen =
className =? "firefox"
<&&> isFullscreen
-- Firefox having multimedia content
isFirefoxVideo :: Query Bool
isFirefoxVideo =
className =? "firefox"
<&&> title ~? "YouTube"