This commit is contained in:
Leon Kowarschick 2020-03-20 20:00:15 +01:00
parent 458880a68e
commit f5ab6feff3
11 changed files with 106 additions and 33 deletions

36
.gitignore vendored
View file

@ -1,18 +1,18 @@
BAZECOR
chromium
dconf
discord
EOS-arch-news.conf
EOS-arch-news-for-you.conf
EOS-greeter.conf
EOS-initial-wallpaper.XFCE
pavucontrol.ini
ristretto
systemd
Thunar
user-dirs.dirs
user-dirs.locale
xfce4
yay
.stack-work
.surf/cache
**/BAZECOR
**/chromium
**/dconf
**/discord
**/EOS-arch-news.conf
**/EOS-arch-news-for-you.conf
**/EOS-greeter.conf
**/EOS-initial-wallpaper.XFCE
**/pavucontrol.ini
**/ristretto
**/systemd
**/Thunar
**/user-dirs.dirs
**/user-dirs.locale
**/xfce4
**/yay
**/.stack-work
**/.surf/cache

View file

@ -0,0 +1 @@
file:///home/leon/studium/Studium

View file

@ -54,10 +54,12 @@ module-margin-right = 2
font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
font-7 = NotoEmoji:size=7;
modules-left = xmonad test
modules-center = mpd gitlab-pipeline player-mpv-tail
modules-right = info-pingrtt pulseaudio filesystem memory cpu date
modules-right = network-traffic info-pingrtt pulseaudio filesystem memory cpu date
tray-position = right
tray-padding = 2
@ -161,7 +163,6 @@ margin-bottom = 5
[module/xmonad]
type = custom/script
exec = xmonad-log
tail = true
@ -186,3 +187,10 @@ click-middle = ~/.config/polybar/polybar-scripts/player-mpv-tail.py -p playlist-
click-right = ~/.config/polybar/polybar-scripts/player-mpv-tail.py -p playlist-pos +1
scroll-up = ~/.config/polybar/polybar-scripts/player-mpv-tail.py -p time-pos -10
scroll-down = ~/.config/polybar/polybar-scripts/player-mpv-tail.py -p time-pos +10
[module/network-traffic]
; configure interval, etc in script
type = custom/script
exec = ~/.config/polybar/polybar-scripts/network-traffic.sh
tail = true

View file

@ -0,0 +1,62 @@
#!/bin/bash
print_bytes() {
if [ "$1" -eq 0 ] || [ "$1" -lt 1000 ]; then
bytes="0 kB/s"
elif [ "$1" -lt 1000000 ]; then
bytes="$(echo "scale=0;$1/1000" | bc -l ) kB/s"
else
bytes="$(echo "scale=1;$1/1000000" | bc -l ) MB/s"
fi
echo "$bytes"
}
print_bit() {
if [ "$1" -eq 0 ] || [ "$1" -lt 10 ]; then
bit="0 B"
elif [ "$1" -lt 100 ]; then
bit="$(echo "scale=0;$1*8" | bc -l ) B"
elif [ "$1" -lt 100000 ]; then
bit="$(echo "scale=0;$1*8/1000" | bc -l ) K"
else
bit="$(echo "scale=1;$1*8/1000000" | bc -l ) M"
fi
echo "$bit"
}
INTERVAL=5
INTERFACES="enp0s31f6"
declare -A bytes
for interface in $INTERFACES; do
bytes[past_rx_$interface]="$(cat /sys/class/net/"$interface"/statistics/rx_bytes)"
bytes[past_tx_$interface]="$(cat /sys/class/net/"$interface"/statistics/tx_bytes)"
done
while true; do
down=0
up=0
for interface in $INTERFACES; do
bytes[now_rx_$interface]="$(cat /sys/class/net/"$interface"/statistics/rx_bytes)"
bytes[now_tx_$interface]="$(cat /sys/class/net/"$interface"/statistics/tx_bytes)"
bytes_down=$((((${bytes[now_rx_$interface]} - ${bytes[past_rx_$interface]})) / INTERVAL))
bytes_up=$((((${bytes[now_tx_$interface]} - ${bytes[past_tx_$interface]})) / INTERVAL))
down=$(((( "$down" + "$bytes_down" ))))
up=$(((( "$up" + "$bytes_up" ))))
bytes[past_rx_$interface]=${bytes[now_rx_$interface]}
bytes[past_tx_$interface]=${bytes[now_tx_$interface]}
done
echo "D: $(print_bytes $down) U: $(print_bytes $up)"
#echo "Download: $(print_bytes $down) / Upload: $(print_bytes $up)"
# echo "Download: $(print_bit $down) / Upload: $(print_bit $up)"
sleep $INTERVAL
done

View file

@ -27,7 +27,7 @@ packages:
hackage: netlink-1.1.1.0
snapshots:
- completed:
size: 491163
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/4.yaml
sha256: bc60043a06b58902b533baa80fb566c0ec495c41e428bc0f8c1e8c15b2a4c468
original: lts-15.4
size: 491373
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/3.yaml
sha256: 29e9ff61b8bf4b4fcff55cde3ac106ebb971f0d21331dccac9eee63374fa6ca8
original: lts-15.3

Binary file not shown.

View file

@ -1,10 +1,10 @@
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
xmonad.hs:205:109: warning: [-Wdeprecations]
xmonad.hs:207:109: warning: [-Wdeprecations]
In the use of defaultConfig
(imported from XMonad, but defined in XMonad.Config):
Deprecated: "Use def (from Data.Default, and re-exported by XMonad and XMonad.Config) instead."
|
205 | , manageHook = manageDocks <+> myManageHook <+> (namedScratchpadManageHook scratchpads) <+> manageHook defaultConfig
207 | , manageHook = manageDocks <+> myManageHook <+> (namedScratchpadManageHook scratchpads) <+> manageHook defaultConfig <+> (isFullscreen --> doF W.focusDown <+> doFullFloat)
| ^^^^^^^^^^^^^

Binary file not shown.

View file

@ -1,7 +1,7 @@
{-# Language ScopedTypeVariables #-}
-- Imports -------------------------------------------------------- {{{
import qualified Data.Map as M
import Data.List (isInfixOf)
import Data.List (isSuffixOf)
import qualified Data.Maybe as Maybe
import qualified System.IO as SysIO
import Text.Read (readMaybe)
@ -21,6 +21,7 @@ import XMonad.Config.Desktop
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.DynamicProperty
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageDocks
@ -62,7 +63,7 @@ scratchpads =
(customFloating $ W.RationalRect 0 0.7 1 0.3)
, NS "ghci" (myTerminal ++ " -e \"stack exec -- ghci\" --class scratchpad_ghci") (className =? "scratchpad_ghci")
(customFloating $ W.RationalRect 0 0.7 1 0.3)
, NS "whatsapp" ("gtk-launch chrome-hnpfjngllnobngcgfapefoaidbinmjnm-Default.desktop") (("WhatsApp" `isInfixOf`) <$> title) defaultFloating
, NS "whatsapp" ("gtk-launch chrome-hnpfjngllnobngcgfapefoaidbinmjnm-Default.desktop") (("WhatsApp" `isSuffixOf`) <$> title) defaultFloating
]
{-| adds the scripts-directory path to the filename of a script |-}
@ -115,10 +116,10 @@ myLogHook = do
-- Startuphook ----------------------------- {{{
myStartupHook = do
setWMName "LG3D" -- Java stuff hack
spawnOnce "picom --config ~/.config/picom.conf --no-fading-openclose"
spawnOnce "pasystray"
spawn "/home/leon/.config/polybar/launch.sh"
setWMName "LG3D" -- Java stuff hack
-- }}}
@ -195,14 +196,15 @@ main = do
D.requestName dbus (D.busName_ "org.xmonad.Log")
[D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
xmonad $ ewmh $ desktopConfig
-- $ ewmh (kills IntelliJ)
xmonad $ desktopConfig
{ terminal = myTerminal
, modMask = myModMask
, borderWidth = 1
, layoutHook = avoidStruts $ myLayout
, logHook = myLogHook <+> logHook desktopConfig <+> dynamicLogWithPP (polybarPP dbus)
, startupHook = myStartupHook <+> startupHook desktopConfig
, manageHook = manageDocks <+> myManageHook <+> (namedScratchpadManageHook scratchpads) <+> manageHook defaultConfig
, manageHook = manageDocks <+> myManageHook <+> (namedScratchpadManageHook scratchpads) <+> manageHook defaultConfig <+> (isFullscreen --> doF W.focusDown <+> doFullFloat)
, focusedBorderColor = aqua
, normalBorderColor = "#282828"
} `removeKeysP` removedKeys `additionalKeysP` myKeys
@ -220,12 +222,12 @@ polybarPP dbus = namedScratchpadFilterOutWorkspacePP $ def
, ppCurrent = withBG bg2
, ppVisible = withBG bg2
, ppUrgent = withFG red
, ppLayout = removeWord "Spacing" . withFG purple
, ppLayout = removeWord "Hinted" . removeWord "Spacing" . withFG purple
, ppHidden = wrap " " " " . unwords . map wrapOpenWorkspaceCmd . words
, ppWsSep = ""
, ppSep = " | "
, ppExtras = []
, ppTitle = (shorten 40) . withFG aqua
, ppTitle = withFG aqua . (shorten 40)
}
where
removeWord substr = unwords . filter (/= substr) . words

Binary file not shown.