Fixing xmonad build

This commit is contained in:
Zoe Roux
2022-02-04 01:34:07 +01:00
parent 14a42e1fae
commit 0d550e5c37
8 changed files with 71 additions and 40 deletions

View File

@@ -0,0 +1,8 @@
XDG_DESKTOP_DIR="$HOME"
XDG_DOCUMENTS_DIR="$HOME"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_MUSIC_DIR="$HOME"
XDG_PICTURES_DIR="$HOME"
XDG_PUBLICSHARE_DIR="$HOME"
XDG_TEMPLATES_DIR="$HOME"
XDG_VIDEOS_DIR="$HOME"

5
cli/haskell/local/bin/hoogle Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/bash
[[ ! -d ~/.local/share/hoogle/ ]] && ~/.cache/cabal/bin/hoogle generate --database ~/.local/share/hoogle/database
~/.cache/cabal/bin/hoogle --database ~/.local/share/hoogle/database $@

View File

@@ -93,6 +93,7 @@ return packer.startup(function(use)
-- Telescope
use "nvim-telescope/telescope.nvim"
use "folke/trouble.nvim"
use "psiska/telescope-hoogle.nvim"
-- Treesitter
use {

View File

@@ -94,3 +94,4 @@ telescope.setup {
-- please take a look at the readme of the extension you want to configure
},
}
telescope.load_extension("hoogle")

View File

@@ -161,7 +161,8 @@ local mappings = {
name = "Search",
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
h = { "<cmd>Telescope hoogle list<CR>", "Hoogle" },
H = { "<cmd>Telescope help_tags<cr>", "Find Help" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },

View File

@@ -0,0 +1,4 @@
#!/usr/bin/bash
stack build
cp -uf $(stack path --local-install-root)/bin/xmonad "$1"

View File

@@ -1,4 +1,4 @@
module Lemonbar where
module Lemonbar where
import Data.List.Utils (replace)
import XMonad.Hooks.DynamicLog (wrap)
@@ -38,7 +38,7 @@ lemonbarFormatOne fmt = case fmt of
(Overline color) -> wrap (bracket ("o" <> color) <> bracket "+o") (bracket "-o")
(Font index) -> wrap (bracket ("T" <> show index)) (bracket "T-")
(Offset size) -> (bracket ("O" <> show size) <>)
(Action button cmd) -> wrap (bracket (format "A{}:{}:" (fromMouseButton button, escape ':' cmd)))
(Action button cmd) -> wrap (bracket ("A" <> (show . fromMouseButton) button <> ":" <> escape ':' cmd <> ":"))
(bracket "A")
where
escape :: Char -> String -> String

View File

@@ -2,35 +2,21 @@
module Main where
import Data.Maybe (mapMaybe)
import GHC.IO.Handle (hClose, hDuplicateTo, Handle)
import Data.List.Utils (split)
import System.Posix.Process (getProcessID)
import System.Posix.Types (CPid(..))
import Text.Read (readMaybe, Lexeme (String))
import Text.Printf (printf)
import Lemonbar
import XMonad
import XMonad.Actions.Navigation2D (withNavigation2DConfig)
import XMonad.Config.Dmwit (outputOf)
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, PP (..), wrap, shorten)
import XMonad.Hooks.EwmhDesktops (ewmh, ewmhFullscreen)
import XMonad.Hooks.ManageDocks (docks, avoidStruts)
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Layout.Named (named)
import XMonad.Layout.NoBorders (noBorders)
import XMonad.Util.Run (spawnPipe)
import XMonad.Util.Loggers
import XMonad.Util.WorkspaceCompare (getSortByIndex)
import XMonad.Hooks.StatusBar.PP (PP(..))
import XMonad.Hooks.StatusBar (StatusBarConfig, statusBarPipe, dynamicSBs)
main :: IO ()
main = xmonad
. ewmhFullscreen
. ewmh
. docks
-- . ewmhFullscreen
-- . ewmh
-- . docks
. polybarEnable
$ xConfig
@@ -38,28 +24,53 @@ polybarEnable :: XConfig a -> XConfig a
polybarEnable = dynamicSBs barSpawner
where
barSpawner :: ScreenId -> IO StatusBarConfig
barSpawner x = statusBarPipe (barScript x) (polyPP x)
barSpawner x = statusBarPipe (barScript x) (pure basicPP)
barScript (S x) = "~/.config/polybar/launch.sh " ++ show x
polyPP :: ScreenId -> X PP
polyPP sid = pure $ def
{ ppCurrent = lemonbarFormat [Background accent]
, ppExtras = [logTitlesOnScreen sid formatFocused formatUnfocused]
--, ppSep = magenta " • "
basicPP :: PP
basicPP = def
{ ppSep = " "
, ppWsSep = " "
, ppTitleSanitize = filter (`notElem` ['%','{','}'])
, ppOrder = layoutFirstOrder
, ppSort = getSortByIndex
, ppExtras = []
, ppOutput = const mempty
}
where
formatFocused, formatUnfocused :: String -> String
formatFocused = wrap (white "[") (white "]") . magenta . ppWindow
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow
where
layoutFirstOrder (workspaces : layout : title : extras) =
[layout] ++ extras ++ [workspaces, title]
layoutFirstOrder other = other
-- | Windows should have *some* title, which should not not exceed a
-- sane length.
ppWindow :: String -> String
ppWindow = xmobarRaw
. (\w -> if null w then "untitled" else w)
. shorten 30
. xmobarStrip
-- polyPP :: ScreenId -> X PP
-- polyPP sid = pure $ basicPP
-- { ppCurrent = lemonbarFormat [ Foreground accent, Background white, Underline magenta ]
-- , ppVisible = lemonbarFormat [ Foreground blue, Background white, Underline magenta ]
-- , ppVisibleNoWindows = Just $
-- lemonbarFormat [ Foreground blue, Background white, Underline magenta ]
-- , ppHidden = lemonbarFormat [ Foreground blue, Underline magenta ]
-- , ppHiddenNoWindows = lemonbarFormat [ Foreground magenta ]
-- , ppUrgent = lemonbarFormat [ Foreground blue, Background magenta ]
-- , ppTitle = lemonbarFormat [ Foreground blue ] . shorten 50
-- , ppLayout = lemonbarFormat [ Foreground blue ]
-- }
-- -- { ppCurrent = lemonbarFormat [Background accent]
-- -- -- , ppExtras = [logTitlesOnScreen sid formatFocused formatUnfocused]
-- -- --, ppSep = magenta " • "
-- -- }
-- where
-- -- formatFocused, formatUnfocused :: String -> String
-- -- formatFocused = wrap (white "[") (white "]") . magenta . ppWindow
-- -- formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow
-- -- | Windows should have *some* title, which should not not exceed a
-- -- sane length.
-- ppWindow :: String -> String
-- ppWindow = xmobarRaw
-- . (\w -> if null w then "untitled" else w)
-- . shorten 30
-- . xmobarStrip