From 9947c2d5ef66990fee4adfe6a5d762ed9b438183 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 3 Jan 2021 15:04:44 +0530 Subject: changed keybindings to mostly use the modkey --- XMonad/baraction | 63 +++++++++++++++ XMonad/xmonad.hs | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 304 insertions(+) create mode 100755 XMonad/baraction create mode 100644 XMonad/xmonad.hs diff --git a/XMonad/baraction b/XMonad/baraction new file mode 100755 index 00000000..9e39c9b5 --- /dev/null +++ b/XMonad/baraction @@ -0,0 +1,63 @@ +#!/bin/zsh + +COLOR1="#0d0c13" +COLOR2="#70638F" + +A0="%{B"$COLOR1"}%{F"$COLOR2"}%{B"$COLOR2"}%{F"$COLOR1"}" +A1="%{B"$COLOR2"}%{F"$COLOR1"}%{B"$COLOR1"}%{F"$COLOR2"}" +A2="%{B"$COLOR1"}%{F"$COLOR2"}%{B"$COLOR2"}%{F"$COLOR1"}" + +clock() { + datetime=$(date +"%d %b(%A) %H:%M") + echo $datetime +} + +cpu_load() { + read cpu a b c previdle rest < /proc/stat + prevtotal=$((a+b+c+previdle)) + sleep 0.5 + read cpu a b c idle rest < /proc/stat + total=$((a+b+c+idle)) + cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) + echo -e "CPU: $cpu%" +} + +cpu_temp() { + CEL=$'\xc2\xb0C' + temp=$( cat /sys/devices/virtual/thermal/thermal_zone0/temp ) + temp=`expr $temp / 1000` + echo "TEMP: " $temp$CEL +} + +root_usage() { + root=$(df -h / | awk 'NR==2 {print $4 "/" $2}') + echo "ROOT: "$root +} + +home_usage() { + home=$(df -h /home | awk 'NR==2 {print $4 "/" $2}') + echo "HOME: "$home +} + +mem_usage() { + mem=$(free -m | grep Mem: | awk '{print$3 / $2 * 100}') + printf "MEM: %.0f %%" $mem +} + +volume() { + vol=$(pamixer --get-mute) + if [ $vol = "true" ] + then + echo "%{B#F15BB5}%{F#232627} ミュート" + fi +} + +weather() { + echo "script broken" + # echo $(> prevWS) + , ((mod1Mask .|. shiftMask, xK_l), shiftToNext >> nextWS) + + -- modify gaps on runtime + , ((mod4Mask, xK_equal), incWindowSpacing 1) + , ((mod4Mask, xK_minus), decWindowSpacing 1) + , ((mod4Mask .|. shiftMask, xK_equal), incScreenSpacing 1) + , ((mod4Mask .|. shiftMask, xK_minus), decScreenSpacing 1) + + -- Swap the focused window and the master window + , ((mod1Mask .|. shiftMask, xK_Return), windows W.swapMaster) + + -- these keybindings are for WindowNavigation + -- and they conflict with BSP layout + + -- directional navigation of windows + , ((mod4Mask, xK_l), sendMessage $ Go R) + , ((mod4Mask, xK_h), sendMessage $ Go L) + , ((mod4Mask, xK_k), sendMessage $ Go U) + , ((mod4Mask, xK_j), sendMessage $ Go D) + + -- swap windows + , ((mod4Mask .|. shiftMask, xK_l), sendMessage $ WN.Swap R) + , ((mod4Mask .|. shiftMask, xK_h), sendMessage $ WN.Swap L) + , ((mod4Mask .|. shiftMask, xK_k), sendMessage $ WN.Swap U) + , ((mod4Mask .|. shiftMask, xK_j), sendMessage $ WN.Swap D) + + -- cycle through windows + , ((mod1Mask, xK_j), windows W.focusDown) + , ((mod1Mask, xK_k), windows W.focusUp) + + -- grid select + , ((mod4Mask, xK_n), goToSelected defaultGSConfig) + + -- windowbringer + , ((mod4Mask, xK_b), bringMenu) + , ((mod4Mask, xK_g), gotoMenu) + + -- paste x selection + , ((mod1Mask, xK_v), pasteSelection) + + -- toggle bars + , ((mod4Mask, xK_backslash), sendMessage ToggleStruts) -- toggle both bars + , ((mod4Mask, xK_bracketleft), sendMessage $ ToggleStrut D) -- toggle bottom bar + , ((mod4Mask, xK_bracketright), sendMessage $ ToggleStrut U) -- toggle top bar + + -- BSP layout keybindings + -- resize + , ((mod4Mask .|. mod1Mask, xK_l ), sendMessage $ ExpandTowards R) + , ((mod4Mask .|. mod1Mask, xK_h ), sendMessage $ ExpandTowards L) + , ((mod4Mask .|. mod1Mask, xK_j ), sendMessage $ ExpandTowards D) + , ((mod4Mask .|. mod1Mask, xK_k ), sendMessage $ ExpandTowards U) + , ((mod4Mask .|. mod1Mask .|. shiftMask , xK_l ), sendMessage $ ShrinkFrom R) + , ((mod4Mask .|. mod1Mask .|. shiftMask , xK_h ), sendMessage $ ShrinkFrom L) + , ((mod4Mask .|. mod1Mask .|. shiftMask , xK_j ), sendMessage $ ShrinkFrom D) + , ((mod4Mask .|. mod1Mask .|. shiftMask , xK_k ), sendMessage $ ShrinkFrom U) + -- other + , ((mod4Mask, xK_r ), sendMessage Rotate) + , ((mod4Mask, xK_s ), sendMessage BSP.Swap) +-- , ((mod4Mask .|. shiftMask .|. controlMask , xK_j ), sendMessage $ SplitShift Prev) +-- , ((mod4Mask .|. shiftMask .|. controlMask , xK_k ), sendMessage $ SplitShift Next) + + + + ] ++ [ -- for extra workspace(s) + ((myModMask, key), (windows $ W.greedyView ws)) + | (key,ws) <- myExtraWorkspaces + ] ++ [ -- also for extra workspaces + ((myModMask .|. shiftMask, key), (windows $ W.shift ws)) + | (key,ws) <- myExtraWorkspaces + ] ++ [ -- to swap workspaces + ((mod1Mask .|. shiftMask, k), windows $ swapWithCurrent i) + | (i, k) <- zip myWorkspaces [xK_1 ..] + ] -- ++ [ +-- ((m .|. myModMask, k), windows $ f i) +-- | (i, k) <- zip (myWorkspaces x) [xK_1 ..] +-- , (f, m) <- [(copy, shiftMask .|. controlMask)] +-- ] + + + +-- layouts +myGap = spacingRaw False (Border sGap sGap sGap sGap) True (Border wGap wGap wGap wGap) True + +myLayouts = avoidStruts $ mouseResize $ windowNavigation $ myGap $ emptyBSP ||| ThreeColMid 1 (3/100) (1/2) ||| Grid ||| TwoPane (3/100) (1/2) ||| ThreeCol 1 (3/100) (1/2) ||| ThreeCol 2 (3/100) (1/2) + +myLayoutHook = myLayouts + + +myLemonbarPP = def {ppCurrent = wrap "%{F#6c71c4}%{B#d33682}%{F-}" "%{F#d33682}%{B-}%{F-}" + , ppWsSep = " " + , ppHidden = wrap "%{B#268bd2}" "%{B-}" + , ppHiddenNoWindows = wrap "%{F#02fc45}" "%{F-}" + , ppTitle = wrap " %{B#6c71c4}%{F#f0f0f0} " " %{B-}" . shorten 75 + , ppUrgent = wrap "%{B#9cfc02} " " %{B-}%{F-}" + , ppLayout = wrap "%{r}%{B#99B1D5}%{F#232627} " " %{B-} " + , ppSep = " " + , ppExtras = [windowCount] + , ppOrder = \(ws:l:t:ex) -> [ws]++[t]++[l]++["%{B#50FA7B}%{F#232627} WIN:"]++ex++["%{B-}%{F-} "] + } + +main = do + notXMobar <- spawnPipe "lemonbar -b -g 1366x21+0+0 -B '#171520' -F '#ffffff' -f 'Source Han Sans JP:size=10' -o -3 -f 'RobotoMono Nerd Font:style=Regular:size=15' -f -n 'notXMobar' -o 0" + xmonad $ docks def + { + terminal = myTerminal, + focusFollowsMouse = True, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = nBorder, + focusedBorderColor = fBorder, + -- mouseBindings = myMouseBindings, + layoutHook = myLayoutHook, + manageHook = namedScratchpadManageHook myScratchpads, + -- handleEventHook = myEventHook, + logHook = dynamicLogWithPP myLemonbarPP { ppOutput = \x -> hPutStrLn notXMobar x}, + startupHook = myStartupHook +} `additionalKeys` myKeys + -- cgit v1.2.3