From c1e3c46afdcb455175f0bb18b606f61c864d008a Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Mon, 23 Oct 2023 11:24:12 -0600 Subject: more xmonad stuff --- xmobar/xmobar.hs | 78 ++++++++++++++++++++++++++++++++++++++------------ xmonad/xmonad.hs | 87 +++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 114 insertions(+), 51 deletions(-) diff --git a/xmobar/xmobar.hs b/xmobar/xmobar.hs index 29eac0c..1bd7e22 100644 --- a/xmobar/xmobar.hs +++ b/xmobar/xmobar.hs @@ -1,34 +1,76 @@ import Xmobar +green, red, blue, blue2, purple, yellow, orange, lowWhite, white :: String +green = "#b8bb26" +red = "#fb4934" +blue = "#83a598" +blue2 = "#458588" +purple = "#d3869b" +yellow = "#fabd2f" +orange = "#fe8019" +lowWhite = "#a89984" +white = "#ebdbb2" + config :: Config config = defaultConfig { overrideRedirect = False - , font = "xft:JetBrains Mono NF:style=medium:size=9" + , font = "xft:JetBrains Mono NF:style=medium:size=10" , bgColor = "#3c3836" , fgColor = "#ebdbb2" - , position = TopW L 120 - , commands = [ Run $ Cpu - [ "-L", "30" - , "-H", "70" - , "--high" , "#fb4934" - , "--normal", "#fabd2f" - ] 10 + , position = Top + , commands = [ Run $ Cpu ["--template", "\63521 %" + , "-L", "30" + , "-H", "70" + , "--high", red + , "--normal", yellow + ] 10 , Run $ Alsa "default" "Master" - [ "--template", "" - , "--suffix" , "True" - , "--" - , "--on", "" - ] - , Run $ Memory ["--template", "Mem: %"] 10 - , Run $ Swap [] 10 - , Run $ Date "%a %D %I:%M %p" "date" 10 + [ "--template", "墳 " + , "--suffix", "True" + , "--" + , "--on", "" + , "--off", "/mute" + , "-c", red + ] + , Run $ Memory ["--template", "\57958 %" + , "--High", "60" + , "--high", orange + ] 10 + , Run $ Swap ["--template", concat ["[%]"] + , "--High", "0" + , "--high", orange + ] 10 + , Run $ Date (concat ["\62956 %a %D %I:%M %p"]) "date" 10 + , Run $ DynNetwork [ "--template", (concat ["\62722 : kBtx kBrx"]) + , "--Low", "5000" -- units: B/s + , "--High", "100000" -- units: B/s + , "--low", green + , "--normal", orange + , "--high", red + ] 10 + , Run $ Battery [ "--template", "\62840 " + , "--Low", "20" -- units: % + , "--High", "80" -- units: % + , "--low", red + , "--normal", green + , "--high", blue + + , "--" -- battery specific options + -- discharging status + , "-o", "% ()" + -- AC "on" status + , "-O", "+%" + -- charged status + , "-i", "Charged" + ] 50 + , Run $ Com "brightness" [] "" 10 , Run XMonadLog ] , sepChar = "%" , alignSep = "}{" - , template = "%XMonadLog% }{ %alsa:default:Master% | %cpu% | %memory% * %swap% | %date% " - } + , template = " %XMonadLog% }{%alsa:default:Master%|\62941 %brightness%|%battery%|%dynnetwork%|%cpu%|%memory%%swap%|%date% " + } main :: IO() main = xmobar config diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs index bde627c..0c55e5c 100644 --- a/xmonad/xmonad.hs +++ b/xmonad/xmonad.hs @@ -1,21 +1,29 @@ import XMonad -import System.Exit (exitSuccess) + +import XMonad.Actions.UpdatePointer +import XMonad.Actions.CycleWS +import XMonad.Actions.DwmPromote import XMonad.Hooks.DynamicLog import XMonad.Hooks.ManageHelpers import XMonad.Hooks.StatusBar import XMonad.Hooks.EwmhDesktops -import XMonad.Util.Cursor +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.WindowSwallowing +import XMonad.Layout.ThreeColumns +import XMonad.Layout.Spacing +import XMonad.Layout.NoBorders +import XMonad.Layout.Renamed +import XMonad.Layout.Accordion +import XMonad.Layout.Grid + +import XMonad.Util.Cursor import XMonad.Util.EZConfig import XMonad.Util.Loggers import XMonad.Util.Ungrab -import XMonad.Layout.ThreeColumns -import XMonad.Layout.Spacing -import XMonad.Actions.CycleWS -import XMonad.Layout.Renamed -import XMonad.Layout.Spacing +import System.Exit (exitSuccess) main :: IO () main = xmonad @@ -26,68 +34,80 @@ main = xmonad myConfig = def { modMask = mod4Mask -- Rebind Mod to the Super key - , layoutHook = myLayout - , manageHook = myManageHook - , startupHook = setDefaultCursor xC_left_ptr - , workspaces = myWorkspaces + , layoutHook = lessBorders OnlyFloat $ avoidStruts $ myLayout -- layouts + , manageHook = myManageHook -- float/swallow rules + , startupHook = setDefaultCursor xC_left_ptr -- sets the cursor + , handleEventHook = swallowEventHook (className =? "Alacritty") (return True) -- make alacritty swallowable + , workspaces = myWorkspaces -- workspace names + , logHook = updatePointer (0.5, 0.5) (0, 0) -- warp pointer to center of window on focus , borderWidth = 2 , normalBorderColor = "#3c3836" , focusedBorderColor = "#928374" } `additionalKeysP` - [ ("M-S-", spawn "slock") - , ("M-", unGrab *> spawn "screenshot" ) - , ("M-S-f", spawn "librewolf-bin" ) - , ("M-S-k", spawn "keepassxc" ) - , ("M-S-", spawn "spawn-alacritty") - , ("M-p", spawn "dmenu_run_history" ) + [ -- executables + ("M-S-", spawn "slock") + , ("M-S-f", spawn "librewolf-bin") + , ("M-S-k", spawn "keepassxc") , ("M-", spawn "volmute") , ("M-", spawn "voldown") , ("M-", spawn "volup") , ("M-", spawn "brightness-down") , ("M-", spawn "brightness-up") , ("M-", spawn "screenshot") + , ("M-p", spawn "dmenu_run_history -fn 'JetBrains Mono NF:style=medium:size=11' -nb '#3c3836' -nf '#ebdbb2' -sb '#504945' -sf '#ebdbb2'") + , ("M-S-", spawn "spawn-alacritty") + -- XMonad calls , ("M-", toggleWS) + , ("M-", dwmpromote) + -- layout jumps + , ("M-t", sendMessage $ JumpToLayout "Normal") + -- rebound quit call , ("M-S-", io exitSuccess) - , ("M-S-q", spawn "true") + ] + `removeKeysP` + [ -- default quit keybind, as moved to M-S- + ("M-S-q") ] +myWorkspaces :: [String] myWorkspaces = [ "!", "@", "#", "$", "%", "^", "&", "*", "(" ] -myLayout = tiled ||| full ||| threeCol +myLayout = tiled ||| full ||| threeCol ||| accordion ||| grid where - threeCol = renamed [Replace "ThreeCol"] $ spacing 2 $ ThreeColMid nmaster delta ratio - tiled = renamed [Replace "Tall"] $ spacing 2 $ Tall nmaster delta ratio - full = renamed [Replace "Full"] $ spacing 2 $ Full - nmaster = 1 -- Default number of windows in the master pane - ratio = 6/10 -- Default proportion of screen occupied by master pane - delta = 2/100 -- Percent of screen to increment by when resizing panes + tiled = renamed [Replace "Normal"] $ spaced $ Tall nmaster delta ratio + full = renamed [Replace "Full"] $ spaced $ Full + threeCol = renamed [Replace "ThreeCol"] $ spaced $ ThreeColMid nmaster delta ratio + accordion = renamed [Replace "Accrdin"] $ spaced $ Accordion + grid = renamed [Replace "Grid"] $ spaced $ Grid + nmaster = 1 -- Default number of windows in the master pane + ratio = 6/10 -- Default proportion of screen occupied by master pane + delta = 2/100 -- Percent of screen to increment by when resizing panes + spaced = spacing 2 myManageHook :: ManageHook myManageHook = composeAll [ className =? "Gimp" --> doFloat , isDialog --> doFloat - ] + ] myXmobarPP :: PP myXmobarPP = def { ppSep = magenta " • " , ppTitleSanitize = xmobarStrip - , ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2 - , ppHidden = white . wrap " " "" - , ppHiddenNoWindows = lowWhite . wrap " " "" + , ppCurrent = wrap "" "" . xmobarBorder "Top" "#8be9fd" 2 , ppUrgent = red . wrap (yellow "!") (yellow "!") , ppOrder = \[ws, l, _, wins] -> [ws, l, wins] , ppExtras = [logTitles formatFocused formatUnfocused] } where - formatFocused = wrap (white "[") (white "]") . green . ppWindow - formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . lowWhite . ppWindow + formatFocused = wrap (white "{") (white "}") . aqua . ppWindow . shorten 80 + formatUnfocused = wrap (lowWhite "<") (lowWhite ">") . lowWhite . ppWindow . shorten 40 -- | 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 80 + ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) blue, lowWhite, magenta, red, white, yellow :: String -> String magenta = xmobarColor "#d3869b" "" @@ -96,4 +116,5 @@ myXmobarPP = def yellow = xmobarColor "#fabd2f" "" red = xmobarColor "#fb4934" "" green = xmobarColor "#b8bb26" "" - lowWhite = xmobarColor "#a89984" "" \ No newline at end of file + lowWhite = xmobarColor "#a89984" "" + aqua = xmobarColor "#8ec07c" "" \ No newline at end of file -- cgit v1.2.3