0.2
This commit is contained in:
parent
d03bb9f39b
commit
b098817242
4
LICENSE
4
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright 2022 Bob Slacker
|
||||
Copyright 2023 Bob Slacker
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
@ -8,4 +8,4 @@ Redistribution and use in source and binary forms, with or without modification,
|
|||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 27 0 0 0
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 50
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
@ -28,21 +28,22 @@ color menufg yellow
|
|||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/b2r1s8/.local/bin/term"
|
||||
bind-key 4-Return "lxterminal --geometry=80x25"
|
||||
#bind-key 4-Return "lxterminal --geometry=80x25 -e /home/puffy/.local/bin/tm"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l lock
|
||||
bind-key CM-l /home/puffy/.local/bin/lck
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/b2r1s8/.local/bin/printscreen
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/b2r1s8/.local/bin/mpm
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
|
@ -131,20 +132,25 @@ bind-key 4-v window-vtile
|
|||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + / = show popup menu to run a command (configured bellow)
|
||||
bind-key 4-slash menu-cmd
|
||||
# mod + ? = menu-window-hidden to search for hidden windows
|
||||
bind-key 4-question menu-window-hiden
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# some unbinds
|
||||
unbind-key 4-w
|
||||
|
||||
# some bindings
|
||||
bind-key 4-w menu-window
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
|
@ -162,10 +168,16 @@ bind-mouse 4-2 window-lower
|
|||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
command "Terminal" "lxterminal"
|
||||
command "Browser" "firefox"
|
||||
command "clock" "xclock -d -update 1 -render"
|
||||
command "calc" xcalc
|
||||
command "i2pb" "/home/puffy/.local/bin/i2pb"
|
||||
|
||||
# Autogroup this ports
|
||||
autogroup 9 TelegramDesktop
|
||||
autogroup 8 hexchat
|
||||
autogroup 7 KeePassXC
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Categories=Internet
|
||||
NoDisplay=true
|
||||
Exec=/home/puffy/.local/bin/i2pb
|
||||
Icon=/home/puffy/.config/i2p/i2pd-logo.png
|
||||
Name=i2pb
|
||||
Terminal=false
|
||||
Comment=Custom profile for Firefox and i2p+
|
|
@ -1,8 +1,8 @@
|
|||
file:///home/b2r1s8/Documents Documents
|
||||
file:///home/b2r1s8/Downloads Downloads
|
||||
file:///home/b2r1s8/Music Music
|
||||
file:///home/b2r1s8/Pictures Pictures
|
||||
file:///home/b2r1s8/Public Public
|
||||
file:///home/b2r1s8/Templates Templates
|
||||
file:///home/b2r1s8/tmp tmp
|
||||
file:///home/b2r1s8/usb usb
|
||||
file:///home/puffy/Documents Documents
|
||||
file:///home/puffy/Downloads Downloads
|
||||
file:///home/puffy/Music Music
|
||||
file:///home/puffy/Pictures Pictures
|
||||
file:///home/puffy/Public Public
|
||||
file:///home/puffy/Templates Templates
|
||||
file:///home/puffy/tmp tmp
|
||||
file:///home/puffy/Videos Videos
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
gtk-theme-name=Flat-Remix-GTK-Yellow-Darkest
|
||||
gtk-icon-theme-name=hercules
|
||||
gtk-font-name=Hack Nerd Font 8
|
||||
gtk-cursor-theme-name=Radioactive
|
||||
gtk-cursor-theme-name=radioactive
|
||||
gtk-cursor-theme-size=0
|
||||
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
|
||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
# Configuration file for the libfm version 1.3.2.
|
||||
# Autogenerated file, don't edit, your changes will be overwritten.
|
||||
|
||||
[config]
|
||||
single_click=0
|
||||
use_trash=1
|
||||
confirm_del=1
|
||||
confirm_trash=1
|
||||
advanced_mode=0
|
||||
si_unit=0
|
||||
force_startup_notify=1
|
||||
backup_as_hidden=1
|
||||
no_usb_trash=1
|
||||
no_child_non_expandable=0
|
||||
show_full_names=0
|
||||
only_user_templates=0
|
||||
template_run_app=0
|
||||
template_type_once=0
|
||||
auto_selection_delay=600
|
||||
drop_default_action=auto
|
||||
defer_content_test=0
|
||||
quick_exec=0
|
||||
thumbnail_local=1
|
||||
thumbnail_max=2048
|
||||
smart_desktop_autodrop=1
|
||||
|
||||
[ui]
|
||||
big_icon_size=48
|
||||
small_icon_size=24
|
||||
pane_icon_size=24
|
||||
thumbnail_size=128
|
||||
show_thumbnail=1
|
||||
shadow_hidden=0
|
||||
|
||||
[places]
|
||||
places_home=1
|
||||
places_desktop=1
|
||||
places_root=0
|
||||
places_computer=0
|
||||
places_trash=1
|
||||
places_applications=1
|
||||
places_network=0
|
||||
places_unmounted=1
|
|
@ -0,0 +1,53 @@
|
|||
[general]
|
||||
fontname=Hack Nerd Font Mono 8
|
||||
selchars=-A-Za-z0-9,./?%&#:_
|
||||
scrollback=10000
|
||||
bgcolor=rgba(0,0,0,0.9)
|
||||
fgcolor=rgb(229,165,10)
|
||||
palette_color_0=rgb(0,0,0)
|
||||
palette_color_1=rgb(170,0,0)
|
||||
palette_color_2=rgb(0,170,0)
|
||||
palette_color_3=rgb(170,85,0)
|
||||
palette_color_4=rgb(0,0,170)
|
||||
palette_color_5=rgb(170,0,170)
|
||||
palette_color_6=rgb(0,170,170)
|
||||
palette_color_7=rgb(170,170,170)
|
||||
palette_color_8=rgb(85,85,85)
|
||||
palette_color_9=rgb(255,85,85)
|
||||
palette_color_10=rgb(85,255,85)
|
||||
palette_color_11=rgb(255,255,85)
|
||||
palette_color_12=rgb(85,85,255)
|
||||
palette_color_13=rgb(255,85,255)
|
||||
palette_color_14=rgb(85,255,255)
|
||||
palette_color_15=rgb(255,255,255)
|
||||
color_preset=Custom
|
||||
disallowbold=false
|
||||
cursorblinks=true
|
||||
cursorunderline=false
|
||||
audiblebell=true
|
||||
tabpos=top
|
||||
geometry_columns=80
|
||||
geometry_rows=24
|
||||
hidescrollbar=true
|
||||
hidemenubar=true
|
||||
hideclosebutton=true
|
||||
hidepointer=false
|
||||
disablef10=false
|
||||
disablealt=false
|
||||
disableconfirm=false
|
||||
|
||||
[shortcut]
|
||||
new_window_accel=<Primary><Shift>n
|
||||
new_tab_accel=<Primary><Shift>t
|
||||
close_tab_accel=<Primary><Shift>w
|
||||
close_window_accel=<Primary><Shift>q
|
||||
copy_accel=<Primary><Shift>c
|
||||
paste_accel=<Primary><Shift>v
|
||||
name_tab_accel=<Primary><Shift>i
|
||||
previous_tab_accel=<Primary>Page_Up
|
||||
next_tab_accel=<Primary>Page_Down
|
||||
move_tab_left_accel=<Primary><Shift>Page_Up
|
||||
move_tab_right_accel=<Primary><Shift>Page_Down
|
||||
zoom_in_accel=<Primary><Shift>plus
|
||||
zoom_out_accel=<Primary><Shift>underscore
|
||||
zoom_reset_accel=<Primary><Shift>parenright
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"Alt-/": "lua:comment.comment",
|
||||
"CtrlUnderscore": "lua:comment.comment"
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -0,0 +1,10 @@
|
|||
set -g window-status-current-style fg=black,bg='#ff0000'
|
||||
set-option -g status-position top
|
||||
set-option -g status-style bg=black
|
||||
set-option -g status-style fg='#ff0000'
|
||||
set -g pane-active-border-style fg=''#ff0000''
|
||||
set -g pane-border-style fg=''#ff0000''
|
||||
set -g mode-style bg='#ff0000',fg=black
|
||||
set -g clock-mode-colour red
|
||||
set -g mouse on
|
||||
set -g default-shell /usr/local/bin/zsh
|
|
@ -0,0 +1,10 @@
|
|||
set -g window-status-current-style fg=black,bg=yellow
|
||||
set-option -g status-position top
|
||||
set-option -g status-style bg=black
|
||||
set-option -g status-style fg=yellow
|
||||
set -g pane-active-border-style fg=yellow
|
||||
set -g pane-border-style fg=yellow
|
||||
set -g mode-style bg=yellow,fg=black
|
||||
set -g clock-mode-colour red
|
||||
set -g mouse on
|
||||
set -g default-shell /usr/local/bin/zsh
|
|
@ -0,0 +1,10 @@
|
|||
set -g window-status-current-style fg=black,bg=yellow
|
||||
set-option -g status-position top
|
||||
set-option -g status-style bg=black
|
||||
set-option -g status-style fg=yellow
|
||||
set -g pane-active-border-style fg=yellow
|
||||
set -g pane-border-style fg=yellow
|
||||
set -g mode-style bg=yellow,fg=black
|
||||
set -g clock-mode-colour red
|
||||
set -g mouse on
|
||||
#set -g default-shell /usr/local/bin/zsh
|
|
@ -0,0 +1,12 @@
|
|||
# Colors
|
||||
set-option -g status-style bg=black
|
||||
set-option -g status-style fg=yellow
|
||||
set -g window-status-current-style fg=black,bg=yellow
|
||||
set -g pane-active-border-style fg=yellow
|
||||
set -g pane-border-style fg=yellow
|
||||
set -g mode-style bg=yellow,fg=black
|
||||
set -g clock-mode-colour red
|
||||
|
||||
# Settigs
|
||||
set-option -g status-position top
|
||||
set -g mouse on
|
|
@ -0,0 +1,17 @@
|
|||
# Colors
|
||||
# Enable color support inside of tmux.
|
||||
set -g default-terminal "xterm-256color"
|
||||
set -ga terminal-overrides ",*256col*:Tc"
|
||||
set-option -g status-style bg=black
|
||||
set-option -g status-style fg=yellow
|
||||
set -g window-status-current-style fg=black,bg=yellow
|
||||
set -g pane-active-border-style fg=yellow
|
||||
set -g pane-border-style fg=yellow
|
||||
set -g mode-style bg=yellow,fg=black
|
||||
set -g clock-mode-colour red
|
||||
|
||||
# Settigs
|
||||
set-option -g status-position top
|
||||
set -g mouse on
|
||||
# Add a bit more scroll history in the buffer.
|
||||
set -g history-limit 50000
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 27 0 0 0
|
||||
moveamount 3
|
||||
vtile 50
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/b2r1s8/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l lock
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/b2r1s8/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/b2r1s8/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 27 0 0 0
|
||||
moveamount 3
|
||||
vtile 50
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l lock
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "lxterminal --geometry=80x25"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l /home/puffy/.local/bin/lck
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,191 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "lxterminal --geometry=80x25 -e /home/puffy/.local/bin/tm"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l /home/puffy/.local/bin/lck
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu to run a command (configured bellow)
|
||||
bind-key 4-slash menu-cmd
|
||||
# mod + ? = menu-window-hidden to search for hidden windows
|
||||
bind-key 4-question menu-window-hiden
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# some unbinds
|
||||
unbind-key 4-w
|
||||
|
||||
# some bindings
|
||||
bind-key 4-w menu-window
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" "lxterminal"
|
||||
command "Browser" "firefox"
|
||||
command "clock" "xclock -d -update 1 -render"
|
||||
command "calc" xcalc
|
||||
command "i2pb" "/home/puffy/.local/bin/i2pb"
|
||||
|
||||
# Autogroup this ports
|
||||
autogroup 9 TelegramDesktop
|
||||
autogroup 8 hexchat
|
||||
autogroup 7 KeePassXC
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 23 0 0 0
|
||||
moveamount 3
|
||||
vtile 50
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l lock
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 23 0 0 0
|
||||
moveamount 3
|
||||
vtile 70
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l lock
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 23 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l lock
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l lock
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "terminator --geometry 480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l /home/puffy/.local/bin/lck
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "lxterminal --geometry 480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l /home/puffy/.local/bin/lck
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "lxterminal --geometry=480x325"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l /home/puffy/.local/bin/lck
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,180 @@
|
|||
# Defaults
|
||||
|
||||
sticky yes
|
||||
snapdist 4
|
||||
gap 20 0 0 0
|
||||
moveamount 3
|
||||
vtile 60
|
||||
|
||||
# set font for menus
|
||||
fontname "fixed:pixelsize=13:style=semicondensed"
|
||||
|
||||
# remove all default keybindings
|
||||
unbind-key all
|
||||
|
||||
# Layout
|
||||
borderwidth 1
|
||||
color activeborder yellow
|
||||
color inactiveborder orange
|
||||
color urgencyborder red
|
||||
color font yellow
|
||||
color menubg black
|
||||
color menufg yellow
|
||||
|
||||
# KEYBINDINGS:
|
||||
# 4 = mod (windows key)
|
||||
# S = shift
|
||||
# C = control
|
||||
# M = meta (alt)
|
||||
|
||||
# mod + enter = new terminal
|
||||
bind-key 4-Return "lxterminal --geometry=80x25"
|
||||
#bind-key 4-Return "/home/puffy/.local/bin/term"
|
||||
|
||||
# mod + b = browser
|
||||
bind-key 4-b firefox
|
||||
# mod+ E = Emacs
|
||||
bind-key 4-e "emacs"
|
||||
# ctrl + alt + L = lock screen (xlock)
|
||||
bind-key CM-l /home/puffy/.local/bin/lck
|
||||
# mod + backspace = hide window
|
||||
bind-key 4-BackSpace window-hide
|
||||
# mod + prtsc = screenshot
|
||||
bind-key 4-Print /home/puffy/.local/bin/printscreen
|
||||
# mod + M = mocp
|
||||
bind-key 4-m /home/puffy/.local/bin/mpm
|
||||
|
||||
## mocp binds
|
||||
# Toggle play and pause
|
||||
bind-key 4-p "mocp -G"
|
||||
# Toggle shuffle
|
||||
bind-key 4S-p "mocp -t s"
|
||||
# Toggle auto next
|
||||
bind-key 4M-p "mocp -t n"
|
||||
# Toggle repeat
|
||||
bind-key 4SM-p "mocp -t r"
|
||||
|
||||
# mod + down arrow = lower window's focus
|
||||
bind-key 4-Down window-lower
|
||||
# mod + up arrow = raise window's focus
|
||||
bind-key 4-Up window-raise
|
||||
# mod/alt + tab = cycle through current windows
|
||||
bind-key 4-Tab window-cycle
|
||||
bind-key M-Tab window-cycle
|
||||
# mod/alt + shift + tab = same thing in reverse
|
||||
bind-key 4S-Tab window-rcycle
|
||||
bind-key MS-Tab window-rcycle
|
||||
# mod + w = kill window
|
||||
bind-key 4-w window-delete
|
||||
# set a window's label
|
||||
bind-key 4-n window-menu-label
|
||||
|
||||
# mod + $N = show only windows for group $N
|
||||
# (you can think of this as switching to virtual desktop $N)
|
||||
bind-key 4-1 group-only-1
|
||||
bind-key 4-2 group-only-2
|
||||
bind-key 4-3 group-only-3
|
||||
bind-key 4-4 group-only-4
|
||||
bind-key 4-5 group-only-5
|
||||
bind-key 4-6 group-only-6
|
||||
bind-key 4-7 group-only-7
|
||||
bind-key 4-8 group-only-8
|
||||
bind-key 4-9 group-only-9
|
||||
|
||||
# mod + shift +$N = move window to group $N
|
||||
bind-key 4S-1 window-movetogroup-1
|
||||
bind-key 4S-2 window-movetogroup-2
|
||||
bind-key 4S-3 window-movetogroup-3
|
||||
bind-key 4S-4 window-movetogroup-4
|
||||
bind-key 4S-5 window-movetogroup-5
|
||||
bind-key 4S-6 window-movetogroup-6
|
||||
bind-key 4S-7 window-movetogroup-7
|
||||
bind-key 4S-8 window-movetogroup-8
|
||||
bind-key 4S-9 window-movetogroup-9
|
||||
|
||||
# mod + A = toggle showing windows from all groups
|
||||
bind-key 4-a group-toggle-all
|
||||
# mod + G = toggle current window's group membership
|
||||
bind-key 4-g window-group
|
||||
|
||||
# mod + right arrow = cycle through the window groups
|
||||
# (you can think of this as switching to the next virtual desktop)
|
||||
bind-key 4-Right group-cycle
|
||||
# mod + left arrow = same thing in reverse
|
||||
bind-key 4-Left group-rcycle
|
||||
# mod + S = stick current window to be visible in all groups
|
||||
bind-key 4-s window-stick
|
||||
|
||||
# mod + shift + F = make current window fullscreen
|
||||
bind-key 4S-f window-fullscreen
|
||||
# mod + f = maximize current window
|
||||
bind-key 4-f window-maximize
|
||||
# mod + equals = maximize window in vertical direction only
|
||||
bind-key 4-equal window-vmaximize
|
||||
# mod + shift + equals = maximize window in horizontal direction only
|
||||
bind-key 4S-equal window-hmaximize
|
||||
|
||||
# mod + H,J,K,L = move window left, down, up, right 10 pixels
|
||||
bind-key 4-h window-move-left
|
||||
bind-key 4-j window-move-down
|
||||
bind-key 4-k window-move-up
|
||||
bind-key 4-l window-move-right
|
||||
|
||||
# mod + shift + H,J,K,L = resize window left, down, up, right by 10 pixels
|
||||
bind-key 4S-h window-resize-left
|
||||
bind-key 4S-j window-resize-down
|
||||
bind-key 4S-k window-resize-up
|
||||
bind-key 4S-l window-resize-right
|
||||
|
||||
# mod + V = tile windows vertically, current window to the left
|
||||
bind-key 4-v window-vtile
|
||||
# mod + C = tile windows horizontally, current window to the top
|
||||
bind-key 4-c window-htile
|
||||
|
||||
# mod + / = show popup menu of current windows
|
||||
bind-key 4-slash menu-window
|
||||
# mod + ? = show popup menu to run a command (configured below)
|
||||
bind-key 4-question menu-cmd
|
||||
# mod + d = show popup menu to run an arbitrary command
|
||||
bind-key 4-d menu-exec
|
||||
# mod + . = show popup menu of known ssh hosts to connect to
|
||||
bind-key 4-period menu-ssh
|
||||
|
||||
# mod + shift + R = restart cwm, reloading configuration
|
||||
bind-key 4S-r restart
|
||||
# mod + shift + E = log out
|
||||
bind-key 4S-e quit
|
||||
|
||||
# unbind default mouse actions
|
||||
unbind-mouse M-1
|
||||
unbind-mouse CM-1
|
||||
unbind-mouse M-2
|
||||
unbind-mouse M-3
|
||||
unbind-mouse CMS-3
|
||||
|
||||
# mod + left click drag = move window
|
||||
bind-mouse 4-1 window-move
|
||||
# mod + right click drag = resize window
|
||||
bind-mouse 4-3 window-resize
|
||||
# mod + middle click = lower window's focus
|
||||
bind-mouse 4-2 window-lower
|
||||
# mod + shift + middle click = hide window
|
||||
bind-mouse 4S-2 window-hide
|
||||
|
||||
# these commands will appear in the command menu
|
||||
command "Terminal" urxvtc
|
||||
command Browser "firefox"
|
||||
command xclock "xclock -d -update 1 -render"
|
||||
command xcalc xcalc
|
||||
|
||||
# ignore these windows when tiling/cycling
|
||||
ignore xclock
|
||||
autogroup 0 xclock
|
||||
ignore lemonbar
|
||||
autogroup 0 lemonbar
|
||||
ignore termbar
|
||||
autogroup 0 termbar
|
||||
ignore dunst
|
||||
autogroup 0 dunst
|
||||
ignore xmessage
|
||||
autogroup 0 xmessage
|
|
@ -0,0 +1,67 @@
|
|||
PATH=$HOME/bin:$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
|
||||
export PATH HOME TERM
|
||||
export PAGER=most
|
||||
export LESS='-iMRS -x2'
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export CLICOLOR=1
|
||||
export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
|
||||
export MAILCHECK=0
|
||||
|
||||
HISTFILE=$HOME/.ksh_history
|
||||
HISTSIZE=20000
|
||||
|
||||
export _little_puffy='
|
||||
_____
|
||||
\- -/ _________________________
|
||||
\_/ \ / \
|
||||
| O O | / Wellcome to OpenBSD! |
|
||||
|_ < ) 3 ) \ 7.1 GENERIC.MP#3 |
|
||||
/ \ / \_________________________/
|
||||
/-_____-\
|
||||
'
|
||||
|
||||
[ -n "$XTERM_VERSION" ] && transset-df --id "$WINDOWID" >/dev/null
|
||||
|
||||
# emacs mode gives you the familiar Ctrl-A, Ctrl-E, etc
|
||||
set -o emacs
|
||||
|
||||
# Aliases
|
||||
alias ls='exa --icons'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias lla='ll -a'
|
||||
alias cp='cp -vi'
|
||||
alias mv='mv -vi'
|
||||
alias rm='rm -vi'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ...'
|
||||
alias mkdir='mkdir -p'
|
||||
alias df='df -h'
|
||||
alias du='du -ch'
|
||||
alias lsblk='df'
|
||||
alias pingobsd='ping -c 3 openbsd.org'
|
||||
alias enw='emacs -nw'
|
||||
alias tbin='nc termbin.com 9999'
|
||||
alias sysclean='doas sysclean'
|
||||
alias pkg_add='doas pkg_add'
|
||||
alias pkg_delete='doas pkg_delete'
|
||||
alias pkg_list="pkg_info -zm | sed 's/--$//g'"
|
||||
alias dotstow='stow --dotfiles'
|
||||
alias reboot='doas shutdown -r now'
|
||||
alias poweroff='doas shutdown -p now'
|
||||
alias dsu='doas su -'
|
||||
alias cdt="cd ~/Documents/livros/ocultismo/Thelema/"
|
||||
alias cdo="cd ~/Documents/livros/tech/openbsd/"
|
||||
alias faq='w3m ~/Templates/unixlike/openbsd/projects/www/faq/index.html'
|
||||
alias stilde='ssh b2r1s8@tilde.institute'
|
||||
alias hss='hugo server --noHTTPCache'
|
||||
|
||||
PS1="\u\e[1;36m<@>\e[1;33m\h \e[1;34m\w \n\e[0;32m§\033[0m\] "
|
||||
#PS1=" \e[1;34m\w \e[m$ "
|
||||
#PS1="\$([-s /var/mail/`whoami` ] && echo '* ')$PS1"
|
||||
|
||||
export PS1
|
||||
|
||||
echo "$_little_puffy"
|
||||
thelemic-date
|
|
@ -0,0 +1,67 @@
|
|||
PATH=$HOME/bin:$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
|
||||
export PATH HOME TERM
|
||||
export PAGER=most
|
||||
export LESS='-iMRS -x2'
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export CLICOLOR=1
|
||||
export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
|
||||
export MAILCHECK=0
|
||||
|
||||
HISTFILE=$HOME/.ksh_history
|
||||
HISTSIZE=20000
|
||||
|
||||
export _little_puffy='
|
||||
_____
|
||||
\- -/ _________________________
|
||||
\_/ \ / \
|
||||
| O O | / Wellcome to OpenBSD! |
|
||||
|_ < ) 3 ) \ 7.1 GENERIC.MP#3 |
|
||||
/ \ / \_________________________/
|
||||
/-_____-\
|
||||
'
|
||||
|
||||
[ -n "$XTERM_VERSION" ] && transset-df --id "$WINDOWID" >/dev/null
|
||||
|
||||
# emacs mode gives you the familiar Ctrl-A, Ctrl-E, etc
|
||||
set -o emacs
|
||||
|
||||
# Aliases
|
||||
alias ls='exa --icons'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias lla='ll -a'
|
||||
alias cp='cp -vi'
|
||||
alias mv='mv -vi'
|
||||
alias rm='rm -vi'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ...'
|
||||
alias mkdir='mkdir -p'
|
||||
alias df='df -h'
|
||||
alias du='du -ch'
|
||||
alias lsblk='df'
|
||||
alias pingobsd='ping -c 3 openbsd.org'
|
||||
alias enw='emacs -nw'
|
||||
alias tbin='nc termbin.com 9999'
|
||||
alias sysclean='doas sysclean'
|
||||
alias pkg_add='doas pkg_add'
|
||||
alias pkg_delete='doas pkg_delete'
|
||||
alias pkg_list="pkg_info -zm | sed 's/--$//g'"
|
||||
alias dotstow='stow --dotfiles'
|
||||
alias reboot='doas shutdown -r now'
|
||||
alias poweroff='doas shutdown -p now'
|
||||
alias dsu='doas su -'
|
||||
alias cdt="cd ~/Documents/livros/ocultismo/Thelema/"
|
||||
alias cdo="cd ~/Documents/livros/tech/openbsd/"
|
||||
alias faq='w3m ~/Templates/unixlike/openbsd/projects/www/faq/index.html'
|
||||
alias stilde='ssh b2r1s8@tilde.institute'
|
||||
alias hss='hugo server --noHTTPCache'
|
||||
|
||||
PS1="\u\e[1;36m<@>\e[1;33m\h \e[1;34m\w \n\e[0;32m§\033[0m\] "
|
||||
#PS1=" \e[1;34m\w \e[m$ "
|
||||
#PS1="\$([-s /var/mail/`whoami` ] && echo '* ')$PS1"
|
||||
|
||||
export PS1
|
||||
|
||||
echo "$_little_puffy"
|
||||
#thelemic-date
|
|
@ -0,0 +1,68 @@
|
|||
PATH=$HOME/bin:$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
|
||||
export PATH HOME TERM
|
||||
export PAGER=most
|
||||
export LESS='-iMRS -x2'
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export CLICOLOR=1
|
||||
export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
|
||||
export MAILCHECK=0
|
||||
|
||||
HISTFILE=$HOME/.ksh_history
|
||||
HISTSIZE=20000
|
||||
|
||||
export _little_puffy='
|
||||
_____
|
||||
\- -/ _________________________
|
||||
\_/ \ / \
|
||||
| O O | / Wellcome to OpenBSD! |
|
||||
|_ < ) 3 ) \ 7.1 GENERIC.MP#3 |
|
||||
/ \ / \_________________________/
|
||||
/-_____-\
|
||||
'
|
||||
|
||||
[ -n "$XTERM_VERSION" ] && transset-df --id "$WINDOWID" >/dev/null
|
||||
|
||||
# emacs mode gives you the familiar Ctrl-A, Ctrl-E, etc
|
||||
set -o emacs
|
||||
|
||||
# Aliases
|
||||
alias ls='exa --icons'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias lla='ll -a'
|
||||
alias cp='cp -vi'
|
||||
alias mv='mv -vi'
|
||||
alias rm='rm -vi'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ...'
|
||||
alias mkdir='mkdir -p'
|
||||
alias df='df -h'
|
||||
alias du='du -ch'
|
||||
alias lsblk='df'
|
||||
alias pingobsd='ping -c 3 openbsd.org'
|
||||
alias enw='emacs -nw'
|
||||
alias tbin='nc termbin.com 9999'
|
||||
alias sysclean='doas sysclean'
|
||||
alias pkg_add='doas pkg_add'
|
||||
alias pkg_delete='doas pkg_delete'
|
||||
alias pkg_list="pkg_info -zm | sed 's/--$//g'"
|
||||
alias pkg_search="pkg_info -Q"
|
||||
alias dotstow='stow --dotfiles'
|
||||
alias reboot='doas shutdown -r now'
|
||||
alias poweroff='doas shutdown -p now'
|
||||
alias dsu='doas su -'
|
||||
alias cdt="cd ~/Documents/livros/ocultismo/Thelema/"
|
||||
alias cdo="cd ~/Documents/livros/tech/openbsd/"
|
||||
alias faq='w3m ~/Templates/unixlike/openbsd/projects/www/faq/index.html'
|
||||
alias stilde='ssh b2r1s8@tilde.institute'
|
||||
alias hss='hugo server --noHTTPCache'
|
||||
|
||||
PS1="\u\e[1;36m<@>\e[1;33m\h \e[1;34m\w \n\e[0;32m§\033[0m\] "
|
||||
#PS1=" \e[1;34m\w \e[m$ "
|
||||
#PS1="\$([-s /var/mail/`whoami` ] && echo '* ')$PS1"
|
||||
|
||||
export PS1
|
||||
|
||||
echo "$_little_puffy"
|
||||
#thelemic-date
|
|
@ -0,0 +1,68 @@
|
|||
PATH=$HOME/bin:$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
|
||||
export PATH HOME TERM
|
||||
export PAGER=most
|
||||
export LESS='-iMRS -x2'
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export CLICOLOR=1
|
||||
export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
|
||||
export MAILCHECK=0
|
||||
|
||||
HISTFILE=$HOME/.ksh_history
|
||||
HISTSIZE=20000
|
||||
|
||||
export _little_puffy='
|
||||
_____
|
||||
\- -/ _________________________
|
||||
\_/ \ / \
|
||||
| O O | / Wellcome to OpenBSD! |
|
||||
|_ < ) 3 ) \ 7.3 GENERIC.MP#1125 |
|
||||
/ \ / \_________________________/
|
||||
/-_____-\
|
||||
'
|
||||
|
||||
[ -n "$XTERM_VERSION" ] && transset-df --id "$WINDOWID" >/dev/null
|
||||
|
||||
# emacs mode gives you the familiar Ctrl-A, Ctrl-E, etc
|
||||
set -o emacs
|
||||
|
||||
# Aliases
|
||||
alias ls='exa --icons'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias lla='ll -a'
|
||||
alias cp='cp -vi'
|
||||
alias mv='mv -vi'
|
||||
alias rm='rm -vi'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ...'
|
||||
alias mkdir='mkdir -p'
|
||||
alias df='df -h'
|
||||
alias du='du -ch'
|
||||
alias lsblk='df'
|
||||
alias pingobsd='ping -c 3 openbsd.org'
|
||||
alias enw='emacs -nw'
|
||||
alias tbin='nc termbin.com 9999'
|
||||
alias sysclean='doas sysclean'
|
||||
alias pkg_add='doas pkg_add'
|
||||
alias pkg_delete='doas pkg_delete'
|
||||
alias pkg_list="pkg_info -zm | sed 's/--$//g'"
|
||||
alias pkg_search="pkg_info -Q"
|
||||
alias dotstow='stow --dotfiles'
|
||||
alias reboot='doas shutdown -r now'
|
||||
alias poweroff='doas shutdown -p now'
|
||||
alias dsu='doas su -'
|
||||
alias cdt="cd ~/Documents/livros/ocultismo/Thelema/"
|
||||
alias cdo="cd ~/Documents/livros/tech/openbsd/"
|
||||
alias faq='w3m ~/Templates/unixlike/openbsd/projects/www/faq/index.html'
|
||||
alias stilde='ssh b2r1s8@tilde.institute'
|
||||
alias hss='hugo server --noHTTPCache'
|
||||
|
||||
PS1="\u\e[1;36m<@>\e[1;33m\h \e[1;34m\w \n\e[0;32m§\033[0m\] "
|
||||
#PS1=" \e[1;34m\w \e[m$ "
|
||||
#PS1="\$([-s /var/mail/`whoami` ] && echo '* ')$PS1"
|
||||
|
||||
export PS1
|
||||
|
||||
echo "$_little_puffy"
|
||||
#thelemic-date
|
|
@ -0,0 +1,68 @@
|
|||
PATH=$HOME/bin:$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
|
||||
export PATH HOME TERM
|
||||
export PAGER=most
|
||||
export LESS='-iMRS -x2'
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export CLICOLOR=1
|
||||
export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
|
||||
export MAILCHECK=0
|
||||
|
||||
HISTFILE=$HOME/.ksh_history
|
||||
HISTSIZE=20000
|
||||
|
||||
export _little_puffy='
|
||||
_____
|
||||
\- -/ _________________________
|
||||
\_/ \ / \
|
||||
| O O | / Wellcome to OpenBSD! |
|
||||
|_ < ) 3 ) \ 7.3 GENERIC.MP#1125 |
|
||||
/ \ / \_________________________/
|
||||
/-_____-\
|
||||
'
|
||||
|
||||
[ -n "$XTERM_VERSION" ] && transset-df --id "$WINDOWID" >/dev/null
|
||||
|
||||
# emacs mode gives you the familiar Ctrl-A, Ctrl-E, etc
|
||||
set -o emacs
|
||||
|
||||
# Aliases
|
||||
alias ls='exa --icons'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias lla='ll -a'
|
||||
alias cp='cp -vi'
|
||||
alias mv='mv -vi'
|
||||
alias rm='rm -vi'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ...'
|
||||
alias mkdir='mkdir -p'
|
||||
alias df='df -h'
|
||||
alias du='du -ch'
|
||||
alias lsblk='df'
|
||||
alias pingobsd='ping -c 3 openbsd.org'
|
||||
alias enw='emacs -nw'
|
||||
alias tbin='nc termbin.com 9999'
|
||||
alias sysclean='doas sysclean'
|
||||
alias pkg_add='doas pkg_add'
|
||||
alias pkg_delete='doas pkg_delete'
|
||||
alias pkg_list="pkg_info -zm | sed 's/--$//g'"
|
||||
alias pkg_search="pkg_info -Q"
|
||||
alias dotstow='stow --dotfiles'
|
||||
alias reboot='doas shutdown -r now'
|
||||
alias poweroff='doas shutdown -p now'
|
||||
alias dsu='doas su -'
|
||||
alias cdt="cd ~/Documents/livros/ocultismo/Thelema/"
|
||||
alias cdo="cd ~/Documents/livros/tech/openbsd/"
|
||||
alias faq='w3m ~/Templates/unixlike/openbsd/projects/www/faq/index.html'
|
||||
alias stilde='ssh b2r1s8@tilde.institute'
|
||||
alias hss='hugo server --noHTTPCache'
|
||||
alias tm='tmux -f ~/.config/tmux/tmux.conf'
|
||||
PS1="\u\e[1;36m<@>\e[1;33m\h \e[1;34m\w \n\e[0;32m§\033[0m\] "
|
||||
#PS1=" \e[1;34m\w \e[m$ "
|
||||
#PS1="\$([-s /var/mail/`whoami` ] && echo '* ')$PS1"
|
||||
|
||||
export PS1
|
||||
|
||||
echo "$_little_puffy"
|
||||
#thelemic-date
|
|
@ -0,0 +1,68 @@
|
|||
PATH=$HOME/bin:$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
|
||||
export PATH HOME TERM
|
||||
export PAGER=most
|
||||
export LESS='-iMRS -x2'
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export CLICOLOR=1
|
||||
export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
|
||||
export MAILCHECK=0
|
||||
|
||||
HISTFILE=$HOME/.ksh_history
|
||||
HISTSIZE=20000
|
||||
|
||||
export _little_puffy='
|
||||
_____
|
||||
\- -/ _________________________
|
||||
\_/ \ / \
|
||||
| O O | / Wellcome to OpenBSD! |
|
||||
|_ < ) 3 ) \ 7.3 GENERIC.MP#1125 |
|
||||
/ \ / \_________________________/
|
||||
/-_____-\
|
||||
'
|
||||
|
||||
[ -n "$XTERM_VERSION" ] && transset-df --id "$WINDOWID" >/dev/null
|
||||
|
||||
# emacs mode gives you the familiar Ctrl-A, Ctrl-E, etc
|
||||
set -o emacs
|
||||
|
||||
# Aliases
|
||||
alias ls='exa --icons'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias lla='ll -a'
|
||||
alias cp='cp -vi'
|
||||
alias mv='mv -vi'
|
||||
alias rm='rm -vi'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ...'
|
||||
alias mkdir='mkdir -p'
|
||||
alias df='df -h'
|
||||
alias du='du -ch'
|
||||
alias lsblk='df'
|
||||
alias pingobsd='ping -c 3 openbsd.org'
|
||||
alias enw='emacs -nw'
|
||||
alias tbin='nc termbin.com 9999'
|
||||
alias sysclean='doas sysclean'
|
||||
alias pkg_add='doas pkg_add'
|
||||
alias pkg_delete='doas pkg_delete'
|
||||
alias pkg_list="pkg_info -zm | sed 's/--$//g'"
|
||||
alias pkg_search="pkg_info -Q"
|
||||
alias dotstow='stow --dotfiles'
|
||||
alias reboot='doas shutdown -r now'
|
||||
alias poweroff='doas shutdown -p now'
|
||||
alias dsu='doas su -'
|
||||
alias cdt="cd ~/Documents/livros/ocultismo/Thelema/"
|
||||
alias cdo="cd ~/Documents/livros/tech/openbsd/"
|
||||
alias faq='w3m ~/Templates/unixlike/openbsd/projects/www/faq/index.html'
|
||||
alias stilde='ssh b2r1s8@tilde.institute'
|
||||
alias hss='hugo server --noHTTPCache'
|
||||
|
||||
PS1="\u\e[1;36m<@>\e[1;33m\h \e[1;34m\w \n\e[0;32m§\033[0m\] "
|
||||
#PS1=" \e[1;34m\w \e[m$ "
|
||||
#PS1="\$([-s /var/mail/`whoami` ] && echo '* ')$PS1"
|
||||
|
||||
export PS1
|
||||
|
||||
echo "$_little_puffy"
|
||||
#thelemic-date
|
|
@ -0,0 +1,384 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem_use="$(top -d1 | \
|
||||
head -n ${_h} | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}' | \
|
||||
sed s/M//)"
|
||||
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/b2r1s8 | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="cha" ;;
|
||||
"idle") _states="idl" ;;
|
||||
"full") _states="ful" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,384 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem_use="$(top -d1 | \
|
||||
head -n ${_h} | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}' | \
|
||||
sed s/M//)"
|
||||
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="cha" ;;
|
||||
"idle") _states="idl" ;;
|
||||
"full") _states="ful" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,387 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_dig="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}'
|
||||
sed s/[0-9]*//)"
|
||||
|
||||
# if [ "${_dig
|
||||
|
||||
_mem_use="11"
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,386 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# if [ "${_dig
|
||||
|
||||
_mem_use="11"
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,386 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
|
||||
_mem_use="11"
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,383 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_used="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case dig in
|
||||
M) echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) echo "${_blue}Ram:%{F-} ${_green}$_mem_use/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
_mem_use="11"
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,383 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_used="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case dig in
|
||||
M) echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
_mem_use="11"
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="11G"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_used="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case dig in
|
||||
M) echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="11G"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_used="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
M) echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="11G"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
M) echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="111M"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
M) echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,383 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="111M"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
M) _out="${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) _out="${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo -n "${_out}"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,384 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem_use="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}' | \
|
||||
sed s/M//)"
|
||||
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="cha" ;;
|
||||
"idle") _states="idl" ;;
|
||||
"full") _states="ful" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,383 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="1111M"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
M) _out="${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) _out="${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo -n "${_out}"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,383 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="1111M"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
M) _out="${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
G) _out="${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_out}"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,383 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="1111M"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") _out="${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") _out="${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_out}"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _mem="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_mem="111M"
|
||||
_dig="$(printf '%s' $_mem | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_mem | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,385 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem_use="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}' | \
|
||||
sed s/M// | \
|
||||
sed s/G//)"
|
||||
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="cha" ;;
|
||||
"idle") _states="idl" ;;
|
||||
"full") _states="ful" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case ${_net} in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os} "
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}] "
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}] "
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}] "
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,382 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}] "
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,389 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,390 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) |\
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,385 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem_use="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}' | \
|
||||
sed s/M// | \
|
||||
sed s/G//)"
|
||||
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,390 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="11G"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
#echo "test"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="11G"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") _out="${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") _out-"${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "_out"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="11G"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case _dig in
|
||||
"M") _out="${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") _out-"${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "$_out"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,385 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem_use="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}' | \
|
||||
sed s/M// | \
|
||||
sed s/G//)"
|
||||
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="11G"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
case "${_dig}" in
|
||||
"M") _out="${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}" ;;
|
||||
"G") _out-"${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}" ;;
|
||||
esac
|
||||
echo "$_out"
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="11G"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
# _memo="$(top -d1 | \
|
||||
# head -n "${_h}" | \
|
||||
# tail -1 | \
|
||||
# awk '{print $3}' | \
|
||||
# awk -F / '{print $1}')"
|
||||
|
||||
_memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
(_temp) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo ""
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,392 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo ""
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_rec) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,391 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo ""
|
||||
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,385 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case $_net in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_mem_use="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}' | \
|
||||
sed s/M// | \
|
||||
sed s/G//)"
|
||||
|
||||
_b=999
|
||||
|
||||
### Build the output
|
||||
if [ "$_mem_use" -ge "$_b" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}0$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%Y-%m-%d %H:%M") ;;
|
||||
*) _date=$(date "+%a %Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#$(_thelemic_date) \
|
||||
#$(_fan_speed) | \
|
||||
#$(_smt_func) | \
|
||||
#$(_sec) | \
|
||||
#$(_pf) | \
|
||||
#$(_rec) | \
|
||||
#(_temp) | \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o} \
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
%{c}| $(_mem) | \
|
||||
$(_network) | \
|
||||
$(_mail) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
%{r}$(_clock) "
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,391 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}Video:%{F-} $_video_color | ${_pink}Audio:%{F-} $_audio_color"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,391 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}V/%{F-}${_pink}A:%{F-} ${_video_color}/${_audio_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,391 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,391 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo ""
|
||||
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,391 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,391 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
_net="em0"
|
||||
# _net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
echo " "
|
||||
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,398 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
_net="em0"
|
||||
# _net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
if [ "${_net}" = "em0" ]; then
|
||||
echo " "
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,400 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
_net="em0"
|
||||
# _net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
_net="em0"
|
||||
|
||||
#_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
if [ "${_net}" = "em0" ]; then
|
||||
echo " "
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,400 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
_net="em0"
|
||||
# _net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
_net="ecdv"
|
||||
|
||||
#_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
if [ "${_net}" = "em0" ]; then
|
||||
echo " "
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,400 @@
|
|||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
|
||||
_pink="%{F#FF00B6}"
|
||||
_purple="%{F#7C00FF}"
|
||||
_cyan="%{F#00F0FF}"
|
||||
_blue="%{F#002EFF}"
|
||||
_orange="%{F#FF9E00}"
|
||||
_green="%{F#00FF00}"
|
||||
_red="%{F#FF0000}"
|
||||
_yellow="%{F#FFF000}"
|
||||
|
||||
# Functions
|
||||
|
||||
## Define OS version
|
||||
_os_type(){
|
||||
|
||||
_net=$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')
|
||||
|
||||
case "${_net}" in
|
||||
"em0") _os="Open${_orange}BSD%{F-} ${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
"iwn0") _os="${_cyan}$(sysctl -n kern.osrelease)%{F-} ${_red}$(sysctl -n kern.osversion)%{F-}" ;;
|
||||
esac
|
||||
|
||||
echo "| ${_os}"
|
||||
|
||||
}
|
||||
|
||||
## Thelemic date
|
||||
_thelemic_date(){
|
||||
|
||||
# Vars
|
||||
_dayw=$(date "+%a") ## Day of the week
|
||||
_daym=$(date "+%d") ## Day of the mounth
|
||||
_mounth=$(date "+%m") ## Mounth number
|
||||
_year=$(date "+%Y") ## Current year
|
||||
_year_zero="1904"
|
||||
_year_diff="$(echo "${_year} - ${_year_zero}" | bc)"
|
||||
_year_cicles="$(echo "scale=0; ${_year_diff} / 22" | bc)"
|
||||
_year_cur_cicle="$(echo "${_year_diff} - (${_year_cicles} * 22)" | bc)"
|
||||
#_zone="-z -3" ## Time zone
|
||||
_lat="-20.351034"
|
||||
_log="-40.284485"
|
||||
#_coord="-zl ${_log} ${_lat}"
|
||||
_sun="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | sed 's/[0-9]//g')"
|
||||
_sun_pos="$(astrolog -n ${_zone} ${_coord} | head -4 | tail -1 | awk '{print $3}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_moon="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | sed 's/[0-9]//g')"
|
||||
_moon_pos="$(astrolog -n ${_zone} ${_coord} | head -5 | tail -1 | awk '{print $2}' | ghead -c 2 | sed 's/[A-Z]//')"
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
case $_sun in
|
||||
"Aqu") _sun_done="Aquarii";;
|
||||
"Gem") _sun_done="Geminorum";;
|
||||
"Sag") _sun_done="Sagittarii";;
|
||||
"Tau") _sun_done="Tauri";;
|
||||
"Ari") _sun_done="Arietis";;
|
||||
"Pis") _sun_done="Piscis";;
|
||||
"Cap") _sun_done="Capricorni";;
|
||||
"Can") _sun_done="Cancri";;
|
||||
"Sco") _sun_done="Scorpii";;
|
||||
"Lib") _sun_done="Librae";;
|
||||
"Leo") _sun_done="Leonis";;
|
||||
"Vir") _sun_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_moon in
|
||||
"Aqu") _moon_done="Aquarii";;
|
||||
"Gem") _moon_done="Geminorum";;
|
||||
"Sag") _moon_done="Sagittarii";;
|
||||
"Tau") _moon_done="Tauri";;
|
||||
"Ari") _moon_done="Arietis";;
|
||||
"Pis") _moon_done="Piscis";;
|
||||
"Cap") _moon_done="Capricorni";;
|
||||
"Can") _moon_done="Cancri";;
|
||||
"Sco") _moon_done="Scorpii";;
|
||||
"Lib") _moon_done="Librae";;
|
||||
"Leo") _moon_done="Leonis";;
|
||||
"Vir") _moon_done="Virginis";;
|
||||
esac
|
||||
|
||||
case $_dayw in
|
||||
"Sun") _dayw_done="Solis";;
|
||||
"Mon") _dayw_done="Lunae";;
|
||||
"Tue") _dayw_done="Martis";;
|
||||
"Wed") _dayw_done="Mercurii";;
|
||||
"Thu") _dayw_done="Jovis";;
|
||||
"Fri") _dayw_done="Veneris";;
|
||||
"Sat") _dayw_done="Saturnis";;
|
||||
esac
|
||||
|
||||
case $_net in
|
||||
"em0") _date="Sol in ${_sun_pos}° ${_sun_done} : Luna in ${_moon_pos}° ${_moon_done} : Dies ${_dayw_done} : Anno Vviii e.l." ;;
|
||||
"iwn0") _date="Sol in ${_sun_pos}° ${_sun_done} Luna in ${_moon_pos}° ${_moon_done} Dies ${_dayw_done} Anno Vviii e.l." ;;
|
||||
esac
|
||||
|
||||
# Main function
|
||||
echo "$_date"
|
||||
|
||||
# echo "
|
||||
# ☉︎ in ${_sun_pos}° ${_sun_done}
|
||||
# ☽︎ in ${_moon_pos}° ${_moon_done}
|
||||
# Dies ${_dayw_done}
|
||||
# Anno V:viii a.n.
|
||||
#"
|
||||
}
|
||||
|
||||
## Show current group
|
||||
_grp(){
|
||||
|
||||
_cur_grp="$(xprop -root _NET_CURRENT_DESKTOP | awk -F '=' '{print $2}' | sed 's/ //')"
|
||||
|
||||
echo "[${_cur_grp}]"
|
||||
|
||||
}
|
||||
|
||||
## Show memory usage
|
||||
_mem(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
### Define number of threads
|
||||
if [ "$_smt" = "0" ]; then
|
||||
|
||||
_h="7"
|
||||
|
||||
elif [ "$_smt" = "1" ]; then
|
||||
|
||||
_h="11"
|
||||
|
||||
fi
|
||||
|
||||
### Get memory usage
|
||||
_memo="$(top -d1 | \
|
||||
head -n "${_h}" | \
|
||||
tail -1 | \
|
||||
awk '{print $3}' | \
|
||||
awk -F / '{print $1}')"
|
||||
|
||||
# _memo="1111M"
|
||||
_dig="$(printf '%s' $_memo | sed s/[0-9]*//)"
|
||||
_mem_use="$(printf '%s' $_memo | sed s/[A-Z]*//g)"
|
||||
if [ "${_dig}" = "M" ]; then
|
||||
echo "${_blue}Ram:%{F-} ${_green}$(echo "scale=2; $_mem_use / 1024" | bc)G/16G%{F-}"
|
||||
else
|
||||
echo "${_blue}Ram:%{F-} ${_green}${_mem_use}G/16G%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Define cpu clock rate
|
||||
_cpu_clock(){
|
||||
|
||||
_CSPEED="$(sysctl -n hw.cpuspeed)"
|
||||
|
||||
_CP="$(echo "scale=2; $_CSPEED / 1024" | bc)"
|
||||
|
||||
echo "${_orange}CPU:%{F-} ${_green}${_CP}Ghz%{F-}"
|
||||
|
||||
}
|
||||
|
||||
## Get hardware temperatures
|
||||
_temp(){
|
||||
|
||||
### Some limits
|
||||
y=60
|
||||
r=70
|
||||
|
||||
### Get cpu temp
|
||||
_cpu_temp="$(sysctl -n hw.sensors.cpu0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Get acpitz temp
|
||||
_acpitz_temp="$(sysctl -n hw.sensors.acpitz0.temp0 | awk '{print $1}' | awk -F '.' '{print $1}')"
|
||||
### Correct bug temperature
|
||||
_temp_c="$(echo "scale=0; $_cpu_temp - 15" | bc)"
|
||||
_temp_a="$(echo "scale=0; $_acpitz_temp - 15" | bc)"
|
||||
|
||||
### Some color acording to temperature
|
||||
if [ "$_temp_c" -ge "$r" ]; then
|
||||
_tempc="${_red}${_cpu_temp}ºC%{F-}"
|
||||
elif [ "$_temp_c" -ge "$y" ]; then
|
||||
_tempc="%{F#FFF000}${_temp_c}ºC%{F-}"
|
||||
else
|
||||
_tempc="${_green}${_temp_c}ºC%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_temp_a" -ge "$r" ]; then
|
||||
_tempa="${_red}${_temp_a}ºC%{F-}"
|
||||
elif [ "$_temp_a" -ge "$y" ]; then
|
||||
_tempa="%{F#FFF000}${_temp_a}ºC%{F-}"
|
||||
else
|
||||
_tempa="${_green}${_temp_a}ºC%{F-}"
|
||||
fi
|
||||
|
||||
### Build output
|
||||
echo "${_orange}CPU:%{F-} ${_tempc} ${_purple}ACPITZ:%{F-} ${_tempa}"
|
||||
}
|
||||
|
||||
_fan_speed(){
|
||||
|
||||
_fspeed="$(sysctl -n hw.sensors.acpithinkpad0.fan0 | awk '{print $1}')"
|
||||
|
||||
_fp="$(echo "scale=2; $_fspeed / 1024" | bc)"
|
||||
|
||||
echo -e "${_cyan}FAN:%{F-} ${_green}${_fp}kRPM%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_smt_func(){
|
||||
|
||||
_smt="$(sysctl -n hw.smt)"
|
||||
|
||||
echo "${_purple}SMT:%{F-} ${_green}${_smt}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sec(){
|
||||
|
||||
_sec_lvl="$(sysctl -n kern.securelevel)"
|
||||
|
||||
if [ $_sec_lvl = "1" ]; then
|
||||
|
||||
_result="${_green}$_sec_lvl%{F-}"
|
||||
|
||||
elif [ $_sec_lvl = "2" ]; then
|
||||
|
||||
_result="${_orange}$_sec_lvl%{F-}"
|
||||
|
||||
else
|
||||
|
||||
_result="${_red}ERROR!%{F-}"
|
||||
|
||||
fi
|
||||
|
||||
echo "${_red}Sec_lvl=%{F-} $_result"
|
||||
|
||||
}
|
||||
|
||||
## PF Status
|
||||
_pf(){
|
||||
|
||||
_pf_status="$(rcctl get pf | sed 's/pf=//')"
|
||||
|
||||
case "$_pf_status" in
|
||||
"YES") echo "${_cyan}PF: %{F-}${_green}ON%{F-}";;
|
||||
"NO") echo "${_cyan}PF: %{F-}${_red}OFF%{F-}";;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_rec(){
|
||||
|
||||
_audio="$(sysctl -n kern.audio.record)"
|
||||
_video="$(sysctl -n kern.video.record)"
|
||||
|
||||
if [ $_audio = 0 ]; then
|
||||
_audio_color="${_green}$_audio%{F-}"
|
||||
else
|
||||
_audio_color="${_orange}$_audio%{F-}"
|
||||
fi
|
||||
|
||||
if [ $_video = 0 ]; then
|
||||
_video_color="${_green}$_video%{F-}"
|
||||
else
|
||||
_video_color="${_orange}$_video%{F-}"
|
||||
fi
|
||||
|
||||
echo "${_blue}A/%{F-}${_pink}V:%{F-} ${_audio_color}/${_video_color}"
|
||||
|
||||
}
|
||||
|
||||
_network(){
|
||||
_net="kvav"
|
||||
# _net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_iplocal="$(ifconfig trunk0 | tail -1 | awk '{print $2}')"
|
||||
_wifiname="$(ifconfig iwn0 | tail -1 | awk '{print $3}')"
|
||||
_wifistr="$(ifconfig iwn0 | tail -1 | awk '{print $8}' | sed 's/dBm//')"
|
||||
|
||||
|
||||
if [ "$_wifistr" -ge -45 ]; then
|
||||
_wifistr_color="${_green}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -45 ] && [ "$_wifistr" -ge -60 ]; then
|
||||
_wifistr_color="${_orange}${_wifistr}dbm%{F-}"
|
||||
elif [ "$_wifistr" -lt -60 ]; then
|
||||
_wifistr_color="${_red}${_wifistr}dbm%{F-}"
|
||||
fi
|
||||
|
||||
if [ "$_net" = "em0" ]; then
|
||||
|
||||
echo "${_pink}${_net}:%{F-} ${_green}${_iplocal}%{F-}"
|
||||
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
|
||||
echo "${_pink}${_wifiname}:%{F-} ${_green}${_iplocal}%{F-} ${_wifistr_color}"
|
||||
else
|
||||
echo "${_red}No network!%{F-}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_mail(){
|
||||
|
||||
_mail_count="$(grep '^To:' /var/mail/puffy | wc -l | sed 's/ //g')"
|
||||
|
||||
echo "${_cyan}Mail:%{F-}${_green}${_mail_count}%{F-}"
|
||||
|
||||
}
|
||||
|
||||
_sound(){
|
||||
|
||||
_vol="$(sndioctl -n output.level)"
|
||||
_vol_done="$(echo "scale=0; $_vol * 100" | bc | awk -F'[.=]' '{print $1}')%"
|
||||
|
||||
echo "${_orange}Sound:%{F-} ${_green}${_vol_done}"
|
||||
|
||||
}
|
||||
|
||||
_batt(){
|
||||
|
||||
_full="$(sysctl -n hw.sensors.acpibat0.watthour0 | awk '{print $1}')"
|
||||
|
||||
_real="$(sysctl -n hw.sensors.acpibat0.watthour3 | awk '{print $1}')"
|
||||
|
||||
_percent="$(echo "scale=2; ${_real} / ${_full} * 100" | bc | awk -F '.' '{print $1}')"
|
||||
_state="$(sysctl -n hw.sensors.acpibat0.raw0 | awk '{print $3}' | sed s/\)\,//)"
|
||||
|
||||
case $_state in
|
||||
"discharging") _states="dis" ;;
|
||||
"charging") _states="char" ;;
|
||||
"idle") _states="idle" ;;
|
||||
"full") _states="full" ;;
|
||||
esac
|
||||
|
||||
_y=50
|
||||
_r=30
|
||||
|
||||
if [ "$_percent" -ge "$_y" ]; then
|
||||
_percent_color="${_green}${_percent}%"
|
||||
elif [ "$_percent" -ge "$_r" ]; then
|
||||
_percent_color="${_yellow}${_percent}%"
|
||||
else
|
||||
_percent_color="${_red}${_percent}%"
|
||||
fi
|
||||
|
||||
echo "${_purple}${_states}:%{F-} ${_percent_color}"
|
||||
|
||||
}
|
||||
|
||||
_clock(){
|
||||
|
||||
_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
_day="$()"
|
||||
|
||||
case $_net in
|
||||
"em0") _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
"iwn0") _date=$(date "+%a 1%Y-%m-%d %H:%M:%S") ;;
|
||||
*) _date=$(date "+%a 1%Y-%m-%d e.v. %H:%M:%S") ;;
|
||||
esac
|
||||
|
||||
echo -n "$_date |"
|
||||
|
||||
}
|
||||
|
||||
_space(){
|
||||
|
||||
_net="ecdv"
|
||||
|
||||
#_net="$(ifconfig trunk0 | grep active | head -1 | awk '{print $1}')"
|
||||
|
||||
if [ "${_net}" = "em0" ]; then
|
||||
echo " "
|
||||
elif [ "$_net" = "iwn0" ]; then
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
#$(_thelemic_date) \
|
||||
|
||||
while true; do
|
||||
echo "%{l}%{+u}%{+o}\
|
||||
$(_os_type) \
|
||||
$(_grp) \
|
||||
$(_space) \
|
||||
%{c}$(_space) | \
|
||||
$(_mem) | \
|
||||
$(_smt_func) | \
|
||||
$(_fan_speed) | \
|
||||
$(_temp) | \
|
||||
$(_network) | \
|
||||
$(_sec) | \
|
||||
$(_pf) | \
|
||||
$(_mail) | \
|
||||
$(_rec) | \
|
||||
$(_sound) %{F-}| \
|
||||
$(_batt) %{F-}|\
|
||||
$(_space) \
|
||||
%{r}$(_space) \
|
||||
$(_clock)"
|
||||
sleep 1
|
||||
done
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue