diff --git a/dotfiles/config/keepassxc/keepassxc.ini b/dotfiles/config/keepassxc/keepassxc.ini index b970fe17..adf83f51 100644 --- a/dotfiles/config/keepassxc/keepassxc.ini +++ b/dotfiles/config/keepassxc/keepassxc.ini @@ -39,6 +39,15 @@ SortByUsername=false SupportKphFields=true UnlockDatabase=true +[generator] +EnsureEvery=true +ExcludeAlike=true +Length=16 +LowerCase=true +Numbers=true +SpecialChars=false +UpperCase=true + [security] autotypeask=true clearclipboard=true diff --git a/dotfiles/config/systemd/user/batterymon.service b/dotfiles/config/systemd/user/batterymon.service new file mode 100644 index 00000000..1a452293 --- /dev/null +++ b/dotfiles/config/systemd/user/batterymon.service @@ -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 diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index fa09bb9b..6fbbdb99 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -1,7 +1,8 @@ # -*- mode: org; -*- -I suggest you read this document at [[http://ivanmalison.github.io/dotfiles/]] or, -of course, in emacs, as the internal links that follow are unlikely to work -anywhere else (including, for example, at https://github.com/IvanMalison/dotfiles). +This document is best read at [[http://ivanmalison.github.io/dotfiles/]] or, of +course, in emacs, as the internal links that follow are unlikely to work +anywhere else (including, for example, at +https://github.com/IvanMalison/dotfiles). * About 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 diff --git a/dotfiles/lib/bin/xsettingsd-setup b/dotfiles/lib/bin/xsettingsd-setup index a2e9bfb6..4498c484 100755 --- a/dotfiles/lib/bin/xsettingsd-setup +++ b/dotfiles/lib/bin/xsettingsd-setup @@ -2,15 +2,14 @@ dpi="$1" - if [ -z $dpi ]; then # Don't try to guess DPI. For a laptop, we don't want the same DPI as # for an external screen. Just hardcode stuff... 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' | \ sort | tr '\n' ':') in - # imalison-arch,DVI-D-0:HDMI-0:) dpi=144 ;; - imalison-uber-loaner,eDP1:) dpi=72 ;; + imalison-arch,DVI-D-0:HDMI-0:) dpi=96 ;; + imalison-uber-loaner,eDP1:) dpi=96 ;; *) dpi=96 ;; esac fi diff --git a/dotfiles/xmonad/imalison-xmonad.cabal b/dotfiles/xmonad/imalison-xmonad.cabal index 585f056e..8e759d4e 100644 --- a/dotfiles/xmonad/imalison-xmonad.cabal +++ b/dotfiles/xmonad/imalison-xmonad.cabal @@ -18,6 +18,7 @@ executable imalison-xmonad xmonad-contrib>=0.12, X11>=1.6.1.2, gtk-traymanager>=0.1.6, + -- I use a custom version xmonad>=0.12, -- I use a custom version taffybar>=0.4.6, @@ -27,6 +28,7 @@ executable imalison-xmonad containers>=0.5.7.1, directory>=1.2.6.2, filepath>=1.4.1.0, - multimap>=1.2.1 + multimap>=1.2.1, + hostname>=1.0 hs-source-dirs: . default-language: Haskell2010 diff --git a/dotfiles/xmonad/stack.yaml b/dotfiles/xmonad/stack.yaml index 631edc5a..172f0df4 100644 --- a/dotfiles/xmonad/stack.yaml +++ b/dotfiles/xmonad/stack.yaml @@ -2,6 +2,9 @@ flags: {} extra-package-dbs: [] packages: - '.' +- location: + git: git@github.com:IvanMalison/xmonad.git + commit: a501ee613f9be5a4b16c6427ce84fd425e976571 - location: git: git@github.com:IvanMalison/xmonad-contrib.git commit: 751bcbbfecc2b9be9811a7147524e798c7e53bec diff --git a/dotfiles/xmonad/xmonad.hs b/dotfiles/xmonad/xmonad.hs index 8fe8cb54..c7a67a96 100644 --- a/dotfiles/xmonad/xmonad.hs +++ b/dotfiles/xmonad/xmonad.hs @@ -3,15 +3,17 @@ FlexibleInstances, FlexibleContexts #-} module Main where +import qualified Control.Arrow as A import Control.Monad import Control.Monad.Trans.Maybe import Data.Aeson import qualified Data.ByteString.Lazy as B import Data.List import qualified Data.Map as M -import qualified Data.MultiMap as MM import Data.Maybe +import qualified Data.MultiMap as MM import Graphics.X11.ExtraTypes.XF86 +import Network.HostName import System.Directory import System.FilePath.Posix import System.Taffybar.Hooks.PagerHints @@ -116,11 +118,11 @@ maybeRemap k = M.findWithDefault k k 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 @@ -150,7 +152,20 @@ transmissionCommand = "transmission-gtk" -- 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 @@ -201,7 +216,7 @@ toggleStateToString s = toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String toggleToStringWithState toggle = - (printf "%s (%s)" (show toggle) . toggleStateToString) <$> + printf "%s (%s)" (show toggle) . toggleStateToString <$> isToggleActive toggle selectToggle = @@ -253,7 +268,6 @@ selectLayout = DM.menuArgs "rofi" ["-dmenu", "-i"] layoutNames >>= (sendMessage . JumpToLayout) - myLayoutHook = avoidStruts . minimize . boringAuto . mkToggle1 MIRROR . mkToggle1 LIMIT . mkToggle1 GAPS . mkToggle1 MAGICFOCUS . mkToggle1 NBFULL . workspaceNamesHook . @@ -283,7 +297,7 @@ myDecorateName ws w = do classTitle <- getClass w workspaceToName <- getWorkspaceNames return $ printf "%-20s%-40s %+30s" classTitle (take 40 name) - "in " ++ workspaceToName (W.tag ws) + "in " ++ workspaceToName (W.tag ws) -- This needs access to X in order to unminimize, which means that I can't be -- done with the existing window bringer interface @@ -344,17 +358,20 @@ fadeEnabledFor query = fadeEnabledForWindow = fadeEnabledFor ask fadeEnabledForWorkspace = fadeEnabledFor getWindowWorkspace +fadeEnabledForScreen = fadeEnabledFor getWindowScreen getScreens = withWindowSet $ return . W.screens - getWindowWorkspace' = W.findTag <$> ask <*> liftX (withWindowSet return) getWindowWorkspace = flip fromMaybe <$> getWindowWorkspace' <*> pure "1" getWorkspaceToScreen = M.fromList . mapP' (W.tag . W.workspace) W.screen <$> getScreens getWindowScreen = M.lookup <$> getWindowWorkspace <*> liftX getWorkspaceToScreen +getCurrentScreen = join (withFocusedD Nothing (runQuery getWindowScreen)) -toggleFadeInactiveLogHook = - fadeOutLogHook . - fadeIf (isUnfocused <&&> fadeEnabledForWindow <&&> fadeEnabledForWorkspace) +fadeCondition = + isUnfocused <&&> fadeEnabledForWindow <&&> + fadeEnabledForWorkspace <&&> fadeEnabledForScreen + +toggleFadeInactiveLogHook = fadeOutLogHook . fadeIf fadeCondition toggleFadingForActiveWindow = withWindowSet $ maybe (return ()) toggleFading . W.peek @@ -362,6 +379,8 @@ toggleFadingForActiveWindow = withWindowSet $ toggleFadingForActiveWorkspace = withWindowSet $ \ws -> toggleFading $ W.currentTag ws +toggleFadingForActiveScreen = getCurrentScreen >>= toggleFading + toggleFading w = setFading' $ toggleInMap w 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 -workspaceWindows = (maybe [] W.integrate) <$> currentWS +workspaceWindows = maybe [] W.integrate <$> currentWS minimizedWindows = withMinimized return @@ -425,7 +444,7 @@ windowsSatisfyingPredicate workspace getPredicate = do getMatchingUnmatching = partition <$> ((. snd) <$> getClassMatchesCurrent) <*> getWindowClassPairs -getWindowClassPairs = join $ sequence . map windowToClassPair <$> workspaceWindows +getWindowClassPairs = join $ mapM windowToClassPair <$> workspaceWindows windowToClassPair w = (,) w <$> getClass w @@ -490,13 +509,13 @@ shiftToEmptyAndView = setFocusedScreen :: ScreenId -> WindowSet -> WindowSet 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 { W.current = prevCurr , W.visible = visible } = 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 @@ -508,7 +527,7 @@ nextScreen ws @ W.StackSet { W.visible = visible } = 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 = fromMaybe s (flip (shiftThenViewOtherScreen ws) s <$> W.peek s) @@ -602,6 +621,7 @@ addKeys conf@XConfig {modMask = modm} = -- Hyper bindings , ((mod3Mask, xK_1), toggleFadingForActiveWindow) , ((mod3Mask .|. shiftMask, xK_1), toggleFadingForActiveWorkspace) + , ((mod3Mask .|. controlMask, xK_1), toggleFadingForActiveScreen) , ((mod3Mask, xK_e), moveTo Next EmptyWS) , ((mod3Mask, xK_v), spawn "copyq_rofi.sh") , ((mod3Mask, xK_p), spawn "system_password.sh")