Merge branch 'master' of github.com:IvanMalison/dotfiles

This commit is contained in:
Ivan Malison 2016-11-30 15:20:29 -08:00
commit 642ac30254
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
7 changed files with 70 additions and 24 deletions

View File

@ -39,6 +39,15 @@ SortByUsername=false
SupportKphFields=true SupportKphFields=true
UnlockDatabase=true UnlockDatabase=true
[generator]
EnsureEvery=true
ExcludeAlike=true
Length=16
LowerCase=true
Numbers=true
SpecialChars=false
UpperCase=true
[security] [security]
autotypeask=true autotypeask=true
clearclipboard=true clearclipboard=true

View File

@ -0,0 +1,12 @@
[Unit]
Description=BatteryMon
Wants=taffybar.service
After=taffybar.service
[Service]
Type=simple
ExecStart=/usr/bin/env batterymon
ExecStop=/usr/bin/pkill batterymon
[Install]
WantedBy=wm.target

View File

@ -1,7 +1,8 @@
# -*- mode: org; -*- # -*- mode: org; -*-
I suggest you read this document at [[http://ivanmalison.github.io/dotfiles/]] or, This document is best read at [[http://ivanmalison.github.io/dotfiles/]] or, of
of course, in emacs, as the internal links that follow are unlikely to work course, in emacs, as the internal links that follow are unlikely to work
anywhere else (including, for example, at https://github.com/IvanMalison/dotfiles). anywhere else (including, for example, at
https://github.com/IvanMalison/dotfiles).
* About * About
This is my emacs configuration in literate form. It aspires to be This is my emacs configuration in literate form. It aspires to be
like the incredibly well commented literate configurations of [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua]] and like the incredibly well commented literate configurations of [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua]] and

View File

@ -2,15 +2,14 @@
dpi="$1" dpi="$1"
if [ -z $dpi ]; then if [ -z $dpi ]; then
# Don't try to guess DPI. For a laptop, we don't want the same DPI as # Don't try to guess DPI. For a laptop, we don't want the same DPI as
# for an external screen. Just hardcode stuff... # for an external screen. Just hardcode stuff...
case $(hostname),$(xrandr --current | \ case $(hostname),$(xrandr --current | \
sed -n 's/\([^ ]*\) connected .*[0-9][0-9]*x[0-9][0-9]*+[0-9][0-9]*+[0-9][0-9]* .*/\1/p' | \ sed -n 's/\([^ ]*\) connected .*[0-9][0-9]*x[0-9][0-9]*+[0-9][0-9]*+[0-9][0-9]* .*/\1/p' | \
sort | tr '\n' ':') in sort | tr '\n' ':') in
# imalison-arch,DVI-D-0:HDMI-0:) dpi=144 ;; imalison-arch,DVI-D-0:HDMI-0:) dpi=96 ;;
imalison-uber-loaner,eDP1:) dpi=72 ;; imalison-uber-loaner,eDP1:) dpi=96 ;;
*) dpi=96 ;; *) dpi=96 ;;
esac esac
fi fi

View File

@ -18,6 +18,7 @@ executable imalison-xmonad
xmonad-contrib>=0.12, xmonad-contrib>=0.12,
X11>=1.6.1.2, X11>=1.6.1.2,
gtk-traymanager>=0.1.6, gtk-traymanager>=0.1.6,
-- I use a custom version
xmonad>=0.12, xmonad>=0.12,
-- I use a custom version -- I use a custom version
taffybar>=0.4.6, taffybar>=0.4.6,
@ -27,6 +28,7 @@ executable imalison-xmonad
containers>=0.5.7.1, containers>=0.5.7.1,
directory>=1.2.6.2, directory>=1.2.6.2,
filepath>=1.4.1.0, filepath>=1.4.1.0,
multimap>=1.2.1 multimap>=1.2.1,
hostname>=1.0
hs-source-dirs: . hs-source-dirs: .
default-language: Haskell2010 default-language: Haskell2010

View File

@ -2,6 +2,9 @@ flags: {}
extra-package-dbs: [] extra-package-dbs: []
packages: packages:
- '.' - '.'
- location:
git: git@github.com:IvanMalison/xmonad.git
commit: a501ee613f9be5a4b16c6427ce84fd425e976571
- location: - location:
git: git@github.com:IvanMalison/xmonad-contrib.git git: git@github.com:IvanMalison/xmonad-contrib.git
commit: 751bcbbfecc2b9be9811a7147524e798c7e53bec commit: 751bcbbfecc2b9be9811a7147524e798c7e53bec

View File

@ -3,15 +3,17 @@
FlexibleInstances, FlexibleContexts #-} FlexibleInstances, FlexibleContexts #-}
module Main where module Main where
import qualified Control.Arrow as A
import Control.Monad import Control.Monad
import Control.Monad.Trans.Maybe import Control.Monad.Trans.Maybe
import Data.Aeson import Data.Aeson
import qualified Data.ByteString.Lazy as B import qualified Data.ByteString.Lazy as B
import Data.List import Data.List
import qualified Data.Map as M import qualified Data.Map as M
import qualified Data.MultiMap as MM
import Data.Maybe import Data.Maybe
import qualified Data.MultiMap as MM
import Graphics.X11.ExtraTypes.XF86 import Graphics.X11.ExtraTypes.XF86
import Network.HostName
import System.Directory import System.Directory
import System.FilePath.Posix import System.FilePath.Posix
import System.Taffybar.Hooks.PagerHints import System.Taffybar.Hooks.PagerHints
@ -116,11 +118,11 @@ maybeRemap k = M.findWithDefault k k
withFocusedR f = withWindowSet (f . W.peek) withFocusedR f = withWindowSet (f . W.peek)
withFocusedD d f = maybe (return d) f <$> (withWindowSet (return . W.peek)) withFocusedD d f = maybe (return d) f <$> withWindowSet (return . W.peek)
mapP f l = mapP' id mapP = mapP' id
mapP' f f' l = map (\i -> (f i, f' i)) l mapP' f f' = map (f A.&&& f')
-- Selectors -- Selectors
@ -150,7 +152,20 @@ transmissionCommand = "transmission-gtk"
-- Startup hook -- Startup hook
myStartup = spawn "systemctl --user start wm.target" tvScreenId :: ScreenId
tvScreenId = 0
disableTVFading = setFading (Just tvScreenId) False
hostNameToAction =
M.fromList [ ("imalison-arch", disableTVFading)
, ("imalison-uber-loaner", return ())
]
myStartup = do
spawn "systemctl --user start wm.target"
hostName <- io getHostName
M.findWithDefault (return ()) hostName hostNameToAction
-- Manage hook -- Manage hook
@ -201,7 +216,7 @@ toggleStateToString s =
toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String
toggleToStringWithState toggle = toggleToStringWithState toggle =
(printf "%s (%s)" (show toggle) . toggleStateToString) <$> printf "%s (%s)" (show toggle) . toggleStateToString <$>
isToggleActive toggle isToggleActive toggle
selectToggle = selectToggle =
@ -253,7 +268,6 @@ selectLayout =
DM.menuArgs "rofi" ["-dmenu", "-i"] layoutNames >>= DM.menuArgs "rofi" ["-dmenu", "-i"] layoutNames >>=
(sendMessage . JumpToLayout) (sendMessage . JumpToLayout)
myLayoutHook = myLayoutHook =
avoidStruts . minimize . boringAuto . mkToggle1 MIRROR . mkToggle1 LIMIT . avoidStruts . minimize . boringAuto . mkToggle1 MIRROR . mkToggle1 LIMIT .
mkToggle1 GAPS . mkToggle1 MAGICFOCUS . mkToggle1 NBFULL . workspaceNamesHook . mkToggle1 GAPS . mkToggle1 MAGICFOCUS . mkToggle1 NBFULL . workspaceNamesHook .
@ -344,17 +358,20 @@ fadeEnabledFor query =
fadeEnabledForWindow = fadeEnabledFor ask fadeEnabledForWindow = fadeEnabledFor ask
fadeEnabledForWorkspace = fadeEnabledFor getWindowWorkspace fadeEnabledForWorkspace = fadeEnabledFor getWindowWorkspace
fadeEnabledForScreen = fadeEnabledFor getWindowScreen
getScreens = withWindowSet $ return . W.screens getScreens = withWindowSet $ return . W.screens
getWindowWorkspace' = W.findTag <$> ask <*> liftX (withWindowSet return) getWindowWorkspace' = W.findTag <$> ask <*> liftX (withWindowSet return)
getWindowWorkspace = flip fromMaybe <$> getWindowWorkspace' <*> pure "1" getWindowWorkspace = flip fromMaybe <$> getWindowWorkspace' <*> pure "1"
getWorkspaceToScreen = M.fromList . mapP' (W.tag . W.workspace) W.screen <$> getScreens getWorkspaceToScreen = M.fromList . mapP' (W.tag . W.workspace) W.screen <$> getScreens
getWindowScreen = M.lookup <$> getWindowWorkspace <*> liftX getWorkspaceToScreen getWindowScreen = M.lookup <$> getWindowWorkspace <*> liftX getWorkspaceToScreen
getCurrentScreen = join (withFocusedD Nothing (runQuery getWindowScreen))
toggleFadeInactiveLogHook = fadeCondition =
fadeOutLogHook . isUnfocused <&&> fadeEnabledForWindow <&&>
fadeIf (isUnfocused <&&> fadeEnabledForWindow <&&> fadeEnabledForWorkspace) fadeEnabledForWorkspace <&&> fadeEnabledForScreen
toggleFadeInactiveLogHook = fadeOutLogHook . fadeIf fadeCondition
toggleFadingForActiveWindow = withWindowSet $ toggleFadingForActiveWindow = withWindowSet $
maybe (return ()) toggleFading . W.peek maybe (return ()) toggleFading . W.peek
@ -362,6 +379,8 @@ toggleFadingForActiveWindow = withWindowSet $
toggleFadingForActiveWorkspace = toggleFadingForActiveWorkspace =
withWindowSet $ \ws -> toggleFading $ W.currentTag ws withWindowSet $ \ws -> toggleFading $ W.currentTag ws
toggleFadingForActiveScreen = getCurrentScreen >>= toggleFading
toggleFading w = setFading' $ toggleInMap w toggleFading w = setFading' $ toggleInMap w
setFading w f = setFading' $ M.insert w f setFading w f = setFading' $ M.insert w f
@ -380,7 +399,7 @@ withWorkspace f = withWindowSet $ \ws -> maybe (return ()) f (getCurrentWS ws)
currentWS = withWindowSet $ return . getCurrentWS currentWS = withWindowSet $ return . getCurrentWS
workspaceWindows = (maybe [] W.integrate) <$> currentWS workspaceWindows = maybe [] W.integrate <$> currentWS
minimizedWindows = withMinimized return minimizedWindows = withMinimized return
@ -425,7 +444,7 @@ windowsSatisfyingPredicate workspace getPredicate = do
getMatchingUnmatching = getMatchingUnmatching =
partition <$> ((. snd) <$> getClassMatchesCurrent) <*> getWindowClassPairs partition <$> ((. snd) <$> getClassMatchesCurrent) <*> getWindowClassPairs
getWindowClassPairs = join $ sequence . map windowToClassPair <$> workspaceWindows getWindowClassPairs = join $ mapM windowToClassPair <$> workspaceWindows
windowToClassPair w = (,) w <$> getClass w windowToClassPair w = (,) w <$> getClass w
@ -490,13 +509,13 @@ shiftToEmptyAndView =
setFocusedScreen :: ScreenId -> WindowSet -> WindowSet setFocusedScreen :: ScreenId -> WindowSet -> WindowSet
setFocusedScreen to ws = setFocusedScreen to ws =
maybe ws (flip setFocusedScreen' ws) $ find ((to ==) . W.screen) (W.visible ws) maybe ws (`setFocusedScreen'` ws) $ find ((to ==) . W.screen) (W.visible ws)
setFocusedScreen' to ws @ W.StackSet setFocusedScreen' to ws @ W.StackSet
{ W.current = prevCurr { W.current = prevCurr
, W.visible = visible , W.visible = visible
} = ws { W.current = to } = ws { W.current = to
, W.visible = prevCurr:(deleteBy screenEq to visible) , W.visible = prevCurr:deleteBy screenEq to visible
} }
where screenEq a b = W.screen a == W.screen b where screenEq a b = W.screen a == W.screen b
@ -508,7 +527,7 @@ nextScreen ws @ W.StackSet { W.visible = visible } =
viewOtherScreen ws = W.greedyView ws . nextScreen viewOtherScreen ws = W.greedyView ws . nextScreen
shiftThenViewOtherScreen ws w = (viewOtherScreen ws) . (W.shiftWin ws w) shiftThenViewOtherScreen ws w = viewOtherScreen ws . W.shiftWin ws w
shiftCurrentToWSOnOtherScreen ws s = shiftCurrentToWSOnOtherScreen ws s =
fromMaybe s (flip (shiftThenViewOtherScreen ws) s <$> W.peek s) fromMaybe s (flip (shiftThenViewOtherScreen ws) s <$> W.peek s)
@ -602,6 +621,7 @@ addKeys conf@XConfig {modMask = modm} =
-- Hyper bindings -- Hyper bindings
, ((mod3Mask, xK_1), toggleFadingForActiveWindow) , ((mod3Mask, xK_1), toggleFadingForActiveWindow)
, ((mod3Mask .|. shiftMask, xK_1), toggleFadingForActiveWorkspace) , ((mod3Mask .|. shiftMask, xK_1), toggleFadingForActiveWorkspace)
, ((mod3Mask .|. controlMask, xK_1), toggleFadingForActiveScreen)
, ((mod3Mask, xK_e), moveTo Next EmptyWS) , ((mod3Mask, xK_e), moveTo Next EmptyWS)
, ((mod3Mask, xK_v), spawn "copyq_rofi.sh") , ((mod3Mask, xK_v), spawn "copyq_rofi.sh")
, ((mod3Mask, xK_p), spawn "system_password.sh") , ((mod3Mask, xK_p), spawn "system_password.sh")