├── .Xdefaults ├── .cwmrc ├── .xsession ├── LICENSE ├── README.md ├── screenshot.png └── termbar /.Xdefaults: -------------------------------------------------------------------------------- 1 | !!! Colours 2 | *color0: rgb:2a/3b/4d 3 | *color1: rgb:c4/67/6c 4 | *color2: rgb:66/ff/66 5 | *color3: rgb:ff/ff/66 6 | *color4: rgb:15/f4/ee 7 | *color5: rgb:9c/6c/d3 8 | *color6: rgb:4b/8f/77 9 | *color7: rgb:9f/a2/a6 10 | *color8: rgb:55/79/9c 11 | *color9: rgb:c4/67/6c 12 | *color10: rgb:66/ff/66 13 | *color11: rgb:ff/ff/66 14 | *color12: rgb:15/f4/ee 15 | *color13: rgb:9c/6c/d3 16 | *color14: rgb:4b/8f/77 17 | *color15: rgb:ff/ff/ff 18 | *color16: rgb:ff/99/66 # Base 09 19 | *color17: rgb:bb/64/a9 # Base 0F 20 | *color18: rgb:3d/56/6f # Base 01 21 | *color19: rgb:4b/69/88 # Base 02 22 | *color20: rgb:7e/90/a3 # Base 04 23 | *color21: rgb:d6/d7/d9 # Base 06 24 | 25 | !!! Xterm 26 | !!! XTerm*background: rgb:2a/3b/4d 27 | XTerm*background: black 28 | XTerm*foreground: rgb:9f/a2/a6 29 | XTerm*eightBitInput: false 30 | XTerm*loginShell: true 31 | XTerm*scrollBar: false 32 | XTerm*saveLines: 2000 33 | XTerm*faceName: xft:monospace:pixelsize=16 34 | XTerm*internalBorder: 10 35 | XTerm*locale: true 36 | XTerm*pointerMode: 2 37 | XTerm*allowTitleOps: true 38 | XTerm*termName: xterm-256color 39 | 40 | !!! termbar 41 | termbar*faceName: xft:mono:pixelsize=24 42 | !! One Monitor !!termbar*geometry: 1920x1+0+0 43 | !! Two Monitors !! 44 | termbar*geometry: 3840x1+0+0 45 | termbar*internalBorder: 6 46 | termbar*saveLines: 0 47 | termbar*scrollBar: false 48 | termbar*title: termbar 49 | 50 | !!! Xconsole 51 | XConsole*internalBorder: 5 52 | XConsole*scrollBar: false 53 | XConsole*faceName: xft:monospace:pixelsize=10 54 | 55 | !!! xLock 56 | XLock.nice: 19 57 | XLock.mode: blank 58 | XIdle.timeout: 600 59 | XLock.usefirst: yes 60 | XLock.grabmouse: on 61 | XLock.lockdelay: 10 62 | XLock.mousemotion: on 63 | 64 | -------------------------------------------------------------------------------- /.cwmrc: -------------------------------------------------------------------------------- 1 | # KEYBINDINGS: 2 | # 4 = mod (windows key) 3 | # S = shift 4 | # C = control 5 | # M = meta (alt) 6 | 7 | # Autogroups for windows. 8 | autogroup 0 xconsole,XConsole 9 | autogroup 0 "termbar,termbar" 10 | autogroup 2 "firefox,firefox-bin" 11 | autogroup 9 "tor-browser,tor-browser" 12 | 13 | # Add missing keybindings. 14 | bind-key M-1 group-only-1 15 | bind-key M-2 group-only-2 16 | bind-key M-3 group-only-3 17 | bind-key M-4 group-only-4 18 | bind-key M-5 group-only-5 19 | bind-key M-6 group-only-6 20 | bind-key M-7 group-only-7 21 | bind-key M-8 group-only-8 22 | bind-key M-9 group-only-9 23 | bind-key MS-1 window-movetogroup-1 24 | bind-key MS-2 window-movetogroup-2 25 | bind-key MS-3 window-movetogroup-3 26 | bind-key MS-4 window-movetogroup-4 27 | bind-key MS-5 window-movetogroup-5 28 | bind-key MS-6 window-movetogroup-6 29 | bind-key MS-7 window-movetogroup-7 30 | bind-key MS-8 window-movetogroup-8 31 | bind-key MS-9 window-movetogroup-9 32 | 33 | bind-key MS-space window-htile 34 | bind-key M-space window-vtile 35 | 36 | bind-key C-Up pointer-move-up 37 | bind-key C-Down pointer-move-down 38 | bind-key C-Right pointer-move-right 39 | bind-key C-Left pointer-move-left 40 | 41 | bind-key CS-Up pointer-move-up-bigbind-key 42 | bind-key CS-Down pointer-move-down-big 43 | bind-key CS-Right pointer-move-right-big 44 | bind-key CS-Left pointer-move-left-big 45 | 46 | bind-key MS-l lock 47 | bind-key MS-r restart 48 | bind-key MS-q quit 49 | bind-key MS-Return terminal 50 | bind-key MS-p menu-exec 51 | 52 | bind-mouse M-2 window-lower 53 | bind-mouse M-3 window-resize 54 | 55 | ## Windows 56 | borderwidth 4 57 | color activeborder '#202060' 58 | color font '#000000' 59 | color selfont '#e9ffe9' 60 | color inactiveborder 'rgb:33/33/33' 61 | color menubg '#494949' 62 | color menufg '#202060' 63 | 64 | fontname "dejavu sans mono:size=12" 65 | gap 35 5 5 5 66 | 67 | ignore "xconsole" 68 | ignore "termbar" 69 | 70 | command firefox firefox 71 | command xterm xterm 72 | 73 | moveamount 4 74 | snapdist 25 75 | sticky yes 76 | -------------------------------------------------------------------------------- /.xsession: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | xrdb -merge $HOME/.Xresources 4 | 5 | export LANG=en_US.UTF-8 6 | export LC_CTYPE=en_US.UTF-8 7 | export XMODIFIERS=@im=uim 8 | export GTK_IM_MODULE="uim" 9 | export MOZ_USE_XINPUT2=1 10 | export MOZ_ACCELERATED=1 11 | export MOZ_WEBRENDER=1 12 | 13 | ## no bell 14 | xset b 0 0 0 15 | 16 | # DBus 17 | if [ -x /usr/local/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then 18 | eval `dbus-launch --sh-syntax --exit-with-x11` 19 | fi 20 | 21 | # Termbar 22 | exec xterm -fs 12 -bg "black" -fg "grey" -name termbar -class termbar -T termbar -e ~/code/termbar & 23 | 24 | # Wallpaper 25 | feh --bg-center ~/themes/blade-runner--wallpaper.jpg & 26 | 27 | exec cwm 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 gonzalo@x61.sh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # termbar - depsless status bar for OpenBSD 2 | 3 | xterm status bar for cwm (or other wm) on OpenBSD (no idea if works on loonix or other OS). 4 | 5 | ## termbar in C 6 | 7 | You can now use also the C version of termbar [here.](https://github.com/gonzalo-/termbarc/) 8 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonzalo-/termbar/c58d424dca842e682152be16edd1028720bc5250/screenshot.png -------------------------------------------------------------------------------- /termbar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## Debug 4 | #set -x 5 | 6 | trap 'exec $0' HUP # Restart itself 7 | trap 'tput cnorm; exit 1' INT QUIT TERM 8 | 9 | esc="\033" 10 | reset="${esc}[0m" 11 | redf="${esc}[31m" 12 | cyanf="${esc}[36m"; 13 | purplef="${esc}[35m" 14 | pipe="${purplef}|${reset}" 15 | 16 | today() 17 | { 18 | DATE=$(date '+%a %d %b %H:%M') 19 | } 20 | 21 | desktop_id() 22 | { 23 | DESKTOP_ID=$(xprop -root 32c '\t$0' _NET_CURRENT_DESKTOP | cut -f 2) 24 | } 25 | 26 | cpu() 27 | { 28 | # CPU_SPEED=$(sysctl hw.cpuspeed | cut -d "=" -f 2 | cut -d "." -f 1) 29 | CPU_TEMP=$(sysctl hw.sensors.acpithinkpad0.temp0 | cut -d "=" -f 2 | cut -d "." -f 1) 30 | 31 | CPU_SPEED=$(printf "%4s" $(sysctl hw.cpuspeed | cut -d "=" -f 2 | cut -d "." -f 1)) 32 | } 33 | 34 | bat() 35 | { 36 | BAT=$(apm -l) 37 | } 38 | 39 | bat_status() 40 | { 41 | STATUS=$(sysctl hw.sensors.acpiac0.indicator0 | grep -c On) 42 | 43 | if [ ${STATUS} -eq "1" ]; then 44 | BAT_STATUS=$(echo Connected) 45 | else 46 | BAT_STATUS=$(echo ${redf}Disconnected${reset}) 47 | fi 48 | } 49 | 50 | mem() 51 | { 52 | MEM=$(top -n | grep Memory | awk {'print $6'}) 53 | } 54 | 55 | wifi() 56 | { 57 | SSID=$(ifconfig | grep join | sed -e 's/.*join\(.*\)chan.*/\1/') 58 | } 59 | 60 | network() 61 | { 62 | IIP=$(ifconfig iwm0 | grep inet | awk '{print $2}') 63 | PIP=$(dig +short myip.opendns.com @resolver1.opendns.com | awk {'printf $1'}) 64 | } 65 | 66 | my_name() 67 | { 68 | YO=$(printf "ゴンザロ") 69 | } 70 | 71 | tput civis 72 | 73 | while true; do 74 | today 75 | desktop_id 76 | cpu 77 | mem 78 | bat 79 | bat_status 80 | wifi 81 | network 82 | my_name 83 | tput cup 1 0 84 | printf "[${DESKTOP_ID}] ${pipe} ${cyanf}${YO}${reset} ${pipe} ${DATE} ${pipe} ${cyanf}CPU:${reset} ${CPU_SPEED} MHz (${CPU_TEMP}°) ${pipe} ${cyanf}Mem:${reset} ${MEM} " 85 | printf "${pipe} ${cyanf}Bat:${reset} $BAT - ${BAT_STATUS} ${pipe} ${cyanf}SSID:${reset}${SSID}${pipe}" 86 | printf " ${cyanf}IPs:${reset} ${PIP} / ${IIP}" echo "\e[1A" 87 | sleep 1 88 | done 89 | --------------------------------------------------------------------------------