diff --git a/.config/nitrogen/bg-saved.cfg b/.config/nitrogen/bg-saved.cfg index 5b423e8..03fcbbf 100644 --- a/.config/nitrogen/bg-saved.cfg +++ b/.config/nitrogen/bg-saved.cfg @@ -1,14 +1,14 @@ [xin_2] -file=/home/dt/wallpapers/0172.jpg +file=/home/dt/wallpapers/0015.jpg mode=0 bgcolor=#000000 [xin_1] -file=/home/dt/wallpapers/0172.jpg +file=/home/dt/wallpapers/0015.jpg mode=0 bgcolor=#000000 [xin_0] -file=/home/dt/wallpapers/0172.jpg +file=/home/dt/wallpapers/0015.jpg mode=0 bgcolor=#000000 diff --git a/.config/nitrogen/nitrogen.cfg b/.config/nitrogen/nitrogen.cfg index a60af51..0587c6b 100644 --- a/.config/nitrogen/nitrogen.cfg +++ b/.config/nitrogen/nitrogen.cfg @@ -1,5 +1,5 @@ [geometry] -posx=0 +posx=1920 posy=0 sizex=1920 sizey=1080 diff --git a/.xmonad/README.org b/.xmonad/README.org index 87b22d9..780a741 100644 --- a/.xmonad/README.org +++ b/.xmonad/README.org @@ -19,8 +19,6 @@ - [[#scratchpads][Scratchpads]] - [[#layouts][Layouts]] - [[#workspaces][Workspaces]] - - [[#standard-non-clickable-workspaces][Standard Non-Clickable Workspaces]] - - [[#clickable-workspaces][Clickable Workspaces]] - [[#managehook][Managehook]] - [[#loghook][Loghook]] - [[#keybindings][Keybindings]] @@ -52,7 +50,7 @@ import System.Exit (exitSuccess) import qualified XMonad.StackSet as W -- Actions -import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies) +import XMonad.Actions.CopyWindow (kill1) import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen) import XMonad.Actions.GridSelect import XMonad.Actions.MouseResize @@ -65,6 +63,7 @@ import qualified XMonad.Actions.Search as S -- Data import Data.Char (isSpace, toUpper) +import Data.Maybe (fromJust) import Data.Monoid import Data.Maybe (isJust) import Data.Tree @@ -113,12 +112,10 @@ import XMonad.Prompt.Man import XMonad.Prompt.Pass import XMonad.Prompt.Shell import XMonad.Prompt.Ssh +import XMonad.Prompt.Unicode import XMonad.Prompt.XMonad import Control.Arrow (first) - -- Text -import Text.Printf - -- Utilities import XMonad.Util.EZConfig (additionalKeysP) import XMonad.Util.NamedScratchpad @@ -133,6 +130,9 @@ It's nice to assign values to stuff that you will use more than once in the conf myFont :: String myFont = "xft:SauceCodePro Nerd Font Mono:regular:size=9:antialias=true:hinting=true" +myEmojiFont :: String +myEmojiFont = "xft:JoyPixels:regular:size=9:antialias=true:hinting=true" + myModMask :: KeyMask myModMask = mod4Mask -- Sets modkey to super/windows key @@ -181,11 +181,6 @@ myStartupHook = do setWMName "LG3D" #+END_SRC -#+RESULTS: -: Prelude> Prelude> -: :26:11-19: error: -: Variable not in scope: setWMName :: [Char] -> t - * Gridselect GridSelect displays items (programs, open windows, etc.) in a 2D grid and lets the user select from it with the cursor/hjkl keys or the mouse. @@ -558,7 +553,6 @@ The XMonad.Prompt module is useful for writing graphical prompts for XMonad. Th You can write your own prompts if you know some Haskell. Some custom prompts include: + calcPrompt - A simple calculator prompt that uses qalculate. + editPrompt - A prompt for opening files in your editor. -+ scrotPrompt - A prompt for taking screenshots. #+BEGIN_SRC haskell dtXPConfig :: XPConfig @@ -594,6 +588,11 @@ dtXPConfig' :: XPConfig dtXPConfig' = dtXPConfig { autoComplete = Nothing } + +emojiXPConfig :: XPConfig +emojiXPConfig = dtXPConfig + { font = myEmojiFont + } #+END_SRC ** Custom Prompts @@ -627,20 +626,6 @@ openInEditor path = safeSpawn "emacsclient" ["-c", "-a", "emacs", path] #+end_src -*** scrotPrompt -scrotPrompt is a screenshot prompt that takes either a True or False argument. -#+begin_src haskell -scrotPrompt :: String -> Bool -> X () -scrotPrompt home select = do - str <- inputPrompt cfg "~/scrot/" - case str of - Just s -> spawn $ printf "sleep 0.3 && scrot %s '%s' -e 'mv $f ~/scrot'" mode s - Nothing -> pure () - where - mode = if select then "--select" else "--focused" - cfg = dtXPConfig { defaultText = "" } -#+end_src - ** Xprompt Keymap Emacs-like key bindings for xprompts. @@ -730,7 +715,7 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm , NS "mocp" spawnMocp findMocp manageMocp ] where - spawnTerm = myTerminal ++ " -n scratchpad" + spawnTerm = myTerminal ++ " -n scratchpad 'fish'" findTerm = resource =? "scratchpad" manageTerm = customFloating $ W.RationalRect l t w h where @@ -808,14 +793,12 @@ threeCol = renamed [Replace "threeCol"] $ addTabs shrinkText myTabTheme $ subLayout [] (smartBorders Simplest) $ limitWindows 7 - $ mySpacing' 4 $ ThreeCol 1 (3/100) (1/2) threeRow = renamed [Replace "threeRow"] $ windowNavigation $ addTabs shrinkText myTabTheme $ subLayout [] (smartBorders Simplest) $ limitWindows 7 - $ mySpacing' 4 -- Mirror takes a layout and rotates it by 90 degrees. -- So we are applying Mirror to the ThreeCol layout. $ Mirror @@ -860,34 +843,15 @@ myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts float #+END_SRC * Workspaces -I include two options for workspace: (1) Standard non-clickable workspaces, and (2) clickable workspaces. Choose one. - -** Standard Non-Clickable Workspaces -These workspaces do not accept mouse clicks for changing workspaces. You must use the keybindings (which you probably should be doing anyway). To use standard non-clickable workspaces, be sure have 'workspaces = myWorkspaces' in the main at the bottom of this config. +I have made my workspaces in xmobar "clickable." Clickable workspaces means the mouse can be used to switch workspaces. This requires /xdotool/ to be installed. You need to use UnsafeStdInReader instead of simply StdInReader in your xmobar config so you can pass actions to it. #+begin_src haskell -myWorkspaces = [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "] -- myWorkspaces = [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "] -#+end_src +myWorkspaces = [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "] +myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y) -** Clickable Workspaces -Clickable workspaces means the mouse can be used to switch workspaces. This requires /xdotool/ to be installed. You need to use UnsafeStdInReader instead of simply StdInReader in your xmobar config so you can pass actions to it. Finally, to use clickable workspaces, be sure have 'workspaces = myClickableWorkspaces' in the main at the bottom of this config. - -#+BEGIN_SRC haskell -xmobarEscape :: String -> String -xmobarEscape = concatMap doubleLts - where - doubleLts '<' = "<<" - doubleLts x = [x] - -myClickableWorkspaces :: [String] -myClickableWorkspaces = clickable . (map xmobarEscape) - -- $ [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "] - $ [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "] - where - clickable l = [ "" ++ ws ++ "" | - (i,ws) <- zip [1..9] l, - let n = i ] +clickable ws = ""++ws++"" + where i = fromJust $ M.lookup ws myWorkspaceIndices #+END_SRC * Managehook @@ -967,9 +931,8 @@ myKeys home = , ("M-p g", passGeneratePrompt dtXPConfig) -- passGeneratePrompt , ("M-p r", passRemovePrompt dtXPConfig) -- passRemovePrompt , ("M-p s", sshPrompt dtXPConfig) -- sshPrompt + , ("M-p u", mkUnicodePrompt "xsel" ["-b"] "/home/dt/.xmonad/UnicodeData.txt" emojiXPConfig) -- unicodePrompt (for copying emojis) , ("M-p x", xmonadPrompt dtXPConfig) -- xmonadPrompt - , ("M-p q", scrotPrompt home True) -- scrotPrompt True - , ("M-p z", scrotPrompt home False) -- scrotPrompt False -- Useful programs to have a keybinding for launch , ("M-", spawn (myTerminal ++ " -e fish")) @@ -1127,14 +1090,14 @@ main = do , focusedBorderColor = myFocusColor , logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP { ppOutput = \x -> hPutStrLn xmproc0 x >> hPutStrLn xmproc1 x >> hPutStrLn xmproc2 x - , ppCurrent = xmobarColor "#98be65" "" . wrap "[" "]" -- Current workspace in xmobar - , ppVisible = xmobarColor "#98be65" "" -- Visible but not current workspace - , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" -- Hidden workspaces in xmobar - , ppHiddenNoWindows = xmobarColor "#c792ea" "" -- Hidden workspaces (no windows) - , ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window in xmobar - , ppSep = " | " -- Separators in xmobar - , ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace - , ppExtras = [windowCount] -- # of windows current workspace + , ppCurrent = xmobarColor "#98be65" "" . wrap "[" "]" -- Current workspace in xmobar + , ppVisible = xmobarColor "#98be65" "" . clickable -- Visible but not current workspace + , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar + , ppHiddenNoWindows = xmobarColor "#c792ea" "" . clickable -- Hidden workspaces (no windows) + , ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window in xmobar + , ppSep = " | " -- Separators in xmobar + , ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace + , ppExtras = [windowCount] -- # of windows current workspace , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t] } } `additionalKeysP` myKeys home diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 7c44690..ae5cb4c 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -6,7 +6,7 @@ import System.Exit (exitSuccess) import qualified XMonad.StackSet as W -- Actions -import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies) +import XMonad.Actions.CopyWindow (kill1) import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen) import XMonad.Actions.GridSelect import XMonad.Actions.MouseResize @@ -19,6 +19,7 @@ import qualified XMonad.Actions.Search as S -- Data import Data.Char (isSpace, toUpper) +import Data.Maybe (fromJust) import Data.Monoid import Data.Maybe (isJust) import Data.Tree @@ -67,12 +68,10 @@ import XMonad.Prompt.Man import XMonad.Prompt.Pass import XMonad.Prompt.Shell import XMonad.Prompt.Ssh +import XMonad.Prompt.Unicode import XMonad.Prompt.XMonad import Control.Arrow (first) - -- Text -import Text.Printf - -- Utilities import XMonad.Util.EZConfig (additionalKeysP) import XMonad.Util.NamedScratchpad @@ -82,6 +81,9 @@ import XMonad.Util.SpawnOnce myFont :: String myFont = "xft:SauceCodePro Nerd Font Mono:regular:size=9:antialias=true:hinting=true" +myEmojiFont :: String +myEmojiFont = "xft:JoyPixels:regular:size=9:antialias=true:hinting=true" + myModMask :: KeyMask myModMask = mod4Mask -- Sets modkey to super/windows key @@ -500,6 +502,11 @@ dtXPConfig' = dtXPConfig { autoComplete = Nothing } +emojiXPConfig :: XPConfig +emojiXPConfig = dtXPConfig + { font = myEmojiFont + } + calcPrompt c ans = inputPrompt c (trim ans) ?+ \input -> liftIO(runProcessWithInput "qalc" [input] "") >>= calcPrompt c @@ -520,16 +527,6 @@ openInEditor :: String -> X () openInEditor path = safeSpawn "emacsclient" ["-c", "-a", "emacs", path] -scrotPrompt :: String -> Bool -> X () -scrotPrompt home select = do - str <- inputPrompt cfg "~/scrot/" - case str of - Just s -> spawn $ printf "sleep 0.3 && scrot %s '%s' -e 'mv $f ~/scrot'" mode s - Nothing -> pure () - where - mode = if select then "--select" else "--focused" - cfg = dtXPConfig { defaultText = "" } - dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ()) dtXPKeymap = M.fromList $ map (first $ (,) controlMask) -- control + @@ -605,7 +602,7 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm , NS "mocp" spawnMocp findMocp manageMocp ] where - spawnTerm = myTerminal ++ " -n scratchpad" + spawnTerm = myTerminal ++ " -n scratchpad 'fish'" findTerm = resource =? "scratchpad" manageTerm = customFloating $ W.RationalRect l t w h where @@ -678,14 +675,12 @@ threeCol = renamed [Replace "threeCol"] $ addTabs shrinkText myTabTheme $ subLayout [] (smartBorders Simplest) $ limitWindows 7 - $ mySpacing' 4 $ ThreeCol 1 (3/100) (1/2) threeRow = renamed [Replace "threeRow"] $ windowNavigation $ addTabs shrinkText myTabTheme $ subLayout [] (smartBorders Simplest) $ limitWindows 7 - $ mySpacing' 4 -- Mirror takes a layout and rotates it by 90 degrees. -- So we are applying Mirror to the ThreeCol layout. $ Mirror @@ -728,23 +723,12 @@ myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts float ||| threeCol ||| threeRow -myWorkspaces = [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "] -- myWorkspaces = [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "] +myWorkspaces = [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "] +myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y) -xmobarEscape :: String -> String -xmobarEscape = concatMap doubleLts - where - doubleLts '<' = "<<" - doubleLts x = [x] - -myClickableWorkspaces :: [String] -myClickableWorkspaces = clickable . (map xmobarEscape) - -- $ [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "] - $ [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "] - where - clickable l = [ "" ++ ws ++ "" | - (i,ws) <- zip [1..9] l, - let n = i ] +clickable ws = ""++ws++"" + where i = fromJust $ M.lookup ws myWorkspaceIndices myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet) myManageHook = composeAll @@ -784,9 +768,8 @@ myKeys home = , ("M-p g", passGeneratePrompt dtXPConfig) -- passGeneratePrompt , ("M-p r", passRemovePrompt dtXPConfig) -- passRemovePrompt , ("M-p s", sshPrompt dtXPConfig) -- sshPrompt + , ("M-p u", mkUnicodePrompt "xsel" ["-b"] "/home/dt/.xmonad/UnicodeData.txt" emojiXPConfig) -- unicodePrompt (for copying emojis) , ("M-p x", xmonadPrompt dtXPConfig) -- xmonadPrompt - , ("M-p q", scrotPrompt home True) -- scrotPrompt True - , ("M-p z", scrotPrompt home False) -- scrotPrompt False -- Useful programs to have a keybinding for launch , ("M-", spawn (myTerminal ++ " -e fish")) @@ -939,14 +922,14 @@ main = do , focusedBorderColor = myFocusColor , logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP { ppOutput = \x -> hPutStrLn xmproc0 x >> hPutStrLn xmproc1 x >> hPutStrLn xmproc2 x - , ppCurrent = xmobarColor "#98be65" "" . wrap "[" "]" -- Current workspace in xmobar - , ppVisible = xmobarColor "#98be65" "" -- Visible but not current workspace - , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" -- Hidden workspaces in xmobar - , ppHiddenNoWindows = xmobarColor "#c792ea" "" -- Hidden workspaces (no windows) - , ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window in xmobar - , ppSep = " | " -- Separators in xmobar - , ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace - , ppExtras = [windowCount] -- # of windows current workspace + , ppCurrent = xmobarColor "#98be65" "" . wrap "[" "]" -- Current workspace in xmobar + , ppVisible = xmobarColor "#98be65" "" . clickable -- Visible but not current workspace + , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar + , ppHiddenNoWindows = xmobarColor "#c792ea" "" . clickable -- Hidden workspaces (no windows) + , ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window in xmobar + , ppSep = " | " -- Separators in xmobar + , ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace + , ppExtras = [windowCount] -- # of windows current workspace , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t] } } `additionalKeysP` myKeys home