home/xmonad: keybindings cosmetic changes

This commit is contained in:
Dmitriy Pleshevskiy 2022-09-10 23:49:11 +03:00
parent 44850f3e15
commit 4b20878d5f
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -48,11 +48,9 @@ import XMonad.Util.Run
myTerminal = "alacritty"
-- Whether focus follows the mouse pointer.
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = False
-- Whether clicking on a window to focus also passes the click to the window
myClickJustFocuses :: Bool
myClickJustFocuses = False
-- Width of the window border in pixels.
@ -251,79 +249,93 @@ myManageHook = manageApps
-- Key bindings. Add, modify or remove key bindings here.
--
myKeys conf =
mkKeymap conf $
-- launch a terminal
[ ("M-S-<Return>", spawn $ XMonad.terminal conf),
-- launch a 'flameshot' to screenshot
("M-S-s", safeSpawn "flameshot" ["gui"]),
-- launch 'librewolf' browser
("M-S-b", spawn "librewolf"),
-- launch 'dmenu_run' to choose applications
("M-p", spawn "dmenu_run"),
-- close focused window
("M4-S-c", kill),
-- Rotate through the available layout algorithms
("M-<Space>", cycleThroughLayouts ["Full", "Mirror Spacing Tall"]),
("M-<Tab>", cycleThroughLayouts ["Spacing ThreeCol", "Spacing Tall", "Mirror Spacing Tall"]),
-- Reset the layouts on the current workspace to default
("M-S-<Space>", setLayout $ XMonad.layoutHook conf),
-- Resize viewed windows to the correct size
("M-n", refresh),
-- Easy moution to focus windows
("M-s", selectWindow easyMotionConfig >>= (`whenJust` windows . W.focusWindow)),
-- Move focus to the next window
("M-j", windows W.focusDown),
-- Move focus to the previous window
("M-k", windows W.focusUp),
-- Move focus to the master window
("M-m", windows W.focusMaster),
-- Swap the focused window and the master window
("M-<Return>", windows W.swapMaster),
-- Swap the focused window with the next window
("M-S-j", windows W.swapDown),
-- Swap the focused window with the previous window
("M-S-k", windows W.swapUp),
-- Shrink the master area
("M-h", sendMessage Shrink),
-- Expand the master area
("M-l", sendMessage Expand),
-- Push window back into tiling
("M-t", withFocused $ windows . W.sink),
-- Increment the number of windows in the master area
("M-,", sendMessage $ IncMasterN 1),
-- Deincrement the number of windows in the master area
("M-.", sendMessage $ IncMasterN (-1)),
-- Toggle the status bar gap
-- Use this binding with avoidStruts from Hooks.ManageDocks.
-- See also the statusBar function from Hooks.DynamicLog.
--
-- , ("M-b", sendMessage ToggleStruts)
let easyMotionConfig =
def
{ sKeys = AnyKeys [xK_a, xK_o, xK_e, xK_u, xK_h, xK_t, xK_n, xK_s]
}
-- Lock screen
("M4-l", spawn "betterlockscreen --lock --display 1 -- -e"),
-- Change volume
("<XF86AudioMute>", spawn "amixer -q sset Master toggle"),
("<XF86AudioRaiseVolume>", spawn "amixer -q sset Master 5%+"),
("<XF86AudioLowerVolume>", spawn "amixer -q sset Master 5%-"),
-- Keyboard apps
("<XF86Calculator>", spawn "gnome-calculator"),
-- Quit xmonad
("M4-S-q", io exitSuccess)
]
++
--
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
[ ("M-" ++ m ++ show k, windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [1 .. 9],
(f, m) <- [(W.greedyView, ""), (W.shift, "S-")]
]
where
easyMotionConfig =
def
{ sKeys = AnyKeys [xK_a, xK_o, xK_e, xK_u, xK_h, xK_t, xK_n, xK_s]
}
apps_kb =
[ -- launch a terminal
("M-S-<Return>", spawn $ XMonad.terminal conf),
-- launch a 'flameshot' to screenshot
("M-S-s", safeSpawn "flameshot" ["gui"]),
-- launch 'librewolf' browser
("M-S-b", spawn "librewolf"),
-- launch 'dmenu_run' to choose applications
("M-p", spawn "dmenu_run")
-- Open calculator
-- ("<XF86Calculator>", spawn "gnome-calculator"),
]
workspaces_kb =
--
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
[ ("M-" ++ m ++ show k, windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [1 .. 9],
(f, m) <- [(W.greedyView, ""), (W.shift, "S-")]
]
windows_kb =
[ -- close focused window
("M4-S-c", kill),
-- Resize viewed windows to the correct size
("M-n", refresh),
-- Easy moution to focus windows
("M-s", selectWindow easyMotionConfig >>= (`whenJust` windows . W.focusWindow)),
-- Move focus to the next window
("M-j", windows W.focusDown),
-- Move focus to the previous window
("M-k", windows W.focusUp),
-- Move focus to the master window
("M-m", windows W.focusMaster),
-- Swap the focused window and the master window
("M-<Return>", windows W.swapMaster),
-- Swap the focused window with the next window
("M-S-j", windows W.swapDown),
-- Swap the focused window with the previous window
("M-S-k", windows W.swapUp)
]
layout_kb =
[ -- Rotate through the available layout algorithms
("M-<Space>", cycleThroughLayouts ["Full", "Mirror Spacing Tall"]),
("M-<Tab>", cycleThroughLayouts ["Spacing ThreeCol", "Spacing Tall", "Mirror Spacing Tall"]),
-- Reset the layouts on the current workspace to default
("M-S-<Space>", setLayout $ XMonad.layoutHook conf),
-- Shrink the master area
("M-h", sendMessage Shrink),
-- Expand the master area
("M-l", sendMessage Expand),
-- Push window back into tiling
("M-t", withFocused $ windows . W.sink),
-- Increment the number of windows in the master area
("M-,", sendMessage $ IncMasterN 1),
-- Deincrement the number of windows in the master area
("M-.", sendMessage $ IncMasterN (-1))
-- Toggle the status bar gap
-- Use this binding with avoidStruts from Hooks.ManageDocks.
-- See also the statusBar function from Hooks.DynamicLog.
--
-- , ("M-b", sendMessage ToggleStruts)
]
system_kb =
[ -- Lock screen
("M4-l", spawn "betterlockscreen --lock --display 1 -- -e"),
-- Quit xmonad
("M4-S-q", io exitSuccess)
]
misc_kb =
[ -- Change volume
("<XF86AudioMute>", spawn "amixer -q sset Master toggle"),
("<XF86AudioRaiseVolume>", spawn "amixer -q sset Master 5%+"),
("<XF86AudioLowerVolume>", spawn "amixer -q sset Master 5%-")
]
in mkKeymap conf $
apps_kb ++ workspaces_kb ++ windows_kb ++ layout_kb ++ system_kb ++ misc_kb
------------------------------------------------------------------------
-- Mouse bindings: default actions bound to mouse events