Compare commits

...

4 Commits

Author SHA1 Message Date
tosu 9485609ca2 save 2024-05-16 01:17:29 +02:00
tosu 21ecd8c1d6 Update scripts, nvim, etc. 2024-02-01 00:22:43 +01:00
tosu 15777f7160 Improve connect_to_mx5.sh 2024-02-01 00:21:58 +01:00
tosu ec2d6b5949 Alacritty migration 2023-12-29 17:59:38 +01:00
16 changed files with 578 additions and 70 deletions

55
.bashrc
View File

@ -74,6 +74,9 @@ elif 2>/dev/null 1>&2 command -v vi; then
alias v='vi'
fi
alias tapo_bright='ssh -t pt bash -ic tapo_bright'
alias tapo_color_ambience='ssh -t pt bash -ic tapo_color_ambience'
alias tapo_color_ambience2='ssh -t pt bash -ic tapo_color_ambience2'
alias gdb='gdb -q'
alias objdump='objdump --disassembler-color=extended-color -Mintel'
alias v='nvim'
@ -95,7 +98,7 @@ alias aptclean='sudo apt -y update && sudo apt -y full-upgrade &&
alias pacman='pacman --color=auto'
alias pcker='nvim "${HOME-}"/.config/nvim/lua/*'
alias after='nvim "${HOME-}"/.config/nvim/after/plugin'
alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --time-style=long-iso -bharZ1l'
alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --time-style=long-iso -bharZ1l'
# alias l='lsd --timesort --color=auto -harZ1l'
alias ll='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --fu -bharZ1l'
alias ls='\ls --width="${COLUMNS:-80}" --color=auto -bC'
@ -136,11 +139,14 @@ function cd () {
1>/dev/null command cd - || return 1
1>/dev/null pushd "${pwd}" || return 1
}
CDPATH="${CDPATH}:${HOME}"
CDPATH="${CDPATH}:${HOME}/projects"
CDPATH="${CDPATH}:${HOME}/projects/aoc"
CDPATH="${CDPATH}:${HOME}/projects/aoc/2023"
CDPATH="${CDPATH}:${HOME}/42ecole"
CDPATH="${CDPATH}:${HOME}/42ecole/42cursus"
CDPATH="${CDPATH}:${HOME}/onnea"
function paruuu () {
read -p 'Do system upgrade (Y) or exit (n)' choice
@ -174,7 +180,7 @@ function paruuu () {
&& [ ! "${ssid-}" = "Silmaril 4 (2.4)" ] \
&& [ -n "${ssid-}" ] \
&& : ; then
read -p "You're connected to '${ssid-}', update anyway (Y|n)?" choice
read -p "[31mYou're connected to '${ssid-}', update anyway (Y|n)?[m" choice
if [ ! "${choice}" = "y" -a ! "${choice}" = "Y" -a -n "${choice}" ]; then
exit
fi
@ -239,7 +245,7 @@ function norminette () {
local newst
vers="$($(type -P norminette) -v | cut -d" " -f2)"
newst='3.3.53'
newst='3.3.55'
if [ ! "${vers-}" = "${newst-}" ] ; then
printf "%s\n%b\n" "Norminette v${vers-} instead of v${newst-} detected."\
'\033[31mPlease up-/downgrade\033[m'
@ -327,7 +333,7 @@ export MANPAGER='nvim +Man!'
###################### PROMPT STUFF #######################
# If bash runs in posix mode, if should be `cut -c2-' instead
# shellcheck disable=SC2016
PS0='$(clear -x ; printf "${PS1@P}" ; fc -nl -1 | cut -c3- ; printf "\n")'
# PS0='$(clear -x ; printf "${PS1@P}" ; fc -nl -1 | cut -c3- ; printf "\n")'
if [ ! -f "${HOME}"/.bash-preexec.sh ] ; then
curl --silent --location \
@ -494,29 +500,47 @@ aocload () {
command cat <<- TEMPLATE >> './solution.py'
#!/usr/bin/env python3
print()
import os
import re
import sys
import math
import multiprocessing as mp
from copy import copy, deepcopy
from typing import Any
import numpy as np
import more_itertools as miter
from functools import cache, lru_cache, reduce
from collections import deque, defaultdict, Counter
from itertools import (
repeat, cycle, combinations, combinations_with_replacement,
permutations, tee, pairwise, zip_longest, islice, takewhile,
filterfalse, starmap
)
from collections import deque, defaultdict, Counter
e=enumerate
def pairs(iterable, filler=None):
a, b = tee(iterable)
next(b, None)
return islice(zip(a, b), None, None, 2))
data = open(0).read().strip()
lines = data.splitlines()
for line in lines:
data = open(0).read().strip().splitlines()
R = len(data)
C = len(data[0])
def parse_grid(data: list[str]) -> Any:
for r in range(R):
for c in range(C):
pass
def parse_lines(data: list[str]) -> Any:
for line in data:
line = line.split()
def parse_line(data: list[str]) -> Any:
return data[0].split()
# data = parse_line(data)
# data = parse_lines(data)
data = parse_grid(data)
t = 0
for line in data:
n = 0
t += n
print(t)
TEMPLATE
fi
@ -526,3 +550,6 @@ aocload () {
tmux select-pane -l
tmux send-keys "nvim './solution.py'" ENTER
}
xmodmap ~/.Xmodmap
alias q='docker run --rm -it ghcr.io/natesales/q'

View File

@ -0,0 +1,413 @@
live_config_reload = true
[bell]
animation = "EaseOutExpo"
color = "0xffffff"
duration = 0
[colors.bright]
black = "#5b6268"
blue = "#3071db"
cyan = "#46d9ff"
green = "#4db5bd"
magenta = "#a9a1e1"
red = "#da8548"
white = "#dfdfdf"
yellow = "#ecbe7b"
[colors.cursor]
cursor = "#528bff"
text = "CellBackground"
[colors.normal]
black = "#1c1f24"
blue = "#51afef"
cyan = "#5699af"
green = "#98be65"
magenta = "#c678dd"
red = "#ff6c6b"
white = "#abb2bf"
yellow = "#da8548"
[colors.primary]
background = "#282c34"
foreground = "#bbc2cf"
# foreground = "#000000"
# background = "#ffffff"
[colors.selection]
background = "#3e4451"
text = "CellForeground"
[cursor]
style = "Block"
unfocused_hollow = true
[debug]
log_level = "OFF"
persistent_logging = false
print_events = false
# ref_test = false
render_timer = false
[env]
TERM = "xterm-256color"
[font]
size = 12.0
[font.bold]
family = "IosevkaTerm Nerd Font"
style = "Bold"
[font.bold_italic]
family = "IosevkaTerm Nerd Font"
style = "Bold Italic"
[font.glyph_offset]
x = 0
y = 0
[font.italic]
family = "IosevkaTerm Nerd Font"
style = "Italic"
[font.normal]
family = "IosevkaTerm Nerd Font"
style = "Regular"
[font.offset]
x = 0
y = 0
[[keyboard.bindings]]
action = "Paste"
key = "V"
mods = "Command"
[[keyboard.bindings]]
action = "Copy"
key = "C"
mods = "Command"
[[keyboard.bindings]]
action = "Quit"
key = "Q"
mods = "Command"
[[keyboard.bindings]]
action = "SpawnNewInstance"
key = "N"
mods = "Command"
[[keyboard.bindings]]
action = "ToggleFullscreen"
key = "Return"
mods = "Command"
[[keyboard.bindings]]
chars = "\u001BOH"
key = "Home"
mode = "AppCursor"
[[keyboard.bindings]]
chars = "\u001B[H"
key = "Home"
mode = "~AppCursor"
[[keyboard.bindings]]
chars = "\u001BOF"
key = "End"
mode = "AppCursor"
[[keyboard.bindings]]
chars = "\u001B[F"
key = "End"
mode = "~AppCursor"
[[keyboard.bindings]]
action = "IncreaseFontSize"
key = "Equals"
mods = "Command"
[[keyboard.bindings]]
action = "DecreaseFontSize"
key = "Minus"
mods = "Command"
[[keyboard.bindings]]
action = "ResetFontSize"
key = "Minus"
mods = "Command|Shift"
[[keyboard.bindings]]
chars = "\u001B[5;2~"
key = "PageUp"
mods = "Shift"
[[keyboard.bindings]]
chars = "\u001B[5;5~"
key = "PageUp"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001B[5~"
key = "PageUp"
[[keyboard.bindings]]
chars = "\u001B[6;2~"
key = "PageDown"
mods = "Shift"
[[keyboard.bindings]]
chars = "\u001B[6;5~"
key = "PageDown"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001B[6~"
key = "PageDown"
[[keyboard.bindings]]
chars = "\u001B[1;2D"
key = "Left"
mods = "Shift"
[[keyboard.bindings]]
chars = "\u001B[1;5D"
key = "Left"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001B[1;3D"
key = "Left"
mods = "Alt"
[[keyboard.bindings]]
chars = "\u001B[D"
key = "Left"
mode = "~AppCursor"
[[keyboard.bindings]]
chars = "\u001BOD"
key = "Left"
mode = "AppCursor"
[[keyboard.bindings]]
chars = "\u001B[1;2C"
key = "Right"
mods = "Shift"
[[keyboard.bindings]]
chars = "\u001B[1;5C"
key = "Right"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001B[1;3C"
key = "Right"
mods = "Alt"
[[keyboard.bindings]]
chars = "\u001B[C"
key = "Right"
mode = "~AppCursor"
[[keyboard.bindings]]
chars = "\u001BOC"
key = "Right"
mode = "AppCursor"
[[keyboard.bindings]]
chars = "\u001B[1;2A"
key = "Up"
mods = "Shift"
[[keyboard.bindings]]
chars = "\u001B[1;5A"
key = "Up"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001B[1;3A"
key = "Up"
mods = "Alt"
[[keyboard.bindings]]
chars = "\u001B[A"
key = "Up"
mode = "~AppCursor"
[[keyboard.bindings]]
chars = "\u001BOA"
key = "Up"
mode = "AppCursor"
[[keyboard.bindings]]
chars = "\u001B[1;2B"
key = "Down"
mods = "Shift"
[[keyboard.bindings]]
chars = "\u001B[1;5B"
key = "Down"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001B[1;3B"
key = "Down"
mods = "Alt"
[[keyboard.bindings]]
chars = "\u001B[B"
key = "Down"
mode = "~AppCursor"
[[keyboard.bindings]]
chars = "\u001BOB"
key = "Down"
mode = "AppCursor"
[[keyboard.bindings]]
chars = "\u001B[Z"
key = "Tab"
mods = "Shift"
[[keyboard.bindings]]
chars = "\u001BOP"
key = "F1"
[[keyboard.bindings]]
chars = "\u001BOQ"
key = "F2"
[[keyboard.bindings]]
chars = "\u001BOR"
key = "F3"
[[keyboard.bindings]]
chars = "\u001BOS"
key = "F4"
[[keyboard.bindings]]
chars = "\u001B[15~"
key = "F5"
[[keyboard.bindings]]
chars = "\u001B[17~"
key = "F6"
[[keyboard.bindings]]
chars = "\u001B[18~"
key = "F7"
[[keyboard.bindings]]
chars = "\u001B[19~"
key = "F8"
[[keyboard.bindings]]
chars = "\u001B[20~"
key = "F9"
[[keyboard.bindings]]
chars = "\u001B[21~"
key = "F10"
[[keyboard.bindings]]
chars = "\u001B[23~"
key = "F11"
[[keyboard.bindings]]
chars = "\u001B[24~"
key = "F12"
[[keyboard.bindings]]
chars = "\u007F"
key = "Back"
[[keyboard.bindings]]
chars = "\u001B\u007F"
key = "Back"
mods = "Alt"
[[keyboard.bindings]]
chars = "\u001B[2~"
key = "Insert"
[[keyboard.bindings]]
chars = "\u001B[3~"
key = "Delete"
[[keyboard.bindings]]
chars = "\u0002&"
key = "W"
mods = "Command"
[[keyboard.bindings]]
chars = "\u0002c"
key = "T"
mods = "Command"
[[keyboard.bindings]]
chars = "\u0002n"
key = "RBracket"
mods = "Command|Shift"
[[keyboard.bindings]]
chars = "\u0002p"
key = "LBracket"
mods = "Command|Shift"
[[keyboard.bindings]]
chars = "\u0002o"
key = "RBracket"
mods = "Command"
[[keyboard.bindings]]
chars = "\u0002;"
key = "LBracket"
mods = "Command"
[[keyboard.bindings]]
chars = "\u0002/"
key = "F"
mods = "Command"
[mouse]
hide_when_typing = true
[[mouse.bindings]]
action = "PasteSelection"
mouse = "Middle"
# [mouse.double_click]
# threshold = 300
# [mouse.triple_click]
# threshold = 300
[scrolling]
history = 100000
multiplier = 3
[selection]
save_to_clipboard = false
semantic_escape_chars = ",│`|:\"' ()[]{}<>"
[shell]
args = ["-c", "stdout=\"$(tmux ls -F '#{session_name}|#{?session_attached,attached,not attached}' | grep 'not attached$')\"; [ \"$?\" = \"0\" ] && tmux -2 attach -t \"$(printf ${stdout} | tail -1 | cut -d'|' -f1)\" || tmux"]
program = "/bin/sh"
[window]
dynamic_padding = false
dynamic_title = true
opacity = 1.0
startup_mode = "Windowed"
[window.dimensions]
columns = 90
lines = 25
[window.padding]
x = 0
y = 0

View File

@ -85,6 +85,7 @@ font:
# Point size of the font
size: 11.0
# size: 25.0
# Offset is the extra space around each character. offset.y can be thought of
# as modifying the linespacing, and offset.x as modifying the letter spacing.

View File

@ -11,4 +11,4 @@ ColorMyPencils("gruvbox")
-- ColorMyPencils("habamax")
-- For outside
-- ColorMyPencils("peachpuff")
-- ColorMyPencils("zellner")

View File

@ -86,7 +86,7 @@ null_ls.setup({
}
})
require("norme").setup({
-- Your configuration
cmd = os.getenv('HOME') .. '/.local/bin/norminette'
})
-- require("norme").setup({
-- -- Your configuration
-- cmd = os.getenv('HOME') .. '/.local/bin/norminette'
-- })

View File

@ -4,3 +4,6 @@ vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep: ") })
end)
vim.keymap.set('n', '<leader>pw', function()
builtin.grep_string({ search = vim.fn.expand("<cword>") })
end)

View File

@ -1,24 +1,32 @@
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "vimdoc", "javascript", "typescript", "python", "bash", "c", "lua", "vim", "vimdoc", "query" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { "help" },
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
--- require 'nvim-treesitter.configs'.setup {
--- -- A list of parser names, or "all" (the five listed parsers should always be installed)
--- ensure_installed = { "vimdoc", "javascript", "typescript", "python", "bash", "c", "lua", "vim", "vimdoc", "query" },
---
--- -- Install parsers synchronously (only applied to `ensure_installed`)
--- sync_install = false,
---
--- -- Automatically install missing parsers when entering buffer
--- -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
--- auto_install = true,
---
--- -- List of parsers to ignore installing (for "all")
--- ignore_install = { "help" },
---
--- highlight = {
--- enable = true,
---
--- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
--- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
--- -- Using this option may slow down your editor, and you may see some duplicate highlights.
--- -- Instead of true it can also be a list of languages
--- additional_vim_regex_highlighting = false,
--- },
---
--- incremental_selection = {
--- enable = true,
--- keymaps = {
--- node_incremental = "v",
--- node_decremental = "V",
--- },
--- },
--- }

View File

@ -1,2 +1,3 @@
require("tosu")
vim.cmd('source ~/.vim/plugin/stdheader.vim')
vim.cmd('source ~/.vim/hm.vim')

View File

@ -48,3 +48,9 @@ vim.keymap.set("n", "<leader>c", "mz:s/\\(^\\s*\\)\\(.*$\\)/\\1\\/* \\2 *\\//g<C
vim.keymap.set("n", "<leader>C", "mz:s/\\/\\* \\(.*\\) \\*\\//\\1/g<CR>:noh<CR>`z")
vim.keymap.set("v", "<leader>c", "mz:s/\\(^\\s*\\)\\(.*$\\)/\\1\\/* \\2 *\\//g<CR>:noh<CR>`z")
vim.keymap.set("v", "<leader>C", "mz:s/\\/\\* \\(.*\\) \\*\\//\\1/g<CR>:noh<CR>`z")
vim.fn.setreg("t", "m5`1v`2y`3v`4p`1v`2p`5")
vim.keymap.set("n", "<C-t>", "m3yiwi<CR> <C-w><ESC>m2`1bviwp`2viwp`2i<BS><ESC>`3")
-- vim.keymap.set("i", "{<CR>", "<CR>{<CR>}<ESC>O")
vim.keymap.set("n", "*", "#*")

View File

@ -27,7 +27,8 @@ vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 5
-- vim.opt.scrolloff = 5
vim.opt.scrolloff = 0
vim.opt.signcolumn = 'yes'
vim.opt.isfname:append('@-@')

View File

@ -49,8 +49,8 @@ local function save_profiles(threshold)
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/share/lua/5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/share/lua/5.1/?/init.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/lib/luarocks/rocks-5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/lib/lua/5.1/?.so"
local package_path_str = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1713773202/share/lua/5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1713773202/share/lua/5.1/?/init.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1713773202/lib/luarocks/rocks-5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1713773202/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1713773202/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end

View File

@ -15,6 +15,7 @@
conflictsstyle = diff3
[core]
autocrlf = input
editor = nvim
[alias]
l = log
s = status

View File

@ -8,3 +8,7 @@ set page-completions off
TAB: menu-complete
"\e[Z": menu-complete-backward
# "\e[A": history-substring-search-backward
# "\e[B": history-substring-search-forward
"\C-x\C-r": forward-search-history

View File

@ -1,9 +1,25 @@
#!/bin/sh
#!/bin/bash
set -euo pipefail
###################### STOP ###################
# Put device in pairing mode!!!
# MUST be uppercase
MX5_MAC="AC:80:0A:6D:F3:7B"
MX5_SINK="bluez_sink.AC_80_0A_6D_F3_7B.a2dp_sink"
MX3_MAC="14:3F:A6:A8:7F:CD"
DEVICE_MAC="${MX5_MAC}"
DEVICE_SINK="${MX5_SINK}"
function log () {
printf "\n\033[31m%s\033[m\n" "${@}" >/dev/tty
}
bluetoothctl power on \
&& bluetoothctl connect 14:3F:A6:A8:7F:CD
&& bluetoothctl connect "${DEVICE_MAC}"
sleep 3
bluetoothctl connect "${DEVICE_MAC}" ||
{ sleep 3; bluetoothctl connect "${DEVICE_MAC}"; }
bluetoothctl connect 14:3F:A6:A8:7F:CD ||
{ sleep 3; bluetoothctl connect 14:3F:A6:A8:7F:CD; }
pactl set-default-sink "${DEVICE_SINK}"

View File

@ -6,16 +6,26 @@ done
dlm=" | "
delay=1
whitemode='0'
getColor() {
if [ "${whitemode}" = "1" ]; then
printf '%s' "000000" # black
else
printf '%s' "${1}"
fi
}
getDate() {
date="$(date +"%a %d/%m/%Y %H:%M:%S")"
# [ -n "${date}" ] && date="${dlm}^c#d08770^ ${date}^d^"
[ -n "${date}" ] && date="${dlm}^c#d08770^📅 ${date}^d^"
fontColor="$(getColor 'd08770')"
# [ -n "${date}" ] && date="${dlm}^c#${fontColor}^ ${date}^d^"
[ -n "${date}" ] && date="${dlm}^c#${fontColor}^📅 ${date}^d^"
printf '%s' "${date}"
}
getBattery() {
battery="$(level="$(printf '%s' "$(($(cat /sys/class/power_supply/BAT1/energy_now) * 100000 / $(cat /sys/class/power_supply/BAT1/energy_full)))" | sed "s/\(...\)$/.\1%/")$([ "$(cat /sys/class/power_supply/BAT1/status)" = "Charging" ] && printf '%s' "+" || printf '%s' "-")" ; printf '%s' "${level}" ; printf '%s' "$(date "+%a %d/%m/%Y %H:%M:%S"): ${level}" >> /home/tosuman/.logs/battery.log)"
battery="$(level="$(printf '%s' "$(($(cat /sys/class/power_supply/BAT1/energy_now) * 100000 / $(cat /sys/class/power_supply/BAT1/energy_full)))" | sed "s/\(...\)$/.\1%/")$([ "$(cat /sys/class/power_supply/BAT1/status)" = "Charging" ] && printf '%s' "+" || printf '%s' "-")" ; printf '%s' "${level}" ; printf '%s\n' "$(date "+%a %d/%m/%Y %H:%M:%S"): ${level}" >> /home/tosuman/.logs/battery.log)"
int_battery="$(printf '%s' "${battery}" | sed 's/\..*//')"
if [ "${int_battery}" -lt 11 ] && [ -z "$(pgrep -f qutebrowser)" ] ; then
xdotool key "Super_L+m"
@ -23,85 +33,98 @@ getBattery() {
1>/dev/null 2>&1 qutebrowser "/home/tosuman/infopages/battery_low.html" &
fi
# [ -n "${battery}" ] && battery="${dlm}^c#43f1f1^ ${battery}^d^"
[ -n "${battery}" ] && battery="${dlm}^c#43f1f1^🔋 ${battery}^d^"
fontColor="$(getColor '43f1f1')"
# [ -n "${battery}" ] && battery="${dlm}^c#${fontColor}^ ${battery}^d^"
[ -n "${battery}" ] && battery="${dlm}^c#${fontColor}^🔋 ${battery}^d^"
printf '%s' "${battery}"
}
getLayout() {
layout="$(setxkbmap -query | grep layout | awk -F' ' '{ print $2 }')"
# [ -n "${layout}" ] && layout="${dlm}^c#a3be8c^ ${layout}^d^"
[ -n "${layout}" ] && layout="${dlm}^c#a3be8c^💻 ${layout}^d^"
fontColor="$(getColor 'a3be8c')"
# [ -n "${layout}" ] && layout="${dlm}^c#${fontColor}^ ${layout}^d^"
[ -n "${layout}" ] && layout="${dlm}^c#${fontColor}^💻 ${layout}^d^"
printf '%s' "${layout}"
}
getWifi() {
wifi="$(iw dev wlan0 link | grep SSID | sed -e 's/[[:blank:]]*SSID: //' -e 's/[[:blank:]]*$//')"
[ -n "${wifi}" ] && wifi="${dlm}^c#bf616a^ ${wifi}^d^"
fontColor="$(getColor 'bf616a')"
[ -n "${wifi}" ] && wifi="${dlm}^c#${fontColor}^ ${wifi}^d^"
printf '%s' "${wifi}"
}
getWifi1() {
wifi="$(iw dev wlan1 link | grep SSID | sed -e 's/[[:blank:]]*SSID: //' -e 's/[[:blank:]]*$//')"
[ -n "${wifi}" ] && wifi="${dlm}^c#bf616a^ ${wifi}^d^"
fontColor="$(getColor 'bf616a')"
[ -n "${wifi}" ] && wifi="${dlm}^c#${fontColor}^ ${wifi}^d^"
printf '%s' "${wifi}"
}
getEth () {
eth="$(2>/dev/null ip a show "$(ls /sys/class/net | grep enp | head -1)" | grep -v inet6 | grep inet | awk '{print $2}')"
[ -n "${eth}" ] && eth="${dlm}^c#bf616a^ ${eth}^d^"
fontColor="$(getColor 'bf616a')"
[ -n "${eth}" ] && eth="${dlm}^c#${fontColor}^ ${eth}^d^"
printf '%s' "${eth}"
}
getNord() {
# return 1
nord="$(nordvpn status | grep Status | sed 's/.*Status: //')"
# [ -n "${nord}" ] && nord="${dlm}^c#8fbcbb^嬨 ${nord}^d^"
[ -n "${nord}" ] && nord="${dlm}^c#8fbcbb^🌐 ${nord}^d^"
fontColor="$(getColor '8fbcbb')"
# [ -n "${nord}" ] && nord="${dlm}^c#${fontColor}^嬨 ${nord}^d^"
[ -n "${nord}" ] && nord="${dlm}^c#${fontColor}^🌐 ${nord}^d^"
printf '%s' "${nord}"
}
getBluetooth() {
bluetooth="$(bluetoothctl devices | cut -f2 -d' ' | while read -r uuid ; do bluetoothctl info "${uuid}" ; done | grep -e "Connected\|Name" | sed -e "s/\t//" - | perl -0777 -pe 's/Name: (.*?)\nConnected: yes/<<>>\1/' | grep "<<>>" | sed "s/<<>>//")"
[ -n "${bluetooth}" ] && bluetooth="${dlm}^c#81a1c1^ ${bluetooth}^d^"
fontColor="$(getColor '81a1c1')"
[ -n "${bluetooth}" ] && bluetooth="${dlm}^c#${fontColor}^ ${bluetooth}^d^"
printf '%s' "${bluetooth}"
}
getVolume() {
volume="$(pulsemixer --get-volume | cut -d' ' -f1)%"
[ -n "${volume}" ] && volume="${dlm}^c#93a1a1^🔊 ${volume}^d^"
fontColor="$(getColor '93a1a1')"
[ -n "${volume}" ] && volume="${dlm}^c#${fontColor}^🔊 ${volume}^d^"
printf '%s' "${volume}"
}
getRates() {
rxtxrates="$( (cat /tmp/.datarates ; grep wlan0 /proc/net/dev) | awk '{if(l1){printf "%.3f ↑ %.3f ↓\n", ($2-l1)/1024^2*8, ($10-l2)/1024^2*8} else{l1=$2; l2=$10;}}' )"
grep wlan0 /proc/net/dev > /tmp/.datarates
[ -n "${rxtxrates}" ] && rxtxrates="${dlm}^c#92ee791^${rxtxrates}^d^"
fontColor="$(getColor '92ee79')"
[ -n "${rxtxrates}" ] && rxtxrates="${dlm}^c#${fontColor}1^${rxtxrates}^d^"
printf '%s' "${rxtxrates}"
}
getCpuTemp() {
temp="$(($(cat /sys/class/thermal/thermal_zone0/temp) / 1000))°C"
[ -n "${temp}" ] && temp="${dlm}^c#13a1a1^🌡️ ${temp}^d^"
fontColor="$(getColor '13a1a1')"
[ -n "${temp}" ] && temp="${dlm}^c#${fontColor}^🌡️ ${temp}^d^"
printf '%s' "${temp}"
}
getWattage() {
wattage="$(awk '{printf "%.0f", $1*10^-6}' /sys/class/power_supply/BAT1/power_now)"
[ -n "${wattage}" ] && wattage="${dlm}^c#5e81ac^⚡ ${wattage}W^d^"
fontColor="$(getColor '5e81ac')"
[ -n "${wattage}" ] && wattage="${dlm}^c#${fontColor}^⚡ ${wattage}W^d^"
printf '%s' "${wattage}"
}
getBrightness() {
brightness="$(cat /sys/class/backlight/amdgpu_bl1/brightness)/255"
[ -n "${brightness}" ] && brightness="${dlm}^c#4321f1^🔆 ${brightness}^d^"
fontColor="$(getColor '4321f1')"
[ -n "${brightness}" ] && brightness="${dlm}^c#${fontColor}^🔆 ${brightness}^d^"
printf '%s' "${brightness}"
}
getNumberOfTmuxSessions() {
numberOfSessions="$(2>/dev/null tmux ls | wc -l)"
[ ! "${numberOfSessions}" = "0" ] && numberOfSessions="${dlm}^c#92ee791^ ${numberOfSessions}^d^"
fontColor="$(getColor '92ee79')"
[ ! "${numberOfSessions}" = "0" ] && numberOfSessions="${dlm}^c#${fontColor}1^ ${numberOfSessions}^d^"
printf '%s' "${numberOfSessions}"
}

View File

@ -54,3 +54,7 @@ bind-key -r -T prefix C-k resize-pane -U 2
bind-key -r -T prefix C-l resize-pane -R 2
bind-key -T prefix C-u popup -E '~/.local/bin/tmux_urls.py'
set-option -g set-titles on
run-shell ~/repos/tmux-copycat/copycat.tmux