Dope additions to XMonad

f0ee33d5dafc02d044426864cb4ac674e62adb38
Alexis Sellier committed ago 1 parent a7e23b54
.xmobarrc +2 -2
17 17
          , Run Com        "xmobar-dropbox-status" [] "dropbox" 10
18 18
          , Run Com        "todo-widget" [] "todo" 10
19 19
          , Run Com        "xmobar-brightness" [] "brightness" 10
20 20
          , Run Com        "seedbox-status" [] "seedbox" 10
21 21
          , Run CoreTemp   [ "--template", "<core0>° <core1>°" ] 50
22 -
          , Run Wireless   "wlp58s0" [ "--template", "☎ <essid>/<quality>"] 10
22 +
          , Run Wireless   "wlp2s0" [ "--template", "☎ <essid>/<quality>"] 10
23 23
          , Run Battery    [ "--template", "⌁ <left>%" ] 100
24 24
          , Run StdinReader
25 25
          ]
26 26
     , sepChar = "%"
27 27
     , alignSep = "}{"
28 -
     , template = "%StdinReader%  }{ %todo%   %brightness%   %battery%   %wlp58s0wi%   %seedbox%   %dropbox%   %multicpu% · %memory% · %disku% · %dynnetwork%   <fc=#aaaaaa>%date%</fc> "
28 +
     , template = "%StdinReader%  }{ %todo%   %brightness%   %battery%   %wlp2s0wi%   %seedbox%   %dropbox%   %multicpu% · %memory% · %disku% · %dynnetwork%   <fc=#aaaaaa>%date%</fc> "
29 29
}
.xmonad/build +1 -1
1 1
#!/bin/sh
2 2
echo "$1"
3 3
exec stack ghc -- \
4 -
  	--make xmonad.hs \
4 +
    --make xmonad.hs \
5 5
    -i \
6 6
    -ilib \
7 7
    -fforce-recomp \
8 8
    -main-is main \
9 9
    -v0 \
.xmonad/xmonad.hs +13 -1
11 11
import XMonad.Hooks.EwmhDesktops
12 12
import XMonad.Actions.CycleWS
13 13
import XMonad.Util.EZConfig (additionalKeys, additionalKeysP)
14 14
import XMonad.Prompt
15 15
import XMonad.Prompt.XMonad
16 +
import XMonad.Prompt.Input
16 17
17 18
import XMonad.Hooks.UrgencyHook
18 19
import XMonad.Hooks.FloatNext
19 20
20 21
import Graphics.X11.ExtraTypes.XF86
21 22
22 23
import System.Directory
23 24
import System.IO
24 25
import System.Exit
26 +
import System.FilePath
25 27
import Text.Printf
26 28
import Data.Map (Map)
27 29
import qualified Data.Map as Map
28 30
import Control.Monad
29 31
33 35
    showXPrompt (EnterPrompt n) = " " ++ n ++ " "
34 36
35 37
confirmPrompt :: XPConfig -> String -> X () -> X ()
36 38
confirmPrompt config app func = mkXPrompt (EnterPrompt app) config (mkComplFunFromList []) $ const func
37 39
40 +
screenshotPrompt :: String -> X ()
41 +
screenshotPrompt home = do
42 +
    str <- inputPrompt cfg "Screenshot"
43 +
    case str of
44 +
        Just s  -> spawn $ printf "scrot -u '%s.png' -e 'mv $f ~/screenshots'" s
45 +
        Nothing -> pure ()
46 +
  where
47 +
    cfg = myXPConfig { position = CenteredAt 0.5 0.3
48 +
                     , defaultText = "" }
49 +
38 50
termName :: FilePath
39 51
termName = "urxvt"
40 52
41 53
main :: IO ()
42 54
main = do
116 128
       , ((modMask, xK_F10),                    safeSpawn "toggle-displays" [])
117 129
       , ((modMask, xK_F5),                     safeSpawn "refresh-display" [])
118 130
       , ((modMask, xK_p),                      rofi)
119 131
       , ((modMask, xK_Tab),                    toggleWS)
120 132
       , ((modMask .|. controlMask, xK_Return), toggleFloatNext >> (spawn $ XMonad.terminal conf))
121 -
       , ((modMask, xK_Print),                  spawn $ printf "scrot -u -e 'mv $f %s/screenshots'" home)
133 +
       , ((modMask, xK_Print),                  screenshotPrompt home)
122 134
       , ((modMask .|. shiftMask, xK_Print),    safeSpawn "screenshot-region" [])
123 135
       , ((modMask, xK_0),                      windows $ greedyView "ω")
124 136
       , ((modMask .|. shiftMask, xK_0),        windows $ shift "ω")
125 137
       , ((modMask, xK_Left),                   prevWS)
126 138
       , ((modMask, xK_Right),                  nextWS)