TreeSelect, GridSelect, unfocused windows opacity, workspace name on switch.

This commit is contained in:
Derek Taylor
2020-06-24 23:02:45 -05:00
parent 7e4e1c5049
commit e9b8b6c3d7
+51 -47
View File
@@ -14,12 +14,11 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Base -- Base
import XMonad import XMonad
import System.IO (hPutStr, hPutStrLn) import System.IO (hPutStrLn)
import System.Exit (exitSuccess) import System.Exit (exitSuccess)
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
-- Actions -- Actions
import XMonad.Actions.Commands (defaultCommands, screenCommands, workspaceCommands)
import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies) import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen) import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
import XMonad.Actions.GridSelect import XMonad.Actions.GridSelect
@@ -33,7 +32,6 @@ import qualified XMonad.Actions.Search as S
-- Data -- Data
import Data.Char (isSpace) import Data.Char (isSpace)
import Data.List
import Data.Monoid import Data.Monoid
import Data.Maybe (isJust) import Data.Maybe (isJust)
import Data.Tree import Data.Tree
@@ -177,46 +175,46 @@ spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
-- The lists below are actually 3-tuples for use with gridSelect and treeSelect. -- The lists below are actually 3-tuples for use with gridSelect and treeSelect.
-- TreeSelect uses all three values in the 3-tuples but GridSelect only needs first -- TreeSelect uses all three values in the 3-tuples but GridSelect only needs first
-- two values in each list (see myAppGrid, myBookmarkGrid and myConfigGrid below). -- two values in each list (see myAppGrid, myBookmarkGrid and myConfigGrid below).
myApplications :: [([Char], [Char], [Char])] myApplications :: [(String, String, String)]
myApplications = [ ("Audacity", "audacity", "Graphical cross-platform audio eidtor") myApplications = [ ("Audacity", "audacity", "Graphical cross-platform audio eidtor")
, ("Deadbeef", "deadbeef", "Lightweight GUI audio player") , ("Deadbeef", "deadbeef", "Lightweight GUI audio player")
, ("Emacs", "emacs", "Much more than a text editor") , ("Emacs", "emacs", "Much more than a text editor")
, ("Firefox", "firefox", "The famous open source web browser") , ("Firefox", "firefox", "The famous open source web browser")
, ("Geany", "geany", "A nice text editor") , ("Geany", "geany", "A nice text editor")
, ("Geary", "geary", "Email client that is attractive") , ("Geary", "geary", "Email client that is attractive")
, ("Gimp", "gimp", "Open source alternative to Photoshop") , ("Gimp", "gimp", "Open source alternative to Photoshop")
, ("Kdenlive", "kdenlive", "A great open source video editor") , ("Kdenlive", "kdenlive", "A great open source video editor")
, ("LibreOffice Impress", "loimpress", "For making presentations") , ("LibreOffice Impress", "loimpress", "For making presentations")
, ("LibreOffice Writer", "lowriter", "A fully featured word processor") , ("LibreOffice Writer", "lowriter", "A fully featured word processor")
, ("OBS", "obs", "Open broadcaster software") , ("OBS", "obs", "Open broadcaster software")
, ("PCManFM", "pcmanfm", "Lightweight graphical file manager") , ("PCManFM", "pcmanfm", "Lightweight graphical file manager")
, ("Simple Terminal", "st", "Suckless simple terminal") , ("Simple Terminal", "st", "Suckless simple terminal")
, ("Steam", "steam", "Proprietary gaming platform") , ("Steam", "steam", "Proprietary gaming platform")
, ("Surf Browser", "surf suckless.org", "Suckless surf web browser") , ("Surf Browser", "surf suckless.org", "Suckless surf web browser")
, ("Xonotic", "xonotic-glx", "A fast-paced first person shooter") , ("Xonotic", "xonotic-glx", "A fast-paced first person shooter")
] ]
myBookmarks :: [([Char], [Char], [Char])] myBookmarks :: [(String, String, String)]
myBookmarks = [ ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") myBookmarks = [ ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
, ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube") , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
] ]
myConfigs :: [([Char], [Char], [Char])] myConfigs :: [(String, String, String)]
myConfigs = [ ("bashrc", myEditor ++ "/home/dt/.bashrc", "the bourne again shell") myConfigs = [ ("bashrc", myEditor ++ "/home/dt/.bashrc", "the bourne again shell")
, ("doom emacs config.el", myEditor ++ "/home/dt/.doom.d/config.el", "doom emacs config") , ("doom emacs config.el", myEditor ++ "/home/dt/.doom.d/config.el", "doom emacs config")
, ("doom emacs init.el", myEditor ++ "/home/dt/.doom.d/init.el", "doom emacs init") , ("doom emacs init.el", myEditor ++ "/home/dt/.doom.d/init.el", "doom emacs init")
@@ -228,20 +226,22 @@ myConfigs = [ ("bashrc", myEditor ++ "/home/dt/.bashrc", "the bourne again shell
-- Creating two lists and then zipping them together in a 2-tuple so that -- Creating two lists and then zipping them together in a 2-tuple so that
-- GridSelect can use them. myAppGrid is the same as myApplications above, -- GridSelect can use them. myAppGrid is the same as myApplications above,
-- minus the third set of values (the app descriptions). -- minus the third set of values (the app descriptions). myBookmarkGrid
myAppGrid :: [([Char], [Char])] -- is the same as myBookmarks, minus the third set of values. And the same
-- thing is done with myConfigGrid, which is derived from myConfigs.
myAppGrid :: [(String, String)]
myAppGrid = zip myAppGrid = zip
[TE.fst3 $ xs !! n | n <- [0..(length xs - 1)]] [TE.fst3 $ xs !! n | n <- [0..(length xs - 1)]]
[TE.snd3 $ xs !! n | n <- [0..(length xs - 1)]] [TE.snd3 $ xs !! n | n <- [0..(length xs - 1)]]
where xs = myApplications where xs = myApplications
myBookmarkGrid :: [([Char], [Char])] myBookmarkGrid :: [(String, String)]
myBookmarkGrid = zip myBookmarkGrid = zip
[TE.fst3 $ xs !! n | n <- [0..(length xs - 1)]] [TE.fst3 $ xs !! n | n <- [0..(length xs - 1)]]
[TE.snd3 $ xs !! n | n <- [0..(length xs - 1)]] [TE.snd3 $ xs !! n | n <- [0..(length xs - 1)]]
where xs = myBookmarks where xs = myBookmarks
myConfigGrid :: [([Char], [Char])] myConfigGrid :: [(String, String)]
myConfigGrid = zip myConfigGrid = zip
[TE.fst3 $ xs !! n | n <- [0..(length xs - 1)]] [TE.fst3 $ xs !! n | n <- [0..(length xs - 1)]]
[TE.snd3 $ xs !! n | n <- [0..(length xs - 1)]] [TE.snd3 $ xs !! n | n <- [0..(length xs - 1)]]
@@ -275,6 +275,7 @@ treeselectAction a = TS.treeselectAction a
] ]
] ]
-- Configuration options for treeSelect
tsDefaultConfig :: TS.TSConfig a tsDefaultConfig :: TS.TSConfig a
tsDefaultConfig = TS.TSConfig { TS.ts_hidechildren = True tsDefaultConfig = TS.TSConfig { TS.ts_hidechildren = True
, TS.ts_background = 0xdd292d3e , TS.ts_background = 0xdd292d3e
@@ -291,6 +292,7 @@ tsDefaultConfig = TS.TSConfig { TS.ts_hidechildren = True
, TS.ts_navigate = myTreeNavigation , TS.ts_navigate = myTreeNavigation
} }
-- Keybindings for treeSelect menus
myTreeNavigation = M.fromList myTreeNavigation = M.fromList
[ ((0, xK_Escape), TS.cancel) [ ((0, xK_Escape), TS.cancel)
, ((0, xK_Return), TS.select) , ((0, xK_Return), TS.select)
@@ -345,8 +347,8 @@ dtXPConfig = def
, maxComplRows = Nothing -- set to Just 5 for 5 rows , maxComplRows = Nothing -- set to Just 5 for 5 rows
} }
-- The same config minus the autocomplete feature which is annoying on -- The same config above minus the autocomplete feature which is annoying
-- certain Xprompts, like the search engine prompts. -- on certain Xprompts, like the search engine prompts.
dtXPConfig' :: XPConfig dtXPConfig' :: XPConfig
dtXPConfig' = dtXPConfig dtXPConfig' = dtXPConfig
{ autoComplete = Nothing { autoComplete = Nothing
@@ -383,7 +385,7 @@ calcPrompt c ans =
where f = reverse . dropWhile isSpace where f = reverse . dropWhile isSpace
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- XPROMPT KEYMAP (emacs-like key bindings) -- XPROMPT KEYMAP (emacs-like key bindings for xprompts)
------------------------------------------------------------------------ ------------------------------------------------------------------------
dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ()) dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ())
dtXPKeymap = M.fromList $ dtXPKeymap = M.fromList $
@@ -551,7 +553,9 @@ myManageHook = composeAll
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- LOGHOOK -- LOGHOOK
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- sets opacity for inactive (unfocused) windows. -- sets opacity for inactive (unfocused) windows. I prefer to not use
-- this feature so I've set opacity to 1.0. If you want opacity, set
-- this to a value of less than 1 (such as 0.9 for 90% opacity).
myLogHook :: X () myLogHook :: X ()
myLogHook = fadeInactiveLogHook fadeAmount myLogHook = fadeInactiveLogHook fadeAmount
where fadeAmount = 1.0 where fadeAmount = 1.0