From ffa810484c16ffb0a1d1a9f27b77dbcf24212da9 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 27 Nov 2022 22:05:55 +0100 Subject: tv xmonad: Full -> StateFull --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index c921d428b..d7c45f189 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} module Main (main) where @@ -20,6 +21,7 @@ import XMonad.Actions.CycleWS (toggleWS) import XMonad.Layout.NoBorders ( smartBorders ) import XMonad.Layout.ResizableTile (ResizableTall(ResizableTall)) import XMonad.Layout.ResizableTile (MirrorResize(MirrorExpand,MirrorShrink)) +import XMonad.Layout.StateFull (pattern StateFull) import qualified XMonad.Prompt import qualified XMonad.StackSet as W import Data.Map (Map) @@ -67,7 +69,7 @@ mainNoArgs = do (fromIntegral (80 * myTermFontWidth + 2 * (myTermPadding + borderWidth def)) / fromIntegral myScreenWidth) [] ||| - Full + StateFull , manageHook = composeAll [ appName =? "fzmenu-urxvt" --> doCenterFloat -- cgit v1.2.3 From d27b33d5efe50d88fc326084c839375bca0ab915 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Apr 2022 00:24:49 +0200 Subject: tv xmonad: add audioMicMute --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index d7c45f189..2a1793616 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -164,6 +164,7 @@ myKeys conf = Map.fromList $ , ((0, xF86XK_AudioLowerVolume), audioLowerVolume) , ((0, xF86XK_AudioRaiseVolume), audioRaiseVolume) , ((0, xF86XK_AudioMute), audioMute) + , ((0, xF86XK_AudioMicMute), audioMicMute) , ((_4, xF86XK_AudioMute), pavucontrol []) , ((_4, xK_Prior), forkFile {-pkg-}"xcalib" ["-invert", "-alter"] Nothing) @@ -190,6 +191,7 @@ myKeys conf = Map.fromList $ audioLowerVolume = amixer ["-q", "sset", "Master", "5%-"] audioRaiseVolume = amixer ["-q", "sset", "Master", "5%+"] audioMute = amixer ["-q", "sset", "Master", "toggle"] + audioMicMute = amixer ["-q", "sset", "Capture", "toggle"] resetLayout = setLayout $ XMonad.layoutHook conf -- cgit v1.2.3 From 09ea97a7f265d61e4627816d471f05ddf8d8888e Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 31 Mar 2022 23:12:39 +0200 Subject: tv xmonad: use BorderUrgencyHook --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 2a1793616..d4c9c6adf 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -26,7 +26,13 @@ import qualified XMonad.Prompt import qualified XMonad.StackSet as W import Data.Map (Map) import qualified Data.Map as Map -import XMonad.Hooks.UrgencyHook (SpawnUrgencyHook(..), withUrgencyHook) +import XMonad.Hooks.UrgencyHook + ( BorderUrgencyHook(BorderUrgencyHook,urgencyBorderColor) + , RemindWhen(Dont) + , SuppressWhen(Never) + , UrgencyConfig(UrgencyConfig,remindWhen,suppressWhen) + , withUrgencyHookC + ) import XMonad.Hooks.ManageHelpers (doCenterFloat,doRectFloat) import Data.Ratio import XMonad.Hooks.Place (placeHook, smart) @@ -55,7 +61,14 @@ mainNoArgs = do let config = id - $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") + $ withUrgencyHookC + BorderUrgencyHook + { urgencyBorderColor = "#ff0000" + } + UrgencyConfig + { remindWhen = Dont + , suppressWhen = Never + } $ def { terminal = {-pkg:rxvt_unicode-}"urxvtc" , modMask = mod4Mask -- cgit v1.2.3 From 59a447ac046424c27fa926a2416885c4f6724a7a Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 15:17:10 +0100 Subject: tv xmonad: get font and screen info from env --- tv/5pkgs/haskell/xmonad-tv/src/Build.hs | 24 ------------- tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs | 18 ---------- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 47 +++++++++++++++----------- tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal | 3 +- 4 files changed, 29 insertions(+), 63 deletions(-) delete mode 100644 tv/5pkgs/haskell/xmonad-tv/src/Build.hs delete mode 100644 tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs b/tv/5pkgs/haskell/xmonad-tv/src/Build.hs deleted file mode 100644 index 553a129b1..000000000 --- a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs +++ /dev/null @@ -1,24 +0,0 @@ -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TypeApplications #-} - -module Build where - -import XMonad (Dimension) -import THEnv.JSON (getCompileEnvJSONExp) - - -myFont :: String -myFont = - "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*" - -myScreenWidth :: Dimension -myScreenWidth = - $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_SCREEN_WIDTH") - -myTermFontWidth :: Dimension -myTermFontWidth = - $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_TERM_FONT_WIDTH") - -myTermPadding :: Dimension -myTermPadding = - 2 diff --git a/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs b/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs deleted file mode 100644 index 2a3a0e523..000000000 --- a/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables #-} - -module THEnv.JSON where - -import Data.Aeson (eitherDecode,FromJSON) -import Data.ByteString.Lazy.Char8 (pack) -import Language.Haskell.TH.Syntax (Exp,Lift(lift),Q) -import THEnv (getCompileEnv) -import Control.Monad - -getCompileEnvJSON :: (FromJSON a) => String -> Q a -getCompileEnvJSON name = - either error (id :: a -> a) . eitherDecode . pack <$> getCompileEnv name - -getCompileEnvJSONExp :: - forall proxy a. (FromJSON a, Lift a) => proxy a -> String -> Q Exp -getCompileEnvJSONExp _ = - (lift :: a -> Q Exp) <=< getCompileEnvJSON diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index d4c9c6adf..a5b3489bc 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -7,7 +7,10 @@ import System.Exit (exitFailure) import Control.Exception import Control.Monad.Extra (whenJustM) +import qualified Data.Aeson +import qualified Data.ByteString.Char8 import qualified Data.List +import qualified Data.Maybe import Graphics.X11.ExtraTypes.XF86 import Text.Read (readEither) import XMonad @@ -40,8 +43,6 @@ import XMonad.Actions.PerWorkspaceKeys (chooseAction) import Shutdown (shutdown, newShutdownEventHandler) -import Build (myFont, myScreenWidth, myTermFontWidth, myTermPadding) - main :: IO () main = getArgs >>= \case @@ -53,9 +54,19 @@ main = getArgs >>= \case (=??) :: Query a -> (a -> Bool) -> Query Bool (=??) x p = fmap p x +readEnv :: Data.Aeson.FromJSON b => String -> IO b +readEnv name = + Data.Maybe.fromJust + . Data.Aeson.decodeStrict' + . Data.ByteString.Char8.pack + <$> getEnv name mainNoArgs :: IO () mainNoArgs = do + myScreenWidth <- readEnv "XMONAD_SCREEN_WIDTH" :: IO Dimension + myTermFont <- getEnv "XMONAD_TERM_FONT" + myTermFontWidth <- readEnv "XMONAD_TERM_FONT_WIDTH" :: IO Dimension + myTermPadding <- readEnv "XMONAD_TERM_PADDING" :: IO Dimension workspaces0 <- getWorkspaces0 handleShutdownEvent <- newShutdownEventHandler let @@ -72,7 +83,7 @@ mainNoArgs = do $ def { terminal = {-pkg:rxvt_unicode-}"urxvtc" , modMask = mod4Mask - , keys = myKeys + , keys = myKeys myTermFont , workspaces = workspaces0 , layoutHook = smartBorders $ @@ -133,8 +144,8 @@ spawnRootTerm = Nothing -myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ()) -myKeys conf = Map.fromList $ +myKeys :: String -> XConfig Layout -> Map (KeyMask, KeySym) (X ()) +myKeys font conf = Map.fromList $ [ ((_4 , xK_Escape ), forkFile {-pkg-}"slock" [] Nothing) , ((_4S , xK_c ), kill) @@ -209,17 +220,15 @@ myKeys conf = Map.fromList $ resetLayout = setLayout $ XMonad.layoutHook conf promptXPConfig = - def { XMonad.Prompt.font = myFont } - - -xdeny :: X () -xdeny = - forkFile - {-pkg-}"xterm" - [ "-fn", myFont - , "-geometry", "300x100" - , "-name", "AlertFloat" - , "-bg", "#E4002B" - , "-e", "sleep", "0.05" - ] - Nothing + def { XMonad.Prompt.font = font } + + xdeny = + forkFile + {-pkg-}"xterm" + [ "-fn", font + , "-geometry", "300x100" + , "-name", "AlertFloat" + , "-bg", "#E4002B" + , "-e", "sleep", "0.05" + ] + Nothing diff --git a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal index a3ddcb039..62faf2f00 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal +++ b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal @@ -23,7 +23,6 @@ executable xmonad xmonad, xmonad-contrib other-modules: - Shutdown, - THEnv.JSON + Shutdown default-language: Haskell2010 ghc-options: -O2 -Wall -threaded -- cgit v1.2.3 From 93cba42c36634e83a128cd73f85a4302adb27f5b Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:20:34 +0100 Subject: tv xmonad: urxvt -> alacritty --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index a5b3489bc..6ac6b6b10 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -81,7 +81,7 @@ mainNoArgs = do , suppressWhen = Never } $ def - { terminal = {-pkg:rxvt_unicode-}"urxvtc" + { terminal = {-pkg:alacritty-tv-}"alacritty" , modMask = mod4Mask , keys = myKeys myTermFont , workspaces = workspaces0 @@ -139,8 +139,8 @@ forkFile path args env = spawnRootTerm :: X () spawnRootTerm = forkFile - {-pkg:rxvt_unicode-}"urxvtc" - ["-name", "root-urxvt", "-e", "/run/wrappers/bin/su", "-"] + {-pkg:alacritty-tv-}"alacritty" + ["--profile=root", "-e", "/run/wrappers/bin/su", "-"] Nothing @@ -152,7 +152,7 @@ myKeys font conf = Map.fromList $ , ((_4 , xK_o ), forkFile {-pkg:fzmenu-}"otpmenu" [] Nothing) , ((_4 , xK_p ), forkFile {-pkg:fzmenu-}"passmenu" [] Nothing) - , ((_4 , xK_x ), forkFile {-pkg:rxvt_unicode-}"urxvtc" [] Nothing) + , ((_4 , xK_x ), forkFile {-pkg:alacritty-tv-}"alacritty" ["--singleton"] Nothing) , ((_4C , xK_x ), spawnRootTerm) , ((_C , xK_Menu ), toggleWS) -- cgit v1.2.3 From a8cb1328737926cf948d1a7dfbdfd6eff35428d9 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Jan 2023 21:20:08 +0100 Subject: tv xmonad: add ewmh --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 6ac6b6b10..2061ae4b9 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -4,6 +4,7 @@ module Main (main) where import System.Exit (exitFailure) +import XMonad.Hooks.EwmhDesktops (ewmh) import Control.Exception import Control.Monad.Extra (whenJustM) @@ -71,7 +72,7 @@ mainNoArgs = do handleShutdownEvent <- newShutdownEventHandler let config = - id + ewmh $ withUrgencyHookC BorderUrgencyHook { urgencyBorderColor = "#ff0000" -- cgit v1.2.3 From b3ebccb032e0f8e5baba4a96e289807a209cadfb Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Jan 2023 21:22:53 +0100 Subject: tv xmonad: add toggleFocus --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 2061ae4b9..eb61bd5cf 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -5,6 +5,7 @@ module Main (main) where import System.Exit (exitFailure) import XMonad.Hooks.EwmhDesktops (ewmh) +import XMonad.Hooks.RefocusLast (refocusLastLayoutHook, toggleFocus) import Control.Exception import Control.Monad.Extra (whenJustM) @@ -87,6 +88,7 @@ mainNoArgs = do , keys = myKeys myTermFont , workspaces = workspaces0 , layoutHook = + refocusLastLayoutHook $ smartBorders $ ResizableTall 1 @@ -161,6 +163,8 @@ myKeys font conf = Map.fromList $ , ((_4 , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ sendMessage NextLayout) , ((_4M , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ resetLayout) + , ((_4 , xK_l ), toggleFocus) + , ((_4 , xK_m ), windows W.focusMaster) , ((_4 , xK_j ), windows W.focusDown) , ((_4 , xK_k ), windows W.focusUp) -- cgit v1.2.3