2016-05-29 12:06:32 +00:00
|
|
|
import XMonad
|
2017-08-29 10:26:56 +00:00
|
|
|
import XMonad.Config.Desktop
|
2019-11-22 14:31:20 +00:00
|
|
|
import Data.Monoid
|
|
|
|
import Data.Word
|
|
|
|
import Graphics.X11.Xlib
|
|
|
|
import Graphics.X11.Xlib.Extras
|
2021-06-22 06:22:23 +00:00
|
|
|
import XMonad.Actions.UpdatePointer (updatePointer)
|
2016-05-29 12:06:32 +00:00
|
|
|
import XMonad.Hooks.DynamicLog
|
2021-05-27 10:43:17 +00:00
|
|
|
import XMonad.Hooks.EwmhDesktops
|
2016-05-29 12:06:32 +00:00
|
|
|
import XMonad.Hooks.ManageDocks
|
2021-06-22 06:22:23 +00:00
|
|
|
import XMonad.Hooks.UrgencyHook
|
2020-05-22 14:30:00 +00:00
|
|
|
import XMonad.Layout.Accordion
|
|
|
|
import XMonad.Layout.Circle
|
2021-06-22 06:22:23 +00:00
|
|
|
import XMonad.Layout.GridVariants
|
|
|
|
import XMonad.Layout.LayoutCombinators hiding ( (|||) )
|
2020-05-22 14:30:00 +00:00
|
|
|
import XMonad.Layout.Spiral
|
|
|
|
import XMonad.Layout.Tabbed
|
|
|
|
import XMonad.Layout.ThreeColumns
|
|
|
|
import XMonad.Prompt
|
|
|
|
import XMonad.Prompt.Shell ( shellPrompt )
|
2016-05-29 12:06:32 +00:00
|
|
|
import XMonad.Util.Run(spawnPipe)
|
|
|
|
import XMonad.Util.EZConfig(additionalKeys)
|
2021-06-22 06:22:23 +00:00
|
|
|
import XMonad.Util.NamedWindows
|
|
|
|
import XMonad.Util.Run
|
2020-05-22 14:30:00 +00:00
|
|
|
import XMonad.Util.SpawnOnce
|
2016-05-29 12:06:32 +00:00
|
|
|
import System.IO
|
|
|
|
|
2021-06-22 06:22:23 +00:00
|
|
|
import qualified XMonad.StackSet as W
|
|
|
|
|
2020-05-22 14:30:00 +00:00
|
|
|
colourBackground :: String
|
2021-05-27 10:43:17 +00:00
|
|
|
colourBackground = "#1c1c1c"
|
2020-05-22 14:30:00 +00:00
|
|
|
|
|
|
|
colourForeground :: String
|
2021-05-27 10:43:17 +00:00
|
|
|
colourForeground = "#d0d0d0"
|
2020-05-22 14:30:00 +00:00
|
|
|
|
|
|
|
highlightBackground :: String
|
2021-05-27 10:43:17 +00:00
|
|
|
highlightBackground = "#ffaf00"
|
2020-05-22 14:30:00 +00:00
|
|
|
|
|
|
|
highlightForeground :: String
|
2021-05-27 10:43:17 +00:00
|
|
|
highlightForeground = "#1c1c1c"
|
2020-05-22 14:30:00 +00:00
|
|
|
|
|
|
|
-- Set xmobar as my task bar.
|
|
|
|
myWsBar :: String
|
2022-02-08 21:35:05 +00:00
|
|
|
myWsBar = "xmobar -v -d $HOME/.xmobarrc"
|
2020-05-22 14:30:00 +00:00
|
|
|
|
|
|
|
myXPConfig = def -- Configure the prompt's appearance
|
|
|
|
{ alwaysHighlight = True
|
|
|
|
, bgColor = colourBackground
|
|
|
|
, bgHLight = highlightBackground
|
|
|
|
, fgColor = colourForeground
|
|
|
|
, fgHLight = highlightForeground
|
|
|
|
, font = "xft:Open Sans:size=9"
|
|
|
|
, position = Top
|
|
|
|
, promptBorderWidth = 0
|
|
|
|
}
|
|
|
|
|
2021-05-12 01:24:00 +00:00
|
|
|
backgroundCmd = "feh --bg-scale ~/Documents/Images/Posters/STEVEs.jpeg"
|
2020-05-22 14:30:00 +00:00
|
|
|
compositeMgr = "xcompmgr -f -C -n -D 3"
|
|
|
|
musicCmd = "mpd"
|
|
|
|
nextcloudCmd = "nextcloud"
|
|
|
|
notificationCmd = "lxqt-notificationd"
|
|
|
|
screensaverCmd = "xscreensaver -no-splash"
|
|
|
|
settingsDaemon = "xsettingsd"
|
|
|
|
terminalCmd = "termonad"
|
2021-05-27 10:43:17 +00:00
|
|
|
trayerCmd = "trayer --edge top --SetPartialStrut false --width 7 --transparent true --alpha 0 --tint 0x1C1C1C --height 20 --monitor primary"
|
2020-05-22 14:30:00 +00:00
|
|
|
|
2016-05-29 12:06:32 +00:00
|
|
|
main = do
|
2019-01-05 07:06:54 +00:00
|
|
|
-- Make sure that HDMI is turned off by default
|
2021-06-22 06:22:23 +00:00
|
|
|
spawn "xrandr --output eDP-1 --primary --output HDMI-1 --off"
|
2020-05-22 14:30:00 +00:00
|
|
|
wsbar <- spawnPipe myWsBar
|
2021-05-27 10:43:17 +00:00
|
|
|
xmonad $ ewmh desktopConfig
|
2019-11-29 02:26:28 +00:00
|
|
|
{ focusFollowsMouse = False
|
2020-05-22 14:30:00 +00:00
|
|
|
, terminal = terminalCmd -- Set the default terminal
|
|
|
|
, startupHook = do
|
|
|
|
spawnOnce screensaverCmd -- Launch the screen saver
|
|
|
|
spawnOnce backgroundCmd -- Set the background wallpaper
|
|
|
|
spawnOnce compositeMgr -- Launch the composite manager
|
|
|
|
spawnOnce settingsDaemon -- Launch the settings daemon
|
|
|
|
spawnOnce trayerCmd -- Launch the system tray, configured to work correctly with dual monitors
|
|
|
|
spawnOnce notificationCmd -- Launch the notification service
|
|
|
|
spawnOnce musicCmd -- Launch the music playing daemon
|
|
|
|
spawnOnce nextcloudCmd -- Launch the cloud service
|
|
|
|
, manageHook = manageDocks <+> manageHook desktopConfig
|
|
|
|
, layoutHook = avoidStruts $ layoutHook desktopConfig
|
2021-06-22 06:22:23 +00:00
|
|
|
||| ThreeColMid 1 (3/100) (1/2)
|
2020-05-22 14:30:00 +00:00
|
|
|
||| spiral (6/7)
|
2021-06-22 06:22:23 +00:00
|
|
|
||| Grid (16/10)
|
2020-05-22 14:30:00 +00:00
|
|
|
||| Circle
|
|
|
|
||| simpleTabbed
|
|
|
|
||| Accordion
|
2021-06-22 06:22:23 +00:00
|
|
|
||| SplitGrid T 1 2 (1/3) (16/10) (5/100)
|
|
|
|
-- ||| (ThreeColMid 1 (3/100) (1/3) *//* Full)
|
2020-05-22 14:30:00 +00:00
|
|
|
, handleEventHook = handleEventHook desktopConfig <+> docksEventHook
|
2021-06-22 06:22:23 +00:00
|
|
|
, logHook = dynamicLogWithPP xmobarPP
|
2020-05-22 14:30:00 +00:00
|
|
|
{ ppOutput = hPutStrLn wsbar
|
2021-05-27 10:43:17 +00:00
|
|
|
, ppCurrent = xmobarColor "#ffaf00" "" . wrap "[" "]"
|
|
|
|
, ppVisible = xmobarColor "#5fafd7" "" . wrap "(" ")"
|
|
|
|
, ppLayout = xmobarColor "#5fafd7" ""
|
|
|
|
, ppTitle = xmobarColor "#ffaf00" "" . shorten 50
|
2021-06-22 06:22:23 +00:00
|
|
|
} >> updatePointer (0.25, 0.25) (0.25, 0.25) -- near the top-left
|
2017-03-30 03:59:51 +00:00
|
|
|
, modMask = mod4Mask -- Rebind Mod to the Windows key
|
|
|
|
--, borderWidth = 1
|
|
|
|
} `additionalKeys`
|
2020-05-22 14:30:00 +00:00
|
|
|
-- Use Xmonad's built-in launcher
|
|
|
|
[ ((mod4Mask, xK_p), shellPrompt myXPConfig)
|
2017-03-30 03:59:51 +00:00
|
|
|
-- Lock the screen
|
|
|
|
, ((0, 0x1008ff2d), spawn "xscreensaver-command -lock")
|
|
|
|
-- XF86ScreenSaver
|
2018-02-24 11:14:04 +00:00
|
|
|
, ((mod4Mask .|. controlMask, xK_l), spawn "xscreensaver-command -lock")
|
2021-06-22 06:22:23 +00:00
|
|
|
, ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s") -- Screenshot the selected window
|
|
|
|
, ((0, xK_Print), spawn "scrot") -- Screenshot the entire screen
|
2018-02-24 11:14:04 +00:00
|
|
|
-- Turn on the eDP-1 port and set it as the primary display
|
|
|
|
, ((mod4Mask .|. shiftMask, xK_e), spawn
|
2019-12-17 23:18:05 +00:00
|
|
|
"xrandr --output eDP-1 --primary --auto"
|
2017-03-30 03:59:51 +00:00
|
|
|
)
|
2021-06-14 00:42:13 +00:00
|
|
|
-- Turn off the eDP-1 port
|
|
|
|
, ((mod4Mask .|. controlMask, xK_e), spawn
|
|
|
|
"xrandr --output eDP-1 --off"
|
|
|
|
)
|
2017-03-30 03:59:51 +00:00
|
|
|
-- Turn off the HDMI port
|
|
|
|
, ((mod4Mask .|. controlMask, xK_h), spawn
|
2019-06-21 03:41:34 +00:00
|
|
|
"xrandr --output HDMI-1 --off"
|
2017-03-30 03:59:51 +00:00
|
|
|
)
|
2018-02-24 11:14:04 +00:00
|
|
|
-- Turn on the HDMI-1 port and set it as the secondary display
|
2017-03-30 03:59:51 +00:00
|
|
|
, ((mod4Mask .|. shiftMask, xK_h), spawn
|
2021-06-22 06:22:23 +00:00
|
|
|
"xrandr --newmode \"3840x2160R\" 241.50 2560 2608 2640 2720 1440 1443 1448 1481 +hsync -vsync ; xrandr --addmode HDMI-1 2560x1440R ; xrandr --output eDP-1 --primary --auto --output HDMI-1 --above eDP-1 --mode 2560x1440R ; feh --bg-scale ~/Documents/Images/Posters/STEVEs.jpeg"
|
2017-03-30 03:59:51 +00:00
|
|
|
)
|
2019-01-05 07:06:54 +00:00
|
|
|
, ((0 , 0x1008FF11), spawn "amixer set Master 2%-") -- XF86AudioLowerVolume
|
|
|
|
-- , ((mod4Mask , xK_Down), spawn "amixer set Master 2%-")
|
|
|
|
, ((0 , 0x1008FF12), spawn "amixer set Master toggle") -- XF86AudioMute
|
|
|
|
, ((0 , 0x1008FF13), spawn "amixer set Master 2%+") -- XF86AudioRaiseVolume
|
|
|
|
-- , ((mod4Mask , xK_Up), spawn "amixer set Master 2%+")
|
2017-03-30 03:59:51 +00:00
|
|
|
, ((0 , 0x1008FF14), spawn "mpc toggle") -- Play/pause
|
2019-01-05 07:06:54 +00:00
|
|
|
-- , ((mod4Mask , xK_End), spawn "mpc toggle")
|
2018-03-20 23:28:50 +00:00
|
|
|
, ((mod4Mask .|. controlMask, xK_space), spawn "mpc toggle") -- Play/pause
|
2017-03-30 03:59:51 +00:00
|
|
|
, ((0 , 0x1008FF15), spawn "mpc stop") -- Stop
|
|
|
|
, ((0 , 0x1008FF16), spawn "mpc prev") -- XF86AudioPrevious
|
2019-01-05 07:06:54 +00:00
|
|
|
, ((mod4Mask , xK_Left), spawn "mpc prev") -- prev
|
2017-03-30 03:59:51 +00:00
|
|
|
, ((0 , 0x1008FF17), spawn "mpc next") -- XF86AudioNext
|
2019-01-05 07:06:54 +00:00
|
|
|
, ((mod4Mask , xK_Right), spawn "mpc next") -- Next
|
2018-02-24 11:14:04 +00:00
|
|
|
-- XF86MonBrightnessUp
|
2019-01-05 07:06:54 +00:00
|
|
|
, ((0 , 0x1008ff02), spawn "xbrightness +5000")
|
2018-02-24 11:14:04 +00:00
|
|
|
-- XF86MonBrightnessDown
|
2019-01-05 07:06:54 +00:00
|
|
|
, ((0 , 0x1008ff03), spawn "xbrightness -5000")
|
2017-03-30 03:59:51 +00:00
|
|
|
]
|