From 609bb9f9106bc806b362250c02a4aef6c5d0b2cd Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 3 Jul 2014 18:27:58 +0200 Subject: remove stuff for taffybar --- xmonad.hs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xmonad.hs b/xmonad.hs index 8865171..d4d3b79 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -51,9 +51,6 @@ import XMonad.Prompt.XMonad import XMonad.Util.NamedScratchpad --- taffybar -import System.Taffybar.Hooks.PagerHints (pagerHints) - -- --replace handling import XMonad.Util.Replace (replace) import Control.Monad (when) @@ -94,7 +91,6 @@ main = do -- Do _not_ use "ewhm" here, this would add the ewhm hooks to the -- end of your custom hooks (esp. the startup hook) and this would -- overwrite the setWMName "LG3D" and some Java apps will not work. - $ pagerHints $ withUrgencyHook myDzenUrgencyConfig $ myConfig dzenStatusFile -- cgit v1.2.3 From 873eddd2870c86cce65dafb1bea368e85a3dcae7 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 3 Jul 2014 18:28:41 +0200 Subject: add M-M5-q for clean logout --- xmonad.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xmonad.hs b/xmonad.hs index d4d3b79..05efa22 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -1,5 +1,7 @@ import System.IO import System.Directory +import System.Exit (exitWith, ExitCode(ExitSuccess)) +import Codec.Binary.UTF8.String as UTF8 (decodeString) import Data.Ratio ((%)) import Data.List import qualified Data.Map as M @@ -313,6 +315,7 @@ xPropMatches = myKeys c = -- this line is critical to reload config - DON'T REMOVE [ ("M-q", broadcastMessage ReleaseResources >> restart "xmonad" True) + , ("M-M5-q", io (exitWith ExitSuccess)) , ("M-S-", spawn term) , ("M-", openLastHistoryGrid historyGridConfig 30) -- cgit v1.2.3 From 22b828dff88bbdf5f4f6d7bbf7861a5af04863ed Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 3 Jul 2014 18:30:37 +0200 Subject: use our font for all prompts --- xmonad.hs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/xmonad.hs b/xmonad.hs index 05efa22..4dcef11 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -196,6 +196,11 @@ alexTheme = defaultTheme , decoHeight = 15 } +alexXPConfig :: XPConfig +alexXPConfig = P.defaultXPConfig + { P.font = font + } + historyGridConfig = defaultGSConfig { gs_cellheight = 50 , gs_cellwidth = 300 @@ -339,8 +344,8 @@ myKeys c = , ("M-S-j", windows W.swapDown) , ("M-S-k", windows W.swapUp) - , ("M-m", selectWorkspace P.defaultXPConfig) - , ("M-S-m", withWorkspace P.defaultXPConfig (windows . W.shift)) + , ("M-m", selectWorkspace alexXPConfig) + , ("M-S-m", withWorkspace alexXPConfig (windows . W.shift)) , ("M-S-", removeWorkspace) , ("M-h", sendMessage Shrink) @@ -369,15 +374,15 @@ myKeys c = , ("M-^", viewEmptyWorkspace) , ("M-S-^", tagToEmptyWorkspace) - , ("M-p", myShellPrompt P.defaultXPConfig) - , ("M-e", launchApp P.defaultXPConfig "emacsclient" >> (windows (W.greedyView "5:code"))) + , ("M-p", myShellPrompt alexXPConfig) + , ("M-e", launchApp alexXPConfig "emacsclient" >> (windows (W.greedyView "5:code"))) - , ("M-o M-k", passPrompt P.defaultXPConfig) - , ("M-o M-S-k", passGeneratePrompt P.defaultXPConfig) - , ("M-o M-m", manPrompt P.defaultXPConfig) - , ("M-o M-b", safePrompt browser P.defaultXPConfig) - , ("M-o M-s", sshPrompt P.defaultXPConfig) - , ("M-o M-x", xmonadPrompt P.defaultXPConfig) + , ("M-o M-k", passPrompt alexXPConfig) + , ("M-o M-S-k", passGeneratePrompt alexXPConfig) + , ("M-o M-m", manPrompt alexXPConfig) + , ("M-o M-b", safePrompt browser alexXPConfig) + , ("M-o M-s", sshPrompt alexXPConfig) + , ("M-o M-x", xmonadPrompt alexXPConfig) , ("M-g", goToSelected defaultGSConfig) , ("M-S-g", bringSelected defaultGSConfig) -- cgit v1.2.3 From beed9b602ab5c5aa44345831313486bd6053ae7a Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 23 Jul 2014 00:08:22 +0200 Subject: Australien does not have a key for mod4 --- xmonad.hs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/xmonad.hs b/xmonad.hs index 4dcef11..ef36e3f 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -58,6 +58,9 @@ import XMonad.Util.Replace (replace) import Control.Monad (when) import System.Environment (getArgs) +-- for hostname handling (no windows key on "Australien") +import Network.HostName + -- custom modules import HistoryGrid import EZConfig @@ -75,7 +78,10 @@ browser = "viewurl-opera.sh" myWorkspaces :: [String] myWorkspaces = ["1:web", "2:mail" ,"3:irc", "4:im", "5:code"] ++ map show [6 .. 9 :: Int] ++ ["0", "video", "music"] -modM = mod4Mask -- mod1Mask = Alt, mod2Mask = , mod3Mask= , mod4Mask = Win, mod5Mask = AltGr +modM :: String -> KeyMask +-- mod1Mask = Alt, mod2Mask = , mod3Mask= , mod4Mask = Win, mod5Mask = AltGrk +modM "Australien" = mod1Mask +modM _ = mod4Mask myDzenUrgencyConfig = DzenUrgencyHook { args = ["-bg", "red", "-fg", "black", "-fn", font, @@ -89,15 +95,16 @@ main = do dzenStatusDir <- getAppUserDataDirectory "xmonad" dzenStatusFile <- openFile (dzenStatusDir ++ "/dzenStatus") WriteMode + hostname <- getHostName xmonad -- Do _not_ use "ewhm" here, this would add the ewhm hooks to the -- end of your custom hooks (esp. the startup hook) and this would -- overwrite the setWMName "LG3D" and some Java apps will not work. $ withUrgencyHook myDzenUrgencyConfig - $ myConfig dzenStatusFile + $ myConfig dzenStatusFile hostname -myConfig statusFile = defaultConfig - { modMask = modM +myConfig statusFile hostname = defaultConfig + { modMask = modM hostname , terminal = term , borderWidth = 1 , normalBorderColor = "#545454" @@ -105,7 +112,7 @@ myConfig statusFile = defaultConfig , logHook = myLogHook statusFile , manageHook = myManageHook , keys = \c -> mkKeymap c $ myKeys c - , mouseBindings = \c -> M.union (M.fromList $ myMouse c) $ mouseBindings defaultConfig c + , mouseBindings = \c -> M.union (M.fromList $ myMouse (modM hostname) c) $ mouseBindings defaultConfig c , layoutHook = myLayout , workspaces = myWorkspaces , handleEventHook = myEventHook @@ -418,14 +425,14 @@ myKeys c = (m, f) <- [("M-", W.view), ("M-S-", W.shift), ("M-C-", copy)] ] -myMouse c = - [ ((modM, button1), +myMouse modm c = + [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> snapMagicMove (Just 50) (Just 50) w)) - , ((modM .|. shiftMask, button1), + , ((modm .|. shiftMask, button1), (\w -> focus w >> mouseMoveWindow w >> snapMagicMouseResize 0.8 (Just 50) (Just 50) w)) - , ((modM, button3), + , ((modm, button3), (\w -> focus w >> Flex.mouseWindow Flex.resize w)) ] -- cgit v1.2.3 From 4237ce690b7f4195b2bd80d6ee646d8ab1201cd1 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 1 Sep 2014 18:55:48 +0200 Subject: shorter xpropmatches --- xmonad.hs | 80 +++++++++++++++++++++++++-------------------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/xmonad.hs b/xmonad.hs index ef36e3f..aef45d3 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -270,56 +270,38 @@ myManageHook = xPropMatches :: [XPropMatch] xPropMatches = - [ ([ (xprop, any (app `op`))], pmP (W.shift target)) | (xprop, op, app, target) <- myShifts] ++ - [ ([ (xprop, any (app ==))], pmX (float)) | (xprop, app) <- myFloats] + [ (match, pmP $ W.shift target) | (target, match) <- shifts] ++ + [ (match, pmX $ float) | match <- floats] where - myFloats = - [ (wM_CLASS, "vlc") - , (wM_CLASS, "Xmessage") - , (wM_CLASS, "XVkbd") - , (wM_CLASS, "Xdialog") - , (wM_CLASS, "Pinentry") - , (wM_CLASS, "Pinentry-gtk-2") - , (wM_CLASS, "Tiemu") - , (wM_CLASS, "ultrastardx") - , (wM_CLASS, "Ediff") - , (wM_CLASS, "xtensoftphone") - , (wM_CLASS, "Pqiv") - , (wM_CLASS, "XNots") - , (wM_CLASS, "TeamViewer.exe") - , (wM_CLASS, "AmsnWebcam") - , (wM_NAME, "glxgears") - , (wM_NAME, "Passphrase Required") - , (wM_NAME, "Mark all as read") - , (wM_NAME, "Xplanet 1.2.0") - , (wM_NAME, "Eclipse") - ] - - myShifts = - [ (wM_CLASS, (==), "Opera", "1:web") - , (wM_CLASS, (==), "Chrome", "1:web") - , (wM_CLASS, (==), "Chromium-browser", "1:web") - , (wM_CLASS, (==), "Firefox-bin", "1:web") - - , (wM_CLASS, (==), "Claws-mail", "2:mail") - , (wM_CLASS, (==), "Mitter", "2:mail") - , (wM_CLASS, (==), "wanderlust", "2:mail") - , (wM_NAME, (==), "newsbeuter", "2:mail") - - , (wM_CLASS, (==), "Hexchat", "3:irc") - - -- tkabber roater - , (wM_CLASS, (==), "Tkabber", "4:im") - -- tkabber single messages - , (wM_CLASS, (==), "headlines", "4:im") - , (wM_CLASS, isPrefixOf, "chat_##xmpp##1_zedatconferencejabberfuberlinde", "4:im") - , (wM_CLASS, isPrefixOf, "chat_##xmpp##1_mailanimuxdeSyslogBot", "4:im") - - , (wM_CLASS, (==), "emacs", "5:code") - - , (wM_CLASS, (==), "MPlayer", "video") - , (wM_CLASS, (==), "Amarokapp", "music") - ] + floats = [ [(wM_CLASS, anyOf ["vlc", "Xmessage", "XVkbd", "Xdialog", + "Pinentry", "Pinentry-gtk-2", "Tiemu", + "ultrastardx", "Ediff", "xtensoftphone", + "Pqiv", "XNots", "TeamViewer.exe", + "AmsnWebcam"])] + , [(wM_NAME, anyOf ["glxgears", "Passphrase Required", + "Mark all as read", "Xplanet 1.2.0", + "Eclipse"])] + ] + + shifts = [ ("1:web", [(wM_CLASS, anyOf ["Opera", "Chrome", "Google-chrome", "Chromium-browser", + "Firefox-bin"])]) + , ("2:mail", [(wM_CLASS, anyOf ["Claws-mail", "Evolution", "Mitter", "wanderlust"])]) + , ("2:mail", [(wM_NAME, anyOf ["newsbeuter"])]) + , ("3:irc", [(wM_CLASS, anyOf ["Hexchat"])]) + , ("4:im", [(wM_CLASS, anyOf ["TKabber", "headlines", "Vacuum"])]) + + -- tkabber single messages + , ("4:im", [(wM_CLASS, anyOf' isPrefixOf ["chat_##xmpp##1_zedatconferencejabberfuberlinde", + "chat_##xmpp##1_mailanimuxdeSyslogBot"])]) + + , ("5:code", [(wM_CLASS, anyOf ["emacs"])]) + + , ("video", [(wM_CLASS, anyOf ["MPlayer"])]) + , ("music", [(wM_CLASS, anyOf ["Amarokapp"])]) + ] + + anyOf' op valids tests = any (\test -> any (\valid -> op valid test) valids) tests + anyOf = anyOf' (==) -- -- Keys -- cgit v1.2.3 From c8fe2bb1419960b5d539e73326158d1ee4381e5e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 4 Feb 2015 20:02:04 +0100 Subject: lib/Confirm: Add simple confirmation with grid select. --- lib/Confirm.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/Confirm.hs diff --git a/lib/Confirm.hs b/lib/Confirm.hs new file mode 100644 index 0000000..47e3388 --- /dev/null +++ b/lib/Confirm.hs @@ -0,0 +1,11 @@ +module Confirm (confirm) where + +import Control.Monad + +import XMonad.Core +import XMonad.Actions.GridSelect + +confirm :: GSConfig Bool -> String -> X() -> X() +confirm config string action = do + res <- gridselect config [(string, True), ("No", False)] + whenJust res (\x -> when x action) -- cgit v1.2.3 From c5b9d799ce66afefd96e35f56406617cf6d1370e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 4 Feb 2015 20:02:31 +0100 Subject: lib/Pass: Code style. --- lib/Pass.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Pass.hs b/lib/Pass.hs index f29df27..c9b70df 100644 --- a/lib/Pass.hs +++ b/lib/Pass.hs @@ -1,4 +1,3 @@ - ----------------------------------------------------------------------------- -- | -- Module : Pass @@ -131,7 +130,11 @@ generatePassword passLabel = safeSpawn "pass" ["generate", "--force", passLabel, getPasswords :: IO [String] getPasswords = do home <- getHomeDirectory - files <- runProcessWithInput "find" [home ++ "/.password-store","-type", "f", "-name", "*.gpg", "-printf", "%P\n"] [] + files <- runProcessWithInput "find" [ + home ++ "/.password-store", + "-type", "f", + "-name", "*.gpg", + "-printf", "%P\n"] [] return $ map removeGpgExtension $ lines files removeGpgExtension :: String -> String -- cgit v1.2.3 From 6a1480042a0967498f6135bddb5f47fdd4a80f12 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 4 Feb 2015 20:07:45 +0100 Subject: xmonad.hs: Do not use M5 on host "Australien" --- xmonad.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xmonad.hs b/xmonad.hs index aef45d3..957c124 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -111,7 +111,7 @@ myConfig statusFile hostname = defaultConfig , focusedBorderColor = "#A00000" , logHook = myLogHook statusFile , manageHook = myManageHook - , keys = \c -> mkKeymap c $ myKeys c + , keys = \c -> mkKeymap c $ myKeys c hostname , mouseBindings = \c -> M.union (M.fromList $ myMouse (modM hostname) c) $ mouseBindings defaultConfig c , layoutHook = myLayout , workspaces = myWorkspaces @@ -306,10 +306,10 @@ xPropMatches = -- -- Keys -- -myKeys c = +myKeys c hostname = -- this line is critical to reload config - DON'T REMOVE [ ("M-q", broadcastMessage ReleaseResources >> restart "xmonad" True) - , ("M-M5-q", io (exitWith ExitSuccess)) + , (shutdownKey, io (exitWith ExitSuccess)) , ("M-S-", spawn term) , ("M-", openLastHistoryGrid historyGridConfig 30) @@ -406,6 +406,10 @@ myKeys c = | (k, s) <- [("a", 0), ("s", 1)], (m, f) <- [("M-", W.view), ("M-S-", W.shift), ("M-C-", copy)] ] + where + shutdownKey = case hostname of + "Australien" -> "M-S-q" + _ -> "M-M5-q" myMouse modm c = [ ((modm, button1), -- cgit v1.2.3 From 1a40e23790fe41d3048d841166e17428c7c06644 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 4 Feb 2015 20:08:57 +0100 Subject: xmonad.hs: Add confirmation to logout. --- xmonad.hs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xmonad.hs b/xmonad.hs index 957c124..1bcb311 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -65,6 +65,7 @@ import Network.HostName import HistoryGrid import EZConfig import Pass +import qualified Confirm font :: String font = "-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*" @@ -215,6 +216,19 @@ historyGridConfig = defaultGSConfig , gs_font = "xft:Droid Sans Mono Slashed-8" } +confirmConfig :: HasColorizer a => GSConfig a +confirmConfig = defaultGSConfig + { gs_cellheight = 150 + , gs_cellwidth = 300 + , gs_cellpadding = 50 + , gs_font = "xft:Droid Sans Mono Slashed Bold-35" + , gs_originFractX = (1/2) + , gs_originFractY = (1/3) + } + +confirm :: String -> X() -> X() +confirm = Confirm.confirm confirmConfig + -- -- Hooks -- @@ -309,7 +323,7 @@ xPropMatches = myKeys c hostname = -- this line is critical to reload config - DON'T REMOVE [ ("M-q", broadcastMessage ReleaseResources >> restart "xmonad" True) - , (shutdownKey, io (exitWith ExitSuccess)) + , (shutdownKey, confirm "Logout?" $ io (exitWith ExitSuccess)) , ("M-S-", spawn term) , ("M-", openLastHistoryGrid historyGridConfig 30) -- cgit v1.2.3