From 25febb79a55766f0a508af6f493d8da4426f678d Mon Sep 17 00:00:00 2001
From: Anastasios Grammenos <anastasios.grammenos@noris.gr>
Date: Wed, 30 Sep 2020 16:17:19 +0300
Subject: updates..

---
 scripts/date_left  |   3 +
 scripts/date_right |   3 +
 scripts/hehe       |   3 +
 xmobar.hs          |  21 ++++---
 xmonad.hs          | 160 +++++++++++++++++++++++++++++++++--------------------
 5 files changed, 121 insertions(+), 69 deletions(-)
 create mode 100755 scripts/date_left
 create mode 100755 scripts/date_right
 create mode 100755 scripts/hehe

diff --git a/scripts/date_left b/scripts/date_left
new file mode 100755
index 0000000..1c24ff6
--- /dev/null
+++ b/scripts/date_left
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+notify-send " " "$(ncal -bh)"
diff --git a/scripts/date_right b/scripts/date_right
new file mode 100755
index 0000000..b211ac9
--- /dev/null
+++ b/scripts/date_right
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+notify-send " " "$(ncal -bh -3)"
diff --git a/scripts/hehe b/scripts/hehe
new file mode 100755
index 0000000..3c37b29
--- /dev/null
+++ b/scripts/hehe
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+ssh eye scripts/i3blocks/mympdinfo | sed -E 's#<.*>(.*)</span>#\1#'
diff --git a/xmobar.hs b/xmobar.hs
index 86730d0..7532f75 100644
--- a/xmobar.hs
+++ b/xmobar.hs
@@ -1,5 +1,4 @@
-Config { font = "-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
---Config { font = "xfg:Noto Sans"
+Config { font = "xft:Liberation Mono:size=9:bold:antialias=true"
        , additionalFonts = []
        , borderColor = "black"
        , border = TopB
@@ -17,7 +16,7 @@ Config { font = "-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
        , iconRoot = "."
        , allDesktops = True
        , overrideRedirect = True
-       , commands = [ Run Weather "LGTS" ["-t","Thess: <tempC>C, rh <rh>%",
+       , commands = [ Run Weather "LGTS" ["-t","<skyCondition> <tempC>°C, rh <rh>%",
                                           "-L","15","-H","25",
                                           "--normal","green",
                                           "--high","red",
@@ -28,21 +27,25 @@ Config { font = "-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
                                           "--normal","green","--high","red"] 10
                     , Run Cpu ["-L","3","-H","50",
                                "--normal","green","--high","red"] 10
-                    , Run Battery ["-t","[<watts>]<leftbar>[<left>%]"] 30
+                    , Run MultiCoreTemp ["-t","<avg>°C","-L","60","-H","80","-l","green","-n","yellow","-h","red"] 50
+                    , Run Battery ["-t","BAT:(<watts>)[<left>%]",
+                                   "-L", "10", "-H", "80", "-p", "3",
+                                   "-a", "notify-send -u critical 'Battery running out!!'"] 30
                     , Run Memory ["-t","Mem: <usedratio>% <usedbar>"] 10
---                    , Run Com "uname" ["-s","-r"] "" 36000
+                    , Run Alsa "default" "Master" []
                     , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
                     , Run Kbd [("us", "US"), ("gr", "GR")]
-		    , Run StdinReader
+		    , Run UnsafeStdinReader
                     ]
        , sepChar = "%"
        , alignSep = "}{"
-       , template = "%StdinReader% }{ \
+       , template = "%UnsafeStdinReader% }{ \
                     \<fc=#ab68bb>%/home/grm/.config/i3blocks/scripts/thevpn%</fc> %wlo1% - %eth0% | \
-                    \%cpu% | \
+                    \%cpu% %multicoretemp% | \
                     \%/home/grm/.config/i3blocks/scripts/mumu% | \
                     \%memory% | \
                     \%LGTS% | \
                     \%battery% | \
-                    \<fc=#ee9a00>%date%</fc> [ %kbd% ]"
+                    \<action=`pavucontrol`>%alsa:default:Master%</action> | \
+                    \<action=`/home/grm/.xmonad/scripts/date_left`><action=`/home/grm/.xmonad/scripts/date_right` button=3><fc=#ee9a00>%date%</fc></action></action> [%kbd%]"
        }
diff --git a/xmonad.hs b/xmonad.hs
index fb9de1b..de41f6b 100644
--- a/xmonad.hs
+++ b/xmonad.hs
@@ -1,5 +1,6 @@
 import XMonad
 import XMonad.Config.Desktop
+import XMonad.Hooks.EwmhDesktops
 
 import System.Exit
 
@@ -14,6 +15,8 @@ import XMonad.Util.SpawnOnce
 import XMonad.Util.WorkspaceCompare
 
 import XMonad.Hooks.ManageDocks
+import XMonad.ManageHook
+import XMonad.Util.NamedScratchpad
 
 import XMonad.Layout.Grid
 import XMonad.Layout.CenteredMaster
@@ -23,33 +26,54 @@ import XMonad.Layout.MosaicAlt
 import XMonad.Layout.Tabbed
 import XMonad.Layout.ResizableTile
 
-
 import XMonad.Layout.SubLayouts
 import XMonad.Layout.WindowNavigation
+import XMonad.Layout.NoBorders
+
+import XMonad.Layout.Named
+import XMonad.Layout.Dwindle as DWIN
+import XMonad.Layout.BinarySpacePartition as BSP
+
+import XMonad.Layout.MultiToggle
+import XMonad.Layout.MultiToggle.Instances
+
+import XMonad.Layout.Spacing
 
 import XMonad.Prompt
 import XMonad.Prompt.Shell
 import XMonad.Prompt.XMonad
 
-myPP = def { ppCurrent = xmobarColor "#1ABC9C" "" . wrap "[" "]"
-           , ppTitle = xmobarColor "#1ABC9C" "" . shorten 60
-           , ppVisible = wrap "(" ")"
-           , ppUrgent  = xmobarColor "red" "yellow"
-         --  , ppSort = getSortByXineramaPhysicalRule def
-           }
+import XMonad.Hooks.InsertPosition
+
+-- xmobarEscape = concatMap doubleLts
+--   where doubleLts '<' = "<<"
+--         doubleLts x   = [x]
+
+-- myWorkspaces :: [String]
+-- myWorkspaces = clickable . (map xmobarEscape) $ ["1","2","3","4","5","6","7","8","9"]
+--   where
+--     clickable l = [ "<action=xdotool key Super_L+" ++ show (n) ++ ">" ++ ws ++ "</action>" |
+--                     (i,ws) <- zip [1..9] l,
+--                     let n = i ]
+
+scratchpads = [
+  NS "tmux" ("urxvt -name tmux -e tmux") (resource =? "tmux")
+    (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
+  ]
 
 main = do
-  h <- spawnPipe "xmobar ~/.xmonad/xmobar.hs"
-  xmonad $ desktopConfig
-    { terminal      = "urxvt"
+  h <- spawnPipe "~/.cabal/bin/xmobar ~/.xmonad/xmobar.hs"
+  xmonad $ ewmh $ docks def
+    { terminal      = "urxvt-server-client"
     , modMask       = mod4Mask
     , startupHook   = startup
     , layoutHook    = myLayout
+--    , workspaces    = ["1","2","3","4","5"]
+--    , XMonad.workspaces    = myWorkspaces
 --    , keys          = \c -> mykeys c `M.union` keys def c
     , keys          = mykeys
-    , manageHook    = myManageHook <+> manageDocks <+> manageHook def
-    , logHook       = dynamicLogWithPP myPP 
-                      { ppOutput = hPutStrLn h }
+    , manageHook    = insertPosition Below Newer <+> myManageHook <+> manageDocks <+> namedScratchpadManageHook scratchpads <+> manageHook def
+    , logHook       = dynamicLogWithPP . namedScratchpadFilterOutWorkspacePP $ myPP h
     }
   where
     mykeys (XConfig {modMask = modm}) =
@@ -60,84 +84,75 @@ main = do
       , ((modm , xK_j), spawn "jira-issue-nude.sh")
       , ((modm .|. controlMask, xK_x), shellPrompt def)
       , ((modm .|. shiftMask  , xK_x), xmonadPrompt def)
-      , ((modm,               xK_x), sendMessage MirrorShrink)
-      , ((modm,               xK_s), sendMessage MirrorExpand)
-      
+      , ((modm ,              xK_x), sendMessage MirrorShrink)
+      , ((modm ,              xK_s), sendMessage MirrorExpand)
+      , ((modm ,              xK_f), sendMessage $ Toggle NBFULL)
+      , ((modm ,              xK_g), toggleWindowSpacingEnabled)
+      -- , ((modm .|. shiftMask, xK_g), incWindowSpacing 2)
+      -- , ((modm .|. controlMask, xK_g), decWindowSpacing 2)
+      -- ; button
+      , ((modm , 0x3B), namedScratchpadAction scratchpads "tmux")
+      -- menu button
+      -- , ((0    , 0xFF67), namedScratchpadAction scratchpads "tmux")
+      , ((0    , 0x1008FF11), spawn "amixer -D pulse -q sset Master 2%-")
+      , ((0    , 0x1008FF13), spawn "amixer -D pulse -q sset Master 2%+")
+      , ((0    , 0x1008FF12), spawn "amixer set -D pulse Master toggle")
+
       , ((modm, xK_Return), spawn "urxvt-server-client")
 
         -- launch dmenu
       , ((modm,               xK_d     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
-
         -- launch gmrun
       , ((modm .|. shiftMask, xK_p     ), spawn "gmrun")
-
-        -- close focused window 
+        -- close focused window
       , ((modm .|. shiftMask, xK_q     ), kill)
-
         -- Rotate through the available layout algorithms
       , ((modm,               xK_w ), sendMessage NextLayout)
-      
-        -- Reset the layouts on the current workspace to default
-        --, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook def)
-
-        -- Resize viewed windows to the correct size
+      -- Reset the layouts on the current workspace to default
+      --, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook def)
+      -- Resize viewed windows to the correct size
       --, ((modm,               xK_n     ), refresh)
-
         -- Move focus to the next window
       , ((modm,               xK_Tab   ), windows W.focusDown)
-
         -- Move focus to the next window
       , ((modm,               xK_e     ), windows W.focusDown)
-
         -- Move focus to the previous window
       , ((modm,               xK_a     ), windows W.focusUp  )
-
         -- Move focus to the master window
       , ((modm,               xK_m     ), windows W.focusMaster  )
-
         -- Swap the focused window and the master window
       , ((modm .|. shiftMask, xK_Return), windows W.swapMaster)
-
         -- Swap the focused window with the next window
       , ((modm .|. shiftMask, xK_e     ), windows W.swapDown  )
-
         -- Swap the focused window with the previous window
       , ((modm .|. shiftMask, xK_a     ), windows W.swapUp    )
-
         -- Shrink the master area
       , ((modm,               xK_h     ), sendMessage Shrink)
-
         -- Expand the master area
       , ((modm,               xK_l     ), sendMessage Expand)
-
         -- Push window back into tiling
       , ((modm,               xK_t     ), withFocused $ windows . W.sink)
-
         -- Increment the number of windows in the master area
       , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
-
         -- Deincrement the number of windows in the master area
       , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
-
         -- toggle the status bar gap (used with avoidStruts from Hooks.ManageDocks)
         -- , ((modm , xK_b ), sendMessage ToggleStruts)
-
         -- Quit xmonad
       , ((modm .|. shiftMask, xK_z     ), io (exitWith ExitSuccess))
-
         -- Restart xmonad
       , ((modm              , xK_z     ), restart "xmonad" True) ]
 
       ++
 
-      [((modm .|. controlMask, xK_h), sendMessage $ pullGroup L)
-      , ((modm .|. controlMask, xK_l), sendMessage $ pullGroup R)
-      , ((modm .|. controlMask, xK_k), sendMessage $ pullGroup U)
-      , ((modm .|. controlMask, xK_j), sendMessage $ pullGroup D)
-      , ((modm .|. controlMask, xK_m), withFocused (sendMessage . MergeAll))
-      , ((modm .|. controlMask, xK_u), withFocused (sendMessage . UnMerge))
-      , ((modm .|. controlMask, xK_period), onGroup W.focusUp')
-      , ((modm .|. controlMask, xK_comma), onGroup W.focusDown')]
+      [ ((modm .|. controlMask, xK_h)      , sendMessage $ pullGroup L)
+      , ((modm .|. controlMask, xK_l)      , sendMessage $ pullGroup R)
+      , ((modm .|. controlMask, xK_k)      , sendMessage $ pullGroup U)
+      , ((modm .|. controlMask, xK_j)      , sendMessage $ pullGroup D)
+      , ((modm .|. controlMask, xK_m)      , withFocused (sendMessage . MergeAll))
+      , ((modm .|. controlMask, xK_u)      , withFocused (sendMessage . UnMerge))
+      , ((modm .|. controlMask, xK_period) , onGroup W.focusUp')
+      , ((modm .|. controlMask, xK_comma)  , onGroup W.focusDown') ]
 
       ++
 
@@ -147,7 +162,8 @@ main = do
       --
       [((m .|. modm, k), windows $ f i)
       | (i, k) <- zip (XMonad.workspaces def) [xK_1 .. xK_9]
-      , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
+      , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
+
       -- ++
       --
       -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
@@ -157,26 +173,50 @@ main = do
       -- | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
       -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
 
-background = "feh --recursive --randomize --bg-scale /usr/share/backgrounds"
+background = "feh --recursive --randomize --bg-scale ~/Pictures/wallpapers"
 
 startup :: X ()
 startup = do
-  spawn "xrandr --output Virtual1 --primary --mode 1440x900 --pos 0x0 --rotate normal --output Virtual2 --off --output Virtual3 --off --output Virtual4 --off --output Virtual5 --off --output Virtual6 --off --output Virtual7 --off --output Virtual8 --off"
-  spawn background
-  spawn "setxkbmap -model pc104 -layout us,gr -variant qwerty -option grp:win_space_toggle,ctrl:nocaps,grp_led:scroll"
-  spawnOnce "trayer --edge top --align left --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x000000 --height 16 --width 5"
+  spawnOnce "xrandr --output Virtual1 --primary --mode 1440x900 --pos 0x0 --rotate normal --output Virtual2 --off --output Virtual3 --off --output Virtual4 --off --output Virtual5 --off --output Virtual6 --off --output Virtual7 --off --output Virtual8 --off"
+  spawnOnce "trayer --edge top --align left --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x000000 --height 18 --width 5"
   spawnOnce "nm-applet"
   spawnOnce "dunst"
   spawnOnce "blueman-applet"
+  --
+  spawn background
+  spawn "compton"
+  spawn "xsetroot -cursor_name dot"
+  spawn "setxkbmap -model pc104 -layout us,gr -variant qwerty -option grp:win_space_toggle,ctrl:nocaps,grp_led:scroll"
 
--- myLayout = tiled ||| Mirror tiled ||| Full ||| Grid ||| dragPane Vertical 0.1 0.5
 myLayout =
-  avoidStruts ( windowNavigation $
-                subTabbed $
-                MosaicAlt M.empty |||
+  mkToggle (NBFULL ?? EOT) $
+  avoidStruts
+  ( spacingRaw False (Border 10 10 10 10) False (Border 10 10 10 10) True $
+    noBorders ( windowNavigation $ subTabbed $
+                emptyBSP |||
                 ResizableTall 1 (5/100) (1/2) [] |||
-                Full |||
-                Tall 1 (5/100) (1/2) )
+                -- MosaicAlt M.empty |||
+                named "Dwindle" (Dwindle R DWIN.CW 1.5 1.1)
+              )
+    ||| noBorders Full
+  )
+
+myPP h1 = def { ppCurrent = xmobarColor "#1ABC9C" "" . wrap "[" "]"
+                 , ppTitle   = xmobarColor "#1ABC9C" "" . shorten 60
+                 , ppVisible = wrap "(" ")"
+                 , ppUrgent  = xmobarColor "red" "yellow"
+                 , ppSep     = " : "
+                 , ppWsSep   = " "
+                 , ppLayout  = (\x -> case x of
+                                   "Spacing Tabbed Dwindle"       -> "@"
+                                   "Spacing Tabbed ResizableTall" -> "|||"
+                                   "Spacing Tabbed BSP"           -> "|\\|"
+                                   "Spacing Tabbed MosaicAlt"     -> "|+|"
+                                   "Spacing Full"                 -> "|=|"
+                                   _                              -> x
+                               )
+                 , ppOutput  = hPutStrLn h1
+           }
 
 myManageHook = composeAll . concat $
    [ [ className =? "xlnch" --> doCenterFloat ] ]
-- 
cgit v1.2.3