From 34619bec867281e9b65c478d6e017dcc5bd71349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Sat, 15 Nov 2025 22:49:59 +0800 Subject: [PATCH 1/4] vanadium/disko: try compressing /home --- nix/disko/vanadium/btrfs.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/disko/vanadium/btrfs.nix b/nix/disko/vanadium/btrfs.nix index 84b9efb0..11ae7b66 100644 --- a/nix/disko/vanadium/btrfs.nix +++ b/nix/disko/vanadium/btrfs.nix @@ -75,7 +75,10 @@ }; "/home" = { - mountOptions = [ "noatime" ]; + mountOptions = [ + "compress=zstd" + "noatime" + ]; mountpoint = "/home"; }; From 89e9803ed79d183796ceccbd0853bc352ea52e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Sun, 16 Nov 2025 22:33:01 +0800 Subject: [PATCH 2/4] home/firefox: always open link in new window --- nix/homeModules/common/firefox.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix/homeModules/common/firefox.nix b/nix/homeModules/common/firefox.nix index 157c0a94..556a528d 100644 --- a/nix/homeModules/common/firefox.nix +++ b/nix/homeModules/common/firefox.nix @@ -56,6 +56,10 @@ in "browser.ctrlTab.sortByRecentlyUsed" = false; "layout.css.devPixelsPerPx" = 1.1; + # open links in new window + # this works a lot better with xmonad where I have a bunch of windows + "browser.link.open_newwindow" = 2; + # Sponsored crap # Yes "browser.newtabpage.activity-stream.showSearch" = true; From 0d468192be425e59acec80321ce2e12728385a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Sun, 16 Nov 2025 22:34:45 +0800 Subject: [PATCH 3/4] vanadium/xmonad: smarter window focusing We spawn discord on certain window, and ignore its activation request --- .../vanadium/home/xmonad/xmonad.hs | 80 ++++++++++++++----- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index 27a744ad..3c3ad491 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -24,12 +24,11 @@ import XMonad.Util.NamedScratchpad import XMonad.Util.SpawnOnce import XMonad.Layout.Magnifier +import Data.Char.Greek import qualified Data.Map.Strict as M import System.Posix import Graphics.X11.ExtraTypes.XF86 -import Data.Char.Greek - main :: IO () main = xmonad @@ -37,6 +36,7 @@ main = -- https://wiki.archlinux.org/title/java#Gray_window,_applications_not_resizing_with_WM,_menus_immediately_closing . javaHack . withSB xmobarConfig . docks + . setEwmhActivateHook myActivateHook . ewmhFullscreen . ewmh $ def { modMask = superMask @@ -66,31 +66,66 @@ myLayout = in avoidStruts . smartBorders $ mag tallr ||| Full -isOneOf :: Eq a => Query a -> [a] -> Query Bool -isOneOf q = fmap or . traverse (q =?) +isSioyek :: Query Bool +isSioyek = className =? "sioyek" + +isDiscord :: Query Bool +isDiscord = + let electronDiscord = className =? "discord" + firefoxDiscord = isFirefox <&&> title ~? "Discord" + in electronDiscord <||> firefoxDiscord + +isEvolution :: Query Bool +isEvolution = className ~? "gnome.Evolution" + +isFirefox :: Query Bool +isFirefox = className =? "firefox" + +isFirefoxPip :: Query Bool +isFirefoxPip = isFirefox <&&> title =? "Picture-in-Picture" + +isFeh :: Query Bool +isFeh = className =? "feh" + +isNautilus :: Query Bool +isNautilus = className ~? "Nautilus" + +isNautilusPreviewer :: Query Bool +isNautilusPreviewer = className ~? "NautilusPreviewer" + +isMinder :: Query Bool +isMinder = className =? "Minder" <&&> (not <$> title ~? "Pick a Color") + +isKitty :: Query Bool +isKitty = className =? "kitty" + +myActivateHook :: ManageHook +myActivateHook = + -- Ignore activate request + composeOne + [ isDiscord -?> mempty + , isEvolution -?> mempty + , isSioyek -?> mempty + , isFeh -?> mempty + , return True -?> doFocus + ] myManageHook :: ManageHook myManageHook = composeAll - [ className ~? "NautilusPreviewer" --> customFloating centeredFloat - , className =? "feh" --> customFloating buttomRightFloat - , className =? "Minder" - <&&> not <$> title ~? "Pick a Color" -- ignore the color picker - --> customFloating centeredFloat - , className =? "firefox" - <&&> title =? "Picture-in-Picture" - --> doFloat - , namedScratchpadManageHook myScratchpads + [ isNautilusPreviewer --> customFloating centeredFloat + , isFeh --> customFloating buttomRightFloat + , isMinder --> customFloating centeredFloat + , isFirefoxPip --> doFloat + , isDiscord --> (doF $ W.shift chatWS) + , isEvolution --> (doF $ W.shift chatWS) ] <> composeOne - [ className =? "firefox" -?> insertPosition Master Newer - , className =? "kitty" -?> insertPosition Below Newer - , className `isOneOf` - [ "sioyek" - , "Nautilus" - ] - -?> insertPosition End Older + [ isFirefox -?> insertPosition Master Newer + , isKitty -?> insertPosition Below Newer + , isNautilus <||> isSioyek -?> insertPosition End Older ] + <> namedScratchpadManageHook myScratchpads myStartupHook :: X () myStartupHook = do @@ -223,9 +258,12 @@ superMask, altMask :: KeyMask superMask = mod4Mask altMask = mod1Mask -myWorkspaces :: [String] +myWorkspaces :: [WorkspaceId] myWorkspaces = map (:[]) $ take 8 greekLower +chatWS :: WorkspaceId +chatWS = myWorkspaces !! 3 + centeredFloat, smallFloat, fullFloat, buttomRightFloat :: W.RationalRect centeredFloat = W.RationalRect (1/9) (1/9) (7/9) (7/9) smallFloat = W.RationalRect (3/5) (3/5) (2/7) (2/7) From 5f1cea7f2544da57c5e7cae886f6a064e1c2beab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Mon, 17 Nov 2025 08:31:01 +0800 Subject: [PATCH 4/4] vanadium/xmonad: shift windows based on dynamic title property --- .../vanadium/home/xmonad/xmonad.hs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index 3c3ad491..898245aa 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -8,6 +8,7 @@ import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.InsertPosition import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.OnPropertyChange import XMonad.Hooks.RefocusLast import XMonad.Hooks.StatusBar import XMonad.Layout.NoBorders @@ -25,6 +26,7 @@ import XMonad.Util.SpawnOnce import XMonad.Layout.Magnifier import Data.Char.Greek +import Data.Semigroup import qualified Data.Map.Strict as M import System.Posix import Graphics.X11.ExtraTypes.XF86 @@ -50,6 +52,7 @@ main = , startupHook = myStartupHook , layoutHook = myLayout , manageHook = myManageHook + , handleEventHook = myEventHandleHook } -- Only remove mappings that needs pass through @@ -81,6 +84,9 @@ isEvolution = className ~? "gnome.Evolution" isFirefox :: Query Bool isFirefox = className =? "firefox" +isSpotify :: Query Bool +isSpotify = isFirefox <&&> title ~? "Spotify" + isFirefoxPip :: Query Bool isFirefoxPip = isFirefox <&&> title =? "Picture-in-Picture" @@ -127,6 +133,25 @@ myManageHook = ] <> namedScratchpadManageHook myScratchpads +myEventHandleHook :: Event -> X All +myEventHandleHook = + -- TODO: is there a way to always open certain sites in new windows in firefox? + onTitleChange $ composeAll + [ isSpotify --> doShiftAndViewIfMoved multimediaWS + , isDiscord --> doShiftAndViewIfMoved chatWS + ] + +-- If the title changes in the background, we don't want to greedy view that workspace. +-- Imagine Spotify playing in the background, a track change would focus that workspace. +-- We prevent this by checking if the window is already there. +doShiftAndViewIfMoved :: WorkspaceId -> Query (Endo WindowSet) +doShiftAndViewIfMoved n = doF . shiftAndViewIfMoved n =<< ask + +shiftAndViewIfMoved :: WorkspaceId -> Window -> WindowSet -> WindowSet +shiftAndViewIfMoved n w s = case W.findTag w s of + Just from | n `W.tagMember` s && n /= from -> W.greedyView n $ W.shiftWin n w s + _ -> s + myStartupHook :: X () myStartupHook = do spawnOnce "fcitx5 &" -- Input method @@ -261,6 +286,9 @@ altMask = mod1Mask myWorkspaces :: [WorkspaceId] myWorkspaces = map (:[]) $ take 8 greekLower +multimediaWS :: WorkspaceId +multimediaWS = myWorkspaces !! 6 + chatWS :: WorkspaceId chatWS = myWorkspaces !! 3