updated xmonad keybindings to ez config keys

This commit is contained in:
Solomon Laing 2021-05-24 14:09:17 +09:30
parent 9316f42d7d
commit 9441d733e6
3 changed files with 119 additions and 189 deletions

View File

@ -12,8 +12,7 @@ Config {
-- layout -- layout
, sepChar = "%" -- delineator between plugin names and straight text , sepChar = "%" -- delineator between plugin names and straight text
, alignSep = "}{" -- separator between left-right alignment , alignSep = "}{" -- separator between left-right alignment
, template = " <action=`xdotool key super+a`><icon=haskell_20.xpm/></action> %cpu% %memory% %dynnetwork% } %UnsafeStdinReader% { %date% <fc=#9da5ae>|</fc> %YPAD% <fc=#9da5ae>|</fc> %battery% <fc=#9da5ae>|</fc> %updates% %trayerpad%" , template = " <action=`xdotool key super+a`><icon=haskell_20.xpm/></action> %cpu% %memory% %dynnetwork% %battery% } %UnsafeStdinReader% { %date% <fc=#9da5ae>|</fc> %YPAD% <fc=#9da5ae>|</fc> %updates% %trayerpad%"
}
-- general behavior -- general behavior
, lowerOnStart = True -- send to bottom of window stack on start , lowerOnStart = True -- send to bottom of window stack on start
@ -104,7 +103,7 @@ Config {
-- based upon your specific hardware. Or, for a desktop you may want -- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely. -- to just remove this section entirely.
, Run BatteryP ["BAT0"] , Run BatteryP ["BAT0"]
[ "--template", "<left>%, <timeleft>" [ "--template", "<acstatus> <left>%, <timeleft>"
, "-L", "10", "-H", "80" , "-L", "10", "-H", "80"
, "-l", "#882410", "-h", "#95C05D" , "-l", "#882410", "-h", "#95C05D"
, "--", "-O", "Charging", "-o", "Battery" , "--", "-O", "Charging", "-o", "Battery"

View File

@ -146,190 +146,122 @@ clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Key bindings. Add, modify or remove key bindings here. -- Key bindings. Add, modify or remove key bindings here.
-- These are general keybindings custom script bindings are not included. -- These are general keybindings custom script bindings are not included.h
myEZKeys :: [(String, X ())]
myEZKeys =
-- xmonad
[ ("M-'", spawn "xmonad --recompile; xmonad --restart")
-- open my terminal
, ("M-S-<Return>", spawn (myTerminal))
-- run launchers
, ("M-a", spawn "dmenu_run -bw 3 -c -l 15 -h 26")
, ("M-o", spawn "rofi -show run")
-- keybound programs
, ("M-l", spawn (myFileManager))
-- wm controls
-- kill focused windown
, ("M-S-j", kill1)
-- rotate through layouts
, ("M-<Space>", sendMessage NextLayout)
-- reset layout to default
-- , ("M-S-<space>", setLayout $ Xmonad.layoutHook conf)
-- reset current window to correct size
, ("M-S-y", refresh)
-- focus next window
, ("M-<Tab>", windows W.focusDown)
-- focus previous window
, ("M-S-<Tab>", windows W.focusUp)
-- focus master window
, ("M-m", windows W.focusMaster)
-- swap window with master
, ("M-<Return>", windows W.swapMaster)
-- swap window with next window
, ("M-S-<Up>", windows W.swapDown)
-- swap window with previous window
, ("M-S-<Down>", windows W.swapUp)
-- shrink master area
, ("M-<Left>", sendMessage Shrink)
-- grow master area
, ("M-<Right>", sendMessage Expand)
-- shrink master area
, ("M-<Down>", sendMessage MirrorShrink)
-- grow master area
, ("M-<Up>", sendMessage MirrorExpand)
-- push floating window back into tiling
, ("M-y", withFocused $ windows . W.sink)
-- increment windows in master
, ("M-w", sendMessage (IncMasterN 1))
-- decrement windows in master
, ("M-v", sendMessage (IncMasterN (-1)))
-- toggle bar
, ("M-b", sendMessage ToggleStruts)
-- show keybinds
-- , ("M-S-z", spawn "spawn ("echo \"" ++ help ++ "\" | xmessage -file -")
-- My custom keybind/script combinations
-- prompt computer shutdown
, ("M-S-s", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"")
-- prompt computer restart
, ("M-S-r", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Restart?\" \"reboot\"")
-- prompt computer lock
, ("M-<Escape>", spawn "$HOME/.local/bin/prompt \"Are you sure you want to lock?\" \"slock\" 1")
-- unlock bitwarden cli
, ("M-S-x", spawn "$HOME/.local/bin/bw-unlock")
-- get password from bw cli
, ("M-x", spawn "$HOME/.local/bin/passwords")
-- launch searcher (dmenu and surf)
, ("M-s", spawn "$HOME/.local/bin/dmenusearch")
-- launch searcher, default to duckduckgo
, ("M-s d", spawn "$HOME/.local/bin/dmenusearch duckduckgo")
-- launch mounter
, ("M-m m", spawn "$HOME/.local/bin/dmenumount")
-- launch unmounter
, ("M-m u", spawn "$HOME/.local/bin/dmendduumount")
-- backlight controls
-- increase backlight brightness by 10
, ("<XF86MonBrightnessUp>", spawn "$HOME/.local/bin/mod_backlight +10")
-- decrease backlight brightness by 10
, ("<XF86MonBrightnessDown>", spawn "$HOME/.local/bin/mod_backlight -10")
-- music and audio controls
-- decrease output volume
, ("<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-sink-volume")
-- increase output volume
, ("<XF86AudioRaiseVolume>", spawn "$HOME/.local/bin/inc-sink-volume")
-- toggle output mute
, ("<XF86AudioMute>", spawn "$HOME/.local/bin/toggle-sink-mute")
-- decrease input volume
, ("S-<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-source-volume")
-- increase input volume
, ("S-<XF86AudioRaiseVolume>", spawn "$HOME/.local/bin/inc-source-volume")
-- toggle input mute
, ("S-<XF86AudioMute>", spawn "$HOME/.local/bin/toggle-source-mute")
-- set default output
, ("M-S-o", spawn "$HOME/.local/bin/set-default-sink")
-- set default input
, ("M-S-i", spawn "$HOME/.local/bin/set-default-source")
-- extras
, ("<Print>", spawn "flameshot gui")
]
myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $ myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $
[
-- launch a terminal
((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- launch rofi
, ((modm, xK_o ), spawn "rofi -show run")
-- launch dmenu
, ((modm, xK_a ), spawn "dmenu_run -bw 3 -c -l 15 -h 26")
-- launch rofi ssh
, ((modm .|. shiftMask, xK_o ), spawn "rofi -show ssh")
-- launch my file manager
, ((modm, xK_l ), spawn myFileManager)
-- close focused window
, ((modm .|. shiftMask, xK_j ), kill)
-- 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)
-- Resize viewed windows to the correct size
, ((modm .|. shiftMask, xK_y ), refresh)
-- Move focus to the next window
, ((modm, xK_Tab ), windows W.focusDown)
-- Move focus to the next window
, ((modm .|. shiftMask, xK_Tab ), windows W.focusUp)
-- Move focus to the next window
, ((modm, xK_h ), windows W.focusDown)
-- Move focus to the previous window
, ((modm, xK_t ), windows W.focusUp )
-- Move focus to the master window
, ((modm, xK_m ), windows W.focusMaster )
-- Swap the focused window and the master window
, ((modm, xK_Return), windows W.swapMaster)
-- Swap the focused window with the next window
, ((modm .|. shiftMask, xK_Down ), windows W.swapDown )
-- Swap the focused window with the previous window
, ((modm .|. shiftMask, xK_Up ), windows W.swapUp )
-- Shrink the master area
, ((modm, xK_Left ), sendMessage Shrink)
-- Expand the master area
, ((modm, xK_Right ), sendMessage Expand)
-- Push window back into tiling
, ((modm, xK_y ), withFocused $ windows . W.sink)
-- Increment the number of windows in the master area
, ((modm, xK_w ), sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area
, ((modm, xK_v ), sendMessage (IncMasterN (-1)))
-- Toggle the status bar gap
-- Use this binding with avoidStruts from Hooks.ManageDocks.
-- See also the statusBar function from Hooks.DynamicLog.
--
, ((modm, xK_b ), sendMessage ToggleStruts)
-- Restart xmonad
, ((modm, xK_apostrophe ), spawn "xmonad --recompile; xmonad --restart")
-- Run xmessage with a summary of the default keybindings (useful for beginners)
, ((modm .|. shiftMask, xK_z ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -"))
]
++
--
-- these are my general custom bindings and scripts
--
[
-- prompt computer shutdown
((modm .|. shiftMask, xK_s ), spawn "/home/solomon/.local/bin/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"")
-- prompt computer reboot
, ((modm .|. shiftMask, xK_r ), spawn "/home/solomon/.local/bin/prompt \"Are you sure you want to Restart?\" \"reboot\"")
-- prompt computer lock
, ((modm, xK_Escape), spawn "/home/solomon/.local/bin/prompt \"Are you sure you want to lock?\" \"slock\" 1")
-- unlock bitwarden cli and store session key
, ((modm .|. shiftMask, xK_x ), spawn "/home/solomon/.local/bin/bw-unlock")
-- search for password using bitwarden cli through dmenu
, ((modm, xK_x ), spawn "/home/solomon/.local/bin/passwords")
-- launch searcher
, ((modm, xK_s ), spawn "/home/solomon/.local/bin/dmenusearch")
, ((modm, xK_s), submap . M.fromList $
[
-- just open dmenusearch
((0, xK_a), spawn "/home/solomon/.local/bin/dmenusearch")
-- open dmenusearch with duckduckgo preselected
, ((0, xK_d), spawn "/home/solomon/.local/bin/dmenusearch duckduckgo")
])
-- launch mounter
, ((modm, xK_c ), spawn "/home/solomon/.local/bin/dmenumount")
-- launch unmounter
, ((modm .|. shiftMask, xK_c ), spawn "/home/solomon/.local/bin/dmendduumount")
]
++
--
-- music controlls as I figure them out
--por
[
-- decrease volume with mod+f11
((modm, xK_F11), spawn "/home/solomon/.local/bin/dec-sink-volume")
-- increase volume with mod+f12
, ((modm, xK_F12), spawn "/home/solomon/.local/bin/inc-sink-volume")
-- toggle mute with mod+f10
, ((modm, xK_F10), spawn "/home/solomon/.local/bin/toggle-sink-mute")
-- decrease volume with mod+f11
, ((modm .|. shiftMask, xK_F11), spawn "/home/solomon/.local/bin/dec-source-volume")
-- increase volume with mod+f12
, ((modm .|. shiftMask, xK_F12), spawn "/home/solomon/.local/bin/inc-source-volume")
-- toggle mute with mod+f10
, ((modm .|. shiftMask, xK_F10), spawn "/home/solomon/.local/bin/toggle-source-mute")
-- set default sink for pactl to allow above scripts to run
, ((modm, xK_F7), spawn "/home/solomon/.local/bin/set-default-sink")
-- set default source for pactl
, ((modm .|. shiftMask, xK_F7), spawn "/home/solomon/.local/bin/set-default-source")
]
++
--
-- hardware controls, currently just backlight
--
[
-- increase backlight by 10 with mod+f9
((modm, xK_F9), spawn "/home/solomon/.local/bin/mod_backlight +10")
-- decrese backlight by 10 with mod+f8
, ((modm, xK_F8), spawn "/home/solomon/.local/bin/mod_backlight -10")
]
++
--
-- mod-[1..9], Switch to workspace N -- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N -- mod-shift-[1..9], Move client to workspace N
-- --
[((m .|. modm, k), windows $ f i) [((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
--
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r}, 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_p] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-- Mouse bindings: default actions bound to mouse events -- Mouse bindings: default actions bound to mouse events
myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList
@ -440,11 +372,11 @@ myLayout = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats
-- a new window. You can use this to, for example, always float a -- a new window. You can use this to, for example, always float a
-- particular program, or have a client always appear on a particular -- particular program, or have a client always appear on a particular
-- workspace. -- workspace.
--
-- To find the property name associated with a program, use -- To find the property name associated with a program, use
-- > xprop | grep WM_CLASS -- > xprop | grep WM_CLASS
-- and click on the client you're interested in. -- and click on the client you're interested in.
--
-- To match on the WM_NAME, you can use 'title' in the same way that -- To match on the WM_NAME, you can use 'title' in the same way that
-- 'className' and 'resource' are used below. -- 'className' and 'resource' are used below.
myManageHook = composeAll myManageHook = composeAll
@ -466,7 +398,7 @@ myManageHook = composeAll
-- Event handling -- Event handling
-- * EwmhDesktops users should change this to ewmhDesktopsEventHook -- * EwmhDesktops users should change this to ewmhDesktopsEventHook
--
-- Defines a custom handler function for X Events. The function should -- Defines a custom handler function for X Events. The function should
-- return (All True) if the default handler is to be run afterwards. To -- return (All True) if the default handler is to be run afterwards. To
-- combine event hooks use mappend or mconcat from Data.Monoid. -- combine event hooks use mappend or mconcat from Data.Monoid.
@ -485,7 +417,7 @@ myLogHook = fadeInactiveLogHook fadeAmount
-- Perform an arbitrary action each time xmonad starts or is restarted -- Perform an arbitrary action each time xmonad starts or is restarted
-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize -- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
-- per-workspace layout choices. -- per-workspace layout choices.
--
-- By default, do nothing. -- By default, do nothing.
myStartupHook = do myStartupHook = do
-- Startup apps (tray) and settings -- Startup apps (tray) and settings
@ -524,10 +456,7 @@ main = do
xmproc0 <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-main.hs" xmproc0 <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-main.hs"
xmproc1 <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc-sub.hs" xmproc1 <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc-sub.hs"
xmproc2 <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc-sub.hs" xmproc2 <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc-sub.hs"
-- xmproc <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc0"
-- xmproc <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc1"
-- xmproc <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc2"
-- xmonad =<< statusBar myBar myPP toggleStrutsKey defaults
xmonad $ ewmh $ docks def xmonad $ ewmh $ docks def
-- defaults = def -- defaults = def
{ {
@ -566,7 +495,7 @@ main = do
, ppOrder = \(ws:l:t:ex) -> [ws,l] , ppOrder = \(ws:l:t:ex) -> [ws,l]
}, },
startupHook = myStartupHook startupHook = myStartupHook
} } `additionalKeysP` myEZKeys
-- | Finally, a copy of the default bindings in simple textual tabular format. -- | Finally, a copy of the default bindings in simple textual tabular format.
help :: String help :: String

View File

@ -1,5 +1,7 @@
git-flow-completion-git git-flow-completion-git
plexamp-appimage
element-desktop
shotwell shotwell
fish fish
evince evince