added backlight script which can be updated to support more devices, also updated xmonad.hs to use 10% increments rather than 5%

This commit is contained in:
Solomon Laing 2021-04-25 19:06:02 +09:30
parent 58f9ef2077
commit 4354d2cdc7

View File

@ -23,9 +23,8 @@ import qualified XMonad.Actions.Search as S
-- Data
import Data.Char (isSpace, toUpper)
import Data.Maybe (fromJust)
import Data.Maybe ( fromJust, isJust )
import Data.Monoid
import Data.Maybe (isJust)
import Data.Tree
import qualified Data.Map as M
@ -85,7 +84,7 @@ import XMonad.Util.SpawnOnce
-- The preferred terminal program, which is used in a binding below and by
-- certain contrib modules.
myTerminal :: String
myTerminal = "alacritty"
myTerminal = "LIBGL_ALWAYS_SOFTWARE=1 alacritty"
myFileManager :: String
myFileManager = "thunar"
@ -140,7 +139,7 @@ myWorkspaces :: [String]
-- myWorkspaces = [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "]
myWorkspaces = ["web", "game", "dev", "doc", "mus", "vid", "sys", "chat", "virt"]
myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y)
myWorkspaceIndices = M.fromList $ zip myWorkspaces [1..] -- (,) == \x y -> (x,y)
clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
where i = fromJust $ M.lookup ws myWorkspaceIndices
@ -148,7 +147,7 @@ clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
------------------------------------------------------------------------
-- Key bindings. Add, modify or remove key bindings here.
-- These are general keybindings custom script bindings are not included.
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $
[
-- launch a terminal
@ -224,7 +223,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
, ((modm, xK_b ), sendMessage ToggleStruts)
-- Quit xmonad
, ((modm .|. shiftMask, xK_apostrophe ), io (exitWith ExitSuccess))
, ((modm .|. shiftMask, xK_apostrophe ), io (exitSuccess))
-- Restart xmonad
, ((modm, xK_apostrophe ), spawn "xmonad --recompile; xmonad --restart")
@ -310,10 +309,10 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
--
[
-- increase backlight by 10 with mod+f9
((modm, xK_F9), spawn "backlight_control +5")
((modm, xK_F9), spawn "/home/solomon/.local/bin/mod_backlight +10")
-- decrese backlight by 10 with mod+f8x
, ((modm, xK_F8), spawn "backlight_control -5")
, ((modm, xK_F8), spawn "/home/solomon/.local/bin/mod_backlight -10")
]
++
@ -336,7 +335,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- Mouse bindings: default actions bound to mouse events
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList
-- mod-button1, Set the window to floating mode and move by dragging
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
@ -428,8 +427,9 @@ myLayout = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats
spirals
||| grid
||| noBorders monocle
-- ||| tall
||| noBorders tabs
-- unused layouts
-- ||| tall
-- ||| floats
-- ||| magnify
-- ||| threeCol
@ -498,14 +498,14 @@ myStartupHook = do
spawnOnce "dunst &" -- notification daemon
-- Startup Applications
spawnOnce "guake &"
-- spawnOnce "guake &"
spawnOnce "barrier &"
spawnOnce "nextcloud &"
spawnOnce "slack &"
spawnOnce "todoist &"
-- spawnOnce "slack &"
-- spawnOnce "todoist &"
-- Start trayer last
spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x121e32 --height 24 &"
spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x121e32 --height 20 &"
------------------------------------------------------------------------
@ -536,12 +536,12 @@ main = do
mouseBindings = myMouseBindings,
-- hooks, layouts
layoutHook = showWName' myShowWNameTheme $ myLayout,
layoutHook = showWName' myShowWNameTheme myLayout,
manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks,
handleEventHook = myEventHook <+> fullscreenEventHook,
-- logHook = myLogHook,
logHook = myLogHook <+> dynamicLogWithPP xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc x
{ ppOutput = hPutStrLn xmproc
, ppCurrent = xmobarColor "#a8de45" "" . wrap "[" "]" -- Current workspace in xmobar
, ppVisible = xmobarColor "#88ae55" "" . clickable -- Visible but not current workspace
, ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar