diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index b2be92b..4812d58 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ result +.direnv/ diff --git a/flake.lock b/flake.lock index 3237263..a730f57 100644 --- a/flake.lock +++ b/flake.lock @@ -5,14 +5,14 @@ "flake-parts": "flake-parts", "haskell-flake": "haskell-flake", "hercules-ci-effects": "hercules-ci-effects", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1700828696, - "narHash": "sha256-/XW6G0x1xrD2jvSC/69OxW6D3vCSpgTwNxpZZj4BrhI=", + "lastModified": 1701794742, + "narHash": "sha256-A4TZktNCr975ddMf4ShZwuB8x7USOYGCZ9Xwfits8gs=", "owner": "hercules-ci", "repo": "arion", - "rev": "172e69d5632faa173dcbbd4465eec6b91061c4c8", + "rev": "da2141cd9383c8c1cdcd3364b1ba6c32058ba659", "type": "github" }, "original": { @@ -25,7 +25,7 @@ "inputs": { "flake-utils": "flake-utils", "naersk": "naersk", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1662552013, @@ -49,11 +49,11 @@ ] }, "locked": { - "lastModified": 1675933616, - "narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=", + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "47478a4a003e745402acf63be7f9a092d51b83d7", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", "type": "github" }, "original": { @@ -64,14 +64,18 @@ }, "flake-parts_2": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": [ + "arion", + "hercules-ci-effects", + "nixpkgs" + ] }, "locked": { - "lastModified": 1688466019, - "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "lastModified": 1696343447, + "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", "type": "github" }, "original": { @@ -79,29 +83,6 @@ "type": "indirect" } }, - "flake-parts_3": { - "inputs": { - "nixpkgs-lib": [ - "arion", - "hercules-ci-effects", - "hercules-ci-agent", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688466019, - "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "flake-utils": { "locked": { "lastModified": 1656065134, @@ -148,7 +129,7 @@ "gumseite": { "inputs": { "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1680175611, @@ -180,56 +161,20 @@ "type": "github" } }, - "haskell-flake_2": { - "locked": { - "lastModified": 1684780604, - "narHash": "sha256-2uMZsewmRn7rRtAnnQNw1lj0uZBMh4m6Cs/7dV5YF08=", - "owner": "srid", - "repo": "haskell-flake", - "rev": "74210fa80a49f1b6f67223debdbf1494596ff9f2", - "type": "github" - }, - "original": { - "owner": "srid", - "ref": "0.3.0", - "repo": "haskell-flake", - "type": "github" - } - }, - "hercules-ci-agent": { - "inputs": { - "flake-parts": "flake-parts_3", - "haskell-flake": "haskell-flake_2", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1688568579, - "narHash": "sha256-ON0M56wtY/TIIGPkXDlJboAmuYwc73Hi8X9iJGtxOhM=", - "owner": "hercules-ci", - "repo": "hercules-ci-agent", - "rev": "367dd8cd649b57009a6502e878005a1e54ad78c5", - "type": "github" - }, - "original": { - "id": "hercules-ci-agent", - "type": "indirect" - } - }, "hercules-ci-effects": { "inputs": { "flake-parts": "flake-parts_2", - "hercules-ci-agent": "hercules-ci-agent", "nixpkgs": [ "arion", "nixpkgs" ] }, "locked": { - "lastModified": 1689397210, - "narHash": "sha256-fVxZnqxMbsDkB4GzGAs/B41K0wt/e+B/fLxmTFF/S20=", + "lastModified": 1701009247, + "narHash": "sha256-GuX16rzRze2y7CsewJLTV6qXkXWyEwp6VCZXi8HLruU=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "0a63bfa3f00a3775ea3a6722b247880f1ffe91ce", + "rev": "31b6cd7569191bfcd0a548575b0e2ef953ed7d09", "type": "github" }, "original": { @@ -245,11 +190,11 @@ ] }, "locked": { - "lastModified": 1700900274, - "narHash": "sha256-KWoKDP5I1viHR4bG3ENnJ7H1DD16tXWH4ROvS0IfXw8=", + "lastModified": 1702538064, + "narHash": "sha256-At5GwJPu2tzvS9dllhBoZmqK6lkkh/sOp2YefWRlaL8=", "owner": "nix-community", "repo": "home-manager", - "rev": "a462e7315deaa8194b0821f726709bb7e51a850c", + "rev": "0e2e443ff24f9d75925e91b89d1da44b863734af", "type": "github" }, "original": { @@ -261,7 +206,7 @@ "karton": { "inputs": { "naersk": "naersk_2", - "nixpkgs": "nixpkgs_7", + "nixpkgs": "nixpkgs_6", "utils": "utils" }, "locked": { @@ -282,7 +227,7 @@ "flake": false, "locked": { "lastModified": 1, - "narHash": "sha256-ewzM8IBKNFCx73ah5rflcdx605ukRF3oTWwih2CTsvs=", + "narHash": "sha256-+kW8ogc6DykjMVlrr+3vWKs9ZUdJ9EW72LbY7k/Qvh4=", "path": "./mac-brcm-fw", "type": "path" }, @@ -294,7 +239,7 @@ "meowsite": { "inputs": { "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_8" + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1678920998, @@ -312,7 +257,7 @@ }, "naersk": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1655042882, @@ -330,7 +275,7 @@ }, "naersk_2": { "inputs": { - "nixpkgs": "nixpkgs_6" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1671096816, @@ -349,7 +294,7 @@ }, "naersk_3": { "inputs": { - "nixpkgs": "nixpkgs_10" + "nixpkgs": "nixpkgs_9" }, "locked": { "lastModified": 1671096816, @@ -384,11 +329,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1688322751, - "narHash": "sha256-eW62dC5f33oKZL7VWlomttbUnOTHrAbte9yNUNW8rbk=", + "lastModified": 1701436327, + "narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0fbe93c5a7cac99f90b60bdf5f149383daaa615f", + "rev": "91050ea1e57e50388fa87a3302ba12d188ef723a", "type": "github" }, "original": { @@ -398,54 +343,22 @@ "type": "github" } }, - "nixpkgs-lib": { - "locked": { - "dir": "lib", - "lastModified": 1688049487, - "narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-stable": { "locked": { - "lastModified": 1700851152, - "narHash": "sha256-3PWITNJZyA3jz5IGREJRfSykM6xSLmD8u5A3WpBCyDM=", + "lastModified": 1702346276, + "narHash": "sha256-eAQgwIWApFQ40ipeOjVSoK4TEHVd6nbSd9fApiHIw5A=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1216a5ba22a93a4a3a3bfdb4bff0f4727c576fcc", + "rev": "cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "type": "indirect" } }, "nixpkgs_10": { - "locked": { - "lastModified": 1675614288, - "narHash": "sha256-i3Rc/ENnz62BcrSloeVmAyPicEh4WsrEEYR+INs9TYw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d25de6654a34d99dceb02e71e6db516b3b545be6", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_11": { "locked": { "lastModified": 1675614288, "narHash": "sha256-i3Rc/ENnz62BcrSloeVmAyPicEh4WsrEEYR+INs9TYw=", @@ -463,18 +376,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1676300157, - "narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=", + "lastModified": 1656755932, + "narHash": "sha256-TGThfOxr+HjFK464+UoUE6rClp2cwxjiKvHcBVdIGSQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "545c7a31e5dedea4a6d372712a18e00ce097d462", + "rev": "660ac43ff9ab1f12e28bfb31d4719795777fe152", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "type": "indirect" } }, "nixpkgs_3": { @@ -492,20 +403,6 @@ } }, "nixpkgs_4": { - "locked": { - "lastModified": 1656755932, - "narHash": "sha256-TGThfOxr+HjFK464+UoUE6rClp2cwxjiKvHcBVdIGSQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "660ac43ff9ab1f12e28bfb31d4719795777fe152", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_5": { "locked": { "lastModified": 1679966490, "narHash": "sha256-k0jV+y1jawE6w4ZvKgXDNg4+O9NNtcaWwzw8gufv0b4=", @@ -521,7 +418,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_5": { "locked": { "lastModified": 1677852945, "narHash": "sha256-liiVJjkBTuBTAkRW3hrI8MbPD2ImYzwUpa7kvteiKhM=", @@ -535,7 +432,7 @@ "type": "indirect" } }, - "nixpkgs_7": { + "nixpkgs_6": { "locked": { "lastModified": 1677852945, "narHash": "sha256-liiVJjkBTuBTAkRW3hrI8MbPD2ImYzwUpa7kvteiKhM=", @@ -551,7 +448,7 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_7": { "locked": { "lastModified": 1674407282, "narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=", @@ -567,13 +464,13 @@ "type": "github" } }, - "nixpkgs_9": { + "nixpkgs_8": { "locked": { - "lastModified": 1700794826, - "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=", + "lastModified": 1702312524, + "narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8", + "rev": "a9bf124c46ef298113270b1f84a164865987a91c", "type": "github" }, "original": { @@ -582,6 +479,20 @@ "type": "indirect" } }, + "nixpkgs_9": { + "locked": { + "lastModified": 1675614288, + "narHash": "sha256-i3Rc/ENnz62BcrSloeVmAyPicEh4WsrEEYR+INs9TYw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d25de6654a34d99dceb02e71e6db516b3b545be6", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "root": { "inputs": { "arion": "arion", @@ -592,7 +503,7 @@ "mac-brcm-fw": "mac-brcm-fw", "meowsite": "meowsite", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_9", + "nixpkgs": "nixpkgs_8", "nixpkgs-stable": "nixpkgs-stable", "wordsofgod": "wordsofgod" } @@ -630,7 +541,7 @@ "wordsofgod": { "inputs": { "naersk": "naersk_3", - "nixpkgs": "nixpkgs_11", + "nixpkgs": "nixpkgs_10", "utils": "utils_2" }, "locked": { diff --git a/flake.nix b/flake.nix index 8d10e4c..db7820e 100644 --- a/flake.nix +++ b/flake.nix @@ -2,10 +2,8 @@ description = "system"; inputs = { - # nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small"; nixpkgs.url = "nixpkgs/nixos-unstable"; - # nixpkgs.url = "nixpkgs/nixos-22.11"; - nixpkgs-stable.url = "nixpkgs/nixos-23.05"; + nixpkgs-stable.url = "nixpkgs/nixos-23.11"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -32,7 +30,16 @@ nixos-hardware, mac-brcm-fw, ... - } @ inputs: { + } @ inputs: let + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + in { + devShells."x86_64-linux".default = pkgs.mkShell { + buildInputs = [ + (pkgs.haskellPackages.ghcWithPackages + (pkgs: with pkgs; [xmonad xmonad-contrib xmobar])) + pkgs.haskell-language-server + ]; + }; nixosConfigurations = { monosodium-glutamate-g = nixpkgs.lib.nixosSystem { specialArgs = { diff --git a/haskell/xmobar/xmobar.hs b/haskell/xmobar/xmobar.hs new file mode 100644 index 0000000..c9a01f1 --- /dev/null +++ b/haskell/xmobar/xmobar.hs @@ -0,0 +1,44 @@ +import Xmobar + +-- TODOS: +-- - custom cpu module +-- - custom mem module +-- - custom network/ping module with avg of n pings and blah +-- - custom graph rendering based on braille characters +-- - custom "ramp" thingies +-- - newsticker? +-- - mail/message monitoring +-- - if possible, different bars per workspace + +data CustomCpu = CustomCpu + deriving (Read, Show) + +instance Exec CustomCpu where + alias CustomCpu = "cpu" + run CustomCpu = return "meow" + +fc code content = "" ++ content ++ "" + +sep = fc "#7c6f64" +icon = fc "#d65d0e" + +config :: Config +config = + defaultConfig + { font = "FiraCode Nerd Font", + allDesktops = True, + alpha = 255, + bgColor = "#282828", + fgColor = "#ebdbb2", + commands = + [ Run $ Memory ["t", "Mem: %"] 10, + Run $ CustomCpu, + Run $ Date (icon "\983277" ++ " %Y" ++ sep "-" ++ "%m" ++ sep "-" ++ "%d " ++ icon "\988236" ++ " %H" ++ sep ":" ++ "%M" ++ sep ":" ++ "%S ") "date" 10 + ], + template = "%memory% }{ %cpu% }{ %date%", + alignSep = "}{", + position = TopH 24 + } + +main :: IO () +main = xmobar config -- or: configFromArgs config >>= xmobar diff --git a/haskell/xmonad/xmonad.hs b/haskell/xmonad/xmonad.hs index adf0c33..3e4f439 100644 --- a/haskell/xmonad/xmonad.hs +++ b/haskell/xmonad/xmonad.hs @@ -1,321 +1,172 @@ --- --- xmonad example config file. --- --- A template showing all available configuration hooks, --- and how to override the defaults in your own xmonad.hs conf file. --- --- Normally, you'd only override those defaults you care about. --- - -import XMonad +import Control.Monad (when) +import Data.Map qualified as M import Data.Monoid +import Data.Ratio +import Graphics.X11.ExtraTypes.XF86 import System.Exit - +import XMonad +import XMonad.Actions.KeyRemap +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageDocks import XMonad.Hooks.StatusBar import XMonad.Hooks.StatusBar.PP -import XMonad.Hooks.EwmhDesktops - -import qualified XMonad.StackSet as W -import qualified Data.Map as M - +import XMonad.Layout.Circle +import XMonad.Layout.DraggingVisualizer +import XMonad.Layout.Grid +import XMonad.Layout.IfMax +import XMonad.Layout.Magnifier import XMonad.Layout.Spacing import XMonad.Layout.Tabbed - -import XMonad.Actions.KeyRemap - +import XMonad.Layout.ThreeColumns +import XMonad.Layout.VoidBorders +import XMonad.Layout.WindowSwitcherDecoration import XMonad.Prompt import XMonad.Prompt.Layout -import Graphics.X11.ExtraTypes.XF86 +import XMonad.StackSet qualified as W +import XMonad.Actions.NoBorders +import XMonad.Util.EZConfig +import XMonad.Hooks.ServerMode -import Control.Monad (when) +myKeys conf@(XConfig {XMonad.modMask = modm}) = + M.fromList $ + [ ((modm, xK_Return), spawn $ XMonad.terminal conf), + ((modm .|. shiftMask, xK_q), kill), + -- -- Rotate through the available layout algorithms + ((modm, xK_space), sendMessage NextLayout), + -- rofiing + ((modm, xK_d), spawn "rofi -show drun"), + ((modm .|. shiftMask, xK_e), spawn "rofi -show desktopctl -modes desktopctl:desktopctl -show-icons"), + ((modm, xK_m), spawn "menu-qalc -- -theme gruvbox-dark"), + ((modm, xK_i), spawn "rofimoji --selector-args '-theme gruvbox-dark' -f alchemical_symbols anatolian_hieroglyphs emojis braille_patterns box_drawing chess_symbols emoticons geometric_shapes gothic greek_extended math mathematical_alphanumeric_symbols mathematical_operators miscellaneous_symbols miscellaneous_mathematical_symbols-a miscellaneous_mathematical_symbols-b miscellaneous_symbols_and_arrows miscellaneous_symbols_and_pictographs miscellaneous_technical modi modifier_tone_letters musical_symbols nerd_font number_forms shorthand_format_controls specials variation_selectors vertical_forms -a copy"), + -- screenshotting + -- TODO: Fix/rewrite window-screenshot + ((modm, xK_w), spawn "window-screenshot.nu"), + ((modm, xK_s), spawn "flameshot gui -c -p $HOME/Pictures/screenshots"), + ((modm, xK_a), spawn "flameshot screen -c -p $HOME/Pictures/screenshots"), + ((modm, xK_t), spawn "ocr-screenshot.sh"), + ((modm .|. shiftMask, xK_t), spawn "DEVICE=\"MELF0410:00 1FD2:7007\"; if [ $(xinput list-props \"$DEVICE\" | awk '/^\\tDevice Enabled \\([0-9]+\\):\\t[01]/ {print $NF}') = \"1\" ]; then xinput disable \"$DEVICE\"; else xinput enable \"$DEVICE\"; fi"), + -- Push window back into tiling + ((modm .|. shiftMask, xK_space), withFocused $ windows . W.sink), + -- Resize viewed windows to the correct size + ((modm, xK_n), refresh), + -- Move focus to the next window + ((modm, xK_Tab), layoutPrompt def), + -- Move focus + ((modm, xK_j), windows W.focusDown), + ((modm, xK_k), windows W.focusUp), + -- Swap the focused window with the next window + ((modm .|. shiftMask, xK_j), windows W.swapDown), + ((modm .|. shiftMask, xK_k), windows W.swapUp), + -- Shrink the master area + ((modm, xK_h), sendMessage Shrink), + ((modm, xK_l), sendMessage Expand), + -- Increment the number of windows in the master area + ((modm, xK_comma), sendMessage (IncMasterN 1)), + ((modm, xK_period), sendMessage (IncMasterN (-1))), + ((modm, xK_b), sendMessage ToggleStruts >> withFocused toggleBorder), + -- volume keys + -- TODO: other media keys + ((0, xF86XK_AudioRaiseVolume), spawn "amixer -D pulse sset Master 10%+"), + ((0, xF86XK_AudioLowerVolume), spawn "amixer -D pulse sset Master 10%-"), + ((0, xF86XK_AudioMute), spawn "amixer -D pulse sset Master toggle") + ] + ++ [ ((m .|. modm, k), windows $ f i) + | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9], + (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] + ] --- The preferred terminal program, which is used in a binding below and by --- certain contrib modules. --- -myTerminal = "kitty" +-- TODO: figure out multi screen stuff, including xinerama --- Whether focus follows the mouse pointer. -myFocusFollowsMouse :: Bool -myFocusFollowsMouse = False - --- Whether clicking on a window to focus also passes the click to the window -myClickJustFocuses :: Bool -myClickJustFocuses = False - --- Width of the window border in pixels. --- -myBorderWidth = 2 - --- modMask lets you specify which modkey you want to use. The default --- is mod1Mask ("left alt"). You may also consider using mod3Mask --- ("right alt"), which does not conflict with emacs keybindings. The --- "windows key" is usually mod4Mask. --- -myModMask = mod4Mask - --- The default number of workspaces (virtual screens) and their names. --- By default we use numeric strings, but any string may be used as a --- workspace name. The number of workspaces is determined by the length --- of this list. --- --- A tagging example: --- --- > workspaces = ["web", "irc", "code" ] ++ map show [4..9] --- -myWorkspaces = ["comms","browser","3","4","5","6","7","8","9"] - --- Border colors for unfocused and focused windows, respectively. --- -myNormalBorderColor = "#3c3836" -myFocusedBorderColor = "#504945" - -myRemaps = KeymapTable [ ((0, xK_a), (0, xK_b)) ] - ------------------------------------------------------------------------- --- Key bindings. Add, modify or remove key bindings here. --- -myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ - [ ((modm, xK_Return), spawn $ XMonad.terminal conf) - , ((modm .|. shiftMask, xK_q), kill) - -- -- Rotate through the available layout algorithms - , ((modm, xK_space ), sendMessage NextLayout) - - -- rofiing - , ((modm, xK_d), spawn "rofi -show drun") - , ((modm .|. shiftMask, xK_e), spawn "rofi -show desktopctl -modes desktopctl:desktopctl -show-icons") - , ((modm, xK_m), spawn "menu-qalc -- -theme gruvbox-dark") - , ((modm, xK_i), spawn "rofimoji --selector-args '-theme gruvbox-dark' -f alchemical_symbols anatolian_hieroglyphs emojis braille_patterns box_drawing chess_symbols emoticons geometric_shapes gothic greek_extended math mathematical_alphanumeric_symbols mathematical_operators miscellaneous_symbols miscellaneous_mathematical_symbols-a miscellaneous_mathematical_symbols-b miscellaneous_symbols_and_arrows miscellaneous_symbols_and_pictographs miscellaneous_technical modi modifier_tone_letters musical_symbols nerd_font number_forms shorthand_format_controls specials variation_selectors vertical_forms -a copy") - - -- screenshotting - -- TODO: Fix/rewrite window-screenshot.sh - , ((modm, xK_w), spawn "window-screenshot.nu") - , ((modm, xK_s), spawn "flameshot gui -c -p $HOME/Pictures/screenshots") - , ((modm, xK_a), spawn "flameshot screen -c -p $HOME/Pictures/screenshots") - , ((modm, xK_t), spawn "ocr-screenshot.sh") - - , ((modm .|. shiftMask, xK_t), spawn "DEVICE=\"MELF0410:00 1FD2:7007\"; if [ $(xinput list-props \"$DEVICE\" | awk '/^\\tDevice Enabled \\([0-9]+\\):\\t[01]/ {print $NF}') = \"1\" ]; then xinput disable \"$DEVICE\"; else xinput enable \"$DEVICE\"; fi") - - -- Reset the layouts on the current workspace to default - -- , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) - -- , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) - -- Push window back into tiling - , ((modm .|. shiftMask, xK_space ), withFocused $ windows . W.sink) - - - -- Resize viewed windows to the correct size - , ((modm, xK_n ), refresh) - - -- Move focus to the next window - , ((modm, xK_Tab ), layoutPrompt def) - - -- Move focus - , ((modm, xK_j ), windows W.focusDown) - , ((modm, xK_k ), windows W.focusUp ) - - -- Swap the focused window with the next window - , ((modm .|. shiftMask, xK_j ), windows W.swapDown ) - , ((modm .|. shiftMask, xK_k ), windows W.swapUp ) - - -- Shrink the master area - , ((modm, xK_h ), sendMessage Shrink) - , ((modm, xK_l ), sendMessage Expand) - - -- Increment the number of windows in the master area - , ((modm , xK_comma ), sendMessage (IncMasterN 1)) - , ((modm , xK_period), sendMessage (IncMasterN (-1))) - - -- Brightness n stuff - -- , ((0, xF86XK_AudioRaiseVolume), spawn "amixer -D pulse sset Master 10%+") - -- , ((0, xF86XK_AudioLowerVolume), spawn "amixer -D pulse sset Master 10%-") - -- , ((0, xF86XK_AudioMute), spawn "amixer -D pulse sset Master toggle") - -- , ((0, xF86XK_MonBrightnessUp), spawn "brightnessctl set +10%") - -- , ((0, xF86XK_MonBrightnessDown), spawn "brightnessctl set 10%-") - -- , ((0, xF86XK_KbdBrightnessUp), spawn "brightnessctl -d \"kbd_backlight\" set +10%") - -- , ((0, xF86XK_KbdBrightnessDown), spawn "brightnessctl -d \"kbd_backlight\" set 10%-") - - -- Toggle the status bar gap - -- Use this binding with avoidStruts from Hooks.ManageDocks. - -- See also the statusBar function from Hooks.DynamicLog. - -- - -- , ((modm , xK_b ), sendMessage ToggleStruts) - - --, ((modm .|. shiftMask, xK_e ), io (exitWith ExitSuccess)) - - -- Restart xmonad - --, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart") - - -- Run xmessage with a summary of the default keybindings (useful for beginners) - ] - ++ - - -- - -- mod-[1..9], Switch to workspace N - -- mod-shift-[1..9], Move client to workspace N - -- - [((m .|. modm, k), windows $ f i) - | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] - , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] - -- ++ - - -- - -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 - -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 - -- - -- [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) - -- | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] - -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] - - ------------------------------------------------------------------------- -- Mouse bindings: default actions bound to mouse events --- -myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ - -- mod-button1, Set the window to floating mode and move by dragging - [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w - >> windows W.shiftMaster)) +myMouseBindings (XConfig {XMonad.modMask = modm}) = + M.fromList + -- mod-button1, Set the window to floating mode and move by dragging + [ ( (modm, button1), + \w -> do + focus w + mouseMoveWindow w + windows W.shiftMaster + ), + -- mod-button2, Raise the window to the top of the stack + ( (modm, button3), + \w -> do + focus w + mouseResizeWindow w + windows W.shiftMaster + ) + ] - -- mod-button2, Raise the window to the top of the stack - , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) +tabCfg = + def + { activeColor = "#282828", + inactiveColor = "#1d2021", + urgentColor = "#9d0006", + activeBorderColor = "#504945", + inactiveBorderColor = "#3c3836", + urgentBorderColor = "#cc241d", + activeTextColor = "#ebdbb2", + inactiveTextColor = "#bdae93", + urgentTextColor = "#ebdbb2" + } - -- mod-button3, Set the window to floating mode and resize by dragging - , ((modm, button3), (\w -> focus w >> mouseResizeWindow w - >> windows W.shiftMaster)) - - -- you may also bind events to the mouse scroll wheel (button4 and button5) - ] - ------------------------------------------------------------------------- --- Layouts: - --- You can specify and transform your layouts by modifying these values. --- If you change layout bindings be sure to use 'mod-shift-space' after --- restarting (with 'mod-q') to reset your layout state to the new --- defaults, as xmonad preserves your old layout settings by default. --- --- The available layouts. Note that each layout is separated by |||, --- which denotes layout choice. - -tabCfg = def - { activeColor = "#282828" - , inactiveColor = "#1d2021" - , urgentColor = "#9d0006" - , activeBorderColor = "#504945" - , inactiveBorderColor = "#3c3836" - , urgentBorderColor = "#cc241d" - , activeTextColor = "#ebdbb2" - , inactiveTextColor = "#bdae93" - , urgentTextColor = "#ebdbb2" - } -myLayout = tiled ||| tabbed shrinkText tabCfg ||| Mirror tiled +myLayout = setupSpacing $ avoidStruts $ autoChoose ||| tabbed shrinkText tabCfg where - -- default tiling algorithm partitions the screen into two panes - tiled = Tall nmaster delta ratio + -- default tiling algorithm partitions the screen into two panes + autoChoose = IfMax 2 tiled $ IfMax 3 tiled_mag $ IfMax 4 grid_mag threeCol + setupSpacing = spacingRaw True (Border 0 0 0 0) True (Border 7 7 7 7) True + grid_mag = magnifiercz 1.4 Grid + tiled = Tall nmaster delta ratio + tiled_mag = magnifiercz' 1.4 tiled + threeCol = magnifiercz' 1.6 $ ThreeColMid nmaster delta ratio + -- The default number of windows in the master pane + nmaster = 1 + -- Default proportion of screen occupied by master pane + ratio = 1 / 2 + -- Percent of screen to increment by when resizing panes + delta = 3 / 100 - -- The default number of windows in the master pane - nmaster = 1 +myManageHook = + composeAll + [ className =? "MPlayer" --> doFloat, + className =? "Gimp" --> doFloat, + className =? "firefox" --> doShift "browser", + className =? "Evolution" --> doShift "comms", + className =? "Signal" --> doShift "comms", + className =? "SchildiChat" --> doShift "comms", + resource =? "desktop_window" --> doIgnore, + resource =? "kdesktop" --> doIgnore + ] - -- Default proportion of screen occupied by master pane - ratio = 1/2 - - -- Percent of screen to increment by when resizing panes - delta = 3/100 - ------------------------------------------------------------------------- --- Window rules: - --- Execute arbitrary actions and WindowSet manipulations when managing --- a new window. You can use this to, for example, always float a --- particular program, or have a client always appear on a particular --- workspace. --- --- To find the property name associated with a program, use --- > xprop | grep WM_CLASS --- and click on the client you're interested in. --- --- To match on the WM_NAME, you can use 'title' in the same way that --- 'className' and 'resource' are used below. --- -myManageHook = composeAll - [ className =? "MPlayer" --> doFloat - , className =? "Gimp" --> doFloat - , resource =? "desktop_window" --> doIgnore - , resource =? "kdesktop" --> doIgnore ] - ------------------------------------------------------------------------- --- Event handling - --- * EwmhDesktops users should change this to ewmhDesktopsEventHook --- --- Defines a custom handler function for X Events. The function should --- return (All True) if the default handler is to be run afterwards. To --- combine event hooks use mappend or mconcat from Data.Monoid. --- -myEventHook = mempty - -focusChangeHook (FocusChangeEvent {ev_event_type=t, ev_window=window}) = do - when (t == focusIn) $ spawn "notify-send 'focusIn'" - when (t == focusOut) $ spawn "notify-send 'focusOut'" - return $ All True - ------------------------------------------------------------------------- --- Status bars and logging - --- Perform an arbitrary action on each internal state change or X event. --- See the 'XMonad.Hooks.DynamicLog' extension for examples. --- -myLogHook = return () - ------------------------------------------------------------------------- --- Startup hook - --- Perform an arbitrary action each time xmonad starts or is restarted --- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize --- per-workspace layout choices. --- --- By default, do nothing. myStartupHook = do - spawn "pkill oneko; oneko -tofocus -tora -position +-1+5 -fg palevioletred3 -bg pink -name 'Rose the desktop kitty'" - --spawn "pkill polybar; polybar" - spawn "pkill volumeicon; volumeicon" - spawn "pkill nm-applet; nm-applet" - spawn "mullvad-vpn --background" + spawn "pgrep oneko || oneko -tofocus -tora -position +-1+5 -fg palevioletred3 -bg pink -name 'Rose the desktop kitty'" + spawn "pgrep volumeicon || volumeicon" + spawn "pgrep nm-applet || nm-applet" + spawn "pgrep mullvad-gui || mullvad-vpn" spawn "feh --bg-fill ~/Pictures/wallpaper.jpg" - setDefaultKeyRemap myRemaps [myRemaps] +xmeowbar = statusBarProp "~/.config/xmobar/xmobar" $ pure xmobarPP +polybar = statusBarProp "polybar" $ pure xmobarPP +barSpawner 0 = pure $ xmeowbar <> polybar +barSpawner _ = mempty +main :: IO() +main = xmonad $ docks $ dynamicSBs barSpawner $ ewmh defaults ------------------------------------------------------------------------- --- Now run xmonad with all the defaults we set up. - --- Run xmonad with the settings you specify. No need to modify this. --- -mySB = statusBarProp "polybar" (pure xmobarPP) -main = xmonad $ withEasySB mySB defToggleStrutsKey (ewmh defaults) - --- A structure containing your configuration settings, overriding --- fields in the default config. Any you don't override, will --- use the defaults defined in xmonad/XMonad/Config.hs --- --- No need to modify this. --- -defaults = def - -- simple stuff - { terminal = myTerminal - , focusFollowsMouse = myFocusFollowsMouse - , clickJustFocuses = myClickJustFocuses - , borderWidth = myBorderWidth - , modMask = myModMask - , workspaces = myWorkspaces - , normalBorderColor = myNormalBorderColor - , focusedBorderColor = myFocusedBorderColor - -- , clientMask = focusChangeMask .|. XMonad.clientMask - -- key bindings - , keys = myKeys - , mouseBindings = myMouseBindings - -- hooks, layouts - , layoutHook = spacingRaw True (Border 0 0 0 0) True (Border 7 7 7 7) True $ myLayout - , manageHook = myManageHook - , handleEventHook = myEventHook - , logHook = myLogHook - , startupHook = myStartupHook - } +defaults = + def + { -- simple stuff + terminal = "kitty", + focusFollowsMouse = False, + clickJustFocuses = False, + borderWidth = 2, + modMask = mod4Mask, + workspaces = ["comms", "browser"] ++ map show [3 .. 9], + normalBorderColor = "#3c3836", + focusedBorderColor = "#504945", + keys = myKeys, + mouseBindings = myMouseBindings, + layoutHook =myLayout, + manageHook = myManageHook, + startupHook = myStartupHook, + handleEventHook = serverModeEventHook + } diff --git a/hosts/catbook-j/configuration.nix b/hosts/catbook-j/configuration.nix index 0109deb..98104c5 100644 --- a/hosts/catbook-j/configuration.nix +++ b/hosts/catbook-j/configuration.nix @@ -7,6 +7,9 @@ lib, ... }: { + nixpkgs.config.permittedInsecurePackages = [ + "electron-25.9.0" + ]; imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix diff --git a/modules/desktop/creative.nix b/modules/desktop/creative.nix index 6211540..efaec26 100644 --- a/modules/desktop/creative.nix +++ b/modules/desktop/creative.nix @@ -24,11 +24,9 @@ fspy scribus - onlyoffice-bin + libreoffice typst - digikam - darktable rawtherapee ]; }; diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 518b300..00e80de 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -79,7 +79,7 @@ in programs.xss-lock = { enable = true; - lockerCommand = "${pkgs.i3lock}/bin/i3lock"; + lockerCommand = "${pkgs.i3lock}/bin/i3lock -c 1d2021"; }; services.illum.enable = true; @@ -141,8 +141,6 @@ in uhk-agent cool-retro-term xdg-desktop-portal-gtk - obsidian - zettlr virt-manager ddccontrol-db firebird-emu diff --git a/modules/desktop/polybar.nix b/modules/desktop/polybar.nix index 9e6fd03..a01189c 100644 --- a/modules/desktop/polybar.nix +++ b/modules/desktop/polybar.nix @@ -6,12 +6,6 @@ }: { config = { home-manager.users.jade = {pkgs, ...}: { - #xsession.windowManager.i3.config.startup = [ - #{ - #command = "pkill polybar; polybar"; - #always = true; - #} - #]; services.polybar = { enable = true; package = pkgs.polybarFull; @@ -29,6 +23,7 @@ }; "bar/status" = { # Style + bottom = true; width = "100%"; height = "24px"; radius = 0; @@ -44,7 +39,7 @@ separator-foreground = "\${colors.disabled}"; font-0 = "FiraCode Nerd Font"; modules-left = "xworkspaces xwindow"; - modules-right = "memory cpu wlan battery date"; + modules-right = "memory cpu wlan battery"; cursor-click = "pointer"; cursor-scroll = "ns-resize"; enable-ipc = true; @@ -137,14 +132,6 @@ ]; }; - "module/date" = { - type = "internal/date"; - interval = 1; - date = "%Y%{F#7c6f64}-%{F#ebdbb2}%m%{F#7c6f64}-%{F#ebdbb2}%d"; - time = "%H%{F#7c6f64}:%{F#ebdbb2}%M%{F#7c6f64}:%{F#ebdbb2}%S"; - label = "%{F#d65d0e}󰃭%{F#ebdbb2} %date% %{F#d65d0e}󱑌%{F#ebdbb2} %time%"; - }; - "settings" = { screenchange-reload = true; pseudo-transparency = true; diff --git a/modules/desktop/social.nix b/modules/desktop/social.nix index e54b562..3c0f274 100644 --- a/modules/desktop/social.nix +++ b/modules/desktop/social.nix @@ -14,7 +14,8 @@ in home-manager.users.jade = {pkgs, ...}: { home.packages = with pkgs; [ evolutionWithPlugins - schildichat-desktop + cinny-desktop + signal-desktop mumble ]; }; diff --git a/modules/desktop/xmonad.nix b/modules/desktop/xmonad.nix index 38b58e9..db504a5 100644 --- a/modules/desktop/xmonad.nix +++ b/modules/desktop/xmonad.nix @@ -1,11 +1,28 @@ { - config, lib, pkgs, ... -}: -with lib; { - home-manager.users.jade = {pkgs, ...}: { +}: { + home-manager.users.jade = { + config, + pkgs, + ... + }: let + xmobarGhc = pkgs.haskellPackages.ghcWithPackages (pkgs: with pkgs; [xmobar]); + in { + home.packages = [xmobarGhc pkgs.xmonadctl]; + programs.xmobar = { + enable = true; + }; + home.file."xmobar.hs" = rec { + source = ../../haskell/xmobar/xmobar.hs; + target = ".config/xmobar/xmobar.hs"; + onChange = '' + ${xmobarGhc}/bin/ghc -threaded ${target} + ${pkgs.busybox}/bin/pkill xmobar + ${pkgs.haskellPackages.xmonad}/bin/xmonad --restart + ''; + }; xsession.windowManager.xmonad = { enable = true; enableContribAndExtras = true; diff --git a/modules/shell/default.nix b/modules/shell/default.nix index 309259f..4134bbc 100644 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -7,4 +7,5 @@ ./carapace.nix ./direnv.nix ]; + programs.mosh.enable = true; } diff --git a/modules/shell/helix.nix b/modules/shell/helix.nix index 2929e9b..2238418 100644 --- a/modules/shell/helix.nix +++ b/modules/shell/helix.nix @@ -4,11 +4,9 @@ sessionVariables.EDITOR = "hx"; packages = [ pkgs.nil - pkgs.haskell-language-server - pkgs.nodePackages_latest.vscode-html-languageserver-bin - pkgs.nodePackages_latest.vscode-json-languageserver-bin - pkgs.nodePackages_latest.vscode-css-languageserver-bin - pkgs.nodePackages_latest.bash-language-server + pkgs.vscode-langservers-extracted + pkgs.nodePackages.typescript-language-server + pkgs.emmet-language-server ]; }; programs.helix = { @@ -49,6 +47,10 @@ check.command = "clippy"; }; }; + language-server."emmet-language-server" = { + command = "emmet-language-server"; + args = ["--stdio"]; + }; # "php" = { # name = "php"; # file-types = [ "php" ]; @@ -70,6 +72,12 @@ }; auto-format = true; } + { + name = "html"; + roots = [".git"]; + language-servers = ["vscode-html-language-server" "emmet-language-server"]; + auto-format = false; + } ]; }; }; diff --git a/modules/shell/nu.nix b/modules/shell/nu.nix index c09f5dc..8a6327f 100644 --- a/modules/shell/nu.nix +++ b/modules/shell/nu.nix @@ -1,5 +1,17 @@ {config, ...}: { home-manager.users.jade = {pkgs, ...}: { + # Needed for nu_scripts background_task + services.pueue = { + enable = true; + settings = { + shared = { + use_unix_socket = true; + }; + }; + }; + home.packages = [ + pkgs.pueue + ]; programs.nushell = { enable = true; package = config.users.defaultUserShell; @@ -7,6 +19,7 @@ envFile.source = ../../other/env.nu; extraConfig = '' source ${pkgs.nu_scripts}/share/nu_scripts/modules/nix/nix.nu; + use ${pkgs.nu_scripts}/share/nu_scripts/modules/background_task/job.nu; ''; }; programs.starship.enableNushellIntegration = true; diff --git a/modules/shell/zellij.nix b/modules/shell/zellij.nix index 7efcb57..9e24251 100644 --- a/modules/shell/zellij.nix +++ b/modules/shell/zellij.nix @@ -4,16 +4,6 @@ ... }: { home-manager.users.jade = {pkgs, ...}: { - home.file = { - zellij-forgot = { - target = ".config/zellij/plugins/zellij-forgot.wasm"; - source = builtins.fetchurl "https://github.com/karimould/zellij-forgot/releases/download/0.2.0/zellij_forgot.wasm"; - }; - monocle = { - target = ".config/zellij/plugins/monocle.wasm"; - source = builtins.fetchurl "https://github.com/imsnif/monocle/releases/download/0.37.2/monocle.wasm"; - }; - }; programs.zellij = { enable = true; settings = {