Update xmonad config

This commit is contained in:
Lucas Barbieri 2022-11-09 21:16:35 -03:00
parent 4be43297e7
commit 8728b6d167
19 changed files with 842 additions and 605 deletions

View File

@ -0,0 +1,26 @@
/* XPM */
static char * floating_xpm[] = {
"20 20 3 1",
" c #31353F",
". c #B6BDCA",
"+ c #ABB2BF",
" ",
" ",
" ............. ",
" ............. ",
" ............. ",
" ............. ",
" ............. ",
" ............. ",
" .............+++ ",
" .............+++ ",
" .............+++ ",
" +++++++++++++ ",
" +++++++++++++ ",
" +++++++++++++ ",
" +++++++++++++ ",
" +++++++++++++ ",
" +++++++++++++ ",
" ",
" ",
" "};

View File

@ -1,24 +0,0 @@
Discord 0.0.21
Starting app.
Starting updater.
[Modules] Modules initializing
[Modules] Distribution: remote
[Modules] Host updates: enabled
[Modules] Module updates: enabled
[Modules] Module install path: /home/klein/.config/discord/0.0.21/modules
[Modules] Module installed file path: /home/klein/.config/discord/0.0.21/modules/installed.json
[Modules] Module download path: /home/klein/.config/discord/0.0.21/modules/pending
[Modules] No updates to install
[Modules] Checking for host updates.
[Modules] Host is up to date.
[Modules] Checking for module updates at https://discord.com/api/modules/stable/versions.json
[Modules] No module updates available.
Optional module ./ElectronTestRpc was not included.
WEIGHT /home/klein/.config/discord/0.0.21/modules/discord_krisp/NC_small_8k.thw
WEIGHT /home/klein/.config/discord/0.0.21/modules/discord_krisp/NC_small_16k.thw
WEIGHT /home/klein/.config/discord/0.0.21/modules/discord_krisp/c6.s.f.27f1a3.thw
WEIGHT /home/klein/.config/discord/0.0.21/modules/discord_krisp/VAD_weight.thw
[Modules] Checking for host updates.
[Modules] Host is up to date.
[Modules] Checking for module updates at https://discord.com/api/modules/stable/versions.json
[Modules] No module updates available.

View File

@ -10,6 +10,7 @@ ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-pattern
dependencies:
- base
- xmonad-contrib >= 0.16
- dbus
source-dirs: src

9
configs/xmonad/scripts/mpd.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
mpt=$(mpc current -f %title%)
mpa=$(mpc current -f %artist%)
icon1=' '
icon2=''
echo "$icon2 $mpa - $icon1 $mpt"

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=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#C678DD,#212121:5>\xf30d </fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=5>@UnsafeXMonadLog@</fn>}{" ]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#E06C75,#212121:5>@mpc@</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#56B6C2,#212121:5>CPU: @cpu@%</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#C678DD,#212121:5>Mem: @memory@% </fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#98C379,#212121:5>@vol@</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#61AFEF,#212121:5>@date@</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
-- <>
-- [ "@trayer@"]
, commands = myCommands
}
myCommands :: [Runnable]
myCommands =
[ Run UnsafeXMonadLog
, Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh" ) ["vol"] "vol" 20
, Run $ Date "\xf017 %-l:%M %p" "date" 600
, Run $ Cpu [ "-t", "<fc=#8c7f80><total></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83" ] 50
, Run $ Memory [ "-t", "<fc=#8c7f80><freeratio></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094" ] 50
-- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/gputemp.sh") ["gpu"] "gpu" 5
-- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/trayer-padding.sh") ["trayer"] "trayer" 100
, Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["mpc"] "mpc" 20
-- , 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 = "xft:mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
, additionalFonts = [ "xft:mononoki Nerd Font:pixelsize=10:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:size=13:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:pixelsize=13:antialias=true:hinting=true"
]
, textOffsets = [20, 22, 21, 21, 20]
, bgColor = "#212121"
, fgColor = "#c8b6b8"
, borderColor = "#a6e22e"
, border = FullB
, borderWidth = 1
{-
, 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 = 148, width = 1920, height = 30 }
, alpha = 255
, overrideRedirect = True
, lowerOnStart = True
, hideOnStart = False
, allDesktops = True
, persistent = True
, iconRoot = myHomeDir ++ "/.config/xmonad/icons"
, iconOffset = -1
, sepChar = "@"
, alignSep = "}{"
}

View File

@ -1,36 +0,0 @@
-- vim: ft=haskell
--
-- xmobar config - https://github.com/jaor/xmobar
-- depends on:
-- - xmonad
--
Config {
-- BEHAVIOUR
overrideRedirect = True
, lowerOnStart = True
, persistent = True
-- APPEARANCE
, font = "xft:FiraCode Nerd Font:style=Regular:size=12"
, additionalFonts = ["xft:Open Sans:style=Regular:size=12"]
--bgColor = "#0d0e0c",
, bgColor = "#212121"
, fgColor = "#c8b6b8"
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 30 }
-- MODULES
, commands =
[ Run Date "%a %b %d, %H:%M" "date" 10
, Run Cpu [ "-t", "<fc=#8c7f80><bar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Memory [ "-t", "<fc=#8c7f80><usedbar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Com "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1" [] "volume" 1
-- , Run ComX "tail" ["-n1", "/tmp/.xmonad-workspace-log"] " Xmonad" "ws" 1
, Run ComX "tail" ["-n1", "/tmp/.xmonad-title-log"] "" "title" 1
-- , Run ComX "xkb-switch" [] "en" "lang" 1
, Run Com "/home/klein/.config/xmonad/xmobar/trayer-padding.sh" [] "trayerpad" 10
, Run UnsafeStdinReader
, Run UnsafeXMonadLog
]
-- DISPLAY
, alignSep = "}{"
, sepChar = "%"
, template = "  <fn=5>%UnsafeXMonadLog%</fn> }{ CPU: %cpu% Mem: %memory% %date% %trayerpad%"
}

View File

@ -1,36 +0,0 @@
-- vim: ft=haskell
--
-- xmobar config - https://github.com/jaor/xmobar
-- depends on:
-- - xmonad
--
Config {
-- BEHAVIOUR
overrideRedirect = True
, lowerOnStart = True
, persistent = True
-- APPEARANCE
, font = "xft:FiraCode Nerd Font:style=Regular:size=12"
, additionalFonts = ["xft:Open Sans:style=Regular:size=12"]
--bgColor = "#0d0e0c",
, bgColor = "#181814"
, fgColor = "#c8b6b8"
, position = Static { xpos = 1920, ypos = 148, width = 1920, height = 35 }
-- MODULES
, commands =
[ Run Date "%a %b %d, %H:%M" "date" 10
, Run Cpu [ "-t", "<fc=#8c7f80><bar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Memory [ "-t", "<fc=#8c7f80><usedbar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Com "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1" [] "volume" 1
-- , Run ComX "tail" ["-n1", "/tmp/.xmonad-workspace-log"] " Xmonad" "ws" 1
, Run ComX "tail" ["-n1", "/tmp/.xmonad-title-log"] "" "title" 1
-- , Run ComX "xkb-switch" [] "en" "lang" 1
-- , Run Com "/home/klein/.config/xmonad/xmobar/trayer-padding.sh" [] "trayerpad" 10
, Run UnsafeStdinReader
, Run UnsafeXMonadLog
]
-- DISPLAY
, alignSep = "}{"
, sepChar = "%"
, template = "  <fn=5>%UnsafeXMonadLog%</fn> <fc=#8c7f80>%title%</fc>}{ CPU: %cpu% Mem: %memory% %date%"
}

View File

@ -0,0 +1,506 @@
{-# 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 qualified Data.Map as M
import Data.Functor
import Data.Monoid
-- Used in io exitSuccess
import System.Exit
import System.Environment (getEnv)
import System.IO.Unsafe (unsafeDupablePerformIO)
-- XMonad imports
import XMonad
import XMonad.Hooks.WindowSwallowing
-- import XMonad.Config.Xfce
import XMonad.Actions.NoBorders (toggleBorder)
import XMonad.Util.Ungrab
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Layout.Fullscreen
-- import XMonad.Actions.PhysicalScreens
import XMonad.Layout.SimpleFloat
import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W
import XMonad.Util.ClickableWorkspaces
-- import XMonad.Util.WorkspaceCompare
import XMonad.Util.Cursor
import XMonad.Util.EZConfig
import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.SpawnOnce
import XMonad.Util.NamedScratchpad
import XMonad.Hooks.DynamicProperty
import XMonad.Layout.PerWorkspace
import XMonad.Hooks.ManageDebug
-- import qualified DBus as D
-- import qualified DBus.Client as D
main :: IO ()
main = do
-- dbus <- D.connectSession
-- getWellKnownName dbus
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 = map show [1 .. 9]
myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "music", "email", "x"]
-- Border Width
myBorderWidth :: Dimension
myBorderWidth = 2
-- Formal Unfocused Color
myNormColor :: String
myNormColor = "#5f819d"
-- Focused Color
myFocusColor :: String
myFocusColor = "#de935f"
-- 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; 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 "vscodium")
, ("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
[ "echo launched"
-- , "sh ~/scripts/screenlayout.sh"
, "nitrogen --restore &"
, "touch ~/tmp/touchy && rm -rf ~/tmp/*"
, "lxqt-policykit-agent &"
, myHomeDir ++ "/.local/bin/picom-jonaburg --glx-no-stencil --xrender-sync-fence -b &"
, "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 &"
, "nvidia-settings --load-config-only"
, "mpd &"
, "dunst -config $HOME/.config/dunst/base16-nord.dunstrc &"
, "lxqt-policykit-agent &"
, "/usr/bin/emacs --daemon &"
-- , "redshift -l -23.591672:-46.561005 -t 5700:3600 &"
]
setDefaultCursor xC_left_ptr
setWMName "jabuxas' bane"
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 =? "steam_app_1172620" --> doShift "gfx"
, className =? "discord" --> doShift "irc"
, className =? "discord-screenaudio" --> doShift "irc"
, className =? "Spotify" --> doShift "music"
, className =? "thunderbird" --> doShift "email"
, className =? "Steam" --> doShift "x"
, className =? "Lutris" --> doShift "gfx" <> doFloat
, className =? "leagueclientux.exe" --> doShift "gfx"
, className =? "league of legends.exe" --> doShift "gfx"
, className =? "leagueclient.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
, className =? "easyeffects" --> doFloat
, 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
]
myDynHook :: ManageHook
myDynHook =
composeAll
[ title=? "Riot Client Main" --> doFloat
]
{- 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
-- $ onWorkspace "gfx" simpleFloat
$ 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 "#98c379" "" . xmobarFont 5 . wrap "[" "]"
, ppVisibleNoWindows = Just (xmobarColor "#cc6666" "")
, ppHidden = xmobarColor "#d2ba8b" ""
, ppHiddenNoWindows = xmobarColor "#a3846e" ""
, ppUrgent = xmobarColor "#F7768E" "" . wrap "!" "!"
, ppTitle = xmobarColor "#98C379" "" . 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"))
xmobar :: StatusBarConfig
xmobar = statusBarProp myXmobar myXmobarPP
myXmobar :: String
myXmobar = ("xmobar " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs")
xmobar2 :: StatusBarConfig
xmobar2 = statusBarProp myXmobar2 myXmobarPP
myXmobar2 :: String
myXmobar2 = ("xmobar-2nd ")
myConfig =
def
{ modMask = myModMask
, focusFollowsMouse = myFocusFollowsMouse
, terminal = myTerminal
, mouseBindings = myMouseBindings
, borderWidth = myBorderWidth
, normalBorderColor = myNormColor
-- , logHook = logTitle dbus
, focusedBorderColor = myFocusColor
, layoutHook = myLayoutHook
-- <> onWorkspace "gfx" h8league
, startupHook = myStartupHook
, manageHook = myManageHook
, handleEventHook = Hacks.windowedFullscreenFixEventHook
<> swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True)
<> Hacks.trayerPaddingXmobarEventHook
<> dynamicPropertyChange "WM_CLASS" myDynHook
<> 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

@ -1,10 +1,11 @@
import System.Environment (getEnv)
import System.Environment
import System.IO.Unsafe (unsafeDupablePerformIO)
import Xmobar
main :: IO ()
main = xmobar =<< myConfig
main = xmobar =<< configFromArgs =<< myConfig
-- main = xmobar =<< myConfig
myHomeDir :: String
myHomeDir = unsafeDupablePerformIO (getEnv "HOME")
@ -19,62 +20,65 @@ myConfig =
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=5>%UnsafeXMonadLog%</fn>}{" ]
-- <>
-- [ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
-- \<fn=4><fc=#E06C75,#212121:5>%wlp5s0%</fc></fn>\
-- \<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
-- ]
[ "<fn=5>@UnsafeXMonadLog@</fn>}{" ]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#56B6C2,#212121:5>CPU: %cpu%</fc></fn>\
\<fn=4><fc=#E06C75,#212121:5>@music@</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#56B6C2,#212121:5>CPU: @cpu@%</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#C678DD,#212121:5>Mem: %memory%</fc></fn>\
\<fn=4><fc=#C678DD,#212121:5>Mem: @memory@% </fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#98C379,#212121:5>%vol%</fc></fn>\
\<fn=4><fc=#98C379,#212121:5>@vol@</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "<fn=2><fc=#212121,#212121:7>\xe0b6</fc></fn>\
\<fn=4><fc=#61AFEF,#212121:5>%date%</fc></fn>\
\<fn=4><fc=#61AFEF,#212121:5>@date@</fc></fn>\
\<fn=2><fc=#212121,#212121:7>\xe0b4</fc></fn> "
]
<>
[ "%trayer%"]
<>
[ "@trayer@"]
, commands = myCommands
}
myCommands :: [Runnable]
myCommands =
[ Run UnsafeXMonadLog
, Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh" ) ["vol"] "vol" 1
, Run $ Date "\xf017 %-l:%M %p" "date" 10
, Run $ Cpu [ "-t", "<fc=#8c7f80><bar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83" ] 10
, Run $ Memory [ "-t", "<fc=#8c7f80><usedbar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094" ] 10
, Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh" ) ["vol"] "vol" 20
, Run $ Date "\xf017 %-l:%M %p" "date" 600
, Run $ Cpu [ "-t", "<fc=#8c7f80><total></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83" ] 50
, Run $ Memory [ "-t", "<fc=#8c7f80><freeratio></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094" ] 50
-- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/gputemp.sh") ["gpu"] "gpu" 5
, Run $ Com (myHomeDir <> "/.config/xmonad/src/trayer-padding.sh") ["trayer"] "trayer" 10
, Run $ Com (myHomeDir <> "/.config/xmonad/scripts/trayer-padding.sh") ["trayer"] "trayer" 100
, Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["music"] "music" 20
-- , 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 = "xft:InconsolataGo Nerd Font:pixelsize=12:antialias=true:hinting=true"
, additionalFonts = [ "xft:InconsolataGo Nerd Font:pixelsize=10:antialias=true:hinting=true"
, "xft:InconsolataGo Nerd Font:size=13:antialias=true:hinting=true"
, "xft:InconsolataGo Nerd Font:size=11:antialias=true:hinting=true"
, "xft:InconsolataGo Nerd Font:size=11:antialias=true:hinting=true"
, "xft:InconsolataGo Nerd Font:pixelsize=13:antialias=true:hinting=true"
{ font = "xft:mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
, additionalFonts = [ "xft:mononoki Nerd Font:pixelsize=10:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:size=13:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true"
, "xft:mononoki Nerd Font:pixelsize=13:antialias=true:hinting=true"
]
, textOffsets = [20, 22, 21, 21, 20]
, bgColor = "#212121"
, fgColor = "#c8b6b8"
, borderColor = "#de935f"
, borderColor = "#a6e22e"
, border = FullB
, borderWidth = 1
{-
@ -84,13 +88,13 @@ baseConfig =
-}
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 30 }
, alpha = 255
, overrideRedirect = False
, overrideRedirect = True
, lowerOnStart = True
, hideOnStart = False
, allDesktops = True
, persistent = True
, iconRoot = myHomeDir ++ "/.config/xmonad/icons"
, iconOffset = -1
, sepChar = "%"
, sepChar = "@"
, alignSep = "}{"
}

View File

@ -2,6 +2,7 @@
MultiWayIf -- Required for `toggleFull` in `myAdditionalKeys`
, LambdaCase -- Required for `(\case)` statement in `myXmobarPP`
, FlexibleContexts
, OverloadedStrings
#-}
{-# OPTIONS_GHC
-Wno-missing-signatures
@ -30,6 +31,7 @@ import XMonad.Hooks.SetWMName
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Layout.Fullscreen
import XMonad.Layout.SimpleFloat
import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W
@ -38,10 +40,18 @@ import XMonad.Util.Cursor
import XMonad.Util.EZConfig
import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.SpawnOnce
import XMonad.Util.NamedScratchpad
import XMonad.Hooks.DynamicProperty
import XMonad.Layout.PerWorkspace
import XMonad.Hooks.ManageDebug
-- import qualified DBus as D
-- import qualified DBus.Client as D
main :: IO ()
main = do
xmonad
$ debugManageHookOn "M-S-d"
. docks
. ewmhFullscreen
. fullscreenSupport
@ -59,20 +69,23 @@ myModMask = mod4Mask
-- Default Terminal
myTerminal :: String
myTerminal = "kitty"
myTerminal = "urxvtc"
-- Default Launcher
myLauncher :: String
myLauncher = "/home/klein/.config/rofi/launchers/type-7/launcher.sh"
myLauncher = myHomeDir ++ "/.config/rofi/launchers/type-7/launcher.sh"
-- Default Launcher
myFileManager :: String
myFileManager = "pcmanfm"
myFileManager = "thunar"
-- Default Browser
myBrowser :: String
myBrowser = "firefox"
myPowerMenu :: String
myPowerMenu = myHomeDir ++ "/.config/rofi/powermenu/type-6/powermenu.sh"
-- Workspaces
myWorkspaces :: [String]
-- myWorkspaces = map show [1 .. 9]
@ -84,11 +97,11 @@ myBorderWidth = 2
-- Formal Unfocused Color
myNormColor :: String
myNormColor = "#5f819d"
myNormColor = "#383830"
-- Focused Color
myFocusColor :: String
myFocusColor = "#de935f"
myFocusColor = "#a6e22e"
-- Home Directory
myHomeDir :: String
@ -129,8 +142,10 @@ myAdditionalKeys =
where
fullscreen = W.RationalRect 0 0 1 1
-- Screenshots
screenShotSelection = "/home/klein/.local/bin/print-select" :: String
screenShotFullscreen = "/home/klein/.local/bin/print-fullscreen" :: String
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)
@ -162,10 +177,14 @@ myAdditionalKeys =
-- Spawning applications.
applications =
[ ("M-<Return>", spawn myTerminal)
, ("M-S-<Escape>", spawn "/home/klein/.config/rofi/powermenu/type-6/powermenu.sh")
, ("M-S-m", namedScratchpadAction myScratchpads "ncmpcpp")
, ("M-C-<Return>", namedScratchpadAction myScratchpads "terminal")
, ("M-S-<Escape>", spawn myPowerMenu)
, ("M-b", spawn myBrowser)
, ("M-S-d", spawn "/home/klein/Documents/discord-screenaudio/build/discord-screenaudio")
, ("M-v", spawn "vscodium")
, ("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)
@ -197,12 +216,27 @@ myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList
myStartupHook :: X ()
myStartupHook = do
traverse spawnOnce
[ "nitrogen --restore"
-- , ""
, "$HOME/scripts/xmonad.sh"
[ "sh ~/.config/conky/Regulus/start.sh"
, "sh ~/scripts/screenlayout.sh"
, "nitrogen --restore &"
, "touch ~/tmp/touchy && rm -rf ~/tmp/*"
, "lxqt-policykit-agent &"
, myHomeDir ++ "/.local/bin/picom-jonaburg --glx-no-stencil --xrender-sync-fence -b &"
, "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 &"
, "nvidia-settings --load-config-only"
, "mpd &"
, "dunst -config $HOME/.config/dunst/base16-nord.dunstrc &"
, "lxqt-policykit-agent &"
, "xrdb -load ~/.Xresources"
, "urxvtd --opendisplay --quiet --fork"
, "/usr/bin/emacs --daemon &"
-- , "redshift -l -23.591672:-46.561005 -t 5700:3600 &"
]
setDefaultCursor xC_left_ptr
setWMName "xmonad"
setWMName "jay's sin"
isInstance (ClassApp c _) = className =? c
isInstance (TitleApp t _) = title =? t
@ -246,7 +280,7 @@ myManageHook = manageRules
manageRules = composeOne
[ transience
, isDialog -?> doCenterFloat
, isFullscreen -?> (doF W.focusDown <+> doFullFloat)
, isFullscreen -?> (doF W.focusDown <> doFullFloat)
, match [ gimp
, gimp2
, about
@ -261,7 +295,7 @@ myManageHook = manageRules
, isSplash
] -?> doCenterFloat
] <> composeAll
[ manageDocks
[ manageDocks <> namedScratchpadManageHook myScratchpads
, className =? "firefox" <&&> title =? "File Upload" --> doFloat
, className =? "firefox" <&&> title =? "Library" --> doCenterFloat
, className =? "firefox" <&&> title ^? "Save" --> doFloat
@ -271,23 +305,31 @@ myManageHook = manageRules
, 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 =? "discord" --> doShift "irc"
, className =? "discord-screenaudio" --> doShift "irc"
, className =? "Spotify" --> doShift "music"
, className =? "thunderbird" --> doShift "email"
, className =? "Steam" --> doShift "x"
, className =? "leagueclientux.exe" --> doShift "gfx" <> doFloat
, className =? "Lutris" --> doShift "gfx" <> doFloat
, className =? "league of legends.exe" --> doShift "gfx" <> doFloat
, className =? "riotclientux.exe" --> doShift "gfx" <> doFloat
, className =? "leagueclientux.exe" --> doShift "gfx"
, className =? "league of legends.exe" --> doShift "gfx"
, className =? "leagueclient.exe" --> doShift "gfx"
, className =? "riotclientux.exe" --> doShift "gfx"
, className =? "dauntless-win64-shipping.exe" --> doShift "gfx"
, className =? "leagueclient.exe" --> doShift "gfx" <> doFloat
, 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
@ -296,19 +338,26 @@ myManageHook = manageRules
-- , title ^? "Steam - News" --> doHide -- I don't like the Steam news menu
]
myDynHook :: ManageHook
myDynHook =
composeAll
[ title=? "Riot Client Main" --> doFloat
]
{- May be useful one day
doClose = ask >>= liftX . killWindow >> mempty :: ManageHook
doForceKill = ask >>= liftX . forceKillWindow >> mempty :: ManageHook
-}
myEventHook :: Event -> X All
myEventHook _ = swallowEventHook (className =? "kitty" <||> className =? "Alacritty") (return True)
myEventHook _ = return (All True)
myLayoutHook =
avoidStruts
-- $ onWorkspace "gfx" simpleFloat
$ lessBorders OnlyScreenFloat
$ spacingRaw False(Border w w w w) True(Border w w w w) True
$ tiled ||| Mirror tiled ||| Full
$ tiled ||| simpleFloat ||| Mirror tiled ||| Full
where
tiled = Tall nmaster delta ratio
nmaster = 1 -- Default number of windows in the master pane.
@ -318,13 +367,13 @@ myLayoutHook =
myXmobarPP :: X PP
myXmobarPP =
clickablePP $ def
{ ppCurrent = xmobarColor "#de935f" "" . xmobarFont 5 . wrap "[" "]"
clickablePP $ filterOutWsPP ["NSP"] $ def
{ ppCurrent = xmobarColor "#a6e22e" "" . xmobarFont 5 . wrap "[" "]"
, ppVisibleNoWindows = Just (xmobarColor "#cc6666" "")
, ppHidden = xmobarColor "#d2ba8b" ""
, ppHiddenNoWindows = xmobarColor "#a3846e" ""
, ppHidden = xmobarColor "#a1efe4" ""
, ppHiddenNoWindows = xmobarColor "#ae81ff" ""
, ppUrgent = xmobarColor "#F7768E" "" . wrap "!" "!"
, ppTitle = xmobarColor "#98C379" "" . shorten 49
, ppTitle = xmobarColor "#a6e22e" "" . shorten 49
, ppSep = wrapSep " "
, ppTitleSanitize = xmobarStrip
, ppWsSep = xmobarColor "" "#212121" " "
@ -333,6 +382,8 @@ myXmobarPP =
"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
@ -346,13 +397,13 @@ xmobar :: StatusBarConfig
xmobar = statusBarProp myXmobar myXmobarPP
myXmobar :: String
myXmobar = ("xmobar " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs")
myXmobar = (myHomeDir ++ "/.local/bin/xmobar " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs")
xmobar2 :: StatusBarConfig
xmobar2 = statusBarProp myXmobar2 myXmobarPP
myXmobar2 :: String
myXmobar2 = ("xmobar-2nd")
myXmobar2 = (myHomeDir ++ "/.local/bin/xmobar-2nd ")
myConfig =
def
@ -366,9 +417,86 @@ myConfig =
, layoutHook = myLayoutHook
, startupHook = myStartupHook
, manageHook = myManageHook
, handleEventHook = myEventHook
<> Hacks.trayerAboveXmobarEventHook
, handleEventHook = Hacks.windowedFullscreenFixEventHook
<> swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True)
<> Hacks.trayerPaddingXmobarEventHook
<> dynamicPropertyChange "WM_CLASS" myDynHook
<> myEventHook
, workspaces = myWorkspaces
, keys = myKeys
} `additionalKeysP` myAdditionalKeys
}
`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

@ -5,12 +5,13 @@ packages:
extra-deps:
- github: xmonad/x11
commit: da9295f8b9d7768a836b5b9dca1b554f8ad1a047
commit: d91b15fd8bfe78fe2865976bd357d70381fd85ab
- github: xmonad/xmonad
commit: 488b52ffaa03456c295575c7a6613d2fe5281903
commit: cf4d6f31b1751318309ddcc1c5fd8aa71a6a453a
- github: xmonad/xmonad-contrib
commit: afd6824ce00063bb8e9b7a1c5daf0737c2f61616
commit: 6373dc41fa4dfb2a12c20e431976ceee6fd03837
- xmobar-0.44.2
- dbus-1.2.22
flags:
xmobar:
@ -18,5 +19,7 @@ flags:
with_threaded: true
with_xft: true
with_rtsopts: true
with_dbus: true
with_mpd: true
arch: x86_64

View File

@ -1,52 +0,0 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
name: X11
pantry-tree:
sha256: 498db3650a791ddc061ad184f3fde3f48c6825053ddfab6b137b5f50b7a8afff
size: 3504
sha256: f76c54965c6ace0a14a898972b5c0ff7ff2dc14cbea1b33aa00b86330509d04f
size: 162967
url: https://github.com/xmonad/x11/archive/da9295f8b9d7768a836b5b9dca1b554f8ad1a047.tar.gz
version: 1.10.3
original:
url: https://github.com/xmonad/x11/archive/da9295f8b9d7768a836b5b9dca1b554f8ad1a047.tar.gz
- completed:
name: xmonad
pantry-tree:
sha256: 33d22819ed69d12f0833ce062b431e4330200ae77eb2da2b84172d850e656f25
size: 3702
sha256: 21b0722219d9a870e3cca3c44768088077cbd2c9dcb02c9a101d7f2e9efb0525
size: 106520
url: https://github.com/xmonad/xmonad/archive/488b52ffaa03456c295575c7a6613d2fe5281903.tar.gz
version: 0.17.1
original:
url: https://github.com/xmonad/xmonad/archive/488b52ffaa03456c295575c7a6613d2fe5281903.tar.gz
- completed:
name: xmonad-contrib
pantry-tree:
sha256: e965913f4482e3506f6dbd902a3e02ad4629421cad2c971e4f58fb5db0cd079a
size: 24086
sha256: 753fc8d0331ffb9820aa068e99149f0d20425b031483bae1de2086c9a44b6b1f
size: 660327
url: https://github.com/xmonad/xmonad-contrib/archive/afd6824ce00063bb8e9b7a1c5daf0737c2f61616.tar.gz
version: 0.17.1
original:
url: https://github.com/xmonad/xmonad-contrib/archive/afd6824ce00063bb8e9b7a1c5daf0737c2f61616.tar.gz
- completed:
hackage: xmobar-0.44.2@sha256:a2eed5f8833194babd60e45520023cd5698ccb8d40976d1f41a9b53b350297d0,14895
pantry-tree:
sha256: c7714be550d267369496c484ba727847f50e941d66009d2f8a8268629fe953f8
size: 9498
original:
hackage: xmobar-0.44.2
snapshots:
- completed:
sha256: f5d9002479d87103fd070f17cfe71fcd2147676f1e47a2dabca5ab91a42b846d
size: 619399
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/23.yaml
original: lts-19.23

View File

@ -1,53 +0,0 @@
#!/bin/bash
# Detects the width of running window with name given as first
# argument (xprop name '$1') and creates an XPM icon of that width,
# 1px height, and transparent. Outputs an <icon>-tag for use in
# xmobar to display the generated XPM icon.
#
# Run script from xmobar and trayer:
# `Run Com "/where/ever/padding-icon.sh" ["panel"] "trayerpad" 10`
# and use `%trayerpad%` in your template.
# or, if you're using for instance stalonetray:
# `Run Com "/where/ever/padding-icon.sh" ["stalonetray"] "tray" 10`
# Very heavily based on Jonas Camillus Jeppensen code
# https://github.com/jaor/xmobar/issues/239#issuecomment-233206552
# Function to create a transparent Wx1 px XPM icon
create_xpm_icon () {
timestamp=$(date)
pixels=$(for i in `seq $1`; do echo -n "."; done)
cat << EOF > "$2"
/* XPM *
static char * trayer_pad_xpm[] = {
/* This XPM icon is used for padding in xmobar to */
/* leave room for trayer-srg. It is dynamically */
/* updated by by trayer-pad-icon.sh which is run */
/* by xmobar. */
/* Created: ${timestamp} */
/* <w/cols> <h/rows> <colors> <chars per pixel> */
"$1 1 1 1",
/* Colors (none: transparent) */
". c none",
/* Pixels */
"$pixels"
};
EOF
}
# Width of the trayer window
width=$(xprop -name panel | grep 'program specified minimum size' | cut -d ' ' -f 5)
# Icon file name
iconfile="/tmp/$pname-padding-${width:-0}px.xpm"
# If the desired icon does not exist create it
if [ ! -f $iconfile ]
then
create_xpm_icon $width $iconfile
fi
# Output the icon tag for xmobar
echo "<icon=${iconfile}/>"

View File

@ -1,36 +0,0 @@
-- vim: ft=haskell
--
-- xmobar config - https://github.com/jaor/xmobar
-- depends on:
-- - xmonad
--
Config {
-- BEHAVIOUR
overrideRedirect = True
, lowerOnStart = True
, persistent = True
-- APPEARANCE
, font = "xft:FiraCode Nerd Font:style=Regular:size=12"
, additionalFonts = ["xft:Open Sans:style=Regular:size=12"]
--bgColor = "#0d0e0c",
, bgColor = "#212121"
, fgColor = "#c8b6b8"
, position = Static { xpos = 0, ypos = 0, width = 1920, height = 30 }
-- MODULES
, commands =
[ Run Date "%a %b %d, %H:%M" "date" 10
, Run Cpu [ "-t", "<fc=#8c7f80><bar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Memory [ "-t", "<fc=#8c7f80><usedbar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Com "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1" [] "volume" 1
-- , Run ComX "tail" ["-n1", "/tmp/.xmonad-workspace-log"] " Xmonad" "ws" 1
, Run ComX "tail" ["-n1", "/tmp/.xmonad-title-log"] "" "title" 1
-- , Run ComX "xkb-switch" [] "en" "lang" 1
, Run Com "/home/klein/.config/xmonad/xmobar/trayer-padding.sh" [] "trayerpad" 10
, Run UnsafeStdinReader
, Run UnsafeXMonadLog
]
-- DISPLAY
, alignSep = "}{"
, sepChar = "%"
, template = "  <fn=5>%UnsafeXMonadLog%</fn> }{ CPU: %cpu% Mem: %memory% %date% %trayerpad%"
}

View File

@ -1,36 +0,0 @@
-- vim: ft=haskell
--
-- xmobar config - https://github.com/jaor/xmobar
-- depends on:
-- - xmonad
--
Config {
-- BEHAVIOUR
overrideRedirect = True
, lowerOnStart = True
, persistent = True
-- APPEARANCE
, font = "xft:FiraCode Nerd Font:style=Regular:size=12"
, additionalFonts = ["xft:Open Sans:style=Regular:size=12"]
--bgColor = "#0d0e0c",
, bgColor = "#181814"
, fgColor = "#c8b6b8"
, position = Static { xpos = 1920, ypos = 148, width = 1920, height = 35 }
-- MODULES
, commands =
[ Run Date "%a %b %d, %H:%M" "date" 10
, Run Cpu [ "-t", "<fc=#8c7f80><bar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Memory [ "-t", "<fc=#8c7f80><usedbar></fc>", "-f", ":", "-H", "75", "-L", "25", "-h", "#C15A45", "-n", "#E4966D", "-l", "#BE8961" ] 10
, Run Com "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1" [] "volume" 1
-- , Run ComX "tail" ["-n1", "/tmp/.xmonad-workspace-log"] " Xmonad" "ws" 1
, Run ComX "tail" ["-n1", "/tmp/.xmonad-title-log"] "" "title" 1
-- , Run ComX "xkb-switch" [] "en" "lang" 1
-- , Run Com "/home/klein/.config/xmonad/xmobar/trayer-padding.sh" [] "trayerpad" 10
, Run UnsafeStdinReader
, Run UnsafeXMonadLog
]
-- DISPLAY
, alignSep = "}{"
, sepChar = "%"
, template = "  <fn=5>%UnsafeXMonadLog%</fn> <fc=#8c7f80>%title%</fc>}{ CPU: %cpu% Mem: %memory% %date%"
}

View File

@ -1,6 +1,6 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.0.
--
-- see: https://github.com/sol/hpack
@ -22,6 +22,7 @@ executable xmobar
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -O2 -j -dynamic -rtsopts -threaded -with-rtsopts=-N
build-depends:
base
, dbus
, xmobar
, xmonad-contrib >=0.16
default-language: Haskell2010
@ -37,6 +38,7 @@ executable xmonad
X11 >=1.10
, base
, containers
, dbus
, xmonad
, xmonad-contrib >=0.16
default-language: Haskell2010

View File

@ -1,269 +0,0 @@
-- ## Modules ## -------------------------------------------------------------------
{-# LANGUAGE MultiWayIf #-}
import XMonad
import XMonad.Util.SpawnOnce
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.ManageHook
import XMonad.Util.Ungrab
import XMonad.Util.Hacks as Hacks
import XMonad.Hooks.WindowSwallowing
import XMonad.Layout.Fullscreen
import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing
import XMonad.Layout.Gaps
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import System.Exit
import Control.Monad
import Data.Monoid
import Data.Maybe
import XMonad.Util.Cursor
import Graphics.X11.ExtraTypes.XF86
import XMonad.Util.ClickableWorkspaces
import qualified XMonad.StackSet as W
import qualified Data.Map as M
-- focus follows the mouse pointer
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
-- clicking on a window to focus
myClickJustFocuses :: Bool
myClickJustFocuses = True
-- Width of the window border in pixels
myBorderWidth = 2
-- Border colors for focused & unfocused windows
myFocusedBorderColor = "#de935f"
myNormalBorderColor = "#5f819d"
-- modMask : modkey you want to use
-- mod1Mask : left alt Key
-- mod4Mask : Windows or Super Key
myModMask = mod4Mask
myTerminal = "kitty"
-- Workspaces (ewmh)
myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "music", "email", "x"]
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- Close focused window
[ ((modm .|. shiftMask, xK_c), kill)
, ((modm, xK_Escape), spawn "mpc toggle")
, ((modm .|. shiftMask, xK_m), spawn "kitty -e ncmpcpp")
, ((modm, xK_e), spawn "pcmanfm")
, ((modm, xK_v), spawn "vscodium")
, ((modm, xK_Return), spawn myTerminal)
, ((modm .|. shiftMask, xK_Escape), spawn "/home/klein/.config/rofi/powermenu/type-6/powermenu.sh")
, ((modm .|. shiftMask, xK_Return), spawn "/home/klein/.config/rofi/launchers/type-7/launcher.sh")
, ((0 .|. shiftMask, xK_Print), unGrab >> spawn "/home/klein/.local/bin/print-select")
, ((0, xK_Print), spawn "/home/klein/.local/bin/print-fullscreen")
-- Change gaps on the fly
, ((modm .|. controlMask, xK_o), sendMessage $ IncGap 10 L) -- increment the left-hand gap
, ((modm .|. shiftMask, xK_o), sendMessage $ DecGap 10 L) -- decrement the left-hand gap
, ((modm .|. controlMask, xK_y), sendMessage $ IncGap 10 U) -- increment the top gap
, ((modm .|. shiftMask, xK_y), sendMessage $ DecGap 10 U) -- decrement the top gap
, ((modm .|. controlMask, xK_u), sendMessage $ IncGap 10 D) -- increment the bottom gap
, ((modm .|. shiftMask, xK_u), sendMessage $ DecGap 10 D) -- decrement the bottom gap
, ((modm .|. controlMask, xK_i), sendMessage $ IncGap 10 R) -- increment the right-hand gap
, ((modm .|. shiftMask, xK_i), sendMessage $ DecGap 10 R) -- decrement the right-hand gap
-- Resize viewed windows to the correct size
, ((modm, xK_r), refresh)
-- Move focus to the master window
, ((modm, xK_m), windows W.focusMaster)
-- Push window back into tiling
, ((modm, xK_t), withFocused $ windows . W.sink)
-- Rotate through the available layout algorithms
, ((modm, xK_space), sendMessage NextLayout)
-- Reset the layouts on the current workspace to default
, ((modm .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf)
-- Move focus to the next window
, ((modm, xK_Tab), windows W.focusDown)
-- Move focus to the next window
, ((modm, xK_j), windows W.focusDown)
, ((modm, xK_Left), windows W.focusDown)
-- Move focus to the previous window
, ((modm, xK_k), windows W.focusUp)
, ((modm, xK_Right), windows W.focusUp)
-- Swap the focused window with the next window
, ((modm .|. shiftMask, xK_j), windows W.swapDown)
, ((modm .|. shiftMask, xK_h), windows W.swapDown)
-- Swap the focused window with the previous window
, ((modm .|. shiftMask, xK_k), windows W.swapUp)
, ((modm .|. shiftMask, xK_l), windows W.swapUp)
-- Shrink the master area
, ((modm, xK_h), sendMessage Shrink)
, ((modm .|. controlMask, xK_Left), sendMessage Shrink)
-- Expand the master area
, ((modm, xK_l), sendMessage Expand)
, ((modm .|. controlMask, xK_Right), sendMessage Expand)
-- Increment the number of windows in the master area
, ((modm, xK_comma), sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area
, ((modm, xK_period), sendMessage (IncMasterN (-1)))
-- volume
, ((0,xF86XK_AudioMute), spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle")
, ((0,xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%")
, ((0,xF86XK_AudioRaiseVolume), spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%")
-- Restart xmonad
, ((controlMask .|. shiftMask, xK_r), spawn "xmonad --recompile; xmonad --restart")
-- Quit xmonad
, ((controlMask .|. shiftMask, xK_q), spawn "pkill -KILL -u $USER")
-- programs
, ((modm, xK_d), spawn "cd ~/.config && ./webcordx")
, ((modm, xK_s), spawn "spotify")
, ((modm , xK_y ), sendMessage ToggleStruts)
, ((modm .|. shiftMask, xK_b), spawn "firefox")
-- , ((modm, xK_F1), spawn "dmenu_run")
-- spotify controls, handy af
, ((modm, xK_F9), spawn "playerctl play-pause")
, ((modm, xK_F11), spawn "playerctl previous")
, ((modm, xK_F12), spawn "playerctl next")
, ((modm, xK_p), spawn "flameshot")
, ((modm, xK_F4), withFocused toggleFull)
]
++
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
[ ((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)]
]
++
-- mod-{q,a,z}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{q,a,z}, Move client to screen 1, 2, or 3
[ ((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)]
]
-- ## Mouse Bindings ## ------------------------------------------------------------------
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)
]
myLayout =
avoidStruts
$ lessBorders OnlyScreenFloat
$ gaps [(L,5), (R,5), (U,5), (D,5)]
$ spacingRaw False (Border 10 0 10 0) True (Border 0 10 0 10) True
$ tiled ||| 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.
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
myManageHook = manageRules
where
viewShift = doF . liftM2 (.) W.greedyView W.shift
manageRules = composeAll . concat $
[ [ isDialog --> doCenterFloat ]
, [ className =? c --> doCenterFloat | c <- myCFloats ]
, [ title =? t --> doCenterFloat | t <- myTFloats ]
, [ resource =? r --> doFloat | r <- myRFloats ]
, [ resource =? i --> doIgnore | i <- myIgnores ]
, [ className =? "firefox" --> viewShift "web" ]
, [ className =? "firefox-esr" --> doShift "web" ]
, [ className =? "discord" --> doShift "irc" ]
, [ className =? "Spotify" --> doShift "music" ]
, [ className =? "thunderbird" --> doShift "email" ]
, [ className =? "Steam" --> doShift "x" ]
, [ className =? "leagueclientux.exe" --> doShift "gfx" <> doFloat ]
, [ className =? "Lutris" --> doShift "gfx" <> doFloat]
, [ className =? "league of legends.exe" --> doShift "gfx" <> doFloat ]
, [ className =? "riotclientux.exe" --> doShift "gfx" <> doFloat ]
, [ className =? "dauntless-win64-shipping.exe" --> doShift "gfx" ]
, [ className =? "leagueclient.exe" --> doShift "gfx" <> doFloat ]
, [ className =? "battle.net.exe" --> doShift "gfx" <> doFloat ]
, [ className =? "Pcmanfm" --> doFloat ]
, [ className =? "Pavucontrol" --> doFloat ]
]
where
myCFloats = ["Viewnior", "Alafloat"]
myTFloats = ["Downloads", "Save As...", "Getting Started"]
myRFloats = []
myIgnores = ["desktop_window"]
-- , [className =? "Alacritty" --> viewShift "1"]
-- , [className =? "Thunar" --> viewShift "3"]
-- , [className =? "Geany" --> viewShift "4"]
-- , [className =? "Inkscape" --> viewShift "5"]
-- , [className =? "vlc" --> viewShift "6"]
-- , [className =? "Xfce4-settings-manager" --> viewShift "7"]
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
myEventHook :: Event -> X All
myEventHook = mempty $ swallowEventHook (className =? "Alacritty" <||> className =? "kitty") (return True) -- ewmh
myStartupHook :: X ()
myStartupHook = do
setDefaultCursor xC_left_ptr
spawnOnce "nitrogen --restore"
spawnOnce "/home/klein/scripts/xmonad.sh"
-- spawnOnce "picom --daemon --experimental-backends --backend glx --blur-method dual_kawase --transparent-clipping"
-- spawnOnce "killall trayer; trayer --edge top --align right --widthtype request --padding 2 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x161814 --height 25 --distance 3 &"
-- spawnOnce "dunst"
myLogHook = return ()
myXmobarPP :: PP
myXmobarPP =
def
{ ppCurrent = xmobarColor "#de935f" "" . wrap "[" "]",
ppHidden = xmobarColor "#d2ba8b" "",
ppHiddenNoWindows = xmobarColor "#a3846e" "",
ppSep = " > ",
ppOrder = \(ws : l : t : ex) -> [ws] ++ map (xmobarColor "#E06C75" "") ex ++ [xmobarColor "#ABB2BF" "" t],
ppExtras = []
}
myConfig =
def
{ focusFollowsMouse = myFocusFollowsMouse
, clickJustFocuses = myClickJustFocuses
, borderWidth = myBorderWidth
, modMask = myModMask
, workspaces = myWorkspaces
, normalBorderColor = myNormalBorderColor
, focusedBorderColor = myFocusedBorderColor
, terminal = myTerminal
-- Keybindings
, keys = myKeys
, mouseBindings = myMouseBindings
-- Hooks and layouts
, manageHook = myManageHook
, layoutHook = myLayout
, handleEventHook = myEventHook
<> Hacks.trayerAboveXmobarEventHook
, logHook = myLogHook
, startupHook = myStartupHook
}
main :: IO ()
main =
do
xmonad
. ewmhFullscreen
. docks
. ewmh
-- . withEasySB (statusBarProp "xmobar -x 1 ~/.config/xmonad/xmobar/xmobar1.hs" (pure myXmobarPP)) defToggleStrutsKey
. withEasySB (statusBarProp "xmobar -x 0 ~/.config/xmonad/xmobar/xmobar.hs" (pure myXmobarPP)) defToggleStrutsKey
$ myConfig