diff options
author | azahi <azahi@teknik.io> | 2018-10-03 14:30:31 +0300 |
---|---|---|
committer | azahi <azahi@teknik.io> | 2018-10-03 14:30:31 +0300 |
commit | 7e19bd16b48bd009a3b4d0f029c445bb49d95615 (patch) | |
tree | ff4fc89baaef3a684294463e18569fd56996f3bd | |
parent | Release 0.2.1.1 (diff) |
Move to 0.15
Fix windows not showing with fullscreen hooks Add misc directory with stuff that should be moved to ~/.xmonad Switch indentation style Add submodules
-rw-r--r-- | .gitmodules | 6 | ||||
-rw-r--r-- | cabal.project | 3 | ||||
-rwxr-xr-x | misc/bin/mpc-play-pause.sh | 8 | ||||
-rwxr-xr-x | misc/bin/nsp-console.sh | 8 | ||||
-rwxr-xr-x | misc/bin/screenlock.sh | 7 | ||||
-rwxr-xr-x | misc/bin/toggle-compton.sh | 8 | ||||
-rwxr-xr-x | misc/bin/toggle-redshift.sh | 9 | ||||
-rwxr-xr-x | misc/bin/toggle-touchpad.sh | 11 | ||||
-rwxr-xr-x | misc/bin/toggle-trackpoint.sh | 11 | ||||
-rwxr-xr-x | misc/bin/xmobar/fcitx.sh | 16 | ||||
-rwxr-xr-x | misc/bin/xshot-select-upload.sh | 7 | ||||
-rwxr-xr-x | misc/bin/xshot-select.sh | 5 | ||||
-rwxr-xr-x | misc/bin/xshot-upload.sh | 7 | ||||
-rwxr-xr-x | misc/bin/xshot.sh | 5 | ||||
-rw-r--r-- | misc/xmobarrcBot.hs (renamed from xmobarrcBot.hs) | 0 | ||||
-rw-r--r-- | misc/xmobarrcTop.hs (renamed from xmobarrcTop.hs) | 0 | ||||
-rw-r--r-- | src/Main.hs | 45 | ||||
-rw-r--r-- | src/XMonad/Custom/Bindings.hs | 27 | ||||
-rw-r--r-- | src/XMonad/Custom/Layout.hs | 13 | ||||
-rw-r--r-- | src/XMonad/Custom/Log.hs | 9 | ||||
-rw-r--r-- | src/XMonad/Custom/Navigation.hs | 4 | ||||
-rw-r--r-- | src/XMonad/Custom/Startup.hs | 4 | ||||
-rw-r--r-- | src/XMonad/Custom/Workspaces.hs | 20 | ||||
-rw-r--r-- | stack.yaml | 5 | ||||
m--------- | vendor/xmonad | 0 | ||||
m--------- | vendor/xmonad-contrib | 0 | ||||
-rw-r--r-- | xmonad-ng.cabal | 30 |
27 files changed, 199 insertions, 69 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..781a58e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "vendor/xmonad"] + path = vendor/xmonad + url = https://github.com/azahi/xmonad +[submodule "vendor/xmonad-contrib"] + path = vendor/xmonad-contrib + url = https://github.com/azahi/xmonad-contrib diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..2f7a15c --- /dev/null +++ b/cabal.project @@ -0,0 +1,3 @@ +packages: ./ + ./vendor/xmonad/ + ./vendor/xmonad-contrib/ diff --git a/misc/bin/mpc-play-pause.sh b/misc/bin/mpc-play-pause.sh new file mode 100755 index 0000000..3fb4f3b --- /dev/null +++ b/misc/bin/mpc-play-pause.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if mpc | grep -q "playing" +then + mpc --no-status pause +else + mpc --no-status play +fi diff --git a/misc/bin/nsp-console.sh b/misc/bin/nsp-console.sh new file mode 100755 index 0000000..5d19f46 --- /dev/null +++ b/misc/bin/nsp-console.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if tmux list-sessions | grep -q "scratchpad" +then + tmux attach-session -t "scratchpad" +else + tmux new-session -s "scratchpad" -n "scratchpad" -c "${HOME}" +fi diff --git a/misc/bin/screenlock.sh b/misc/bin/screenlock.sh new file mode 100755 index 0000000..28dbe0c --- /dev/null +++ b/misc/bin/screenlock.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +i3lock \ + --no-unlock-indicator \ + --image "${HOME}/pictures/wallpapers/mill-lock.png" \ + --pointer default \ + --ignore-empty-password diff --git a/misc/bin/toggle-compton.sh b/misc/bin/toggle-compton.sh new file mode 100755 index 0000000..91ebc4d --- /dev/null +++ b/misc/bin/toggle-compton.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if [[ $(pgrep 'compton') ]] +then + pkill "compton" +else + compton -b --config "${XDG_CONFIG_HOME}/compton.conf" +fi diff --git a/misc/bin/toggle-redshift.sh b/misc/bin/toggle-redshift.sh new file mode 100755 index 0000000..8ba6b60 --- /dev/null +++ b/misc/bin/toggle-redshift.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [[ $(pgrep 'redshift') ]] +then + pkill "redshift" +else + redshift -c "${XDG_CONFIG_HOME}/redshift.conf" & + disown redshift +fi diff --git a/misc/bin/toggle-touchpad.sh b/misc/bin/toggle-touchpad.sh new file mode 100755 index 0000000..5a30528 --- /dev/null +++ b/misc/bin/toggle-touchpad.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +ID=$(xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}') +STATE=$(xinput list-props "$ID" | awk '/Device Enabled/ {print $4}') + +if [ "$STATE" -eq 1 ] +then + xinput disable "$ID" +else + xinput enable "$ID" +fi diff --git a/misc/bin/toggle-trackpoint.sh b/misc/bin/toggle-trackpoint.sh new file mode 100755 index 0000000..b0b3501 --- /dev/null +++ b/misc/bin/toggle-trackpoint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +ID=$(xinput list | grep -Eo 'TrackPoint\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}') +STATE=$(xinput list-props "$ID" | awk '/Device Enabled/ {print $4}') + +if [ "$STATE" -eq 1 ] +then + xinput disable "$ID" +else + xinput enable "$ID" +fi diff --git a/misc/bin/xmobar/fcitx.sh b/misc/bin/xmobar/fcitx.sh new file mode 100755 index 0000000..ddf1826 --- /dev/null +++ b/misc/bin/xmobar/fcitx.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +status="$(fcitx-remote)" +set out + +if [[ "$status" = 0 ]] +then + out="Off" +elif [[ "$status" = 1 ]] +then + out="Disabled" +else + out="Enabled" +fi + +echo -e "$out" diff --git a/misc/bin/xshot-select-upload.sh b/misc/bin/xshot-select-upload.sh new file mode 100755 index 0000000..e846800 --- /dev/null +++ b/misc/bin/xshot-select-upload.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png" + +maim --format=png --hidecursor --quality 8 --select "${PIC}" && \ + curl --form "file=@${PIC}" "https://0x0.st" | \ + xclip -quiet diff --git a/misc/bin/xshot-select.sh b/misc/bin/xshot-select.sh new file mode 100755 index 0000000..53ad782 --- /dev/null +++ b/misc/bin/xshot-select.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png" + +maim --format=png --hidecursor --quality 8 --select "${PIC}" diff --git a/misc/bin/xshot-upload.sh b/misc/bin/xshot-upload.sh new file mode 100755 index 0000000..91c23f4 --- /dev/null +++ b/misc/bin/xshot-upload.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png" + +maim --format=png --hidecursor --quality 8 "${PIC}" && \ + curl --form "file=@${PIC}" "https://0x0.st" | \ + xclip -quiet diff --git a/misc/bin/xshot.sh b/misc/bin/xshot.sh new file mode 100755 index 0000000..d7984e3 --- /dev/null +++ b/misc/bin/xshot.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png" + +maim --format=png --hidecursor --quality 8 "${PIC}" diff --git a/xmobarrcBot.hs b/misc/xmobarrcBot.hs index c70689b..c70689b 100644 --- a/xmobarrcBot.hs +++ b/misc/xmobarrcBot.hs diff --git a/xmobarrcTop.hs b/misc/xmobarrcTop.hs index 6764359..6764359 100644 --- a/xmobarrcTop.hs +++ b/misc/xmobarrcTop.hs diff --git a/src/Main.hs b/src/Main.hs index fadabec..27379ab 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -46,25 +46,26 @@ instance UrgencyHook NotifyUrgencyHook where safeSpawn (Custom.notify Custom.customApplications) [show n, "workspace " ++ wrap "[" "]" i] main :: IO () -main = xmonad $ ewmh - $ fullscreenSupport - $ docks - $ withUrgencyHook NotifyUrgencyHook - $ withNavigation2DConfig Custom.navigation2DConfig - $ dynamicProjects Custom.projects - $ addDescrKeys' ((Custom.modMask', xK_F1), Custom.showKeyBindings) Custom.keyBindings - $ def { borderWidth = Custom.border - , workspaces = Custom.workspaces' -- TODO save WS state - , layoutHook = Custom.layoutHook' -- TODO save layout state and floating W position - , terminal = Custom.term Custom.customApplications - , normalBorderColor = Custom.colorN - , focusedBorderColor = Custom.colorF - , modMask = Custom.modMask' - , logHook = Custom.logHook' - , startupHook = Custom.startupHook' - , mouseBindings = Custom.mouseBindings' - , manageHook = Custom.manageHook' - , handleEventHook = Custom.handleEventHook' - , focusFollowsMouse = False - , clickJustFocuses = False - } +main = xmonad + $ ewmh + $ fullscreenSupport + $ docks + $ withUrgencyHook NotifyUrgencyHook + $ withNavigation2DConfig Custom.navigation2DConfig + $ dynamicProjects Custom.projects + $ addDescrKeys' ((Custom.modMask', xK_F1), Custom.showKeyBindings) Custom.keyBindings + $ def { borderWidth = Custom.border + , workspaces = Custom.workspaces' -- TODO save WS state + , layoutHook = Custom.layoutHook' -- TODO save layout state and floating W position + , terminal = Custom.term Custom.customApplications + , normalBorderColor = Custom.colorN + , focusedBorderColor = Custom.colorF + , modMask = Custom.modMask' + , logHook = Custom.logHook' + , startupHook = Custom.startupHook' + , mouseBindings = Custom.mouseBindings' + , manageHook = Custom.manageHook' + , handleEventHook = Custom.handleEventHook' + , focusFollowsMouse = False + , clickJustFocuses = False + } diff --git a/src/XMonad/Custom/Bindings.hs b/src/XMonad/Custom/Bindings.hs index 19eaa2a..414e89a 100644 --- a/src/XMonad/Custom/Bindings.hs +++ b/src/XMonad/Custom/Bindings.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE LambdaCase #-} + ----------------------------------------------------------------------------- -- | -- Module : XMonad.Custom.Bindings @@ -34,7 +36,7 @@ import XMonad.Actions.MessageFeedback import XMonad.Actions.Navigation2D import XMonad.Actions.PerConditionKeys import XMonad.Actions.Promote -import XMonad.Actions.Volume +--import XMonad.Actions.Volume import XMonad.Actions.WithAll import XMonad.Custom.Layout import qualified XMonad.Custom.Misc as CM @@ -86,16 +88,15 @@ zipM' :: [a] -> String -> [[a]] -> [t] -> (t -> t1 -> X ()) -> t1 -> [([a], Name zipM' m nm ks as f b = zipWith (\k d -> (m ++ k, addName nm $ f d b)) ks as tryMessageR_ :: (Message a, Message b) => a -> b -> X () -tryMessageR_ x y = sequence_ [tryMessage_ x y, refresh] +tryMessageR_ x y = sequence_ [tryMessageWithNoRefreshToCurrent x y, refresh] xSelectionNotify :: MonadIO m => m () xSelectionNotify = join $ io - $ (unsafeSpawn . (\x -> CM.notify CM.customApplications ++ " Clipboard " ++ wrap "\"\\\"" "\"\\\"" x)) <$> getSelection + $ unsafeSpawn . (\x -> CM.notify CM.customApplications ++ " Clipboard " ++ wrap "\"\\\"" "\"\\\"" x) <$> getSelection toggleCopyToAll :: X () -toggleCopyToAll = wsContainingCopies >>= \x -> case x of - [] -> windows copyToAll - _ -> killAllOtherCopies +toggleCopyToAll = wsContainingCopies >>= \case [] -> windows copyToAll + _ -> killAllOtherCopies getSortByIndexNonSP :: X ([WindowSpace] -> [WindowSpace]) getSortByIndexNonSP = (. namedScratchpadFilterOutWorkspace) <$> getSortByIndex @@ -107,12 +108,10 @@ prevNonEmptyWS = findWorkspace getSortByIndexNonSP Prev HiddenNonEmptyWS 1 >>= \ toggleFloat :: Window -> X () toggleFloat w = windows (\s -> if M.member w (S.floating s) then S.sink w s - else S.float w (S.RationalRect (1/2 - 1/4) (1/2 - 1/4) (1/2) (1/2)) s) + else S.float w (S.RationalRect (1/2 - 1/4) (1/2 - 1/4) (1/2) (1/2)) s) keyBindings :: XConfig Layout -> [((KeyMask, KeySym), NamedAction)] -keyBindings c = - let subKeys s ks = subtitle s:mkNamedKeymap c ks - in +keyBindings c = let subKeys s ks = subtitle s:mkNamedKeymap c ks in subKeys "System" [ ("M-q" , addName "Restart XMonad" $ spawn "xmonad-ng --restart") , ("M-S-q" , addName "Quit XMonad" $ confirmPrompt hotPromptTheme "Quit XMonad?" $ io exitSuccess) @@ -148,10 +147,10 @@ keyBindings c = ] ^++^ subKeys "Volume & Music" - [ ("<XF86AudioMute>" , addName "ALSA: Mute" $ void toggleMute) - , ("<XF86AudioLowerVolume>" , addName "ALSA: Lower volume" $ void $ lowerVolume 5) - , ("<XF86AudioRaiseVolume>" , addName "ALSA: Raise volume" $ void $ raiseVolume 5) - , ("<XF86AudioPlay>" , addName "MPD: Play/pause" $ spawn "~/.xmonad/bin/mpc-play-pause.sh") + -- [ ("<XF86AudioMute>" , addName "ALSA: Mute" $ void toggleMute) + -- , ("<XF86AudioLowerVolume>" , addName "ALSA: Lower volume" $ void $ lowerVolume 5) + -- , ("<XF86AudioRaiseVolume>" , addName "ALSA: Raise volume" $ void $ raiseVolume 5) + [ ("<XF86AudioPlay>" , addName "MPD: Play/pause" $ spawn "~/.xmonad/bin/mpc-play-pause.sh") , ("<XF86AudioStop>" , addName "MPD: Stop" $ spawn "mpc --no-status stop") , ("<XF86AudioPrev>" , addName "MPD: Previos track" $ spawn "mpc --no-status prev") , ("<XF86AudioNext>" , addName "MPD: Next track" $ spawn "mpc --no-status next") diff --git a/src/XMonad/Custom/Layout.hs b/src/XMonad/Custom/Layout.hs index 3a0a107..9983b9c 100644 --- a/src/XMonad/Custom/Layout.hs +++ b/src/XMonad/Custom/Layout.hs @@ -40,23 +40,16 @@ import XMonad.Layout.Tabbed import XMonad.Layout.WindowNavigation applySpacing :: l a -> ModifiedLayout Spacing l a -applySpacing = spacing gapBase - -applyGaps :: l a -> ModifiedLayout Gaps l a -applyGaps = gaps [ (U, gapBase) - , (D, gapBase) - , (R, gapBase) - , (L, gapBase) - ] +applySpacing = spacingRaw True (Border 12 12 12 12) True (Border 12 12 12 12) True data CustomTransformers = GAPS deriving (Read, Show, Eq, Typeable) instance Transformer CustomTransformers Window where - transform GAPS x k = k (avoidStruts $ applyGaps $ applySpacing x) (const x) + transform GAPS x k = k (avoidStruts $ applySpacing x) (const x) layoutHook' = fullscreenFloat - $ lessBorders OnlyFloat + $ lessBorders OnlyLayoutFloat $ mkToggle (single NBFULL) $ avoidStruts $ mkToggle (single GAPS) diff --git a/src/XMonad/Custom/Log.hs b/src/XMonad/Custom/Log.hs index 1bf05f1..4102f6f 100644 --- a/src/XMonad/Custom/Log.hs +++ b/src/XMonad/Custom/Log.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE LambdaCase #-} + ----------------------------------------------------------------------------- -- | -- Module : XMonad.Custom.Log @@ -42,10 +44,9 @@ topBarPP = def , ppWsSep = " " , ppTitle = xmobarColor white1 "" . shorten 50 , ppTitleSanitize = xmobarStrip - , ppLayout = xmobarColor white1 "" . \x -> case x of -- TODO Generalize string conversion - "Spacing 12 Tabbed Hidden BSP" -> "Omni.Gaps" - "Tabbed Hidden BSP" -> "Omni" - _ -> "Misc" + , ppLayout = xmobarColor white1 "" . \case "Spacing 12 Tabbed Hidden BSP" -> "Omni.Gaps" + "Tabbed Hidden BSP" -> "Omni" + _ -> "Misc" , ppOrder = id , ppSort = (namedScratchpadFilterOutWorkspace .) <$> getSortByIndex , ppExtras = [] diff --git a/src/XMonad/Custom/Navigation.hs b/src/XMonad/Custom/Navigation.hs index 583d5ae..c301219 100644 --- a/src/XMonad/Custom/Navigation.hs +++ b/src/XMonad/Custom/Navigation.hs @@ -18,8 +18,8 @@ import XMonad.Actions.Navigation2D navigation2DConfig :: Navigation2DConfig navigation2DConfig = def - { defaultTiledNavigation = hybridNavigation - , floatNavigation = hybridNavigation + { defaultTiledNavigation = hybridOf sideNavigation centerNavigation + , floatNavigation = hybridOf lineNavigation centerNavigation , layoutNavigation = [("Full", centerNavigation)] , unmappedWindowRect = [("Full", singleWindowRect)] } diff --git a/src/XMonad/Custom/Startup.hs b/src/XMonad/Custom/Startup.hs index 592f9b8..68b8fd3 100644 --- a/src/XMonad/Custom/Startup.hs +++ b/src/XMonad/Custom/Startup.hs @@ -51,8 +51,8 @@ addEWMHFullscreen = do startupHook' :: X () startupHook' = do - spawnNamedPipe "xmobar ~/work/xmonad-ng/xmobarrcTop.hs" "xmobarTop" - spawnNamedPipe "xmobar ~/work/xmonad-ng/xmobarrcBot.hs" "xmobarBot" + spawnNamedPipe "xmobar ~/.xmonad/xmobarrcTop.hs" "xmobarTop" + spawnNamedPipe "xmobar ~/.xmonad/xmobarrcBot.hs" "xmobarBot" docksStartupHook addEWMHFullscreen setDefaultCursor xC_left_ptr diff --git a/src/XMonad/Custom/Workspaces.hs b/src/XMonad/Custom/Workspaces.hs index 881861c..3c15671 100644 --- a/src/XMonad/Custom/Workspaces.hs +++ b/src/XMonad/Custom/Workspaces.hs @@ -14,7 +14,27 @@ module XMonad.Custom.Workspaces ( workspaces' ) where +import XMonad.Actions.DynamicProjects import XMonad.Core +import XMonad.Custom.Misc workspaces' :: [WorkspaceId] workspaces' = map show [1..9 :: Int] + +projects :: [Project] +projects = + [ Project { projectName = "scratch" + , projectDirectory = "~/" + , projectStartHook = Nothing + } + + , Project { projectName = "www" + , projectDirectory = "~/" + , projectStartHook = Nothing + } + + , Project { projectName = "mail" + , projectDirectory = "~/" + , projectStartHook = Nothing + } + ] diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..98ff64a --- /dev/null +++ b/stack.yaml @@ -0,0 +1,5 @@ +resolver: lts-12.11 +packages: + - . + - ./vendor/xmonad + - ./vendor/xmonad-contrib diff --git a/vendor/xmonad b/vendor/xmonad new file mode 160000 +Subproject bb13853929f8f6fc59b526bcc10631e1bac309a diff --git a/vendor/xmonad-contrib b/vendor/xmonad-contrib new file mode 160000 +Subproject 81a980823e441713217336040656495850f7e75 diff --git a/xmonad-ng.cabal b/xmonad-ng.cabal index 7216550..87374fb 100644 --- a/xmonad-ng.cabal +++ b/xmonad-ng.cabal @@ -1,5 +1,5 @@ name: xmonad-ng -version: 0.2.1.1 +version: 0.15 synopsis: azahi's XMonad configuration description: azahi's XMonad configuration based on stolen code and bad Haskell knowledge homepage: https://github.com/azahi/xmonad-ng @@ -25,10 +25,10 @@ library exposed-modules: XMonad.Actions.FloatSnapSpaced , XMonad.Actions.PerConditionKeys - build-depends: base >= 4.9.1 && < 4.10 - , containers >= 0.5.7 && < 0.6 - , xmonad >= 0.13 && < 0.14 - , xmonad-contrib >= 0.13 && < 0.14 + build-depends: base >= 4.11 && < 4.12 + , containers >= 0.5 && < 0.6 + , xmonad >= 0.15 && < 0.16 + , xmonad-contrib >= 0.15 && < 0.16 executable xmonad-ng main-is: Main.hs @@ -37,6 +37,7 @@ executable xmonad-ng default-language: Haskell2010 other-extensions: DeriveDataTypeable + , LambdaCase , MultiParamTypeClasses , TypeSynonymInstances @@ -55,13 +56,12 @@ executable xmonad-ng , XMonad.Custom.Theme , XMonad.Custom.Workspaces - build-depends: X11 >= 1.8 && < 1.9 - , base >= 4.9.1 && < 4.10 - , containers >= 0.5.7 && < 0.6 - , directory >= 1.3 && < 1.4 - , filepath >= 1.4.1 && < 1.5 - , text >= 1.2.3 && < 1.3 - , time >= 1.6 && < 1.7 - , xmonad >= 0.13 && < 0.14 - , xmonad-contrib >= 0.13 && < 0.14 - , xmonad-extras >= 0.13 && < 0.14 + build-depends: X11 >= 1.9 && < 1.10 + , base >= 4.11 && < 4.12 + , containers >= 0.5 && < 0.6 + , directory >= 1.3 && < 1.4 + , filepath >= 1.4 && < 1.5 + , text >= 1.2 && < 1.3 + , time >= 1.8 && < 1.9 + , xmonad >= 0.15 && < 0.16 + , xmonad-contrib >= 0.15 && < 0.16 |