Add copy/paste functionality
Getty Ritter
3 years ago
11 | 11 | import qualified System.Exit as Sys |
12 | 12 | import qualified System.IO as Sys |
13 | 13 | import qualified System.Process as Sys |
14 | import qualified Graphics.X11.ExtraTypes.XF86 as X11 | |
14 | 15 | |
15 | 16 | import XMonad ((|||), (<+>)) |
16 | 17 | import qualified XMonad as XM |
19 | 20 | import qualified XMonad.Hooks.SetWMName as XM |
20 | 21 | import qualified XMonad.Layout.NoBorders as XM |
21 | 22 | import qualified XMonad.Layout.Tabbed as Tab |
23 | import qualified XMonad.Util.Paste as Paste | |
22 | 24 | import qualified XMonad.Util.Run as Run |
23 | 25 | |
24 | 26 | -- | A 'ColorScheme' represents a handful of salient colors used in |
49 | 51 | , ((mdMask, XM.xK_u), XM.spawn "amixer -q sset Master 3%+") |
50 | 52 | , ((mdMask, XM.xK_d), XM.spawn "amixer -q sset Master 3%-") |
51 | 53 | , ((mdMask, XM.xK_m), XM.spawn "amixer -q sset Master 0%") |
54 | , ((mdMask, XM.xK_c), xCopy) | |
55 | , ((mdMask, XM.xK_v), Paste.pasteSelection) | |
52 | 56 | , ((mdMask, 0x1008ff13), XM.spawn "amixer -q set Master 3%+") |
53 | 57 | , ((mdMask, 0x1008ff12), XM.spawn "amixer set Master toggle") |
54 | 58 | , ((mdMask, 0x1008ff11), XM.spawn "amixer -q set Master 3%-") |
57 | 61 | , ((mdMask, 0x1008ff16), XM.spawn "mpc prev") |
58 | 62 | , ((mdMask, 0x1008ff17), XM.spawn "mpc next") |
59 | 63 | ] |
64 | ||
65 | xCopy :: XM.X () | |
66 | xCopy = XM.withFocused $ \w -> do | |
67 | winName <- XM.runQuery XM.className w | |
68 | if winName == "Alacritty" | |
69 | then (Paste.sendKey XM.noModMask X11.xF86XK_Copy) | |
70 | else (Paste.sendKey XM.controlMask XM.xK_c) | |
71 | ||
60 | 72 | |
61 | 73 | recompile :: IO () |
62 | 74 | recompile = do |