aboutsummaryrefslogtreecommitdiffstats
path: root/lib/LaNinpreConfig.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LaNinpreConfig.hs')
-rw-r--r--lib/LaNinpreConfig.hs412
1 files changed, 0 insertions, 412 deletions
diff --git a/lib/LaNinpreConfig.hs b/lib/LaNinpreConfig.hs
deleted file mode 100644
index 14f5994..0000000
--- a/lib/LaNinpreConfig.hs
+++ /dev/null
@@ -1,412 +0,0 @@
-{-# OPTIONS_HADDOCK prune #-}
-----------------------------------------------------------------------
--- |
--- Module : LaNinpreConfig
--- Description : personal stuff for xmonad
--- Maintainer : la-ninpre
--- License : ISC
--- Copyright : la-ninpre <aaoth AT aaoth DOT xyz>
---
--- this module exists because i find it more convenient to manage some things
--- from here instead of doing it right in xmonad config
---
-----------------------------------------------------------------------
-
-module LaNinpreConfig (
- -- $global
-
- -- * fonts
- -- $fonts
- myFonts,
-
- -- * colors
- -- $colors
- MyColorTheme(..),
- def,
- myNormColor,
- myFocusColor,
-
- -- * software constants
- -- $software
- myTerminal,
- myBrowser,
- myGeminiClient,
- myFileMgr,
- myMocp,
- myEditor,
-
- -- * hooks
- -- $hooks
- myManageHook,
- myStartupHook,
-
- -- * scratchpads
- -- $scratchpads
- myScratchPads,
-
- -- * workspaces
- -- $workspaces
- myWorkspaces,
-
- -- * misc
- -- $misc
- myModMask,
- myBorderWidth,
- myAppGrid,
- ) where
-
-import Data.List
-import Data.Map as M
-import Data.Maybe
-import Data.Monoid
-
-import XMonad
-import qualified XMonad.StackSet as W
-import XMonad.Hooks.ManageHelpers
-import XMonad.Hooks.SetWMName
-import XMonad.Util.NamedScratchpad
-import XMonad.Util.SpawnOnce
-
--- $global
---
--- constants and functions starting with \'my\' are exported and used in
--- xmonad config.
-
--- $fonts
---
--- default fonts and helper functions for them.
-
--- | default lato font
-fontLatoDef :: String
-fontLatoDef = fontXft "Lato" "regular" 14
-
--- | font for @ShowWMName@
---
--- normal variant
---
--- > fontSWN = fontXft "Press Start 2P" "regular" 60
---
--- sitelen pona pona variant
---
--- > fontSWN = fontXft "sitelen\\-pona" "regular" 80
-fontSWN :: String
-fontSWN = fontXft "linja pona" "regular" 80
-
--- | fonts list
-myFonts :: [String]
-myFonts = [ fontLatoDef
- , fontSWN
- ]
-
--- ** helper functions
---
--- | font constructor
---
--- it is just a helper function to simplify the process of specifying font
--- with xft.
-fontXft :: String -- ^ font family
- -> String -- ^ font style
- -> Int -- ^ font size
- -> String
-
-fontXft font style size = intercalate ":" [ "xft"
- , font
- , style
- , "size=" ++ show size
- , "antialias=true"
- , "hinting=true"
- ]
-
--- $colors
---
--- color theme and stuff
-
-myColorTheme :: MyColorTheme
-myColorTheme = MyColorTheme "#111111" "#ccbbcc" "#223333" "#ffaaaa"
-
--- | unfocused window border colour
-myNormColor :: String
-myNormColor = col_bg def
-
--- | focused window border colour
-myFocusColor :: String
-myFocusColor = col_bg_alt def
-
--- | color theme datatype
---
--- 'Default' instance gives simple four-color colorscheme
-data MyColorTheme = MyColorTheme {
- col_bg :: String,
- col_fg :: String,
- col_bg_alt :: String,
- col_fg_alt :: String
-}
-
-instance Default MyColorTheme where
- def = myColorTheme
-
-
--- $software
---
--- these are just contstants
-
--- | set terminal emulator
-myTerminal :: String
-myTerminal = "alacritty"
-
--- | set default browser
-myBrowser :: String
-myBrowser = "firefox"
-
--- | set gemini client
-myGeminiClient :: String
-myGeminiClient = "amfora"
-
--- | set file manager
-myFileMgr :: String
-myFileMgr = "thunar"
-
--- | music on console
---
--- this is to avoid spamming strings everywhere. @moc@ doesn't comply with
--- XDG_CONFIG_HOME, so we force it to do so.
-myMocp :: String
-myMocp = "mocp -M '~/.config/moc'"
-
--- | set editor
-myEditor :: String
-myEditor = myTerminal ++ " -e vim"
-
--- $hooks
---
--- hooks for xmonad config
-
--- ** startup hook
---
--- start things at login.
-
--- | actual instance
-myStartupHook :: X ()
-myStartupHook = do
- --spawnOnce "dunst &"
- --spawnOnce "lxsession &"
- --spawnOnce "picom &"
- --spawnOnce "nm-applet &"
- --spawnOnce "volumeicon &"
- spawnOnce "setxkbmap -layout us,ru -option 'grp:alt_shift_toggle'"
- spawnOnce "kbdd"
- {-spawnOnce ("trayer --edge top "
- ++ "--align right "
- ++ "--widthtype request "
- ++ "--SetDockType true --SetPartialStrut true --expand false "
- ++ "--monitor 0 --transparent true --alpha 0 "
- ++ "--tint 0x19191a --height 24 &"
- )
- -}
- spawnOnce "~/.fehbg &"
- setWMName "LG3D"
-
--- ** manage hook
---
--- @doFloat@ forces a window to float. useful for dialog boxes and such.
--- using @doShift (myWorkspaces !! 7)@ sends program to workspace 8
--- i'm doing it this way because otherwise i would have to write out the full
--- name of my workspaces and the names would be very long if using clickable workspaces.
-
--- | manage hook
-myManageHook :: Query (Endo WindowSet)
-myManageHook = composeAll
- [ className =? "confirm" --> doFloat
- , className =? "file_progress" --> doFloat
- , className =? "dialog" --> doFloat
- , className =? "download" --> doFloat
- , className =? "error" --> doFloat
- , className =? "notification" --> doFloat
- , className =? "pinentry-gtk-2" --> doFloat
- , className =? "splash" --> doFloat
- , className =? "toolbar" --> doFloat
- , className =? "Gimp" --> doFloat
- , className =? "Cadence" --> doFloat
- , className =? "Steam" --> doFloat
- , className =? "Image Lounge" --> doFloat
- , title =? "Oracle VM VirtualBox Manager" --> doFloat
- -- web workspace
- , title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 )
- , className =? "Brave-browser" --> doShift ( myWorkspaces !! 1 )
- , className =? "amfora" --> doShift ( myWorkspaces !! 1 )
- , className =? "qutebrowser" --> doShift ( myWorkspaces !! 1 )
- -- doc workspace
- , className =? "Geary" --> doShift ( myWorkspaces !! 3 )
- , className =? "libreoffice" --> doShift ( myWorkspaces !! 3 )
- -- , className =? "libreoffice-impress" --> doShift ( myWorkspaces !! 3 )
- -- vm workspace
- , className =? "VirtualBox Manager" --> doShift ( myWorkspaces !! 4 )
- -- chat workspace
- , className =? "discord" --> doShift ( myWorkspaces !! 5 )
- , className =? "TelegramDesktop" --> doShift ( myWorkspaces !! 5 )
- , className =? "Element" --> doShift ( myWorkspaces !! 5 )
- , className =? "Steam" --> doShift ( myWorkspaces !! 5 )
- -- full workspace
- , isFullscreen --> doShift ( myWorkspaces !! 6 )
- -- vid workspace
- , className =? "Deadbeef" --> doShift ( myWorkspaces !! 7 )
- , appName =? "mpv" --> doShift ( myWorkspaces !! 7 )
- , className =? "vlc" --> doShift ( myWorkspaces !! 7 )
- -- gfx workspace
- , className =? "Gimp" --> doShift ( myWorkspaces !! 8 )
- , className =? "Blender" --> doShift ( myWorkspaces !! 8 )
- , className =? "obs" --> doShift ( myWorkspaces !! 8 )
- , isFullscreen --> doFullFloat
- ] <+> namedScratchpadManageHook myScratchPads
-
--- $scratchpads
---
--- currently i have:
---
--- * plain terminal scratchpad
---
--- * music on console
---
--- * calculator (qalculate-gtk)
---
--- * mpv instance that plays playlist in @~\/Video\/sp_playlist.m3u@
-
--- | scratchpad list
-myScratchPads :: [NamedScratchpad]
-myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
- , NS "mocp" spawnMocp findMocp manageMocp
- , NS "calculator" spawnCalc findCalc manageCalc
- , NS "mpvfloat" spawnMpv findMpv manageMpv
- ]
- where
- -- terminal
- spawnTerm = myTerminal ++ " -t scratchpad"
- findTerm = title =? "scratchpad"
- manageTerm = customFloating $ W.RationalRect l t w h
- where
- h = 0.9
- w = 0.9
- t = 0.95 - h
- l = 0.95 - w
- -- music on console
- spawnMocp = myTerminal ++ " -t mocp -e " ++ myMocp
- findMocp = title =? "mocp"
- manageMocp = customFloating $ W.RationalRect l t w h
- where
- h = 0.9
- w = 0.9
- t = 0.95 - h
- l = 0.95 - w
- -- calculator
- spawnCalc = "qalculate-gtk"
- findCalc = className =? "Qalculate-gtk"
- manageCalc = customFloating $ W.RationalRect l t w h
- where
- h = 0.5
- w = 0.4
- t = 0.75 - h
- l = 0.70 - w
- -- mpv scratchpad to watch some stuff listed in ~/Video/sp_playlist.m3u
- spawnMpv = "mpv --pause -x11-name mpv-sp ~/Video/sp_playlist.m3u"
- ++ mpvGeometry mpvPercentage mpvPercentage
- findMpv = appName =? "mpv-sp"
- manageMpv = customFloating $ W.RationalRect l t w h
- where
- h = mpvPercentage
- w = mpvPercentage
- t = 0.03
- l = 0.996 - w
-
--- ** helper functions
---
--- | percentage of mpv scratchpad at start
-mpvPercentage :: Rational
-mpvPercentage = 1/4
-
--- | mpv needs geometry of window at start, so it won't resize itself, when
--- playing next video on a playlist
-mpvGeometry :: RealFrac a
- => a -- ^ relative height of window
- -> a -- ^ relative width of window
- -> String
-
-mpvGeometry h w = " --geometry=" ++ show pw ++ "x" ++ show ph
- where
- pw = ceiling (1920 * w)
- ph = ceiling (1080 * h)
-
--- $workspaces
---
--- i've got three ways of specifying them. first one is pretty close to the
--- original dt's config. second is using sitelen pona pona font by jackhumbert
--- (check it out [here](https://jackhumbert.github.io/sitelen-pona-pona/)).
--- and third one is using linja pona font by jan same
--- (check it out [here](http://musilili.net/linja-pona/)).
---
--- * normal variant
---
--- > myWorkspaces = [ "dev"
--- > , "www"
--- > , "sys"
--- > , "doc"
--- > , "vm"
--- > , "chat"
--- > , "full"
--- > , "vid"
--- > , "gfx"
--- > ]
---
--- * one using sitelen pona pona by jackhumbert
---
--- this is specified with actual glyph codes because xmobar
--- don't allow for ligatures and otf features.
---
--- > myWorkspaces = [ "\xee3d" -- nanpa
--- > , "\xee3b" -- musi
--- > , "\xee49" -- pali
--- > , "\xee2a" -- lipu
--- > , "\xee53" -- poki
--- > , "\xee6c" -- toki
--- > , "\xee63" -- suli
--- > , "\xee60" -- sitelen
--- > , "\xee1e" -- kule
--- > ]
-
--- | workspaces container
-myWorkspaces :: [String]
-myWorkspaces = [ "\xe661\xe921" -- sona nanpa
- , "\xe63b" -- musi
- , "\xe649" -- pali
- , "\xe62a\xf105" -- lipu ale
- , "\xe653\xf115" -- poki ilo
- , "\xe66c" -- toki
- , "\xe62a\xf200" -- lipu suli
- , "\xf010\xe915" -- sitelen tawa
- , "\xf010\xf107" -- sitelen ante
- ]
-
--- $misc
---
--- misc constants
-
--- | set windows key as modkey
-myModMask :: KeyMask
-myModMask = mod4Mask
-
--- | specify border width
-myBorderWidth :: Dimension
-myBorderWidth = 1
-
--- | app grid for 'GridSelect' layout
-myAppGrid :: [(String,String)]
-myAppGrid = [ ("files" ,"thunar" )
- , ("mail" ,"thunderbird")
- , ("blender" ,"blender-3.1")
- , ("inkscape" ,"inkscape" )
- , ("discord" ,"discord" )
- , ("steam" ,"steam" )
- , ("obs" ,"obs" )
- , ("gimp" ,"gimp" )
- , ("ardour" ,"ardour6" )
- , ("kdenlive" ,"kdenlive" )
- ]