haskell things

This commit is contained in:
Schrottkatze 2024-02-27 18:18:55 +01:00
parent ab508dbcb9
commit 6687b0ff4a
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
3 changed files with 18 additions and 5 deletions

View file

@ -36,7 +36,13 @@
devShells."x86_64-linux".default = pkgs.mkShell { devShells."x86_64-linux".default = pkgs.mkShell {
buildInputs = [ buildInputs = [
(pkgs.haskellPackages.ghcWithPackages (pkgs.haskellPackages.ghcWithPackages
(pkgs: with pkgs; [xmonad xmonad-contrib xmobar])) (pkgs:
with pkgs; [
xmonad
xmonad-contrib
xmobar
statgrab
]))
pkgs.haskell-language-server pkgs.haskell-language-server
]; ];
}; };

View file

@ -1,4 +1,5 @@
import Xmobar import Xmobar
import System.Statgrab
-- TODOS: -- TODOS:
-- - custom cpu module -- - custom cpu module
@ -10,12 +11,14 @@ import Xmobar
-- - mail/message monitoring -- - mail/message monitoring
-- - if possible, different bars per workspace -- - if possible, different bars per workspace
data CustomCpu = CustomCpu data CustomCpu = CustomCpu
deriving (Read, Show) deriving (Read, Show)
instance Exec CustomCpu where instance Exec CustomCpu where
alias CustomCpu = "cpu" alias CustomCpu = "cpu"
run CustomCpu = return "meow" run CustomCpu = do
-- return (show :: IO String (snapshot :: Stats CPUPercent))
return "meow"
fc code content = "<fc=" ++ code ++ ">" ++ content ++ "</fc>" fc code content = "<fc=" ++ code ++ ">" ++ content ++ "</fc>"
@ -31,7 +34,7 @@ config =
bgColor = "#282828", bgColor = "#282828",
fgColor = "#ebdbb2", fgColor = "#ebdbb2",
commands = commands =
[ Run $ Memory ["t", "Mem: <usedratio>%"] 10, [ Run $ Xmobar.Memory ["t", "Mem: <usedratio>%"] 10,
Run $ CustomCpu, Run $ CustomCpu,
Run $ Date (icon "\983277" ++ " %Y" ++ sep "-" ++ "%m" ++ sep "-" ++ "%d " ++ icon "\988236" ++ " %H" ++ sep ":" ++ "%M" ++ sep ":" ++ "%S ") "date" 10 Run $ Date (icon "\983277" ++ " %Y" ++ sep "-" ++ "%m" ++ sep "-" ++ "%d " ++ icon "\988236" ++ " %H" ++ sep ":" ++ "%M" ++ sep ":" ++ "%S ") "date" 10
], ],

View file

@ -8,7 +8,11 @@
pkgs, pkgs,
... ...
}: let }: let
xmobarGhc = pkgs.haskellPackages.ghcWithPackages (pkgs: with pkgs; [xmobar]); xmobarGhc = pkgs.haskellPackages.ghcWithPackages (pkgs:
with pkgs; [
xmobar
statgrab
]);
in { in {
home.packages = [xmobarGhc pkgs.xmonadctl]; home.packages = [xmobarGhc pkgs.xmonadctl];
programs.xmobar = { programs.xmobar = {