fix game launchers

This commit is contained in:
Lucas Barbieri 2023-04-18 18:30:26 -03:00
parent 1a5538218b
commit d903c5c002
12 changed files with 220 additions and 1327 deletions

7
configs/xmonad/build-bin Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# Recompile
cd "$XMONAD_CONFIG_DIR" && stack-bin install || exit
# Create a hard link at the requested destination, replacing any existing one.
ln -f -T "$(stack-bin exec -- which xmonad)" "$1"

View File

@ -1,527 +1,12 @@
{-# LANGUAGE module Main (main) where
MultiWayIf -- Required for `toggleFull` in `myAdditionalKeys`
, LambdaCase -- Required for `(\case)` statement in `myXmobarPP`
, FlexibleContexts
, OverloadedStrings
#-}
{-# OPTIONS_GHC -Wno-missing-signatures
-Wno-orphans #-}
-- Data Imports
import Data.Functor
import Data.List (isInfixOf)
import qualified Data.Map as M
import Data.Monoid
-- Used in io exitSuccess
import System.Environment (getEnv)
import System.Exit
import System.IO.Unsafe (unsafeDupablePerformIO)
-- XMonad imports
import XMonad import XMonad
import XMonad.Actions.NoBorders (toggleBorder)
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDebug
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Hooks.WindowSwallowing
import XMonad.Layout.Fullscreen
import XMonad.Layout.NoBorders
import XMonad.Layout.SimpleFloat
import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W
import XMonad.Util.ClickableWorkspaces
import XMonad.Util.Cursor
import XMonad.Util.EZConfig
import qualified XMonad.Util.Hacks as Hacks import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.NamedScratchpad
import XMonad.Util.SpawnOnce
import XMonad.Util.Ungrab
-- import qualified DBus as D
-- import qualified DBus.Client as D
main :: IO () main :: IO ()
main = main =
do xmonad $
xmonad fullscreenSupport
$ debugManageHookOn "M-S-d"
. docks
. ewmhFullscreen
. fullscreenSupport
. ewmh
. Hacks.javaHack
-- . withEasySB xmobar toggleSB
-- . withSB xmobar2
$ myConfig
-- where
-- toggleSB XConfig {modMask = modm} = (modm, xK_m)
-- Windows key/Super key
myModMask :: KeyMask
myModMask = mod4Mask
-- Default Terminal
myTerminal :: String
myTerminal = "kitty"
-- Default Launcher
myLauncher :: String
myLauncher = myHomeDir ++ "/.config/rofi/launchers/type-6/launcher.sh"
-- Default Launcher
-- myWinSwitch :: String
-- myWinSwitch = myHomeDir ++ "/.config/rofi/launchers/type-6/tab.sh"
-- Default Launcher
myFileManager :: String
myFileManager = "kitty -e ranger"
-- Default Browser
myBrowser :: String
myBrowser = "brave-bin"
myPowerMenu :: String
myPowerMenu = myHomeDir ++ "/.config/rofi/powermenu/type-6/powermenu.sh"
-- Workspaces
myWorkspaces :: [String]
myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "msc", "eml", "stm"]
-- myWorkspaces = map show [1 .. 9]
-- Border Width
myBorderWidth :: Dimension
myBorderWidth = 1
-- Formal Unfocused Color
myNormColor :: String
myNormColor = "#383830"
-- Focused Color
myFocusColor :: String
myFocusColor = "#a2a2a2"
-- Home Directory
myHomeDir :: String
myHomeDir = unsafeDupablePerformIO (getEnv "HOME")
-- focus follows the mouse pointer
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
myKeys conf@(XConfig {XMonad.modMask = modm}) =
M.fromList $
[ ((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0],
(f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
]
++ [ ((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_comma, xK_period, xK_z] [0 ..],
(f, m) <- [(W.view, 0), (W.shift, shiftMask)]
]
myAdditionalKeys :: [(String, X ())]
myAdditionalKeys =
base
++ window
++ applications
++ multimedia
where
-- Force killing a frozen window.
forceKillWindow :: Window -> X ()
forceKillWindow w = withDisplay $ \d ->
io $ void $ killClient d w
-- Making a window have a full float over a workspace.
toggleFull :: Window -> X ()
toggleFull w = windows $ \s ->
if
| M.lookup w (W.floating s) == Just fullscreen -> W.sink w s
| otherwise -> W.float w fullscreen s
where
fullscreen = W.RationalRect 0 0 1 1
-- Screenshots
screenShotSelection = myHomeDir ++ "/.local/bin/print-select" :: String
screenShotFullscreen = myHomeDir ++ "/.local/bin/print-fullscreen" :: String
screenShotTmp = myHomeDir ++ "/.local/bin/print-tmp" :: String
screenShotApp = myHomeDir ++ "/.local/bin/print-window.sh" :: String
-- XMonad base keybinds.
base =
[ ("M-g", withFocused toggleBorder),
("M-S-c", kill),
("M-S-x", withFocused forceKillWindow),
("M-<Space>", sendMessage NextLayout),
("M-n", refresh),
("M-S-q", io exitSuccess),
("C-S-r", spawn "xmonad --recompile && killall xmobar2 ; killall xmobar ; xmonad --restart"),
("C-S-q", spawn "pkill -KILL -u $USER")
]
-- Window management keybinds.
window =
[ ("M-<Tab>", windows W.focusDown),
("M-j", windows W.focusDown),
("M-k", windows W.focusUp),
("M-S-m", windows W.focusMaster),
("M-m", sendMessage ToggleStruts),
("M-p", windows W.swapMaster),
("M-S-j", windows W.swapDown),
("M-S-h", windows W.swapDown),
("M-S-k", windows W.swapUp),
("M-S-l", windows W.swapUp),
("M-h", sendMessage Shrink),
("M-l", sendMessage Expand),
("M-t", withFocused $ windows . W.sink),
("M-f", withFocused toggleFull)
]
-- Spawning applications.
applications =
[ ("M-<Return>", spawn myTerminal),
("M-S-m", namedScratchpadAction myScratchpads "ncmpcpp"),
("M-C-<Return>", namedScratchpadAction myScratchpads "terminal"),
("M-S-<Escape>", spawn myPowerMenu),
("M-b", spawn myBrowser),
("M-v", spawn "code"),
("M-S-s", spawn "~/steam/steam.sh"),
("S-<Print>", unGrab *> spawn screenShotSelection),
("C-S-<Print>", unGrab *> spawn screenShotTmp),
("C-<Print>", unGrab *> spawn screenShotApp),
("<Print>", spawn screenShotFullscreen),
("M-S-<Return>", spawn myLauncher),
-- ("M1-<Tab>", spawn myWinSwitch),
("M-e", spawn myFileManager)
]
-- Multimedia keybinds.
multimedia =
[ ("<XF86AudioPlay>", spawn "playerctl play-pause"),
("<XF86AudioPrev>", spawn "playerctl previous"),
("<XF86AudioNext>", spawn "playerctl next"),
("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"),
("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -1.5%"),
("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +1.5%"),
("<Pause>", spawn "amixer sset Capture toggle"),
("M-<Escape>", spawn "mpc toggle"),
("M-<F1>", spawn "mpc prev"),
("M-<F2>", spawn "mpc next")
]
myMouseBindings :: XConfig l -> M.Map (KeyMask, Button) (Window -> X ())
myMouseBindings XConfig {XMonad.modMask = modm} =
M.fromList
-- Set the window to floating mode and move by dragging.
[ ((modm, button1), \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster),
-- Raise the window to the top of the stack.
((modm, button2), \w -> focus w >> windows W.shiftMaster),
-- Set the window to floating mode and resize by dragging.
((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster)
]
myStartupHook :: X ()
myStartupHook = do
_ <-
traverse
spawnOnce
[ "sh ~/scripts/screenlayout.sh",
"nitrogen --restore &",
-- "sh ~/scripts/wallpaper.sh",
"touch ~/tmp/touchy && rm -rf ~/tmp/*",
myHomeDir ++ "/.local/bin/picom-ibhagwan -b --experimental-backends &",
"nm-applet &",
-- "picom",
"xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Profile Enabled' 0, 1 && xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Speed' 0.5",
"setxkbmap -option ctrl:nocaps br abnt2",
"nm-applet",
-- "trayer-srg --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x2F2F2F --height 25 --distance 0 --margin 0 --alpha 0 --monitor 0 --transparent true", -- normal bar
-- "trayer-srg --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x002b36 --height 30 --transparent false --distance 15 --margin 10 --alpha 0 --monitor 0 --transparent true", -- spaced bar
"dunst &",
"lxqt-policykit-agent &",
"xrdb -load ~/.Xresources",
"redshift -t 4500:2500 -l -23.5475:-46.63611 -b 0.9:0.6"
]
setDefaultCursor xC_left_ptr
setWMName "zmonad"
isInstance (ClassApp c _) = className =? c
isInstance (TitleApp t _) = title =? t
isInstance (NameApp n _) = appName =? n
type AppName = String
type AppTitle = String
type AppClassName = String
type AppCommand = String
data App
= ClassApp AppClassName AppCommand
| TitleApp AppTitle AppCommand
| NameApp AppName AppCommand
deriving (Show)
gimp = ClassApp "Gimp" "gimp"
gimp2 = ClassApp "Gimp-2.99" "gimp-2.99"
multimc = ClassApp "MultiMC" "MultiMC"
about = TitleApp "About Mozilla Firefox" "About Mozilla Firefox"
message = ClassApp "Xmessage" "Xmessage"
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
-- Like '=?' but matches substrings.
q =?? x = fmap (isInfixOf x) q
myManageHook = manageRules
where
-- Hides windows without ignoring it, see doHideIgnore in XMonad contrib.
doHide = ask >>= doF . W.delete :: ManageHook
-- WM_WINDOW_ROLE will be parsed with the role variable.
isRole = stringProperty "WM_WINDOW_ROLE"
-- To match multiple properties with one operator.
anyOf = foldl (<||>) (pure False) :: [Query Bool] -> Query Bool
-- To match multiple classNames with one operator.
match = anyOf . fmap isInstance :: [App] -> Query Bool
-- Checking for splash dialogs.
isSplash = isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_SPLASH"
-- Checking for pop-ups.
isPopup = isRole =? "pop-up"
-- Checking for file chooser dialog.
isFileChooserDialog = isRole =? "GtkFileChooserDialog"
-- Managing rules for applications.
manageRules =
composeOne
[ transience,
isDialog -?> doCenterFloat,
isFullscreen -?> (doF W.focusDown <> doFullFloat),
match
[ gimp,
gimp2,
about,
message
]
-?> doFloat,
match
[ multimc
]
-?> doCenterFloat,
anyOf
[ isFileChooserDialog,
isDialog,
isPopup,
isSplash
]
-?> doCenterFloat
]
<> composeAll
[ manageDocks <> namedScratchpadManageHook myScratchpads,
className =? "firefox" <&&> title =? "File Upload" --> doFloat,
className =? "firefox" <&&> title =? "Library" --> doCenterFloat,
className =? "firefox" <&&> title ^? "Save" --> doFloat,
className =? "firefox" <&&> resource =? "Toolkit" --> doFloat,
className =? "firefox" <&&> title ^? "Sign in" --> doFloat,
className ^? "jetbrains-" <&&> title ^? "Welcome to " --> doCenterFloat,
className ^? "jetbrains-" <&&> title =? "splash" --> doFloat,
className ^? "Visual " <&&> isDialog --> doCenterFloat,
className =? "firefox-esr" --> doShift "web",
className =? "Chromium-browser-chromium" --> doShift "web",
className =? "Brave-browser" --> doShift "web",
className =? "Virt-manager" --> doShift "vm",
className =? "discord" --> doShift "irc",
className =? "discord-screenaudio" --> doShift "irc",
className =? "Spotify" --> doShift "msc",
className =? "thunderbird" --> doShift "eml",
className =? "Steam" --> doShift "stm",
className =? "steam" --> doShift "stm",
className =? "obs" --> doShift "vm",
className =? "Lutris" --> doShift "vm" <> doFloat,
className =? "explorer.exe" --> doShift "gfx",
className =? "riotclientux.exe" --> doShift "gfx",
className =? "dauntless-win64-shipping.exe" --> doShift "gfx",
className =? "battle.net.exe" --> doShift "gfx" <> doFloat,
className =? "Pcmanfm" --> doFloat,
className =? "Thunar" --> doFloat,
className =? "Pavucontrol" --> doFloat,
className =? "Nitrogen" --> doFloat,
className =? "Wrapper-2.0" --> doFloat,
className =? "TeamSpeak 3" --> doShift "irc",
className =? "easyeffects" --> doFloat <> doShift "vm",
className =? "Arandr" --> doFloat,
resource =? "desktop_window" --> doIgnore,
resource =? "kdesktop" --> doIgnore,
className =? "Conky" --> doIgnore,
isRole ^? "About" <||> isRole ^? "about" --> doFloat,
"_NET_WM_WINDOW_TYPE" `isInProperty` "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE" --> doIgnore <> doRaise,
-- Steam Game Fixes
className =? "steam_app_1551360" <&&> title /=? "Forza Horizon 5" --> doHide, -- Prevents black screen when fullscreening.
className =?? "league" --> doShift "gfx" <> doCenterFloat <> hasBorder False,
className =?? "riot" --> doShift "gfx" <> doCenterFloat <> hasBorder False,
className =?? "csgo" --> doShift "gfx" <> doCenterFloat <> hasBorder False,
className =? "gamescope" --> doShift "gfx" <> doCenterFloat <> hasBorder False,
title =? "Wine System Tray" --> doHide, -- Prevents Wine System Trays from taking input focus.
className =?? "steam_" --> doShift "gfx" <> hasBorder False
]
{- May be useful one day
doClose = ask >>= liftX . killWindow >> mempty :: ManageHook
doForceKill = ask >>= liftX . forceKillWindow >> mempty :: ManageHook
-}
myEventHook :: Event -> X All
myEventHook _ = return (All True)
myLayoutHook =
avoidStruts $
lessBorders OnlyScreenFloat $
spacingRaw False (Border w w w w) True (Border w w w w) True $
tiled ||| simpleFloat ||| Mirror tiled ||| Full
where
tiled = Tall nmaster delta ratio
nmaster = 1 -- Default number of windows in the master pane.
ratio = 1 / 2 -- Default proportion of screen occupied by master panes.
delta = 3 / 100 -- Percent of screen increment by when resizing panes.
w = 2 -- Width of pixel size between windows while tiled.
myXmobarPP :: X PP
myXmobarPP =
clickablePP $
filterOutWsPP ["NSP"] $
def def
{ ppCurrent = xmobarColor "#ece1d7" "" . xmobarBorder "Bottom" "#89b3b6" 2, { handleEventHook = handleEventHook def <> Hacks.windowedFullscreenFixEventHook
ppVisible = xmobarColor "#A0A0A0" "" . xmobarBorder "Bottom" "#78997a" 2,
ppVisibleNoWindows = Just (xmobarBorder "Bottom" "#78997a" 2 . xmobarColor "#A0A0A0" ""),
ppHidden = xmobarColor "#c1a78e" "" . xmobarBorder "Top" "#f0c674" 2,
ppHiddenNoWindows = xmobarColor "#c1a78e" "",
ppUrgent = xmobarColor "#D47786" "" . wrap "!" "!",
ppTitle = xmobarColor "#ece1d7" "" . shorten 40,
ppSep = wrapSep " ",
ppTitleSanitize = xmobarStrip,
ppWsSep = " ",
ppLayout =
xmobarColor "#002B36" ""
. ( \case
"Spacing Tall" -> "<icon=tiled.xpm/>"
"Spacing Mirror Tall" -> "<icon=mirrortiled.xpm/>"
"Spacing Full" -> "<icon=full.xpm/>"
"Spacing Simple Float" -> "<icon=floating.xpm/>"
"Simple Float" -> "<icon=floating.xpm/>"
)
} }
where
wrapSep :: String -> String
wrapSep =
wrap
(xmobarColor "#002B36" "#002B36" (xmobarFont 2 "\xe0b4"))
(xmobarColor "#002B36" "#002B36" (xmobarFont 2 "\xe0b6"))
myXmobar :: String
myXmobar = (myHomeDir ++ "/.local/bin/xmobar " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs")
xmobar :: StatusBarConfig
xmobar = statusBarProp myXmobar myXmobarPP
myXmobar2 :: String
myXmobar2 = (myHomeDir ++ "/.local/bin/xmobar2 " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs")
xmobar2 :: StatusBarConfig
xmobar2 = statusBarProp myXmobar2 myXmobarPP
myConfig =
def
{ modMask = myModMask,
focusFollowsMouse = myFocusFollowsMouse,
terminal = myTerminal,
mouseBindings = myMouseBindings,
borderWidth = myBorderWidth,
normalBorderColor = myNormColor,
focusedBorderColor = myFocusColor,
layoutHook = myLayoutHook,
startupHook = myStartupHook,
manageHook = myManageHook,
handleEventHook =
Hacks.windowedFullscreenFixEventHook
<> swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True)
<> Hacks.trayerPaddingXmobarEventHook
<> myEventHook,
workspaces = myWorkspaces,
keys = myKeys
}
`additionalKeysP` myAdditionalKeys
myScratchpads =
[ NS "terminal" spawnTerm findTerm manageTerm,
NS "ncmpcpp" spawnncmpcpp findncmpcpp managencmpcpp
]
where
spawnTerm = myTerminal ++ " --name scratchpad"
findTerm = resource =? "scratchpad"
manageTerm = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 - h
l = 0.95 - w
spawnncmpcpp = myTerminal ++ " --name ncmpcpp -e ncmpcpp"
findncmpcpp = resource =? "ncmpcpp"
managencmpcpp = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 - h
l = 0.95 - w
-- I GIVE UP ON DBUS.
-- logTitle :: D.Client -> X ()
-- logTitle ch = dynamicLogWithPP def
-- {ppCurrent = unPango
-- ,ppVisible = pangoInactive
-- ,ppHidden = const ""
-- ,ppHiddenNoWindows = const ""
-- ,ppUrgent = pangoBold
-- ,ppTitle = unPango
-- ,ppLayout = unPango
-- ,ppWsSep = ""
-- ,ppSep = "⋮"
-- ,ppOrder = swapIcons
-- ,ppSort = getSortByXineramaPhysicalRule horizontalScreenOrderer
-- ,ppOutput = dbusOutput ch
-- }
-- where swapIcons (ws:l:t:nsp:xs) = ws:l:nsp:t:xs
-- -- @@@ so why do the first 4 invocations *only* not match?!
-- swapIcons xs = xs
-- getWellKnownName :: D.Client -> IO ()
-- getWellKnownName ch = do
-- _ <- D.requestName ch
-- (D.busName_ "org.xmonad.Log")
-- [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
-- return ()
-- dbusOutput :: D.Client -> String -> IO ()
-- dbusOutput ch s = do
-- let sig = (D.signal "/org/xmonad/Log" "org.xmonad.Log" "Update")
-- {D.signalBody = [D.toVariant s]}
-- D.emit ch sig
-- -- quick and dirty escaping of HTMLish Pango markup
-- unPango :: String -> String
-- unPango [] = []
-- unPango ('<':xs) = "&lt;" ++ unPango xs
-- unPango ('&':xs) = "&amp;" ++ unPango xs
-- unPango ('>':xs) = "&gt;" ++ unPango xs
-- unPango (x :xs) = x:unPango xs
-- -- show a string as inactive
-- -- @@@ should use gtk theme somehow...
-- pangoInactive :: String -> String
-- pangoInactive s = "<span foreground=\"#8f8f8f\">" ++ unPango s ++ "</span>"
-- -- show a string with highlight
-- pangoBold :: String -> String
-- pangoBold s = "<span weight=\"bold\" foreground=\"#ff2f2f\">" ++ unPango s ++ "</span>"

View File

@ -28,6 +28,7 @@ import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName import XMonad.Hooks.SetWMName
import XMonad.Hooks.StatusBar import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP import XMonad.Hooks.StatusBar.PP
import XMonad.Hooks.UrgencyHook (doAskUrgent)
import XMonad.Hooks.WindowSwallowing import XMonad.Hooks.WindowSwallowing
import XMonad.Layout.Fullscreen import XMonad.Layout.Fullscreen
import XMonad.Layout.NoBorders import XMonad.Layout.NoBorders
@ -51,8 +52,9 @@ main =
xmonad xmonad
$ debugManageHookOn "M-S-d" $ debugManageHookOn "M-S-d"
. docks . docks
. setEwmhActivateHook doAskUrgent
. ewmhFullscreen . ewmhFullscreen
. fullscreenSupport -- . fullscreenSupport
. ewmh . ewmh
. Hacks.javaHack . Hacks.javaHack
. withEasySB xmobar toggleSB . withEasySB xmobar toggleSB
@ -79,7 +81,8 @@ myLauncher = myHomeDir ++ "/.config/rofi/launchers/type-6/launcher.sh"
-- Default Launcher -- Default Launcher
myFileManager :: String myFileManager :: String
myFileManager = "kitty -e ranger" -- myFileManager = "kitty -e ranger"
myFileManager = "thunar"
-- Default Browser -- Default Browser
myBrowser :: String myBrowser :: String
@ -90,13 +93,13 @@ myPowerMenu = myHomeDir ++ "/.config/rofi/powermenu/type-6/powermenu.sh"
-- Workspaces -- Workspaces
myWorkspaces :: [String] myWorkspaces :: [String]
myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "msc", "eml", "stm"] myWorkspaces = ["term", "www", "comms", "games", "misc", "vm", "trash", "stm"]
-- myWorkspaces = map show [1 .. 9] -- myWorkspaces = map show [1 .. 9]
-- Border Width -- Border Width
myBorderWidth :: Dimension myBorderWidth :: Dimension
myBorderWidth = 1 myBorderWidth = 2
-- Formal Unfocused Color -- Formal Unfocused Color
myNormColor :: String myNormColor :: String
@ -104,7 +107,7 @@ myNormColor = "#383830"
-- Focused Color -- Focused Color
myFocusColor :: String myFocusColor :: String
myFocusColor = "#a2a2a2" myFocusColor = "#FF0000"
-- Home Directory -- Home Directory
myHomeDir :: String myHomeDir :: String
@ -225,17 +228,16 @@ myStartupHook = do
traverse traverse
spawnOnce spawnOnce
[ "sh ~/scripts/screenlayout.sh", [ "sh ~/scripts/screenlayout.sh",
"nitrogen --restore &", -- "nitrogen --restore &",
"feh --bg-center ~/Pictures/wallpapers/felca.jpg",
-- "sh ~/scripts/wallpaper.sh", -- "sh ~/scripts/wallpaper.sh",
"touch ~/tmp/touchy && rm -rf ~/tmp/*", "touch ~/tmp/touchy && rm -rf ~/tmp/*",
myHomeDir ++ "/.local/bin/picom-ibhagwan -b --experimental-backends &", myHomeDir ++ "/.local/bin/picom-ibhagwan -b --experimental-backends &",
"nm-applet &", "nm-applet &",
-- "picom",
"xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Profile Enabled' 0, 1 && xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Speed' 0.5", "xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Profile Enabled' 0, 1 && xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Speed' 0.5",
"setxkbmap -option ctrl:nocaps br abnt2", "setxkbmap -option ctrl:nocaps br abnt2",
"nm-applet", "trayer-srg --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x2F2F2F --height 25 --distance 0 --margin 0 --alpha 0 --monitor 0 --transparent true", -- normal bar
-- "trayer-srg --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x2F2F2F --height 25 --distance 0 --margin 0 --alpha 0 --monitor 0 --transparent true", -- normal bar -- "trayer-srg --edge bottom --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x002b36 --height 30 --transparent false --distance 1 --margin 6 --alpha 0 --monitor 0 --transparent true", -- spaced bar
"trayer-srg --edge bottom --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x002b36 --height 30 --transparent false --distance 1 --margin 6 --alpha 0 --monitor 0 --transparent true", -- spaced bar
"dunst &", "dunst &",
"lxqt-policykit-agent &", "lxqt-policykit-agent &",
"xrdb -load ~/.Xresources", "xrdb -load ~/.Xresources",
@ -328,29 +330,31 @@ myManageHook = manageRules
className ^? "jetbrains-" <&&> title ^? "Welcome to " --> doCenterFloat, className ^? "jetbrains-" <&&> title ^? "Welcome to " --> doCenterFloat,
className ^? "jetbrains-" <&&> title =? "splash" --> doFloat, className ^? "jetbrains-" <&&> title =? "splash" --> doFloat,
className ^? "Visual " <&&> isDialog --> doCenterFloat, className ^? "Visual " <&&> isDialog --> doCenterFloat,
className =? "firefox-esr" --> doShift "web", className =? "firefox-esr" --> doShift "www",
className =? "Chromium-browser-chromium" --> doShift "web", className =? "Chromium-browser-chromium" --> doShift "www",
className =? "Brave-browser" --> doShift "web", className =? "Brave-browser" --> doShift "www",
className =? "Virt-manager" --> doShift "vm", className =? "Virt-manager" --> doShift "vm",
className =? "discord" --> doShift "irc", className =? "discord" --> doShift "comms",
className =? "discord-screenaudio" --> doShift "irc", className =? "discord-screenaudio" --> doShift "comms",
className =? "Spotify" --> doShift "msc", className =? "Spotify" --> doShift "msc",
className =? "thunderbird" --> doShift "eml", className =? "thunderbird" --> doShift "trash",
className =? "Steam" --> doShift "stm", className =? "Steam" --> doShift "stm",
className =? "steam" --> doShift "stm", className =? "steam" --> doShift "stm",
className =? "obs" --> doShift "vm", className =? "obs" --> doShift "misc",
className =? "Lutris" --> doShift "vm" <> doFloat, className =? "Lutris" --> doShift "misc",
className =? "explorer.exe" --> doShift "gfx", className =? "explorer.exe" --> doShift "games",
className =? "riotclientux.exe" --> doShift "gfx", className =? "An Anime Game Launcher" --> doShift "misc" <> doCenterFloat <> hasBorder False,
className =? "dauntless-win64-shipping.exe" --> doShift "gfx", className =? "heroic" --> doShift "misc" <> doCenterFloat <> hasBorder False,
className =? "battle.net.exe" --> doShift "gfx" <> doFloat, className =? "riotclientux.exe" --> doShift "games",
className =?? "dauntless" --> doShift "games",
className =? "battle.net.exe" --> doShift "games" <> doFloat,
className =? "Pcmanfm" --> doFloat, className =? "Pcmanfm" --> doFloat,
className =? "Thunar" --> doFloat, className =? "Thunar" --> doFloat,
className =? "Pavucontrol" --> doFloat, className =? "Pavucontrol" --> doFloat,
className =? "Nitrogen" --> doFloat, className =? "Nitrogen" --> doFloat,
className =? "Wrapper-2.0" --> doFloat, className =? "Wrapper-2.0" --> doFloat,
className =? "TeamSpeak 3" --> doShift "irc", className =? "TeamSpeak 3" --> doShift "comms",
className =? "easyeffects" --> doFloat <> doShift "vm", className =? "easyeffects" --> doFloat <> doShift "misc",
className =? "Arandr" --> doFloat, className =? "Arandr" --> doFloat,
resource =? "desktop_window" --> doIgnore, resource =? "desktop_window" --> doIgnore,
resource =? "kdesktop" --> doIgnore, resource =? "kdesktop" --> doIgnore,
@ -359,12 +363,15 @@ myManageHook = manageRules
"_NET_WM_WINDOW_TYPE" `isInProperty` "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE" --> doIgnore <> doRaise, "_NET_WM_WINDOW_TYPE" `isInProperty` "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE" --> doIgnore <> doRaise,
-- Steam Game Fixes -- Steam Game Fixes
className =? "steam_app_1551360" <&&> title /=? "Forza Horizon 5" --> doHide, -- Prevents black screen when fullscreening. className =? "steam_app_1551360" <&&> title /=? "Forza Horizon 5" --> doHide, -- Prevents black screen when fullscreening.
className =?? "league" --> doShift "gfx" <> doCenterFloat <> hasBorder False, className =? "Steam" <&&> title ~? "News" --> doHide,
className =?? "riot" --> doShift "gfx" <> doCenterFloat <> hasBorder False, className =?? "league" --> doShift "games" <> doCenterFloat <> hasBorder False,
className =?? "csgo" --> doShift "gfx" <> doCenterFloat <> hasBorder False, className =?? "deceive" --> doShift "games" <> doCenterFloat <> hasBorder False,
className =? "gamescope" --> doShift "gfx" <> doCenterFloat <> hasBorder False, className =?? "riot" --> doShift "games" <> doCenterFloat <> hasBorder False,
className =?? "Minecraft" --> doShift "games" <> doCenterFloat <> hasBorder False,
className =?? "csgo" --> doShift "games" <> doCenterFloat <> hasBorder False,
className =? "gamescope" --> doShift "games" <> doCenterFloat <> hasBorder False,
title =? "Wine System Tray" --> doHide, -- Prevents Wine System Trays from taking input focus. title =? "Wine System Tray" --> doHide, -- Prevents Wine System Trays from taking input focus.
className =?? "steam_" --> doShift "gfx" <> hasBorder False className =?? "steam_" --> doShift "games" <> hasBorder False <> doCenterFloat
] ]
{- May be useful one day {- May be useful one day
@ -375,6 +382,10 @@ doForceKill = ask >>= liftX . forceKillWindow >> mempty :: ManageHook
myEventHook :: Event -> X All myEventHook :: Event -> X All
myEventHook _ = return (All True) myEventHook _ = return (All True)
-- myActivateHook :: ManageHook
-- myActivateHook = composeAll
-- [ className =? "steam_app_1284210" --> doAskUrgent ]
myLayoutHook = myLayoutHook =
avoidStruts $ avoidStruts $
lessBorders OnlyScreenFloat $ lessBorders OnlyScreenFloat $
@ -392,16 +403,16 @@ myXmobarPP =
clickablePP $ clickablePP $
filterOutWsPP ["NSP"] $ filterOutWsPP ["NSP"] $
def def
-- { ppCurrent = xmobarColor "#ece1d7" "" . xmobarBorder "Bottom" "#89b3b6" 2, { ppCurrent = xmobarColor "#ece1d7" "" . xmobarBorder "Bottom" "#89b3b6" 3,
-- ppVisible = xmobarColor "#A0A0A0" "" . xmobarBorder "Bottom" "#78997a" 2, ppVisible = xmobarColor "#ece1d7" "",
-- ppHidden = xmobarColor "#c1a78e" "" . xmobarBorder "Top" "#f0c674" 2, ppHidden = xmobarColor "#c1a78e" "" . xmobarBorder "Top" "#f0c674" 2,
-- ppHiddenNoWindows = xmobarColor "#c1a78e" "", ppHiddenNoWindows = xmobarColor "#c1a78e" "",
{ ppVisible = xmobarColor "#dddddd" "" . const "\xf10c", -- { ppVisible = xmobarColor "#dddddd" "" . const "\xf10c",
ppCurrent = xmobarColor "#dddddd" "" . const "\xf192", -- ppCurrent = xmobarColor "#dddddd" "" . const "\xf192",
ppHidden = xmobarColor "#777777" "" . const "\xf10c", -- ppHidden = xmobarColor "#777777" "" . const "\xf10c",
ppHiddenNoWindows = xmobarColor "#444444" "" . const "\xf10c", -- ppHiddenNoWindows = xmobarColor "#444444" "" . const "\xf10c",
-- ppVisibleNoWindows = Just (xmobarBorder "Bottom" "#78997a" 2 . xmobarColor "#A0A0A0" ""), ppVisibleNoWindows = Just (xmobarBorder "Bottom" "#78997a" 2 . xmobarColor "#A0A0A0" ""),
ppVisibleNoWindows = Just (xmobarColor "#dddddd" "" . const "\xf10c"), -- ppVisibleNoWindows = Just (xmobarColor "#dddddd" "" . const "\xf10c"),
ppUrgent = xmobarColor "#D47786" "" . wrap "!" "!", ppUrgent = xmobarColor "#D47786" "" . wrap "!" "!",
ppTitle = xmobarColor "#ece1d7" "" . shorten 40, ppTitle = xmobarColor "#ece1d7" "" . shorten 40,
ppSep = wrapSep " ", ppSep = wrapSep " ",
@ -419,19 +430,21 @@ myXmobarPP =
} }
where where
wrapSep :: String -> String wrapSep :: String -> String
wrapSep = (++ xmobarColor "#002b36" "#002B36" (xmobarFont 2 "\xe0b4 ")) -- wrapSep = (++ xmobarColor "#002b36" "#002B36" (xmobarFont 2 "\xe0b4 "))
wrapSep = (++ xmobarColor "#292522" "#292522" (xmobarFont 2 "\xe0b4 "))
-- wrap -- wrap
-- (xmobarColor "#002B36" "#002B36" (xmobarFont 2 "\xe0b4")) -- (xmobarColor "#002B36" "#002B36" (xmobarFont 2 "\xe0b4"))
-- (xmobarColor "#002B36" "#002B36" (xmobarFont 2 "\xe0b6")) -- (xmobarColor "#002B36" "#002B36" (xmobarFont 2 "\xe0b6"))
myXmobar :: String myXmobar :: String
myXmobar = (myHomeDir ++ "/.local/bin/xmobar " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs") myXmobar = (myHomeDir ++ "/.local/bin/xmobar " ++ "-x 0")
xmobar :: StatusBarConfig xmobar :: StatusBarConfig
xmobar = statusBarProp myXmobar myXmobarPP xmobar = statusBarProp myXmobar myXmobarPP
myXmobar2 :: String myXmobar2 :: String
myXmobar2 = (myHomeDir ++ "/.local/bin/xmobar2 " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs") myXmobar2 = (myHomeDir ++ "/.local/bin/xmobar2 " ++ "-x 1")
xmobar2 :: StatusBarConfig xmobar2 :: StatusBarConfig
xmobar2 = statusBarProp myXmobar2 myXmobarPP xmobar2 = statusBarProp myXmobar2 myXmobarPP
@ -449,8 +462,8 @@ myConfig =
startupHook = myStartupHook, startupHook = myStartupHook,
manageHook = myManageHook, manageHook = myManageHook,
handleEventHook = handleEventHook =
Hacks.windowedFullscreenFixEventHook -- Hacks.windowedFullscreenFixEventHook
<> swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True) swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True)
<> Hacks.trayerPaddingXmobarEventHook <> Hacks.trayerPaddingXmobarEventHook
<> myEventHook, <> myEventHook,
workspaces = myWorkspaces, workspaces = myWorkspaces,

View File

@ -85,13 +85,14 @@ baseConfig =
, position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat , position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat , position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat
-} -}
position = Static {xpos = 0, ypos = 0, width = 1920, height = 25}, -- position = Static {xpos = 0, ypos = 0, width = 1920, height = 25},
position = TopH 25,
alpha = 255, alpha = 255,
overrideRedirect = True, overrideRedirect = True,
lowerOnStart = True, lowerOnStart = True,
hideOnStart = False, hideOnStart = False,
allDesktops = True, allDesktops = False,
persistent = True, persistent = False,
iconRoot = myHomeDir ++ "/.config/xmonad/icons", iconRoot = myHomeDir ++ "/.config/xmonad/icons",
iconOffset = -1, iconOffset = -1,
sepChar = "@", sepChar = "@",

View File

@ -5,8 +5,6 @@ import Xmobar
main :: IO () main :: IO ()
main = xmobar =<< configFromArgs =<< myConfig main = xmobar =<< configFromArgs =<< myConfig
-- main = xmobar =<< myConfig
myHomeDir :: String myHomeDir :: String
myHomeDir = unsafeDupablePerformIO (getEnv "HOME") myHomeDir = unsafeDupablePerformIO (getEnv "HOME")
@ -84,13 +82,14 @@ baseConfig =
, position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat , position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat , position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat
-} -}
position = Static {xpos = 1920, ypos = 148, width = 1920, height = 25}, -- position = Static {xpos = 1920, ypos = 148, width = 1920, height = 25},
position = TopH 25,
alpha = 255, alpha = 255,
overrideRedirect = True, overrideRedirect = True,
lowerOnStart = True, lowerOnStart = True,
hideOnStart = False, hideOnStart = False,
allDesktops = True, allDesktops = False,
persistent = True, persistent = False,
iconRoot = myHomeDir ++ "/.config/xmonad/icons", iconRoot = myHomeDir ++ "/.config/xmonad/icons",
iconOffset = -1, iconOffset = -1,
sepChar = "@", sepChar = "@",

View File

@ -21,7 +21,7 @@ myConfig =
\<fn=4><fc=#558c8e,#002b36:5>\xf30d </fc></fn>\ \<fn=4><fc=#558c8e,#002b36:5>\xf30d </fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> " \<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
] ]
<> ["<fn=5>@UnsafeXMonadLog@</fn>}"] <> ["<fn=2>@UnsafeXMonadLog@</fn>}"]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\ <> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#E06C75,#002b36:5>\xf001 </fc></fn>\ \<fn=4><fc=#E06C75,#002b36:5>\xf001 </fc></fn>\
\<fn=5><fc=#E06C75,#002b36:5>@music@</fc></fn>\ \<fn=5><fc=#E06C75,#002b36:5>@music@</fc></fn>\
@ -69,15 +69,15 @@ myCommands =
baseConfig :: Config baseConfig :: Config
baseConfig = baseConfig =
defaultConfig defaultConfig
{ font = "xft:Sugar Snow:pixelsize=14:antialias=true:hinting=true", { font = "Sugar Snow 13",
additionalFonts = additionalFonts =
[ "xft:Sugar Snow:pixelsize=12:antialias=true:hinting=true", [ "Sugar Snow 11",
"xft:Sugar Snow:size=15:antialias=true:hinting=true", "Sugar Snow 13",
"xft:Sugar Snow:size=13:antialias=true:hinting=true", "Sugar Snow 12",
"xft:JetBrainsMono Nerd Font:size=12:antialias=true:hinting=true", "JetBrainsMono Nerd Font 12",
"xft:Sugar Snow:pixelsize=14:antialias=true:hinting=true" "Sugar Snow 13"
], ],
textOffsets = [20, 22, 21, 21, 20], -- textOffsets = [20, 22, 21, 21, 20],
bgColor = "#002b36", bgColor = "#002b36",
fgColor = "#c8b6b8", fgColor = "#c8b6b8",
borderColor = "#272727", borderColor = "#272727",
@ -88,7 +88,7 @@ baseConfig =
, position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat , position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat , position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat
-} -}
position = Static {xpos = 20, ypos = 15, width = 1880, height = 34}, position = Static {xpos = 0, ypos = 0, width = 1920, height = 34},
alpha = 255, alpha = 255,
overrideRedirect = True, overrideRedirect = True,
lowerOnStart = True, lowerOnStart = True,

View File

@ -0,0 +1,100 @@
import System.Environment
import System.IO.Unsafe (unsafeDupablePerformIO)
import Xmobar
main :: IO ()
main = xmobar =<< configFromArgs =<< myConfig
-- main = xmobar =<< myConfig
myHomeDir :: String
myHomeDir = unsafeDupablePerformIO (getEnv "HOME")
myConfig :: IO Config
myConfig =
do
pure
baseConfig
{ template =
concat $
[ " <fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#558c8e,#002b36:5>\xf30d </fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> ["<fn=5>@UnsafeXMonadLog@</fn>}"]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#E06C75,#002b36:5>\xf001 </fc></fn>\
\<fn=5><fc=#E06C75,#002b36:5>@music@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn>{"
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#56B6C2,#002b36:5>\xf2db </fc></fn>\
\<fn=5><fc=#56B6C2,#002b36:5>CPU: @cpu@%</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#C678DD,#002b36:5>\xf538 </fc></fn>\
\<fn=5><fc=#C678DD,#002b36:5>Mem: @memory@% </fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#98C379,#002b36:5>@volicon@</fc></fn>\
\<fn=5><fc=#98C379,#002b36:5>@vol@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#61AFEF,#002b36:5>\xf017 </fc></fn>\
\<fn=5><fc=#61AFEF,#002b36:5>@date@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
],
commands = myCommands
}
myCommands :: [Runnable]
myCommands =
[ Run UnsafeXMonadLog,
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh") ["vol"] "vol" 100,
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volumeicon.sh") ["volicon"] "volicon" 100,
Run $ Date "%-l:%M %p" "date" 600,
Run $ Cpu ["-t", "<fc=#8c7f80><total></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83"] 100,
Run $ Memory ["-t", "<fc=#8c7f80><usedratio></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094"] 100,
-- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/gputemp.sh") ["gpu"] "gpu" 5
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["music"] "music" 100
-- , Run $ Com (myHomeDir <> "/.config/xmonad/src/trayer-padding.sh") ["trayer"] "trayer" 50
-- , Run $ MPD ["-h", "127.0.0.1", "-p", "6600", "-t", "<composer> <title> <track>/<plength> <statei>", "--", "-P", ">>", "-Z", "|", "-S", "><"] 10
]
baseConfig :: Config
baseConfig =
defaultConfig
{ font = "Sugar Snow 13",
additionalFonts =
[ "Sugar Snow 11",
"Sugar Snow 13",
"Sugar Snow 12",
"JetBrainsMono Nerd Font 12",
"Sugar Snow 13"
],
-- textOffsets = [20, 22, 21, 21, 20],
bgColor = "#002b36",
fgColor = "#c8b6b8",
borderColor = "#272727",
border = FullB,
borderWidth = 0,
{-
, position = Static { xpos = 13, ypos = 1034, width = 1893, height = 32 } Bottom Padded
, position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat
-}
position = Static {xpos = 1920, ypos = 1194, width = 1920, height = 34},
alpha = 255,
overrideRedirect = True,
lowerOnStart = True,
hideOnStart = False,
allDesktops = True,
persistent = True,
iconRoot = myHomeDir ++ "/.config/xmonad/icons",
iconOffset = -1,
sepChar = "@",
alignSep = "}{"
}

View File

@ -1,102 +0,0 @@
import System.Environment
import System.IO.Unsafe (unsafeDupablePerformIO)
import Xmobar
main :: IO ()
main = xmobar =<< configFromArgs =<< myConfig
-- main = xmobar =<< myConfig
myHomeDir :: String
myHomeDir = unsafeDupablePerformIO (getEnv "HOME")
myConfig :: IO Config
myConfig =
do
pure
baseConfig
{ template =
concat $
[ " <fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#558c8e,#002b36:5>\xf30d </fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> ["<fn=2>@UnsafeXMonadLog@</fn>}"]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#E06C75,#002b36:5>\xf001 </fc></fn>\
\<fn=5><fc=#E06C75,#002b36:5>@music@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn>{"
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#56B6C2,#002b36:5>\xf2db </fc></fn>\
\<fn=5><fc=#56B6C2,#002b36:5>CPU: @cpu@%</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#C678DD,#002b36:5>\xf538 </fc></fn>\
\<fn=5><fc=#C678DD,#002b36:5>Mem: @memory@% </fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#98C379,#002b36:5>@volicon@</fc></fn>\
\<fn=5><fc=#98C379,#002b36:5>@vol@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#61AFEF,#002b36:5>\xf017 </fc></fn>\
\<fn=5><fc=#61AFEF,#002b36:5>@date@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> ["@_XMONAD_TRAYPAD@"],
commands = myCommands
}
myCommands :: [Runnable]
myCommands =
[ Run UnsafeXMonadLog,
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh") ["vol"] "vol" 100,
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volumeicon.sh") ["volicon"] "volicon" 100,
Run $ Date "%-l:%M %p" "date" 600,
Run $ Cpu ["-t", "<fc=#8c7f80><total></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83"] 100,
Run $ Memory ["-t", "<fc=#8c7f80><usedratio></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094"] 100,
-- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/gputemp.sh") ["gpu"] "gpu" 5
Run $ XPropertyLog "_XMONAD_TRAYPAD",
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["music"] "music" 100
-- , Run $ Com (myHomeDir <> "/.config/xmonad/src/trayer-padding.sh") ["trayer"] "trayer" 50
-- , Run $ MPD ["-h", "127.0.0.1", "-p", "6600", "-t", "<composer> <title> <track>/<plength> <statei>", "--", "-P", ">>", "-Z", "|", "-S", "><"] 10
]
baseConfig :: Config
baseConfig =
defaultConfig
{ font = "Sugar Snow 13",
additionalFonts =
[ "Sugar Snow 11",
"Sugar Snow 13",
"Sugar Snow 12",
"JetBrainsMono Nerd Font 12",
"Sugar Snow 13"
],
-- textOffsets = [20, 22, 21, 21, 20],
bgColor = "#002b36",
fgColor = "#c8b6b8",
borderColor = "#272727",
border = FullB,
borderWidth = 0,
{-
, position = Static { xpos = 13, ypos = 1034, width = 1893, height = 32 } Bottom Padded
, position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat
-}
position = Static {xpos = 0, ypos = 1046, width = 1920, height = 34},
alpha = 255,
overrideRedirect = True,
lowerOnStart = True,
hideOnStart = False,
allDesktops = True,
persistent = True,
iconRoot = myHomeDir ++ "/.config/xmonad/icons",
iconOffset = -1,
sepChar = "@",
alignSep = "}{"
}

View File

@ -0,0 +1 @@
melange1.hs

View File

@ -1,100 +0,0 @@
import System.Environment
import System.IO.Unsafe (unsafeDupablePerformIO)
import Xmobar
main :: IO ()
main = xmobar =<< configFromArgs =<< myConfig
-- main = xmobar =<< myConfig
myHomeDir :: String
myHomeDir = unsafeDupablePerformIO (getEnv "HOME")
myConfig :: IO Config
myConfig =
do
pure
baseConfig
{ template =
concat $
[ " <fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#558c8e,#002b36:5>\xf30d </fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> ["<fn=5>@UnsafeXMonadLog@</fn>}"]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#E06C75,#002b36:5>\xf001 </fc></fn>\
\<fn=5><fc=#E06C75,#002b36:5>@music@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn>{"
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#56B6C2,#002b36:5>\xf2db </fc></fn>\
\<fn=5><fc=#56B6C2,#002b36:5>CPU: @cpu@%</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#C678DD,#002b36:5>\xf538 </fc></fn>\
\<fn=5><fc=#C678DD,#002b36:5>Mem: @memory@% </fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#98C379,#002b36:5>@volicon@</fc></fn>\
\<fn=5><fc=#98C379,#002b36:5>@vol@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
]
<> [ "<fn=2><fc=#002b36,#002b36:7>\xe0b6</fc></fn>\
\<fn=4><fc=#61AFEF,#002b36:5>\xf017 </fc></fn>\
\<fn=5><fc=#61AFEF,#002b36:5>@date@</fc></fn>\
\<fn=2><fc=#002b36,#002b36:7>\xe0b4</fc></fn> "
],
commands = myCommands
}
myCommands :: [Runnable]
myCommands =
[ Run UnsafeXMonadLog,
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh") ["vol"] "vol" 100,
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volumeicon.sh") ["volicon"] "volicon" 100,
Run $ Date "%-l:%M %p" "date" 600,
Run $ Cpu ["-t", "<fc=#8c7f80><total></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83"] 100,
Run $ Memory ["-t", "<fc=#8c7f80><usedratio></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094"] 100,
-- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/gputemp.sh") ["gpu"] "gpu" 5
Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["music"] "music" 100
-- , Run $ Com (myHomeDir <> "/.config/xmonad/src/trayer-padding.sh") ["trayer"] "trayer" 50
-- , Run $ MPD ["-h", "127.0.0.1", "-p", "6600", "-t", "<composer> <title> <track>/<plength> <statei>", "--", "-P", ">>", "-Z", "|", "-S", "><"] 10
]
baseConfig :: Config
baseConfig =
defaultConfig
{ font = "Sugar Snow 13",
additionalFonts =
[ "Sugar Snow 11",
"Sugar Snow 13",
"Sugar Snow 12",
"JetBrainsMono Nerd Font 12",
"Sugar Snow 13"
],
-- textOffsets = [20, 22, 21, 21, 20],
bgColor = "#002b36",
fgColor = "#c8b6b8",
borderColor = "#272727",
border = FullB,
borderWidth = 0,
{-
, position = Static { xpos = 13, ypos = 1034, width = 1893, height = 32 } Bottom Padded
, position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 32 } Top Flat
-}
position = Static {xpos = 1920, ypos = 1194, width = 1920, height = 34},
alpha = 255,
overrideRedirect = True,
lowerOnStart = True,
hideOnStart = False,
allDesktops = True,
persistent = True,
iconRoot = myHomeDir ++ "/.config/xmonad/icons",
iconOffset = -1,
sepChar = "@",
alignSep = "}{"
}

View File

@ -0,0 +1 @@
melange2.hs

View File

@ -1,512 +0,0 @@
{-# LANGUAGE
MultiWayIf -- Required for `toggleFull` in `myAdditionalKeys`
, LambdaCase -- Required for `(\case)` statement in `myXmobarPP`
, FlexibleContexts
, OverloadedStrings
#-}
{-# OPTIONS_GHC -Wno-missing-signatures
-Wno-orphans #-}
-- Data Imports
import Data.Functor
import qualified Data.Map as M
import Data.Monoid
-- Used in io exitSuccess
import System.Environment (getEnv)
import System.Exit
import System.IO.Unsafe (unsafeDupablePerformIO)
-- XMonad imports
import XMonad
import XMonad.Actions.NoBorders (toggleBorder)
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDebug
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Hooks.WindowSwallowing
import XMonad.Layout.Fullscreen
import XMonad.Layout.NoBorders
import XMonad.Layout.SimpleFloat
import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W
import XMonad.Util.ClickableWorkspaces
import XMonad.Util.Cursor
import XMonad.Util.EZConfig
import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.NamedScratchpad
import XMonad.Util.SpawnOnce
import XMonad.Util.Ungrab
-- import qualified DBus as D
-- import qualified DBus.Client as D
main :: IO ()
main =
do
xmonad
$ debugManageHookOn "M-S-d"
. docks
. ewmhFullscreen
. fullscreenSupport
. ewmh
. Hacks.javaHack
. withEasySB xmobar toggleSB
. withSB xmobar2
$ myConfig
where
toggleSB XConfig {modMask = modm} = (modm, xK_m)
-- Windows key/Super key
myModMask :: KeyMask
myModMask = mod4Mask
-- Default Terminal
myTerminal :: String
myTerminal = "kitty"
-- Default Launcher
myLauncher :: String
myLauncher = myHomeDir ++ "/.config/rofi/launchers/type-7/launcher.sh"
-- Default Launcher
myFileManager :: String
myFileManager = "thunar"
-- Default Browser
myBrowser :: String
myBrowser = "firefox"
myPowerMenu :: String
myPowerMenu = myHomeDir ++ "/.config/rofi/powermenu/type-6/powermenu.sh"
-- Workspaces
myWorkspaces :: [String]
myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "msc", "eml", "stm"]
-- myWorkspaces = map show [1 .. 9]
-- Border Width
myBorderWidth :: Dimension
myBorderWidth = 1
-- Formal Unfocused Color
myNormColor :: String
myNormColor = "#383830"
-- Focused Color
myFocusColor :: String
myFocusColor = "#a2a2a2"
-- Home Directory
myHomeDir :: String
myHomeDir = unsafeDupablePerformIO (getEnv "HOME")
-- focus follows the mouse pointer
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
myKeys conf@(XConfig {XMonad.modMask = modm}) =
M.fromList $
[ ((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0],
(f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
]
++ [ ((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_comma, xK_period, xK_z] [0 ..],
(f, m) <- [(W.view, 0), (W.shift, shiftMask)]
]
myAdditionalKeys :: [(String, X ())]
myAdditionalKeys =
base
++ window
++ applications
++ multimedia
where
-- Force killing a frozen window.
forceKillWindow :: Window -> X ()
forceKillWindow w = withDisplay $ \d ->
io $ void $ killClient d w
-- Making a window have a full float over a workspace.
toggleFull :: Window -> X ()
toggleFull w = windows $ \s ->
if
| M.lookup w (W.floating s) == Just fullscreen -> W.sink w s
| otherwise -> W.float w fullscreen s
where
fullscreen = W.RationalRect 0 0 1 1
-- Screenshots
screenShotSelection = myHomeDir ++ "/.local/bin/print-select" :: String
screenShotFullscreen = myHomeDir ++ "/.local/bin/print-fullscreen" :: String
screenShotTmp = myHomeDir ++ "/.local/bin/print-tmp" :: String
screenShotApp = myHomeDir ++ "/.local/bin/print-select-fr" :: String
-- XMonad base keybinds.
base =
[ ("M-g", withFocused toggleBorder),
("M-S-c", kill),
("M-S-x", withFocused forceKillWindow),
("M-<Space>", sendMessage NextLayout),
("M-n", refresh),
("M-S-q", io exitSuccess),
("C-S-r", spawn "xmonad --recompile; xmonad --restart"),
("C-S-q", spawn "pkill -KILL -u $USER")
]
-- Window management keybinds.
window =
[ ("M-<Tab>", windows W.focusDown),
("M-j", windows W.focusDown),
("M-k", windows W.focusUp),
("M-S-m", windows W.focusMaster),
("M-m", sendMessage ToggleStruts),
("M-p", windows W.swapMaster),
("M-S-j", windows W.swapDown),
("M-S-h", windows W.swapDown),
("M-S-k", windows W.swapUp),
("M-S-l", windows W.swapUp),
("M-h", sendMessage Shrink),
("M-l", sendMessage Expand),
("M-t", withFocused $ windows . W.sink),
("M-f", withFocused toggleFull)
]
-- Spawning applications.
applications =
[ ("M-<Return>", spawn myTerminal),
("M-S-m", namedScratchpadAction myScratchpads "ncmpcpp"),
("M-C-<Return>", namedScratchpadAction myScratchpads "terminal"),
("M-S-<Escape>", spawn myPowerMenu),
("M-b", spawn myBrowser),
("M-v", spawn "code"),
("M-S-s", spawn "~/steam/steam.sh"),
("S-<Print>", unGrab *> spawn screenShotSelection),
("C-<Print>", unGrab *> spawn screenShotTmp),
("C-S-<Print>", unGrab *> spawn screenShotApp),
("<Print>", spawn screenShotFullscreen),
("M-S-<Return>", spawn myLauncher),
("M-e", spawn myFileManager)
]
-- Multimedia keybinds.
multimedia =
[ ("<XF86AudioPlay>", spawn "playerctl play-pause"),
("<XF86AudioPrev>", spawn "playerctl previous"),
("<XF86AudioNext>", spawn "playerctl next"),
("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"),
("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -1.5%"),
("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +1.5%"),
("<Pause>", spawn "amixer sset Capture toggle"),
("M-<Escape>", spawn "mpc toggle"),
("M-<F1>", spawn "mpc prev"),
("M-<F2>", spawn "mpc next")
]
myMouseBindings :: XConfig l -> M.Map (KeyMask, Button) (Window -> X ())
myMouseBindings XConfig {XMonad.modMask = modm} =
M.fromList
-- Set the window to floating mode and move by dragging.
[ ((modm, button1), \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster),
-- Raise the window to the top of the stack.
((modm, button2), \w -> focus w >> windows W.shiftMaster),
-- Set the window to floating mode and resize by dragging.
((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster)
]
myStartupHook :: X ()
myStartupHook = do
_ <-
traverse
spawnOnce
[ "sh ~/scripts/screenlayout.sh",
"nitrogen --restore &",
"touch ~/tmp/touchy && rm -rf ~/tmp/*",
-- , myHomeDir ++ "/.local/bin/picom-jonaburg --glx-no-stencil --xrender-sync-fence -b &"
"picom --config ~/.config/picom/vander.conf",
"xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Profile Enabled' 0, 1 && xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Speed' 0.1",
"setxkbmap br abnt2",
"nm-applet",
"trayer-srg -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0xFF181814 --height 27 --transparent false --distance 2 --margin 1 --alpha 0 --monitor 0 &",
"mpd &",
"dunst &",
"lxqt-policykit-agent &",
"xrdb -load ~/.Xresources",
"redshift -t 5700:3600 -l -23.5475:-46.63611 -b 0.9:0.5"
]
setDefaultCursor xC_left_ptr
setWMName "zmonad"
isInstance (ClassApp c _) = className =? c
isInstance (TitleApp t _) = title =? t
isInstance (NameApp n _) = appName =? n
type AppName = String
type AppTitle = String
type AppClassName = String
type AppCommand = String
data App
= ClassApp AppClassName AppCommand
| TitleApp AppTitle AppCommand
| NameApp AppName AppCommand
deriving (Show)
gimp = ClassApp "Gimp" "gimp"
gimp2 = ClassApp "Gimp-2.99" "gimp-2.99"
multimc = ClassApp "MultiMC" "MultiMC"
about = TitleApp "About Mozilla Firefox" "About Mozilla Firefox"
message = ClassApp "Xmessage" "Xmessage"
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
myManageHook = manageRules
where
-- Hides windows without ignoring it, see doHideIgnore in XMonad contrib.
doHide = ask >>= doF . W.delete :: ManageHook
-- WM_WINDOW_ROLE will be parsed with the role variable.
isRole = stringProperty "WM_WINDOW_ROLE"
-- To match multiple properties with one operator.
anyOf = foldl (<||>) (pure False) :: [Query Bool] -> Query Bool
-- To match multiple classNames with one operator.
match = anyOf . fmap isInstance :: [App] -> Query Bool
-- Checking for splash dialogs.
isSplash = isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_SPLASH"
-- Checking for pop-ups.
isPopup = isRole =? "pop-up"
-- Checking for file chooser dialog.
isFileChooserDialog = isRole =? "GtkFileChooserDialog"
-- Managing rules for applications.
manageRules =
composeOne
[ transience,
isDialog -?> doCenterFloat,
isFullscreen -?> (doF W.focusDown <> doFullFloat),
match
[ gimp,
gimp2,
about,
message
]
-?> doFloat,
match
[ multimc
]
-?> doCenterFloat,
anyOf
[ isFileChooserDialog,
isDialog,
isPopup,
isSplash
]
-?> doCenterFloat
]
<> composeAll
[ manageDocks <> namedScratchpadManageHook myScratchpads,
className =? "firefox" <&&> title =? "File Upload" --> doFloat,
className =? "firefox" <&&> title =? "Library" --> doCenterFloat,
className =? "firefox" <&&> title ^? "Save" --> doFloat,
className =? "firefox" <&&> resource =? "Toolkit" --> doFloat,
className =? "firefox" <&&> title ^? "Sign in" --> doFloat,
className ^? "jetbrains-" <&&> title ^? "Welcome to " --> doCenterFloat,
className ^? "jetbrains-" <&&> title =? "splash" --> doFloat,
className ^? "Visual " <&&> isDialog --> doCenterFloat,
className =? "firefox-esr" --> doShift "web",
className =? "Virt-manager" --> doShift "vm",
className =? "steam_app_1172620" --> doShift "gfx",
className =? "steam_app_1063730" --> doShift "gfx",
className =? "steam_app_632360" --> doShift "gfx",
className =? "discord" --> doShift "irc",
className =? "discord-screenaudio" --> doShift "irc",
className =? "Spotify" --> doShift "msc",
className =? "thunderbird" --> doShift "eml",
className =? "Steam" --> doShift "stm",
className =? "Lutris" --> doShift "vm" <> doFloat,
className =? "leagueclientux.exe" --> doShift "gfx",
className =? "league of legends.exe" --> doShift "gfx",
className =? "leagueclient.exe" --> doShift "gfx",
className =? "explorer.exe" --> doShift "gfx",
className =? "riotclientux.exe" --> doShift "gfx",
className =? "dauntless-win64-shipping.exe" --> doShift "gfx",
className =? "battle.net.exe" --> doShift "gfx" <> doFloat,
className =? "Pcmanfm" --> doFloat,
className =? "Thunar" --> doFloat,
className =? "Pavucontrol" --> doFloat,
className =? "Nitrogen" --> doFloat,
className =? "Wrapper-2.0" --> doFloat,
className =? "TeamSpeak 3" --> doFloat <> doShift "irc",
className =? "easyeffects" --> doFloat <> doShift "vm",
className =? "Arandr" --> doFloat,
resource =? "desktop_window" --> doIgnore,
resource =? "kdesktop" --> doIgnore,
className =? "Conky" --> doIgnore,
isRole ^? "About" <||> isRole ^? "about" --> doFloat,
"_NET_WM_WINDOW_TYPE" `isInProperty` "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE" --> doIgnore <> doRaise,
-- Steam Game Fixes
className =? "steam_app_1551360" <&&> title /=? "Forza Horizon 5" --> doHide -- Prevents black screen when fullscreening.
-- , title =? "Wine System Tray" --> doHide -- Prevents Wine System Trays from taking input focus.
-- , title ^? "Steam - News" --> doHide -- I don't like the Steam news menu
]
{- May be useful one day
doClose = ask >>= liftX . killWindow >> mempty :: ManageHook
doForceKill = ask >>= liftX . forceKillWindow >> mempty :: ManageHook
-}
myEventHook :: Event -> X All
myEventHook _ = return (All True)
myLayoutHook =
avoidStruts $
lessBorders OnlyScreenFloat $
spacingRaw False (Border w w w w) True (Border w w w w) True $
tiled ||| simpleFloat ||| Mirror tiled ||| Full
where
tiled = Tall nmaster delta ratio
nmaster = 1 -- Default number of windows in the master pane.
ratio = 1 / 2 -- Default proportion of screen occupied by master panes.
delta = 3 / 100 -- Percent of screen increment by when resizing panes.
w = 5 -- Width of pixel size between windows while tiled.
myXmobarPP :: X PP
myXmobarPP =
clickablePP $
filterOutWsPP ["NSP"] $
def
{ ppCurrent = xmobarColor "#d5d5d5" "" . xmobarFont 5 . wrap "[" "]",
ppVisibleNoWindows = Just (xmobarColor "#ff5151" ""),
ppHidden = xmobarColor "#ac5858" "",
ppHiddenNoWindows = xmobarColor "#595959" "",
ppUrgent = xmobarColor "#F7768E" "" . wrap "!" "!",
ppTitle = xmobarColor "#d5d5d5" "" . shorten 49,
ppSep = wrapSep " ",
ppTitleSanitize = xmobarStrip,
ppWsSep = xmobarColor "" "#212121" " ",
ppLayout =
xmobarColor "#212121" ""
. ( \case
"Spacing Tall" -> "<icon=tiled.xpm/>"
"Spacing Mirror Tall" -> "<icon=mirrortiled.xpm/>"
"Spacing Full" -> "<icon=full.xpm/>"
"Spacing Simple Float" -> "<icon=floating.xpm/>"
"Simple Float" -> "<icon=floating.xpm/>"
)
}
where
wrapSep :: String -> String
wrapSep =
wrap
(xmobarColor "#212121" "#212121:7" (xmobarFont 2 "\xe0b4"))
(xmobarColor "#212121" "#212121:7" (xmobarFont 2 "\xe0b6"))
myXmobar :: String
myXmobar = (myHomeDir ++ "/.local/bin/xmobar " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs")
xmobar :: StatusBarConfig
xmobar = statusBarProp myXmobar myXmobarPP
myXmobar2 :: String
myXmobar2 = (myHomeDir ++ "/.local/bin/xmobar2 " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs")
xmobar2 :: StatusBarConfig
xmobar2 = statusBarProp myXmobar2 myXmobarPP
myConfig =
def
{ modMask = myModMask,
focusFollowsMouse = myFocusFollowsMouse,
terminal = myTerminal,
mouseBindings = myMouseBindings,
borderWidth = myBorderWidth,
normalBorderColor = myNormColor,
focusedBorderColor = myFocusColor,
layoutHook = myLayoutHook,
startupHook = myStartupHook,
manageHook = myManageHook,
handleEventHook =
Hacks.windowedFullscreenFixEventHook
<> swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True)
<> Hacks.trayerPaddingXmobarEventHook
<> myEventHook,
workspaces = myWorkspaces,
keys = myKeys
}
`additionalKeysP` myAdditionalKeys
myScratchpads =
[ NS "terminal" spawnTerm findTerm manageTerm,
NS "ncmpcpp" spawnncmpcpp findncmpcpp managencmpcpp
]
where
spawnTerm = myTerminal ++ " --name scratchpad"
findTerm = resource =? "scratchpad"
manageTerm = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 - h
l = 0.95 - w
spawnncmpcpp = myTerminal ++ " --name ncmpcpp -e ncmpcpp"
findncmpcpp = resource =? "ncmpcpp"
managencmpcpp = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 - h
l = 0.95 - w
-- I GIVE UP ON DBUS.
-- logTitle :: D.Client -> X ()
-- logTitle ch = dynamicLogWithPP def
-- {ppCurrent = unPango
-- ,ppVisible = pangoInactive
-- ,ppHidden = const ""
-- ,ppHiddenNoWindows = const ""
-- ,ppUrgent = pangoBold
-- ,ppTitle = unPango
-- ,ppLayout = unPango
-- ,ppWsSep = ""
-- ,ppSep = "⋮"
-- ,ppOrder = swapIcons
-- ,ppSort = getSortByXineramaPhysicalRule horizontalScreenOrderer
-- ,ppOutput = dbusOutput ch
-- }
-- where swapIcons (ws:l:t:nsp:xs) = ws:l:nsp:t:xs
-- -- @@@ so why do the first 4 invocations *only* not match?!
-- swapIcons xs = xs
-- getWellKnownName :: D.Client -> IO ()
-- getWellKnownName ch = do
-- _ <- D.requestName ch
-- (D.busName_ "org.xmonad.Log")
-- [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
-- return ()
-- dbusOutput :: D.Client -> String -> IO ()
-- dbusOutput ch s = do
-- let sig = (D.signal "/org/xmonad/Log" "org.xmonad.Log" "Update")
-- {D.signalBody = [D.toVariant s]}
-- D.emit ch sig
-- -- quick and dirty escaping of HTMLish Pango markup
-- unPango :: String -> String
-- unPango [] = []
-- unPango ('<':xs) = "&lt;" ++ unPango xs
-- unPango ('&':xs) = "&amp;" ++ unPango xs
-- unPango ('>':xs) = "&gt;" ++ unPango xs
-- unPango (x :xs) = x:unPango xs
-- -- show a string as inactive
-- -- @@@ should use gtk theme somehow...
-- pangoInactive :: String -> String
-- pangoInactive s = "<span foreground=\"#8f8f8f\">" ++ unPango s ++ "</span>"
-- -- show a string with highlight
-- pangoBold :: String -> String
-- pangoBold s = "<span weight=\"bold\" foreground=\"#ff2f2f\">" ++ unPango s ++ "</span>"

View File

@ -7,9 +7,9 @@ extra-deps:
- github: xmonad/x11 - github: xmonad/x11
commit: 8a33c4ebe7d0a1be96073d8c019f1f3901bbf344 commit: 8a33c4ebe7d0a1be96073d8c019f1f3901bbf344
- github: xmonad/xmonad - github: xmonad/xmonad
commit: 5ecdf7591d4f4bc3e44571326e66dfe895393a20 commit: eeac754ac76dabf115deecb545e52a55f9dbbd02
- github: xmonad/xmonad-contrib - github: xmonad/xmonad-contrib
commit: 6fba80168df60d8a151515601f046a22cf9efbf5 commit: 673de11ca876a4a58cae3a4d52e36260f66aa6cc
- xmobar-0.46 - xmobar-0.46
- cairo-0.13.8.2@sha256:ef1709c3c4d2c6d68a9a51d9f220dccc0745f6468d2d0868c15a7ecdf8f325a1,4078 - cairo-0.13.8.2@sha256:ef1709c3c4d2c6d68a9a51d9f220dccc0745f6468d2d0868c15a7ecdf8f325a1,4078
- pango-0.13.8.2@sha256:d4057ebddade4cde3e25d7755b5e030e7a7e56fe7365afd37916a7bba46d3fd9,3917 - pango-0.13.8.2@sha256:d4057ebddade4cde3e25d7755b5e030e7a7e56fe7365afd37916a7bba46d3fd9,3917

View File

@ -5,69 +5,69 @@
packages: packages:
- completed: - completed:
name: X11
pantry-tree:
sha256: 3ad2be290f2328541a46748dd3332aec04d9b5d089ac13d7eed9cb6e514d013d
size: 3651
sha256: a2dd0ebb6fb469f1cfc0c3dfbbeeb38061b2d7cdcef21245ee9f6f555bbb3163
size: 163242 size: 163242
url: https://github.com/xmonad/x11/archive/8a33c4ebe7d0a1be96073d8c019f1f3901bbf344.tar.gz url: https://github.com/xmonad/x11/archive/8a33c4ebe7d0a1be96073d8c019f1f3901bbf344.tar.gz
name: X11
version: 1.10.3.9 version: 1.10.3.9
sha256: a2dd0ebb6fb469f1cfc0c3dfbbeeb38061b2d7cdcef21245ee9f6f555bbb3163
pantry-tree:
size: 3651
sha256: 3ad2be290f2328541a46748dd3332aec04d9b5d089ac13d7eed9cb6e514d013d
original: original:
url: https://github.com/xmonad/x11/archive/8a33c4ebe7d0a1be96073d8c019f1f3901bbf344.tar.gz url: https://github.com/xmonad/x11/archive/8a33c4ebe7d0a1be96073d8c019f1f3901bbf344.tar.gz
- completed: - completed:
size: 107331
url: https://github.com/xmonad/xmonad/archive/5ecdf7591d4f4bc3e44571326e66dfe895393a20.tar.gz
name: xmonad name: xmonad
version: 0.17.1.9
sha256: b5c72c205b2cc66251deb24af6cb338e2f271837e8cb67dfd484d1f107012c54
pantry-tree: pantry-tree:
size: 3917 sha256: f3572e8c9661656858c838e53fab3e020f77638978a5e1fa253337595d7455a6
sha256: 00c673ac7255489f7ded160e9fa9c0e7c4bf2ef697ce67bdbaf10072adc62549 size: 3832
sha256: 2c1e17e2e983ca60563d72ee3558b526ff66311b416a605372e5affe54c268a9
size: 107366
url: https://github.com/xmonad/xmonad/archive/eeac754ac76dabf115deecb545e52a55f9dbbd02.tar.gz
version: 0.17.2.9
original: original:
url: https://github.com/xmonad/xmonad/archive/5ecdf7591d4f4bc3e44571326e66dfe895393a20.tar.gz url: https://github.com/xmonad/xmonad/archive/eeac754ac76dabf115deecb545e52a55f9dbbd02.tar.gz
- completed: - completed:
size: 673668
url: https://github.com/xmonad/xmonad-contrib/archive/6fba80168df60d8a151515601f046a22cf9efbf5.tar.gz
name: xmonad-contrib name: xmonad-contrib
version: 0.17.1.9
sha256: 12efbfa9dc19ea9770d51fd6d1dabadf44e23f190f00b92791a061e82e6ded59
pantry-tree: pantry-tree:
size: 24370 sha256: b14556491c46cc1a804ed0b9cf5ebe09be21f5f51735cebf56f7028e962abba3
sha256: 66c16f132310a956bd86076efb55122dc02e5bedbb86fb7e6d1feeda9b52a082 size: 24430
sha256: 6dc9716a4e2b6238e65f5897e1146d6a98c19bd6f88d3cf5b2afb5212860d86e
size: 676773
url: https://github.com/xmonad/xmonad-contrib/archive/673de11ca876a4a58cae3a4d52e36260f66aa6cc.tar.gz
version: 0.17.1.9
original: original:
url: https://github.com/xmonad/xmonad-contrib/archive/6fba80168df60d8a151515601f046a22cf9efbf5.tar.gz url: https://github.com/xmonad/xmonad-contrib/archive/673de11ca876a4a58cae3a4d52e36260f66aa6cc.tar.gz
- completed: - completed:
hackage: xmobar-0.46@sha256:65e8683aec86e5dc23041959dc2b0803f1be4a3cacab1ed29159c0732212c273,14911 hackage: xmobar-0.46@sha256:65e8683aec86e5dc23041959dc2b0803f1be4a3cacab1ed29159c0732212c273,14911
pantry-tree: pantry-tree:
size: 9769
sha256: 0c97230f9b521b2af6237214a4ca14536a5df936835153b9768d7108ba5eb368 sha256: 0c97230f9b521b2af6237214a4ca14536a5df936835153b9768d7108ba5eb368
size: 9769
original: original:
hackage: xmobar-0.46 hackage: xmobar-0.46
- completed: - completed:
hackage: cairo-0.13.8.2@sha256:ef1709c3c4d2c6d68a9a51d9f220dccc0745f6468d2d0868c15a7ecdf8f325a1,4078 hackage: cairo-0.13.8.2@sha256:ef1709c3c4d2c6d68a9a51d9f220dccc0745f6468d2d0868c15a7ecdf8f325a1,4078
pantry-tree: pantry-tree:
size: 2830
sha256: d6a9b3a15bc2e7b53fda331279cfdbc299fbf0c4be2ee8c1b6b79b924b6fdeb4 sha256: d6a9b3a15bc2e7b53fda331279cfdbc299fbf0c4be2ee8c1b6b79b924b6fdeb4
size: 2830
original: original:
hackage: cairo-0.13.8.2@sha256:ef1709c3c4d2c6d68a9a51d9f220dccc0745f6468d2d0868c15a7ecdf8f325a1,4078 hackage: cairo-0.13.8.2@sha256:ef1709c3c4d2c6d68a9a51d9f220dccc0745f6468d2d0868c15a7ecdf8f325a1,4078
- completed: - completed:
hackage: pango-0.13.8.2@sha256:d4057ebddade4cde3e25d7755b5e030e7a7e56fe7365afd37916a7bba46d3fd9,3917 hackage: pango-0.13.8.2@sha256:d4057ebddade4cde3e25d7755b5e030e7a7e56fe7365afd37916a7bba46d3fd9,3917
pantry-tree: pantry-tree:
size: 1506
sha256: 10c335853e1d43e0b7426b33e8ddbdb90b3e318ebec4d58f0726a2f4cfb2e1c9 sha256: 10c335853e1d43e0b7426b33e8ddbdb90b3e318ebec4d58f0726a2f4cfb2e1c9
size: 1506
original: original:
hackage: pango-0.13.8.2@sha256:d4057ebddade4cde3e25d7755b5e030e7a7e56fe7365afd37916a7bba46d3fd9,3917 hackage: pango-0.13.8.2@sha256:d4057ebddade4cde3e25d7755b5e030e7a7e56fe7365afd37916a7bba46d3fd9,3917
- completed: - completed:
hackage: glib-0.13.8.2@sha256:f44b829e741b3c3244d523f60b058701dfc067ff64c2ba61d43be4cccfc2663d,3156 hackage: glib-0.13.8.2@sha256:f44b829e741b3c3244d523f60b058701dfc067ff64c2ba61d43be4cccfc2663d,3156
pantry-tree: pantry-tree:
size: 1625
sha256: 2442a22152231a94e2f1ecfe7ddc0f4e5fb2d5ae116b371508a448bd3312ef06 sha256: 2442a22152231a94e2f1ecfe7ddc0f4e5fb2d5ae116b371508a448bd3312ef06
size: 1625
original: original:
hackage: glib-0.13.8.2@sha256:f44b829e741b3c3244d523f60b058701dfc067ff64c2ba61d43be4cccfc2663d,3156 hackage: glib-0.13.8.2@sha256:f44b829e741b3c3244d523f60b058701dfc067ff64c2ba61d43be4cccfc2663d,3156
snapshots: snapshots:
- completed: - completed:
sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
size: 619204 size: 619204
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
original: lts-19.33 original: lts-19.33