Skip to content

Commit

Permalink
refactor(xmonad): remove pavucontrol scratchpad
Browse files Browse the repository at this point in the history
Remove the pavucontrol named scratchpad, as it wasn't being used and was
just cluttering up the configuration.
  • Loading branch information
d3adb5 committed Nov 5, 2023
1 parent 75aa587 commit 6297b76
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 0 additions & 1 deletion xmonad/src/Config/Bindings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ keyBindings =
, ("M-M1-k", withFocused swapWithLastHidden)
, ("M-M1-l", withLastHidden unhideWindow)
, ("M-[", namedScratchpadAction MH.scratchpads "term")
, ("M-s v", namedScratchpadAction MH.scratchpads "volume")
, ("M-C-y", chooseWorkspace >>= windows . copy)
, ("M-<Backspace>", kill1)
, ("M-S-y", withFocused $ moveToWorkspace' "fzfmenu" fzfmenuArgs)
Expand Down
6 changes: 6 additions & 0 deletions xmonad/src/Config/Dimensions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ terminalLRatio lnum = verticalSpan % availableVerticalSpan
-- | Calculates the horizontal ratio of a window given its width in pixels.
horizontalRatio :: Integral a => a -> Ratio a
horizontalRatio width = width % availableHorizontalSpan

decorationSpan = borderWidth + terminalPadding

columnsToWindowWidth, linesToWindowHeight :: Integral a => a -> a
columnsToWindowWidth cols = cols * characterWidth + 2 * decorationSpan
linesToWindowHeight lins = lins * characterHeight + 2 * decorationSpan
22 changes: 9 additions & 13 deletions xmonad/src/Config/ManageHook.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import XMonad hiding (manageHook, borderWidth)
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.ManageHelpers
import XMonad.Util.CenterRationalRect
import XMonad.Util.NamedScratchpad hiding (hook)
import XMonad.Util.NamedScratchpad hiding (name, query, hook)
import XMonad.Util.WindowProperties (getProp32s)
import XMonad.StackSet (floating)

import qualified XMonad.Actions.DynamicWorkspaces as DW
import qualified XMonad.StackSet as W

import Config.Dimensions
import Data.List (singleton)
import Data.Map (member)
import Data.Maybe (isJust)
import Data.Ratio
Expand Down Expand Up @@ -40,18 +41,13 @@ manageHook = composeAll
, ("WM_WINDOW_ROLE", "file-png") ]

scratchpads :: [NamedScratchpad]
scratchpads =
[ NS "term" "st -n scratch -t scratch -e tmux new -A -s scratch"
(appName =? "scratch")
(customFloating $ centerIRectOffsetY panelHeight tw th sw sh)
, NS "volume" "pavucontrol"
(className =? "Pavucontrol")
(customFloating $ centerIRectOffsetY panelHeight vw vh sw sh)
]
where tw = 150 * characterWidth + 2 * (borderWidth + terminalPadding)
th = 40 * characterHeight + 2 * (borderWidth + terminalPadding)
(sw,sh) = (screenWidth, screenHeight)
(vw,vh) = (768,648)
scratchpads = singleton $ NS name command query hook
where command = "st -n scratch -t scratch -e tmux new -A -s scratch"
hook = customFloating $ centerIRectOffsetY panelHeight tw th sw sh
(tw, th) = (columnsToWindowWidth 150, linesToWindowHeight 40)
(sw, sh) = (screenWidth, screenHeight)
query = appName =? "scratch"
name = "term"

-- | Properly center a floating window in the available screen real estate.
centerFloat :: ManageHook
Expand Down

0 comments on commit 6297b76

Please sign in to comment.