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 **/BAZECOR
chromium **/chromium
dconf **/dconf
discord **/discord
EOS-arch-news.conf **/EOS-arch-news.conf
EOS-arch-news-for-you.conf **/EOS-arch-news-for-you.conf
EOS-greeter.conf **/EOS-greeter.conf
EOS-initial-wallpaper.XFCE **/EOS-initial-wallpaper.XFCE
pavucontrol.ini **/pavucontrol.ini
ristretto **/ristretto
systemd **/systemd
Thunar **/Thunar
user-dirs.dirs **/user-dirs.dirs
user-dirs.locale **/user-dirs.locale
xfce4 **/xfce4
yay **/yay
.stack-work **/.stack-work
.surf/cache **/.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-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1 font-2 = siji:pixelsize=10;1
font-7 = NotoEmoji:size=7;
modules-left = xmonad test modules-left = xmonad test
modules-center = mpd gitlab-pipeline player-mpv-tail 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-position = right
tray-padding = 2 tray-padding = 2
@ -161,7 +163,6 @@ margin-bottom = 5
[module/xmonad] [module/xmonad]
type = custom/script type = custom/script
exec = xmonad-log exec = xmonad-log
tail = true 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 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-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 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 hackage: netlink-1.1.1.0
snapshots: snapshots:
- completed: - completed:
size: 491163 size: 491373
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/4.yaml url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/3.yaml
sha256: bc60043a06b58902b533baa80fb566c0ec495c41e428bc0f8c1e8c15b2a4c468 sha256: 29e9ff61b8bf4b4fcff55cde3ac106ebb971f0d21331dccac9eee63374fa6ca8
original: lts-15.4 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 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 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 In the use of defaultConfig
(imported from XMonad, but defined in XMonad.Config): (imported from XMonad, but defined in XMonad.Config):
Deprecated: "Use def (from Data.Default, and re-exported by XMonad and XMonad.Config) instead." 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 #-} {-# Language ScopedTypeVariables #-}
-- Imports -------------------------------------------------------- {{{ -- Imports -------------------------------------------------------- {{{
import qualified Data.Map as M import qualified Data.Map as M
import Data.List (isInfixOf) import Data.List (isSuffixOf)
import qualified Data.Maybe as Maybe import qualified Data.Maybe as Maybe
import qualified System.IO as SysIO import qualified System.IO as SysIO
import Text.Read (readMaybe) import Text.Read (readMaybe)
@ -21,6 +21,7 @@ import XMonad.Config.Desktop
import XMonad.Hooks.EwmhDesktops (ewmh) import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.DynamicLog import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.DynamicProperty import XMonad.Hooks.DynamicProperty
import XMonad.Hooks.FadeInactive import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageDocks
@ -62,7 +63,7 @@ scratchpads =
(customFloating $ W.RationalRect 0 0.7 1 0.3) (customFloating $ W.RationalRect 0 0.7 1 0.3)
, NS "ghci" (myTerminal ++ " -e \"stack exec -- ghci\" --class scratchpad_ghci") (className =? "scratchpad_ghci") , NS "ghci" (myTerminal ++ " -e \"stack exec -- ghci\" --class scratchpad_ghci") (className =? "scratchpad_ghci")
(customFloating $ W.RationalRect 0 0.7 1 0.3) (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 |-} {-| adds the scripts-directory path to the filename of a script |-}
@ -115,10 +116,10 @@ myLogHook = do
-- Startuphook ----------------------------- {{{ -- Startuphook ----------------------------- {{{
myStartupHook = do myStartupHook = do
setWMName "LG3D" -- Java stuff hack
spawnOnce "picom --config ~/.config/picom.conf --no-fading-openclose" spawnOnce "picom --config ~/.config/picom.conf --no-fading-openclose"
spawnOnce "pasystray" spawnOnce "pasystray"
spawn "/home/leon/.config/polybar/launch.sh" 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.requestName dbus (D.busName_ "org.xmonad.Log")
[D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue] [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
xmonad $ ewmh $ desktopConfig -- $ ewmh (kills IntelliJ)
xmonad $ desktopConfig
{ terminal = myTerminal { terminal = myTerminal
, modMask = myModMask , modMask = myModMask
, borderWidth = 1 , borderWidth = 1
, layoutHook = avoidStruts $ myLayout , layoutHook = avoidStruts $ myLayout
, logHook = myLogHook <+> logHook desktopConfig <+> dynamicLogWithPP (polybarPP dbus) , logHook = myLogHook <+> logHook desktopConfig <+> dynamicLogWithPP (polybarPP dbus)
, startupHook = myStartupHook <+> startupHook desktopConfig , 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 , focusedBorderColor = aqua
, normalBorderColor = "#282828" , normalBorderColor = "#282828"
} `removeKeysP` removedKeys `additionalKeysP` myKeys } `removeKeysP` removedKeys `additionalKeysP` myKeys
@ -220,12 +222,12 @@ polybarPP dbus = namedScratchpadFilterOutWorkspacePP $ def
, ppCurrent = withBG bg2 , ppCurrent = withBG bg2
, ppVisible = withBG bg2 , ppVisible = withBG bg2
, ppUrgent = withFG red , ppUrgent = withFG red
, ppLayout = removeWord "Spacing" . withFG purple , ppLayout = removeWord "Hinted" . removeWord "Spacing" . withFG purple
, ppHidden = wrap " " " " . unwords . map wrapOpenWorkspaceCmd . words , ppHidden = wrap " " " " . unwords . map wrapOpenWorkspaceCmd . words
, ppWsSep = "" , ppWsSep = ""
, ppSep = " | " , ppSep = " | "
, ppExtras = [] , ppExtras = []
, ppTitle = (shorten 40) . withFG aqua , ppTitle = withFG aqua . (shorten 40)
} }
where where
removeWord substr = unwords . filter (/= substr) . words removeWord substr = unwords . filter (/= substr) . words

Binary file not shown.