aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xextras/HOME/.xmonad/startup15
-rw-r--r--src/Main.hs1
-rw-r--r--src/Rahm/Desktop/Keys/Wml.hs21
-rw-r--r--src/Rahm/Desktop/Workspaces.hs46
4 files changed, 73 insertions, 10 deletions
diff --git a/extras/HOME/.xmonad/startup b/extras/HOME/.xmonad/startup
index 85c888e..5fcfaf7 100755
--- a/extras/HOME/.xmonad/startup
+++ b/extras/HOME/.xmonad/startup
@@ -10,6 +10,21 @@ common() {
rm -rf "$HOME/.xmonad/icons/cache/"
}
+hostname_rahm3() {
+ $HOME/Projects/rkb/setxkbmap.sh
+ xinput set-prop "TPPS/2 Elan TrackPoint" "Coordinate Transformation Matrix" 2 0 0 0 2 0 0 0 1
+ xinput set-prop "ELAN0672:00 04F3:3187 Touchpad" "Coordinate Transformation Matrix" 2 0 0 0 2 0 0 0 1
+
+ n_displays=$(xrandr | grep '\<connected\>' | wc -l)
+ if [[ "$n_displays" -le "2" ]] ; then
+ if [ -z "$(ps aux | grep compton | grep -v grep)" ] ; then
+ __GL_SYNC_TO_VBLANK=1 nohup picom --backend=glx &>/dev/null &
+ fi
+ else
+ killall picom
+ fi
+}
+
hostname_rahm1() {
# Startup commands specific to my worktop.
xinput set-prop "TPPS/2 Elan TrackPoint" "Coordinate Transformation Matrix" 3 0 0 0 3 0 0 0 1
diff --git a/src/Main.hs b/src/Main.hs
index a9aa419..0c00be9 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -121,6 +121,7 @@ main = do
className =? "MPlayer" --> doFloat,
className =? "Xfce4-notifyd" --> doIgnore,
className =? "popup-terminal" --> doShift "*" <> updatePopupTerminalHook,
+ className =? "spotify" --> doShift "s",
className =? "floating-terminal" --> doCenterFloat,
title =? "Event Tester" --> doFloat,
title =? "Notes" --> doCenterFloat,
diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs
index 0c09fd1..792ff74 100644
--- a/src/Rahm/Desktop/Keys/Wml.hs
+++ b/src/Rahm/Desktop/Keys/Wml.hs
@@ -93,7 +93,7 @@ import Rahm.Desktop.History
)
import Rahm.Desktop.Keys.KeyFeed
import Rahm.Desktop.Layout.PinWindow (pinnedWindows)
-import Rahm.Desktop.Logger (LogLevel (Info, Trace), logs)
+import Rahm.Desktop.Logger
import Rahm.Desktop.Marking
( farLeftWindow,
farRightWindow,
@@ -105,14 +105,6 @@ import Rahm.Desktop.Marking
import qualified Rahm.Desktop.StackSet as W
import Rahm.Desktop.Submap (mapNextStringWithKeysym)
import Rahm.Desktop.Workspaces
- ( accompaningWorkspace,
- adjacentWorkspace,
- adjacentWorkspaceNotVisible,
- getHorizontallyOrderedScreens,
- next,
- prev,
- workspaceWithWindow,
- )
import Rahm.Desktop.XMobarLog.PendingBuffer
( addStringToPendingBuffer,
setPendingBuffer,
@@ -474,12 +466,21 @@ readNextWorkspace =
screens <-
liftXToFeed $
map (W.tag . W.workspace . snd)
- <$> withWindowSet (return . getHorizontallyOrderedScreens)
+ <$> withWindowSet (return . getScreensOnSamePlane)
let (_, rest) = break ((== workspaceName ws) . Just) (screens ++ screens)
justWorkspace <$> hoistMaybe (head $ tail rest)
+ -- Workspace on the screen above the current workspace..
+ (_, _, "+") -> do
+ screens <-
+ liftXToFeed $
+ map (W.tag . W.workspace . snd)
+ <$> withWindowSet (return . getScreensOnDifferentPlane)
+
+ justWorkspace <$> hoistMaybe (head screens)
+
-- Workspace to the next screen to the left of the next workspace.
(_, _, ";") -> do
ws <- readNextWorkspace
diff --git a/src/Rahm/Desktop/Workspaces.hs b/src/Rahm/Desktop/Workspaces.hs
index 6f0c08a..0c70591 100644
--- a/src/Rahm/Desktop/Workspaces.hs
+++ b/src/Rahm/Desktop/Workspaces.hs
@@ -15,6 +15,8 @@ module Rahm.Desktop.Workspaces
adjacentScreen,
withScreen,
workspaceWithWindow,
+ getScreensOnSamePlane,
+ getScreensOnDifferentPlane,
WorkspaceState (..),
)
where
@@ -26,9 +28,11 @@ import Data.Char (isUpper, toLower, toUpper)
import Data.List (find, sort, sortBy, sortOn, (\\))
import Data.List.Safe ((!!))
import Data.Maybe (fromMaybe, mapMaybe)
+import Debug.Trace
import Rahm.Desktop.Common (getCurrentWorkspace, gotoWorkspace, runMaybeT_)
import Rahm.Desktop.Logger
import qualified Rahm.Desktop.StackSet as W
+import Text.Printf (printf)
import XMonad
( Rectangle (Rectangle),
ScreenDetail (SD),
@@ -100,6 +104,48 @@ getHorizontallyOrderedScreens windowSet =
where
screens = (True, W.current windowSet) : map (False,) (W.visible windowSet)
+getVerticallyOrderedScreens ::
+ W.StackSet wid l a ScreenId ScreenDetail ->
+ [(Bool, W.Screen wid l a ScreenId ScreenDetail)]
+-- ^ Returns a list of screens ordered from top to bottom
+getVerticallyOrderedScreens windowSet =
+ flip sortBy screens $ \sc1 sc2 ->
+ let (SD (Rectangle _ y1 _ _)) = W.screenDetail (snd sc1)
+ (SD (Rectangle _ y2 _ _)) = W.screenDetail (snd sc2)
+ in y1 `compare` y2
+ where
+ screens = (True, W.current windowSet) : map (False,) (W.visible windowSet)
+
+-- | Returns screens which are horizontally ordered, but are on the same "plane"
+-- as the current screen. A screen is considered on the same "plane" if it's
+-- middle point is vertically oriented within the vertical boundaries of the
+-- current screen.
+getScreensOnSamePlane ::
+ W.StackSet wid l a ScreenId ScreenDetail ->
+ [(Bool, W.Screen wid l a ScreenId ScreenDetail)]
+getScreensOnSamePlane ss =
+ filter matchesYCenter $ getHorizontallyOrderedScreens ss
+ where
+ yCenter
+ | (SD (Rectangle _ y _ h)) <- W.screenDetail . W.current $ ss =
+ (y + fromIntegral h) `div` 2
+ matchesYCenter (_, W.screenDetail -> (SD (Rectangle _ y _ h))) =
+ y < yCenter && y + fromIntegral h > yCenter
+
+-- | Returns screens which are vertically ordered, but are on a different plane
+-- from the current screen.
+getScreensOnDifferentPlane ::
+ W.StackSet wid l a ScreenId ScreenDetail ->
+ [(Bool, W.Screen wid l a ScreenId ScreenDetail)]
+getScreensOnDifferentPlane ss =
+ filter (not . matchesScreen . getYCenter . snd) $ getVerticallyOrderedScreens ss
+ where
+ getYCenter (W.screenDetail -> SD (Rectangle _ y _ h)) =
+ y + (fromIntegral h `div` 2)
+ matchesScreen yCenter
+ | (SD (Rectangle _ y _ h)) <- W.screenDetail (W.current ss) =
+ yCenter < y + fromIntegral h && yCenter > y
+
accompaningWorkspace :: WorkspaceId -> WorkspaceId
accompaningWorkspace [s] =
return $