xmonad config

This commit is contained in:
2021-11-19 21:16:56 +02:00
parent f3e3ab2c13
commit ab25eaed17
4 changed files with 283 additions and 1 deletions

View File

@ -1,5 +1,6 @@
{ config, pkgs, ...}:
{
nixpkgs.config.allowUnfree = true;
programs.command-not-found.enable = true;
home.keyboard.layout = "fi";
@ -70,4 +71,63 @@
programs.myZsh.enable = true;
programs.myUrxvt.enable = true;
programs.xmonad = {
enable = true;
dhallConfigPath = ./xmonad.dhall;
packages = with pkgs;
let
prompt = writeScriptBin "prompt" ''
${pkgs.haskellPackages.xmobar}/bin/xmobar ${xmobarConf}
'';
xmobarConf = pkgs.writeText "xmobar" ''
Config {
font = "xft:Iosevka-9"
, bgColor = "#3F3F3F"
, fgColor = "#DCDCCC"
, position = Top
, lowerOnStart = True
, commands = [
Run MultiCpu ["-t", "CPU: <total>%"] 30
, Run Memory ["-t", "Mem: <usedbar> (<cache>M)"] 3600
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 20
, Run StdinReader
, Run Battery [ "--template" , "Batt: <acstatus>"
, "--Low" , "10" -- units: %
, "--High" , "80" -- units: %
, "--low" , "darkred"
, "--normal" , "darkorange"
, "--high" , "darkgreen"
, "--" -- battery specific options
-- discharging status
, "-o" , "<left>% (<timeleft>)"
-- AC "on" status
, "-O" , "<fc=#dAA520>Charging</fc>"
-- charged status
, "-i" , "<fc=#006000>Charged</fc>"
] 120
, Run DynNetwork [ "--template" , "<dev>: <tx>kB/s|<rx>kB/s"
, "--Low" , "1000" -- units: B/s
, "--High" , "500000" -- units: B/s
, "--normal" , "darkorange"
, "--high" , "darkred"
] 30
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{%dynnetwork% | %battery% | %multicpu% | %memory% | <fc=#FFFFCC>%date%</fc>"
}
'';
in
{
inherit qutebrowser flameshot calibre spotify hledger obsidian prompt;
hledger_ui = hledger-ui;
element = element-desktop;
signal = signal-desktop;
vim = myVim;
emacs = myEmacs;
urxvt = rxvt-unicode;
};
};
}

120
macbook/xmonad.dhall Normal file
View File

@ -0,0 +1,120 @@
let Prelude =
https://prelude.dhall-lang.org/v20.1.0/package.dhall
sha256:26b0ef498663d269e4dc6a82b0ee289ec565d683ef4c00d0ebdd25333a5a3c98
let Config =
/home/masse/git/xmonad-masser/dhall/package.dhall
sha256:8cca83716bc75d06cb22c7f45091606159404289d9866601817b2ab81170afcb
let pkgs =
{ qutebrowser = "@qutebrowser@"
, prompt = "@prompt@"
, signal = "@signal@"
, element = "@element@"
, emacs = "@emacs@"
, urxvt = "@urxvt@"
, flameshot = "@flameshot@"
, obsidian = "@obsidian@"
, vim = "@vim@"
, calibre = "@calibre@"
, spotify = "@spotify@"
, hledger = "@hledger@"
, hledger-ui = "@hledger_ui@"
}
let browser = "${pkgs.qutebrowser}/bin/qutebrowser"
let terminal = "${pkgs.urxvt}/bin/urxvt"
let prompt = "${pkgs.prompt}/bin/prompt"
let shellIn = \(path : Text) -> "${terminal} -cd ${path}"
let paths =
let pathElement = \(x : Prelude.Map.Entry Text Text) -> x.mapValue
in Prelude.Text.concatMapSep
":"
(Prelude.Map.Entry Text Text)
pathElement
(toMap pkgs)
let runOnTopic =
\(name : Text) ->
\(action : Text) ->
Config.Topic::{ name, action = [ Config.Command.Spawn action ] }
let spawn = Config.Command.Spawn
in Config::{
, path = paths
, applications = { terminal, prompt = pkgs.prompt }
, topics =
[ runOnTopic "signal" "${pkgs.signal}/bin/signal-desktop"
, runOnTopic "element" "${pkgs.element}/bin/element-desktop"
, runOnTopic "xmonad" (shellIn "/home/masse/git/xmonad-masser")
, runOnTopic "adhoc" (shellIn "/home/masse/code_practice")
, Config.Topic::{
, name = "zettel"
, action =
[ spawn "${pkgs.obsidian}/bin/obsidian"
, spawn "${pkgs.vim}/bin/vim -g"
]
}
, runOnTopic "conf" (shellIn "/etc/nixos")
, runOnTopic "web" browser
, Config.Topic::{
, name = "ledger"
, action =
[ spawn
"${pkgs.vim}/bin/vim -g /home/masse/wikidata/accounting/2021.journal"
, spawn (shellIn "/home/masse/wikidata/accounting")
, spawn
( shellIn
"/home/masse/wikidata/accounting -e ${pkgs.hledger-ui}/bin/hledger-ui --watch --register checking -U -P"
)
, spawn
( shellIn
"/home/masse/wikidata/accounting -e ${pkgs.hledger-ui}/bin/hledger-ui --watch --register savings -U -P"
)
, spawn
( shellIn
"/home/masse/wikidata/accounting -e ${pkgs.hledger-ui}/bin/hledger-ui --watch --register lunchcard -U -P"
)
]
}
, runOnTopic "pdf" "${pkgs.calibre}/bin/calibre"
, runOnTopic "music" "${pkgs.spotify}/bin/spotify"
]
, bindings =
let mkCommand =
\(prefix : Text) ->
\(name : Text) ->
\(command : Text) ->
Config.SubCommand.act
{ prefix, name, command = Config.Command.Spawn command }
let mkSearch =
\(prefix : Text) ->
\(name : Text) ->
\(site : Text) ->
Config.SubCommand.act
{ prefix
, name
, command = Config.Command.Search { name, browser, site }
}
in [ mkCommand
"M-<Print>"
"Take a screenshot"
"${pkgs.flameshot}/bin/flameshot gui"
, Config.SubCommand.subMap
{ prefix = "M-s"
, name = "Search"
, sub =
[ mkSearch "h" "hoogle" "https://hoogle.haskell.org?hoogle="
, mkSearch "g" "google" "https://google.com/search?q="
, mkSearch "d" "duckduckgo" "https://duckduckgo.com/?q="
]
}
]
}