diff --git a/home/.config/autoimport/config.toml b/home/.config/autoimport/config.toml index 7b85d8f..ae78fb5 100644 --- a/home/.config/autoimport/config.toml +++ b/home/.config/autoimport/config.toml @@ -11,3 +11,4 @@ "dataclass" = "from dataclasses import dataclass" "sleep" = "from time import sleep" "Path" = "from pathlib import Path" +"pytest" = "import pytest" diff --git a/home/.config/fish/config.fish b/home/.config/fish/config.fish index 2c50237..6092219 100644 --- a/home/.config/fish/config.fish +++ b/home/.config/fish/config.fish @@ -116,6 +116,8 @@ end #source /opt/anaconda/etc/fish/conf.d/conda.fish +set -x EDITOR nvim + # Set FREESURFER_HOME for easier surfin' set FREESURFER_HOME /opt/freesurfer diff --git a/home/.config/i3/config b/home/.config/i3/config index 1d1075c..839f606 100644 --- a/home/.config/i3/config +++ b/home/.config/i3/config @@ -188,13 +188,14 @@ assign [class="Logseq"] $ws4 # Audio/music on workspace 5 assign [class="Pavucontrol"] $ws5 +assign [class="Blueman-manager"] $ws5 for_window [class="Spotify"] move to workspace $ws5 # Chat on workspace 6 assign [class="discord"] $ws6 # Steam on workspace 8 -assign [class="Steam"] $ws8 +assign [class="steam"] $ws8 #################### diff --git a/home/.config/i3status/wrapper.py b/home/.config/i3status/wrapper.py index c00ef94..ce68374 100755 --- a/home/.config/i3status/wrapper.py +++ b/home/.config/i3status/wrapper.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- - # This script is a simple wrapper which prefixes each i3status line with custom # information. It is a python reimplementation of: # http://code.stapelberg.de/git/i3status/tree/contrib/wrapper.pl @@ -23,30 +22,32 @@ # the terms of the Do What The Fuck You Want To Public License (WTFPL), Version # 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more # details. - -import sys -import json -import subprocess import glob -import requests +import json import logging - +import subprocess +import sys from datetime import datetime, timedelta from pathlib import Path from typing import Optional +import requests + logging.basicConfig(level=logging.WARNING) logger = logging.getLogger(__name__) def get_governor(): - """ Get the current governor for cpu0, assuming all CPUs use the same. """ + """Get the current governor for cpu0, assuming all CPUs use the same.""" with open("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor") as fp: return fp.readlines()[0].strip() def get_idletime() -> int: - p = subprocess.run("xprintidle", capture_output=True) + try: + p = subprocess.run("xprintidle", capture_output=True) + except FileNotFoundError: + return 666 * 24 * 60 * 60 return int(round(int(str(p.stdout, "ascii").strip()) / 1000)) @@ -80,6 +81,18 @@ def get_power_draw() -> float: return 0 +def format_idle_time(idle_time: int) -> str: + idlestr = "" + if idle_time > 60 * 60 * 24: + idlestr += f"{idle_time // (60 * 60 * 24)}d " + if idle_time > 60 * 60: + idlestr += f"{idle_time // (60 * 60) % 24}h " + if idle_time > 60: + idlestr += f"{idle_time // 60 % 60}m " + idlestr += f"{idle_time % 60}s" + return idlestr + + gasPricePath = Path("/tmp/gasPrice.json") ethPricePath = Path("/tmp/ethPrice.json") APIKEY = "8AKPUEVKW3UNFKIXRTS5HW5WMWG1UX68QH" @@ -140,17 +153,17 @@ def get_eth_price(): with open(ethPricePath, "r") as f: d = json.load(f) - return float(d["result"]["ethusd"]) + return round(float(d["result"]["ethusd"])) def print_line(message): - """ Non-buffered printing to stdout. """ + """Non-buffered printing to stdout.""" sys.stdout.write(message + "\n") sys.stdout.flush() def read_line(): - """ Interrupted respecting reader for stdin. """ + """Interrupted respecting reader for stdin.""" # try reading a line, removing any extra whitespace try: line = sys.stdin.readline().strip() @@ -276,10 +289,18 @@ def colorpick( idletime = get_idletime() idlecolor = colorpick( - idletime, max_value=3 * 60, max_color="#AAAAAA", above_max_color="#FF5500" + idletime, + max_value=3 * 60, + max_color="#AAAAAA", + above_max_color="#FF5500", ) j.insert( - 0, {"full_text": "💤 %ss" % idletime, "name": "idle", "color": idlecolor} + 0, + { + "full_text": "💤 %s" % format_idle_time(idletime), + "name": "idle", + "color": idlecolor, + }, ) # and echo back new encoded json diff --git a/home/.vimrc b/home/.vimrc index 5d4243c..7700f63 100644 --- a/home/.vimrc +++ b/home/.vimrc @@ -21,7 +21,6 @@ " - Fix proper pane/window/buffer config " - Split into seperate files: one base, one for keys, one for theme, one for syntax, one for plugins " - Make pageup/pagedown move half page and center view -" " Set leader key to space let mapleader = "\" @@ -326,6 +325,7 @@ call plug#end() let g:copilot_filetypes = { \ 'markdown': v:true, \ 'vue': v:true, +\ 'yml': v:true, \} " Set up vim-js-file-import