From 91ebbe8be8be118d3ac441c267595da851fb7326 Mon Sep 17 00:00:00 2001 From: mitchell Date: Thu, 16 Dec 2021 16:51:31 -0500 Subject: [PATCH] Add conky config; add alias, global var, binding; update fish scripts --- .config/conky/conky.conf | 122 ++++++++++++++++++ .config/fish/functions/define_aliases.fish | 1 + .../functions/define_global_variables.fish | 1 + .../functions/fish_user_key_bindings.fish | 1 + .config/polybar/config | 2 +- .vimrc | 1 + provision_linux | 15 +-- swim | 74 +++++++++++ swim.fish | 52 -------- sync | 48 +++---- 10 files changed, 234 insertions(+), 83 deletions(-) create mode 100644 .config/conky/conky.conf create mode 100755 swim delete mode 100644 swim.fish diff --git a/.config/conky/conky.conf b/.config/conky/conky.conf new file mode 100644 index 0000000..8f0b1f2 --- /dev/null +++ b/.config/conky/conky.conf @@ -0,0 +1,122 @@ +conky.config ={ + -- CONKY SETTINGS + background = true, + update_interval = 1, + total_run_times = 0, + + cpu_avg_samples = 2, + net_avg_samples = 2, + + override_utf8_locale = true, + + double_buffer = true, + no_buffers = true, + + text_buffer_size = 32768, + + -- CONKY: WINDOW SPECIFICATIONS + own_window = true, + own_window_argb_value = 216, + own_window_argb_visual = true, + own_window_class = 'conky', + own_window_name = 'conky', + own_window_colour = '#282828', + -- own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager', + own_window_transparent = false, + own_window_type = 'desktop', + + border_inner_margin = 6, + border_width = 5, + + minimum_height = 1000, + + minimum_width = 280, + maximum_width = 280, + + alignment = 'top_right', + gap_x = 24, + gap_y = 60, + + -- GRAPHICS SETTINGS + draw_shades = true, + draw_outline = false, + draw_borders = false, + draw_graph_borders = true, + + -- TEXT SETTINGS + use_xft = true, + font = 'IBM Plex Sans Regular:size=10', + xftalpha = 0.2, + + uppercase = false, + + -- Pad percentages to this many decimals (0 = no padding) + pad_percents = 2, + + -- COLOUR SETTINGS + default_color = 'ebdbb2', + default_shade_color = '1d2021', + default_outline_color = '1d2021', + color1 = 'fbf1c7', + color2 = '458588', + color3 = '98971a', + color4 = '79740e', + color5 = '689d6a', + color7 = 'cc241d', + color8 = '9d0006', +}; + + +conky.text = [[ +${alignc}${font IBM Plex Sans Light:size=10}${time %A %d %B %Y}${font}${alignc} +${color1}${hr 2}${color} +${voffset -5} +${font IBM Plex Sans Light:size=8}${color1}HOSTNAME:${color}${font} ${alignr}$nodename +${font IBM Plex Sans Light:size=8}${color1}UPTIME:${color}${font} ${alignr}$uptime_short +${font IBM Plex Sans Light:size=8}${color1}KERNEL:${color}${font} ${alignr}$kernel ${voffset 10} +${font :size=11}${color}Network ${hr 2} +${voffset -15} +${font IBM Plex Sans Light:size=10}${color1}IP ADDRESS:${color}${font} ${alignr}${addr br0}${color} +${if_match "${addr br0}"!="No Address"}${voffset 5}${font IBM Plex Sans Light:size=10}${font}Download ${alignr}${downspeedf br0}k/s (${totaldown br0}) +${color1}${downspeedgraph br0 50,280 98971a 79740e -t}${color} +${font IBM Plex Sans Light:size=10}${font}Upload ${alignr}${upspeedf br0}k/s (${totalup br0}) +${color1}${upspeedgraph br0 50,280 9d0006 cc241d -t}${color} +${endif}${voffset 5}${font :size=11}${color}HDD ${hr 2} +${voffset 5}${color1}Used: ${fs_used /}${goto 175}Free:${goto 225}${fs_free /}${color} +${color2}${fs_bar /}${color} +${font IBM Plex Sans Light:size=8}${color1}DISK I/O:${color}${font} ${alignr}$diskio +${voffset 2}${font IBM Plex Sans Light:size=8}${color1}READ: ${font} ${goto 80}${diskiograph_read 15,210 98971a 79740e 750}${color} +${voffset 2}${font IBM Plex Sans Light:size=8}${color1}WRITE:${font} ${goto 80}${diskiograph_write 15,210 9d0006 cc241d 750}${color} +${voffset 10}${font :size=11}Memory ${hr 2}${voffset 2}${font} +${font IBM Plex Sans Light:size=10}RAM $alignc ${font}${color1}$mem / $memmax $alignr ${color4}$memperc%${color} +${color2}$membar${voffset 10}${color} +${font :size=11}GPU ${hr 2}${voffset 2} +${font IBM Plex Sans Light:size=9}${color1}GPU Freq.: $alignr ${color}${font}${nvidia gpufreq} Mhz${voffset 2} +${font IBM Plex Sans Light:size=9}${color1}Memory Freq.: $alignr ${color}${font}${nvidia memfreq} Mhz${voffset 2} +${font IBM Plex Sans Light:size=9}${color1}Temperature: $alignr ${color4}${font}${nvidia temp}°C ${voffset 10}${color} +${font :size=11}CPUs ${hr 2} +${voffset -15} +${font IBM Plex Sans Light:size=10}${color1}CPU:${color}${font} ${alignr}AMD Ryzen 7 3800X +${voffset -15} +${font IBM Plex Sans Light:size=9}${color1}01 - 04:${color}${font} ${goto 100}${cpu cpu1}% ${goto 150}${cpu cpu2 }% ${goto 200}${cpu cpu3 }% ${goto 250}${cpu cpu4 }% +${font IBM Plex Sans Light:size=9}${color1}05 - 08:${color}${font} ${goto 100}${cpu cpu5}% ${goto 150}${cpu cpu6 }% ${goto 200}${cpu cpu7 }% ${goto 250}${cpu cpu8 }% +${font IBM Plex Sans Light:size=9}${color1}09 - 12:${color}${font} ${goto 100}${cpu cpu9}% ${goto 150}${cpu cpu10}% ${goto 200}${cpu cpu11}% ${goto 250}${cpu cpu12}% +${voffset -10} +${font IBM Plex Sans Light:size=9}${color1}CPU TEMP:${color4}${font}${alignr}${hwmon 1 temp 1}°C${color} +${voffset 10}${font :size=11}Processes ${hr 2}${font} +${voffset -15} +${font :size=10}${font IBM Plex Sans Light:size=8}${color1}TOTAL:${color}${font} ${alignr}${processes} +${voffset -12} +${font IBM Plex Sans Light:size=9}${color1}APP NAME: ${goto 160}MEMORY: ${goto 245}CPU: ${color}${font} +${voffset -15} +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 1} ${color}${font} ${goto 160}${top mem 1} % ${goto 235}${top cpu 1} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 2} ${color}${font} ${goto 160}${top mem 2} % ${goto 235}${top cpu 2} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 3} ${color}${font} ${goto 160}${top mem 3} % ${goto 235}${top cpu 3} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 4} ${color}${font} ${goto 160}${top mem 4} % ${goto 235}${top cpu 4} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 5} ${color}${font} ${goto 160}${top mem 5} % ${goto 235}${top cpu 5} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 6} ${color}${font} ${goto 160}${top mem 6} % ${goto 235}${top cpu 6} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 7} ${color}${font} ${goto 160}${top mem 7} % ${goto 235}${top cpu 7} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 8} ${color}${font} ${goto 160}${top mem 8} % ${goto 235}${top cpu 8} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 9} ${color}${font} ${goto 160}${top mem 9} % ${goto 235}${top cpu 9} % +${font IBM Plex Sans Light:size=9}${color1}${top_mem name 10} ${color}${font} ${goto 160}${top mem 10} % ${goto 235}${top cpu 10} % +]]; diff --git a/.config/fish/functions/define_aliases.fish b/.config/fish/functions/define_aliases.fish index 0d9e75d..55d2c9d 100644 --- a/.config/fish/functions/define_aliases.fish +++ b/.config/fish/functions/define_aliases.fish @@ -2,6 +2,7 @@ function define_aliases -a uname -d 'Defines aliases for commonly used commands' alias rcp 'rsync -aP' alias vg 'vagrant' alias tf 'terraform' + alias gco 'gcloud compute' alias tocb 'xclip -in -selection clipboard' alias fromcb 'xclip -out -selection clipboard' alias ssh-rm 'ssh-keygen -f ~/.ssh/known_hosts -R' diff --git a/.config/fish/functions/define_global_variables.fish b/.config/fish/functions/define_global_variables.fish index 66ee3b5..4baa317 100644 --- a/.config/fish/functions/define_global_variables.fish +++ b/.config/fish/functions/define_global_variables.fish @@ -6,6 +6,7 @@ function define_global_variables -d 'Defines all and exclusively globally export set -gx EDITOR nvim set -gx BROWSER firefox + set -gx DIFFPROG nvim -d set -gx FZF_CTRL_T_COMMAND 'ag --hidden --ignore .git -g ""' set -gx FZF_DEFAULT_COMMAND 'ag --hidden --ignore .git -g ""' diff --git a/.config/fish/functions/fish_user_key_bindings.fish b/.config/fish/functions/fish_user_key_bindings.fish index 0f1f5d6..a801560 100644 --- a/.config/fish/functions/fish_user_key_bindings.fish +++ b/.config/fish/functions/fish_user_key_bindings.fish @@ -5,4 +5,5 @@ function fish_user_key_bindings bind --mode insert ,p 'nvim +FZF; commandline -f repaint' bind --mode insert ,w 'nvim +VimwikiIndex; commandline -f repaint' bind --mode insert ,n 'n; commandline -f repaint' + bind --mode insert ,s 'sysz; commandline -f repaint' end diff --git a/.config/polybar/config b/.config/polybar/config index 9ee51a5..7f7b407 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -23,7 +23,7 @@ background-alt = #3c3836 ;foreground = ${xrdb:color7:#222} foreground = #ebdbb2 foreground-alt = #fbf1c7 -primary = #92971a +primary = #98971a secondary = #458588 alert = #cc241d diff --git a/.vimrc b/.vimrc index 1727dfc..16d2444 100644 --- a/.vimrc +++ b/.vimrc @@ -46,6 +46,7 @@ if !exists('g:vscode') Plug 'hashivim/vim-terraform' Plug 'PProvost/vim-ps1' Plug 'vmchale/dhall-vim' + Plug 'baskerville/vim-sxhkdrc' endif call plug#end() diff --git a/provision_linux b/provision_linux index ec25bd5..ca3da73 100755 --- a/provision_linux +++ b/provision_linux @@ -2,13 +2,13 @@ ### Config ### -set -g cmd_func_prefix 'provision' +set -g cmd_func_prefix provision set -g distro for line in (cat /etc/os-release) set -l items (string split --max 1 '=' $line) - if test $items[1] = 'ID' + if test $items[1] = ID set distro $items[2] end end @@ -45,12 +45,11 @@ function provision_terminal_env -d 'Install base terminal utilities and sync con install_pkgs gpg - echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_10/ /' | - sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list - - curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_10/Release.key | - gpg --dearmor | - sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg >/dev/null + echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_11/ /' | + sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list + and curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_11/Release.key | + gpg --dearmor | + sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg >/dev/null end set -l base_pkgs \ diff --git a/swim b/swim new file mode 100755 index 0000000..733b319 --- /dev/null +++ b/swim @@ -0,0 +1,74 @@ +#!/usr/bin/env -S fish --private + +set general_help ' +A collection of useful functions for this project. + +Either run a function like ./swim.fish [arg [arg [...]] +or source the file and run them as commands: +$ source ./swim.fish +$ lint [args] + +Run ./swim help to see it\'s definition. +' + +# Configuration + +set src_fish_files \ + ./install_arch \ + ./provision_linux \ + ./sync \ + ./upgrade_debian \ + ./**.fish \ + ./.**.fish + +# Commands + +function lint -d 'Lint fish scripts' + fish --no-execute $src_fish_files +end + +function format -d 'Format fish scripts' + fish_indent --write $src_fish_files +end + +function sync -d 'Run the sync script' + ./sync $argv +end + +function install_arch -d 'Run the install_arch script' + ./install_arch $argv +end + +function upgrade_debi -d 'Run the debian_upgrade script' + ./upgrade_debian $argv +end + +function provision -d 'Run the provision_linux script with the specified distro' + argparse 'd/distro=' -- $argv + + if test -n "$_flag_d" + set -g distro $_flag_d + end + + ./provision_linux $argv[2..-1] +end + +# --- execution/help handling --- + +function help -a function_name -d 'Displays help for internal function' + if test -n "$function_name" + functions $function_name + else + echo $general_help + end +end + +argparse --ignore-unknown h/help -- $argv + +if test -n "$_flag_h" + help $argv +else if test -n "$argv" + $argv +else + echo $general_help +end diff --git a/swim.fish b/swim.fish deleted file mode 100644 index c15ec6e..0000000 --- a/swim.fish +++ /dev/null @@ -1,52 +0,0 @@ -##!/usr/bin/env fish -# Uncomment this line and the last 2 lines of this file to enable running it like `./swim.fish`. -# -# This swim.fish script serves as a central place to store frequently run commands for this project. -# Replace Commands section with your own command functions. -# Source: https://github.com/mitchell/swim.fish - -# Configuration - -set -g cmd_func_prefix 'swim' # Set the function prefix for defining tasks -set -g fish_files \ - ./install_arch \ - ./provision_linux \ - ./sync \ - ./upgrade_debian \ - ./**.fish \ - ./.**.fish - -# Commands - -function swim_lint -d 'Lint fish scripts' - fish --no-execute $fish_files -end - -function swim_format -d 'Format fish scripts' - fish_indent --write $fish_files -end - -function swim_sync -d 'Run the sync script' - ./sync $argv -end - -function swim_install_arch -d 'Run the install_arch script' - ./install_arch $argv -end - -function swim_upgrade_debi -d 'Run the debian_upgrade script' - ./upgrade_debian $argv -end - -function swim_provision -d 'Run the provision_linux script with the specified distro' - argparse 'd/distro=' -- $argv - - if test -n "$_flag_d" - set -g distro $_flag_d - end - - ./provision_linux $argv[2..-1] -end - -#curl -fsS https://raw.githubusercontent.com/mitchell/swim.fish/master/importable_sw.fish | source -#run_swim_command 'swim' $argv diff --git a/sync b/sync index a741337..f1962d7 100755 --- a/sync +++ b/sync @@ -3,22 +3,23 @@ function main argparse 'd/desktop' 'g/git' -- $argv set -l start_dir (pwd) - set -l tmp_dir (mktemp --directory 2>/dev/null; or mktemp -d -t 'dotfiles') - set -l cwd (string match -r '\w+$' $start_dir) - set -l uname (uname) + and set -l tmp_dir (mktemp --directory 2>/dev/null; or mktemp -d -t 'dotfiles') + and set -l cwd (string match -r '\w+$' $start_dir) + and set -l uname (uname) + or return $status log 'Syncing shell environment configurations' set_color grey setup_tmp_space $cwd $tmp_dir - sync_terminal_env + and sync_terminal_env - set_fish_universal_vars + and set_fish_universal_vars - install_fisher_packages + and install_fisher_packages - install_nvim_plugins + and install_nvim_plugins if test -n "$_flag_d" set_color normal @@ -37,6 +38,7 @@ function main end clean_up_tmp_space $cwd $start_dir $tmp_dir + or return $status set_color normal echo -s \n 'Done syncing.' @@ -45,7 +47,7 @@ end function setup_tmp_space -a cwd tmp_dir if test ! "$cwd" = 'dotfiles' git clone --recurse-submodules https://github.com/mitchell/dotfiles.git $tmp_dir - cd $tmp_dir + and cd $tmp_dir end end @@ -55,29 +57,31 @@ function sync_terminal_env end rsync -aP ./.config/fish ~/.config/ - rsync -aP ./.config/nvim ~/.config/ - rsync -aP ./.tmux-line.conf ~/ - rsync -aP ./.tmux.conf ~/ - rsync -aP ./.vim ~/ - rsync -aP ./.vimrc ~/ - rsync -aP ./.taskrc ~/ + and rsync -aP ./.config/nvim ~/.config/ + and rsync -aP ./.tmux-line.conf ~/ + and rsync -aP ./.tmux.conf ~/ + and rsync -aP ./.vim ~/ + and rsync -aP ./.vimrc ~/ + and rsync -aP ./.taskrc ~/ end function sync_desktop_env -a uname rsync -aP ./.config/kitty ~/.config/ - rsync -aP ./.config/qutebrowser ~/.config/ - rsync -aP ./.ideavimrc ~/ + and rsync -aP ./.config/qutebrowser ~/.config/ + and rsync -aP ./.ideavimrc ~/ + or return 1 switch $uname case Darwin rsync -aP ./.yabairc ~/ - rsync -aP ./.skhdrc ~/ + and rsync -aP ./.skhdrc ~/ case Linux rsync -aP ./.config/bspwm ~/.config/ - rsync -aP ./.config/sxhkd ~/.config/ - rsync -aP ./.config/picom ~/.config/ - rsync -aP ./.config/polybar ~/.config/ + and rsync -aP ./.config/sxhkd ~/.config/ + and rsync -aP ./.config/picom ~/.config/ + and rsync -aP ./.config/polybar ~/.config/ + and rsync -aP ./.config/conky ~/.config/ end end @@ -113,12 +117,12 @@ end function clean_up_tmp_space -a cwd start_dir tmp_dir if test ! "$cwd" = 'dotfiles' cd $start_dir - rm -r $tmp_dir + and rm -r $tmp_dir end end function log -a message - echo \n"---------------- $message ----------------"\n + echo \n"--- $message ---"\n end main $argv