xmonad-tv: don't use PATH

This commit is contained in:
tv 2016-05-25 01:26:25 +02:00
parent 00d4320545
commit 9172da3aa0
2 changed files with 25 additions and 22 deletions

View File

@ -99,11 +99,6 @@ let
xmonad-start = pkgs.writeScriptBin "xmonad" '' xmonad-start = pkgs.writeScriptBin "xmonad" ''
#! ${pkgs.bash}/bin/bash #! ${pkgs.bash}/bin/bash
set -efu set -efu
export PATH; PATH=${makeSearchPath "bin" [
# TODO put paths into a Haskell module instead of PATH
pkgs.alsaUtils
pkgs.rxvt_unicode
]}:/var/setuid-wrappers
settle() {( settle() {(
# Use PATH for a clean journal # Use PATH for a clean journal
command=''${1##*/} command=''${1##*/}

View File

@ -51,11 +51,11 @@ import XMonad.Stockholm.Rhombus
import XMonad.Stockholm.Shutdown import XMonad.Stockholm.Shutdown
myTerm :: String amixerPath :: FilePath
myTerm = "urxvtc" amixerPath = "${pkgs.alsaUtils}/bin/amixer"
myRootTerm :: String urxvtcPath :: FilePath
myRootTerm = "urxvtc -name root-urxvt -e su -" urxvtcPath = "${pkgs.rxvt_unicode}/bin/urxvtc"
myFont :: String myFont :: String
myFont = "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*" myFont = "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*"
@ -75,7 +75,7 @@ mainNoArgs = do
-- $ withUrgencyHookC BorderUrgencyHook { urgencyBorderColor = "magenta" } urgencyConfig { suppressWhen = Never } -- $ withUrgencyHookC BorderUrgencyHook { urgencyBorderColor = "magenta" } urgencyConfig { suppressWhen = Never }
$ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ")
$ def $ def
{ terminal = myTerm { terminal = urxvtcPath
, modMask = mod4Mask , modMask = mod4Mask
, keys = myKeys , keys = myKeys
, workspaces = workspaces0 , workspaces = workspaces0
@ -83,7 +83,7 @@ mainNoArgs = do
-- , handleEventHook = myHandleEventHooks <+> handleTimerEvent -- , handleEventHook = myHandleEventHooks <+> handleTimerEvent
--, handleEventHook = handleTimerEvent --, handleEventHook = handleTimerEvent
, manageHook = placeHook (smart (1,0)) <+> floatNextHook , manageHook = placeHook (smart (1,0)) <+> floatNextHook
, startupHook = spawn "echo emit XMonadStartup" , startupHook = liftIO (putStrLn "emit XMonadStartup")
, normalBorderColor = "#1c1c1c" , normalBorderColor = "#1c1c1c"
, focusedBorderColor = "#f000b0" , focusedBorderColor = "#f000b0"
, handleEventHook = handleShutdownEvent , handleEventHook = handleShutdownEvent
@ -121,24 +121,30 @@ displaySomeException :: SomeException -> String
displaySomeException = displayException displaySomeException = displayException
forkFile :: FilePath -> [String] -> Maybe [(String, String)] -> X ()
forkFile path args env =
xfork (executeFile path False args env) >> return ()
spawnRootTerm :: X ()
spawnRootTerm =
forkFile
urxvtcPath
["-name", "root-urxvt", "-e", "/var/setuid-wrappers/su", "-"]
Nothing
spawnTermAt :: String -> X () spawnTermAt :: String -> X ()
--spawnTermAt _ = floatNext True >> spawn myTerm
--spawnTermAt "ff" = floatNext True >> spawn myTerm
--spawnTermAt _ = spawn myTerm
spawnTermAt ws = do spawnTermAt ws = do
env <- liftIO getEnvironment env <- liftIO getEnvironment
let env' = ("XMONAD_SPAWN_WORKSPACE", ws) : env let env' = ("XMONAD_SPAWN_WORKSPACE", ws) : env
xfork (executeFile "urxvtc" True [] (Just env')) >> return () forkFile urxvtcPath [] (Just env')
myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ()) myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ())
myKeys conf = Map.fromList $ myKeys conf = Map.fromList $
[ ((_4 , xK_Escape ), spawn "/var/setuid-wrappers/slock") [ ((_4 , xK_Escape ), forkFile "/var/setuid-wrappers/slock" [] Nothing)
, ((_4S , xK_c ), kill) , ((_4S , xK_c ), kill)
, ((_4 , xK_x ), chooseAction spawnTermAt) , ((_4 , xK_x ), chooseAction spawnTermAt)
, ((_4C , xK_x ), spawn myRootTerm) , ((_4C , xK_x ), spawnRootTerm)
--, ((_4M , xK_x ), spawn "xterm")
--, ((_4M , xK_x ), mySpawn "xterm")
--, ((_4 , xK_F1 ), withFocused jojo) --, ((_4 , xK_F1 ), withFocused jojo)
--, ((_4 , xK_F1 ), printAllGeometries) --, ((_4 , xK_F1 ), printAllGeometries)
@ -198,9 +204,9 @@ myKeys conf = Map.fromList $
--, (_4 , xK_v ) & \k -> (k, gridselectWorkspace wsGSConfig { gs_navigate = makeGSNav k } W.view) --, (_4 , xK_v ) & \k -> (k, gridselectWorkspace wsGSConfig { gs_navigate = makeGSNav k } W.view)
--, (_4S , xK_v ) & \k -> (k, gridselectWorkspace wsGSConfig { gs_navigate = makeGSNav k } W.shift) --, (_4S , xK_v ) & \k -> (k, gridselectWorkspace wsGSConfig { gs_navigate = makeGSNav k } W.shift)
--, (_4 , xK_b ) & \k -> (k, goToSelected wGSConfig { gs_navigate = makeGSNav k }) --, (_4 , xK_b ) & \k -> (k, goToSelected wGSConfig { gs_navigate = makeGSNav k })
, ((noModMask, xF86XK_AudioLowerVolume), spawn "amixer sset Master 5%-") , ((noModMask, xF86XK_AudioLowerVolume), amixer ["sset", "Master", "5%+"])
, ((noModMask, xF86XK_AudioRaiseVolume), spawn "amixer sset Master 5%+") , ((noModMask, xF86XK_AudioRaiseVolume), amixer ["sset", "Master", "5%-"])
, ((noModMask, xF86XK_AudioMute), spawn "amixer sset Master toggle") , ((noModMask, xF86XK_AudioMute), amixer ["sset", "Master", "toggle"])
] ]
where where
_4 = mod4Mask _4 = mod4Mask
@ -213,6 +219,8 @@ myKeys conf = Map.fromList $
_4CM = _4 .|. _C .|. _M _4CM = _4 .|. _C .|. _M
_4SM = _4 .|. _S .|. _M _4SM = _4 .|. _S .|. _M
amixer args = forkFile amixerPath args Nothing
pagerConfig :: PagerConfig pagerConfig :: PagerConfig
pagerConfig = def pagerConfig = def