<commit_before>-- | Misc utilities for xmonad configuration
module Misc where

import Control.Monad.Catch
import Data.Char
import Data.Monoid
import XMonad.Actions.PhysicalScreens
import XMonad.Actions.Warp

import Imports hiding (trace)

focusScreen :: Int -> XX ()
focusScreen = warpMid . viewScreen screenOrder . P

moveToScreen :: Int -> XX ()
moveToScreen = warpMid . sendToScreen screenOrder . P

-- | Orders screens primarily horizontally, from right to left.
screenOrder :: ScreenComparator
screenOrder =
  screenComparatorByRectangle $
  \(Rectangle x1 y1 _ _) (Rectangle x2 y2 _ _) -> compare (x2, y2) (x1, y1)

{- TODO: trace utility that uses logger
debug :: Show a => a -> a
debug x = trace ("xmonad debug: " ++ show x) x
-}

nxt :: (Eq a, Enum a, Bounded a) => a -> a
nxt x | x == maxBound = minBound
      | otherwise = succ x

{- TODO: figure out initial manage hook
runManageHookOnAll :: ManageHook -> X ()
runManageHookOnAll mh = void $ withWindowSet $ \s -> do
  mapM
    (\w -> runQuery mh w)
    (W.allWindows s)
-}

readToken :: FilePath -> X String
readToken = liftIO . fmap (takeWhile (not . isSpace)) . readFile

notify :: String -> Xio ()
notify msg = do
  logInfo $ "XMonad notify: " <> fromString msg
  syncSpawn "notify-send" ["-i", "~/env/xmonad.png", "XMonad", msg]<commit_msg>Remove some unused code that won't be useful in the future<commit_after>-- | Misc utilities for xmonad configuration
module Misc where

import Control.Monad.Catch
import Data.Char
import Data.Monoid
import XMonad.Actions.PhysicalScreens
import XMonad.Actions.Warp

import Imports hiding (trace)

focusScreen :: Int -> XX ()
focusScreen = warpMid . viewScreen screenOrder . P

moveToScreen :: Int -> XX ()
moveToScreen = warpMid . sendToScreen screenOrder . P

-- | Orders screens primarily horizontally, from right to left.
screenOrder :: ScreenComparator
screenOrder =
  screenComparatorByRectangle $
  \(Rectangle x1 y1 _ _) (Rectangle x2 y2 _ _) -> compare (x2, y2) (x1, y1)

{- TODO: trace utility that uses logger
debug :: Show a => a -> a
debug x = trace ("xmonad debug: " ++ show x) x
-}

nxt :: (Eq a, Enum a, Bounded a) => a -> a
nxt x | x == maxBound = minBound
      | otherwise = succ x

readToken :: FilePath -> X String
readToken = liftIO . fmap (takeWhile (not . isSpace)) . readFile

notify :: String -> Xio ()
notify msg = do
  logInfo $ "XMonad notify: " <> fromString msg
  syncSpawn "notify-send" ["-i", "~/env/xmonad.png", "XMonad", msg]
{'fraction_non_alphanumeric': 0.12003244120032441, 'fraction_numerical': 0.006488240064882401, 'mean_word_length': 3.637218045112782, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3986530', 'n_tokens_mistral': 831, 'n_tokens_neox': 809, 'n_words': 283}