diff options
Diffstat (limited to 'config/X/xmobar')
-rw-r--r-- | config/X/xmobar/scripts/.updates.swp | bin | 0 -> 12288 bytes | |||
-rwxr-xr-x | config/X/xmobar/scripts/battery | 13 | ||||
-rwxr-xr-x | config/X/xmobar/scripts/checkupds | 2 | ||||
-rwxr-xr-x | config/X/xmobar/scripts/minwinfo | 5 | ||||
-rwxr-xr-x | config/X/xmobar/scripts/whscreen | 23 | ||||
-rwxr-xr-x | config/X/xmobar/scripts/winfo | 124 | ||||
-rw-r--r-- | config/X/xmobar/scripts/winfo_icons | 15 | ||||
-rw-r--r-- | config/X/xmobar/xmobarrc0.hs | 20 | ||||
-rw-r--r-- | config/X/xmobar/xmobarrc1.hs | 149 |
9 files changed, 351 insertions, 0 deletions
diff --git a/config/X/xmobar/scripts/.updates.swp b/config/X/xmobar/scripts/.updates.swp Binary files differnew file mode 100644 index 0000000..99422fc --- /dev/null +++ b/config/X/xmobar/scripts/.updates.swp diff --git a/config/X/xmobar/scripts/battery b/config/X/xmobar/scripts/battery new file mode 100755 index 0000000..77b0d29 --- /dev/null +++ b/config/X/xmobar/scripts/battery @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +battery="$(acpi -i | awk -F ',' 'NR==1 {print $2}')" +charging="$(acpi -i | awk 'NR==1 {print $3}')" +battery=${battery:1:-1} +if [[ "${charging::-1}" == "Charging" ]] +then + icon="<fn=1></fn>" +else + index=$((battery/25)) + array=("<fn=1></fn>" "<fn=1></fn>" "<fn=1></fn>" "<fn=1></fn>" "<fn=1></fn>") + icon="${array[$index]}" +fi +echo -n " ${battery}% ${icon}" diff --git a/config/X/xmobar/scripts/checkupds b/config/X/xmobar/scripts/checkupds new file mode 100755 index 0000000..6cc6030 --- /dev/null +++ b/config/X/xmobar/scripts/checkupds @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +checkupdates | wc -l diff --git a/config/X/xmobar/scripts/minwinfo b/config/X/xmobar/scripts/minwinfo new file mode 100755 index 0000000..1736a5f --- /dev/null +++ b/config/X/xmobar/scripts/minwinfo @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# +echo "name: $1" +echo "icon: $2" +echo "sentence: $3" diff --git a/config/X/xmobar/scripts/whscreen b/config/X/xmobar/scripts/whscreen new file mode 100755 index 0000000..030493b --- /dev/null +++ b/config/X/xmobar/scripts/whscreen @@ -0,0 +1,23 @@ +#!/bin/bash + +# # -- Based on mouse +# # Get mouse location, only X matters +# X=$(\ +# xdotool getmouselocation -s \ +# | head -n1 \ +# | cut -f2 -d'='\ +# ) + +# Based on active window +X=$(xdotool getwindowgeometry -s $(xdotool getwindowfocus) | grep "X" | cut -d'=' -f2) + +# For dual monitor setup +monitor_width="$(\ + xdotool getdisplaygeometry \ + | cut -d ' ' -f 1 \ +)" + +# If '-' number is negative +[[ "$((${X} - ${monitor_width}))" -lt 0 ]] \ + && echo -n '<' \ + || echo -n '>' diff --git a/config/X/xmobar/scripts/winfo b/config/X/xmobar/scripts/winfo new file mode 100755 index 0000000..033ab49 --- /dev/null +++ b/config/X/xmobar/scripts/winfo @@ -0,0 +1,124 @@ +#!/bin/bash +XMDIR="$HOME/.config/xmobar" + +terminal="$(\ + grep -m 1 "myTerminal *=" ~/.config/xmonad/xmonad.hs \ + | cut -f 2 -d '"' \ +)" + +# Gets info over active window in X server +# made to work with xmobar +# Make option to change the terminal + +# ID of focused window +GetWinID () { + xdotool getWindowfocus +} + +# Gets name of program running active window +GetWinName () { + xdotool getwindowclassname $(GetWinID) +} + +GetWinIcons () { + NAME="$(GetWinName | cut -f 1 -d " ")" + test -z "$NAME" || \ + grep -i -m 1 "${NAME}" "$XMDIR/scripts/winfo_icons" | cut -f1 -d' ' +} + +# Get current directory of active window +# for st +GetCWD (){ + # Parent PID of process running in window + PARENT_PID="$(\ + xdotool getwindowpid $(GetWinID)\ + )" + + # PID of process runnning in window + PROCESS="$(\ + pstree -p ${PARENT_PID} \ + | head -n1 \ + | sed \ + -e 's/^.*-\(.*\)$/\1/g' \ + -e 's/^ *\([^{:( ]*\).*$/\1/g' \ + )" + + echo -n "${PROCESS}" \ + | sed \ + -e "s;^zsh$;<fn=1></fn>&;g" \ + -e "s;^htop$;<fn=1></fn> &;g" \ + -e "s;^ranger$;<fn=1></fn> &;g" +} + +# Get title of window / name of process +# takes one argument, window name +GetWinTitle() { + # Max length of string + MAX_LEN=64 + xdotool GetWindowName $(GetWinID) \ + | sed \ + -e 's/ — Mozilla Firefox//g' \ + -e "s;${HOME};~;g" \ + -e "s/^\(.\{$MAX_LEN\}\).*$/\1../g" \ + -e 's/ *\.\.$/\.\./g' \ + -e "s;^${terminal^}$;$(GetCWD);g" +} + +# Help function +Help () { + echo "-- This is winfo --" + echo "Gets information over focused window" + echo + echo "Usage: getFWinfo [OPTION]" + echo " -h display this help and exit" + echo " -n for name" + echo " -i for icons" + echo " -t for titles" +} + +############################################## +#################### MAIN #################### +############################################## + +# Handles options +if [ $# -eq 0 ] +then + Help + exit 0 +fi + +while getopts ":hinTt" option +do + case "$option" in + + h) # Prints help message + Help + exit 0 + ;; + + T) # Get terminal specified by xmonad + echo ${terminal} + exit 0 + ;; + + i) # Get window icons, uses GetWinName + GetWinIcons + exit 0 + ;; + + n) # Get window name "WM_CLASS" + GetWinName + # Capitalize + exit 0 + ;; + + t) # Get window title, like name of webpage/working dir + GetWinTitle + exit 0 + ;; + + esac +done + echo "Invalid option." + Help + exit 1 diff --git a/config/X/xmobar/scripts/winfo_icons b/config/X/xmobar/scripts/winfo_icons new file mode 100644 index 0000000..dbdc3ae --- /dev/null +++ b/config/X/xmobar/scripts/winfo_icons @@ -0,0 +1,15 @@ +<fn=1></fn> alacritty kitty +<fn=1></fn> firefox +<fn=1></fn> minecraft multimc +<fn=1></fn> virt-manager virtualbox rustdesk +<fn=1></fn> mpv +<fn=1>ﭮ</fn> discord +<fn=1></fn> jetbrains-clion +<fn=1></fn> pinentry-gtk-2 +<fn=1></fn> code-oss +<fn=1>響</fn> mumble +<fn=1></fn> soffice libreoffice-writer +<fn=1></fn> steam +<fn=1></fn> packettracer +<fn=1></fn> ktouch +<fn=1></fn> signal diff --git a/config/X/xmobar/xmobarrc0.hs b/config/X/xmobar/xmobarrc0.hs new file mode 100644 index 0000000..e3824f2 --- /dev/null +++ b/config/X/xmobar/xmobarrc0.hs @@ -0,0 +1,20 @@ +Config { font = "xft:Ubuntu Mono:pixelsize=14:style=bold:antialias=true:hinting:=true" + -- Only 1 font, so height automatic + , position = BottomW C 16 + , bgColor = "#2e3440" + , fgColor = "#2aa198" + , lowerOnStart = True + , pickBroadest = False + , persistent = False + , hideOnStart = False + , overrideRedirect = True + , wmName = "xmobar2" + + , commands = [ + Run StdinReader + ] + , sepChar = "%" + , alignSep = "}{" + + , template = "}<fc=#eceff4> %StdinReader% </fc>{"} + diff --git a/config/X/xmobar/xmobarrc1.hs b/config/X/xmobar/xmobarrc1.hs new file mode 100644 index 0000000..a187055 --- /dev/null +++ b/config/X/xmobar/xmobarrc1.hs @@ -0,0 +1,149 @@ +Config { font = "xft:Ubuntu Mono:pixelsize=14:style=bold:antialias=true:hinting:=true" + , additionalFonts = [ + "xft:Mononoki Nerd Font Mono:style=bold:pixelsize=24:antialias=true:hinting=true", + "xft:Mononoki Nerd Font Mono:style=bold:pixelsize=24:antialias=false:hinting=true" + ] + , position = TopH 24 + , borderColor = "#2e3440" + , borderWidth = 2 + , border = BottomB + , bgColor = "#2e3440" + , fgColor = "#2aa198" + , lowerOnStart = True + , pickBroadest = False + , persistent = False + , hideOnStart = False + , iconRoot = "/home/aluc/.config/xmobar/icons" + , overrideRedirect = True + , commands = [ Run Cpu [ "-t", "<total>%" + ,"-l", "#2e3440,#58e1ac" + ,"-L", "20" + ,"-n", "#4c566a,#58e1ac" + ,"-h", "#cb4b16,#58e1ac" + ,"-H", "50" + ,"-w", "3" + ] 10 + + , Run Memory ["-t", "<usedratio>%" + ,"-l", "#2e3440,#58e1ac" + ,"-L", "20" + ,"-n", "#4c566a,#58e1ac" + ,"-h", "#cb4b16,#58e1ac" + ,"-H", "50" + ,"-w", "2" + ] 10 + + -- Focused window info + , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-n"] "FWname" 3 + , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-t"] "FWtitle" 3 + , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-i"] "FWicon" 3 + , Run Com "/home/aluc/.config/xmobar/scripts/checkupds" ["-i"] "updates" 3600 + -- , Run ComX "$HOME/bin/cmusP" [] "" "cmus" 1 + , Run Com "uname" ["-r"] "" 36000 + , Run Date "<fn=1>\xf073</fn> %b %_d %Y - %H:%M:%S" "date" 10 + , Run PipeReader "/home/aluc/.config/xmobar/scripts/volume-pipe" "vol" + ] + , sepChar = "%" + , alignSep = "}{" + + + -- COLORS + -- #2aa198 : Blue/green -- fg + -- + -- #d08770 : pinkish brown -- memory + -- #ff00ff : pink/purple -- swap + -- #828be6 : perrywinkle -- FWname + -- #825be6 : purpley -- FWtitle + -- bgColor = "#2e3440" + -- fgColor = "#2aa198" + -- #58e1ac + + , template = " \ + -- Left + + \<fc=#b48ead,#2e3440><fn=2></fn></fc>\ + \<fc=#2e3440,#b48ead>\ + \<box type=VBoth width=4 color=#b48ead>\ + \ <fn=1></fn> %uname% \ + \</box>\ + \</fc>\ + \<fc=#2e3440,#b48ead><fn=2></fn></fc>\ + + \<fc=#58e1ac,#2e3440><fn=2></fn></fc>\ + \<fc=#2e3440,#58e1ac>\ + \<box type=VBoth width=4 color=#58e1ac>\ + \ %vol% \ + \</box>\ + \</fc>\ + \<fc=#2e3440,#58e1ac><fn=2></fn></fc>\ + + \<fc=#88c0d0,#2e3440><fn=2></fn></fc>\ + \<fc=#2e3440,#88c0d0>\ + \<box type=VBoth width=4 color=#88c0d0>\ + \<action=`dmenu_run` button=1>\ + \ dmenu \ + \</action>\ + \</box>\ + \</fc>\ + \<fc=#88c0d0><fn=2></fn></fc>\ + + + -- Centered + \}\ + \<fc=#ebcb8b,#2e3440><fn=2></fn></fc>\ + \<fc=#4c566a,#ebcb8b>\ + \<box type=VBoth width=4 color=#ebcb8b>\ + \ %FWicon% \ + \</box>\ + \</fc>\ + \<fc=#4c566a,#ebcb8b>\ + \<box type=VBoth width=4 color=#ebcb8b>\ + \%FWname% \ + \</box>\ + \</fc>\ + \<fc=#b48ead,#ebcb8b>\ + \<box type=VBoth width=4 color=#ebcb8b>\ + \<box type=Bottom width=2 mb=3 color=#b48ead>\ + \%FWtitle%\ + \</box>\ + \</box>\ + \</fc>\ + \<fc=#2e3440,#ebcb8b><fn=2> </fn></fc>\ + \<fc=#ebcb8b,#2e3440><fn=2></fn></fc>\ + + + -- Right + \{ \ + + \<fc=#88c0d0,#2e3440><fn=2></fn></fc>\ + \<fc=#2e3440,#88c0d0>\ + \<box type=VBoth width=4 color=#88c0d0>\ + \ %updates% <fn=1></fn>\ + \</box>\ + \</fc>\ + \<fc=#88c0d0><fn=2></fn></fc>\ + + \<fc=#2e3440,#58e1ac><fn=2></fn></fc>\ + \<fc=#2e3440,#58e1ac>\ + \<box type=VBoth width=4 color=#58e1ac>\ + \ <fn=1></fn>%cpu% \ + \</box>\ + \<fc=#2e3440,#58e1ac>\ + \<box type=VBoth width=4 color=#58e1ac>\ + \%memory% \ + \</box>\ + \</fc>\ + \</fc>\ + \<fc=#58e1ac><fn=2></fn></fc>\ + + \<fc=#2e3440,#b48ead><fn=2></fn></fc>\ + \<fc=#2e3440,#b48ead>\ + \<box type=VBoth width=4 color=#b48ead>\ + \ %date% \ + \</box>\ + \</fc>\ + \<fc=#b48ead><fn=2></fn></fc> " + + } + + |