summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux.nix10
-rw-r--r--xmonad.hs65
2 files changed, 56 insertions, 19 deletions
diff --git a/linux.nix b/linux.nix
index c7b2cce..cee253f 100644
--- a/linux.nix
+++ b/linux.nix
@@ -21,10 +21,10 @@ in
services = {
emacs.enable = true;
- network-manager-applet.enable = false;
+ network-manager-applet.enable = true;
polybar = {
- enable = false;
+ enable = true;
config = {
"bar/top" = {
font-0 = "mononoki:size-10";
@@ -43,7 +43,7 @@ in
tray-offset-x = 0;
tray-offset-y = 0;
tray-padding = 0;
- tray-scale = 1.0;
+ tray-scale = 1;
module-margin = 4;
modules-center = "date";
modules-right = "battery";
@@ -103,10 +103,10 @@ in
};
xsession = {
- enable = false;
+ enable = true;
windowManager = {
xmonad = {
- enable = false;
+ enable = true;
extraPackages = hpkgs: [
hpkgs.xmonad-contrib
hpkgs.xmonad-extras
diff --git a/xmonad.hs b/xmonad.hs
index 4113186..55f6a69 100644
--- a/xmonad.hs
+++ b/xmonad.hs
@@ -1,35 +1,72 @@
+{-
+
+Docs:
+
+- EZConfig: https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Util-EZConfig.html#g:3
+- Media keys: https://hackage.haskell.org/package/X11-1.9/docs/Graphics-X11-ExtraTypes-XF86.html
+- Audio control: https://xmonadhaskell.wordpress.com/2018/10/24/xmonad-audio-control/
+
+- XMonad API: https://hackage.haskell.org/package/xmonad
+- Contrib API: https://hackage.haskell.org/package/xmonad-contrib
+
+-}
+
+
import XMonad
import XMonad.Config
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ManageDocks
import XMonad.Layout.Spiral
import XMonad.Util.CustomKeys (customKeys)
+import XMonad.Actions.CopyWindow
+import XMonad.Util.EZConfig (additionalKeys)
+import Graphics.X11.ExtraTypes.XF86
delKeys conf@(XConfig {modMask = modMask}) = [(modMask, xK_p)]
insKeys :: XConfig l -> [((KeyMask, KeySym), X ())]
insKeys conf@(XConfig {modMask = modMask}) =
- [ ((0, xK_F5), spawn "xbacklight -dec 1")
- , ((0, xK_F6), spawn "xbacklight -inc 1")
- , ((modMask, xK_o), spawn "dmenu_run")
+ [ -- run dmenu with M-o
+ ((modMask, xK_o), spawn "dmenu_run")
+ -- passmenu doesn't work :(
, ((modMask, xK_p), spawn "${SHELL:-\"/bin/sh\"} -c passmenu &")
, ((modMask, xK_y), spawn "passmenu &")
+ -- sticky windows
+ , ((modMask, xK_a ), windows copyToAll) -- @@ Make focused window always visible
+ , ((modMask .|. shiftMask, xK_a ), killAllOtherCopies) -- @@ Toggle window state back
+ -- media/ function keys
+ -- backlight
+ , ((0, xK_F5), spawn "xbacklight -dec 5")
+ , ((0, xK_F6), spawn "xbacklight -inc 5")
+ , ((0, xF86XK_KbdBrightnessDown), spawn "xbacklight -dec 5")
+ , ((0, xF86XK_KbdBrightnessUp), spawn "xbacklight -inc 5")
+ -- volume controls
+ , ((0, xK_F1), amixer "2%+")
+ , ((0, xK_F2), amixer "2%-")
+ , ((0, xK_F3), amixer "toggle")
+
+ , ((0, xF86XK_AudioLowerVolume), amixer "2%+")
+ , ((0, xF86XK_AudioRaiseVolume), amixer "2%-")
+ , ((0, xF86XK_AudioMute), amixer "toggle")
]
+amixer :: String -> X ()
+amixer cmd = spawn $ "amixer -q sset Master " <> cmd
+
myLayout = spiral (6 / 7)
myWorkspaces = ["1:mail", "2:org", "3:web"] ++ map show [4 .. 9] ++ ["0"]
-myConf =
- def
- { modMask = mod4Mask -- ^ super instead of alt
- , normalBorderColor = "#eee8d4" -- ^ solarized base3
- , focusedBorderColor = "#2aa198" -- ^ solarized cyan
- , manageHook = manageDocks <+> manageHook defaultConfig
- , layoutHook = avoidStruts $ myLayout ||| layoutHook defaultConfig
- , terminal = "/home/ben/.nix-profile/bin/xterm"
- , keys = customKeys delKeys insKeys
- , workspaces = myWorkspaces
- }
+myConf = additionalKeys c (insKeys c)
+ where c = def
+ { modMask = mod4Mask -- ^ super instead of alt
+ , normalBorderColor = "#eee8d4" -- ^ solarized base3
+ , focusedBorderColor = "#2aa198" -- ^ solarized cyan
+ , manageHook = manageDocks <+> manageHook def
+ , layoutHook = avoidStruts $ myLayout ||| layoutHook def
+ , terminal = "/home/ben/.nix-profile/bin/xterm"
+ , workspaces = myWorkspaces
+ --, keys = customKeys delKeys insKeys
+ }
main = xmonad $ ewmh $ docks $ myConf