From 5b41f4664acf3ea786295e244b9524ef62b0be38 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Fri, 13 Oct 2023 16:15:12 -0600 Subject: experimenting with xmonad/xmobar --- alacritty/alacritty.yml | 2 +- update.sh | 2 + vscode/settings.json | 9 +++-- x/.Xresources | 2 + x/.xinitrc | 6 ++- xmobar/xmobar.hs | 34 +++++++++++++++++ xmonad/xmonad.hs | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 xmobar/xmobar.hs create mode 100644 xmonad/xmonad.hs diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml index b52f8be..ce70c08 100644 --- a/alacritty/alacritty.yml +++ b/alacritty/alacritty.yml @@ -38,7 +38,7 @@ window: padding: x: 10 y: 7 - opacity: 0.85 + opacity: 1 mouse: hide_when_typing: true diff --git a/update.sh b/update.sh index 0857190..f3bd820 100755 --- a/update.sh +++ b/update.sh @@ -17,6 +17,8 @@ cp ~/bin/spawn-alacritty ./x cp ~/bin/quitconf ./x cp ~/bin/battery ./x cp ~/bin/startdwm ./x +cp ~/.config/xmobar/xmobar.hs ./xmobar +cp ~/.config/xmonad/xmonad.hs ./xmonad cp ~/.config/VSCodium/User/settings.json ./vscode # other config files diff --git a/vscode/settings.json b/vscode/settings.json index 51e87f7..47d364e 100644 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -1,13 +1,13 @@ { "editor.inlineSuggest.enabled": true, - "window.menuBarVisibility": "toggle", + "window.menuBarVisibility": "hidden", "telemetry.telemetryLevel": "off", "telemetry.enableTelemetry": false, "java.import.gradle.enabled": true, "workbench.colorCustomizations": { "statusBarItem.remoteBackground": "#79740e", - "statusBar.debuggingBackground": "#d65d0e" + "statusBar.debuggingBackground": "#d65d0e", }, "editor.fontFamily": "'JetBrains Mono'", "java.configuration.runtimes": [ @@ -74,5 +74,8 @@ "debug.onTaskErrors": "showErrors", "explorer.confirmDelete": false, "window.zoomLevel": 1, - "errorLens.messageMaxChars": 200 + "avdmanager.sdkPath": "/home/bryson/.android/sdk", + "avdmanager.executable": "/home/bryson/.android/sdk/tools/bin/avdmanager", + "avdmanager.sdkManager": "/home/bryson/.android/sdk/tools/bin/sdkmanager", + "haskell.manageHLS": "GHCup" } \ No newline at end of file diff --git a/x/.Xresources b/x/.Xresources index 7ab6808..6f83c5c 100644 --- a/x/.Xresources +++ b/x/.Xresources @@ -1,2 +1,4 @@ Xcursor.theme: Adwaita Xcursor.size: 24 +Sxiv.background: #3c3836 +Sxiv.foreground: #fbf1c7 diff --git a/x/.xinitrc b/x/.xinitrc index d71925a..85323f7 100644 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -56,7 +56,7 @@ light -S 30 & # pacmd set-sink-volume alsa_output.pci-0000_03_00.6.HiFi__hw_Generic_1__sink 0 & # set up wallpaper -feh --bg-fill ~/Pictures/Wallpapers/unsplash-beach.jpg +feh --bg-fill ~/Pictures/Wallpapers/solid-gruvbox.png & # apply Xresources xrdb -merge ~/.Xresources @@ -83,5 +83,7 @@ fi # start dwm redshift & +xmobar & xset r rate 300 80 -exec /home/bryson/bin/startdwm +#exec /home/bryson/bin/startdwm +exec $HOME/.cache/xmonad/xmonad-x86_64-linux diff --git a/xmobar/xmobar.hs b/xmobar/xmobar.hs new file mode 100644 index 0000000..29eac0c --- /dev/null +++ b/xmobar/xmobar.hs @@ -0,0 +1,34 @@ +import Xmobar + +config :: Config +config = + defaultConfig + { overrideRedirect = False + , font = "xft:JetBrains Mono NF:style=medium:size=9" + , bgColor = "#3c3836" + , fgColor = "#ebdbb2" + , position = TopW L 120 + , commands = [ Run $ Cpu + [ "-L", "30" + , "-H", "70" + , "--high" , "#fb4934" + , "--normal", "#fabd2f" + ] 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 + , Run XMonadLog + ] + , sepChar = "%" + , alignSep = "}{" + , template = "%XMonadLog% }{ %alsa:default:Master% | %cpu% | %memory% * %swap% | %date% " + } + +main :: IO() +main = xmobar config diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs new file mode 100644 index 0000000..bde627c --- /dev/null +++ b/xmonad/xmonad.hs @@ -0,0 +1,99 @@ +import XMonad +import System.Exit (exitSuccess) + +import XMonad.Hooks.DynamicLog +import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.StatusBar +import XMonad.Hooks.EwmhDesktops +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 + +main :: IO () +main = xmonad + . ewmh + . ewmhFullscreen + . withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey + $ myConfig + +myConfig = def + { modMask = mod4Mask -- Rebind Mod to the Super key + , layoutHook = myLayout + , manageHook = myManageHook + , startupHook = setDefaultCursor xC_left_ptr + , workspaces = myWorkspaces + , 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" ) + , ("M-", spawn "volmute") + , ("M-", spawn "voldown") + , ("M-", spawn "volup") + , ("M-", spawn "brightness-down") + , ("M-", spawn "brightness-up") + , ("M-", spawn "screenshot") + , ("M-", toggleWS) + , ("M-S-", io exitSuccess) + , ("M-S-q", spawn "true") + ] + +myWorkspaces = [ "!", "@", "#", "$", "%", "^", "&", "*", "(" ] + +myLayout = tiled ||| full ||| threeCol + 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 + +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 " " "" + , 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 + + -- | 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 + + blue, lowWhite, magenta, red, white, yellow :: String -> String + magenta = xmobarColor "#d3869b" "" + blue = xmobarColor "#83a598" "" + white = xmobarColor "#ebdbb2" "" + yellow = xmobarColor "#fabd2f" "" + red = xmobarColor "#fb4934" "" + green = xmobarColor "#b8bb26" "" + lowWhite = xmobarColor "#a89984" "" \ No newline at end of file -- cgit v1.2.3