From 97441f275b2b99ded9880392f170cfb02c6a2ee5 Mon Sep 17 00:00:00 2001 From: Ezri Brimhall Date: Mon, 8 Apr 2024 14:56:26 -0600 Subject: [PATCH] changes --- .../eww/scripts/network.py##hostname.tycho | 33 ++++++++++++++++--- .config/sway/workspaces.json##hostname.tycho | 30 +++++++---------- .config/systemd/user/emacs.service | 2 +- .config/zsh/utils.zsh | 11 +++++++ .emacs.d/settings.org | 6 ++++ 5 files changed, 59 insertions(+), 23 deletions(-) diff --git a/.config/eww/scripts/network.py##hostname.tycho b/.config/eww/scripts/network.py##hostname.tycho index cbca19c..99db78e 100755 --- a/.config/eww/scripts/network.py##hostname.tycho +++ b/.config/eww/scripts/network.py##hostname.tycho @@ -212,10 +212,31 @@ def format_time(time: datetime) -> dict[str, str | int]: # dbus_interface = dbus.Interface(dbus_object, "org.freedesktop.network1.Link") # yield dbus_interface -last_default_route = None -last_ip_data = None -last_request = None -last_first_hop = None +runtime_dir = os.environ.get("XDG_RUNTIME_DIR", "/tmp") + + +def load_last_data(var_name: str): + try: + if os.path.exists(f"{runtime_dir}/{var_name}.json"): + with open(f"{runtime_dir}/{var_name}.json", "r") as f: + return json.load(f), os.path.getmtime(f"{runtime_dir}/{var_name}.json") + + except: + pass + return None, None + + +def store_last_data(var_name: str, data): + with open(f"{runtime_dir}/{var_name}.json", "w") as f: + json.dump(data, f) + + +last_default_route = load_last_data("default_route")[0] +last_ip_data, last_request = load_last_data("ip_data") +try: + last_first_hop = IPAddress(load_last_data("first_hop")[0]) +except: + last_first_hop = None while True: try: @@ -243,9 +264,13 @@ while True: public_ip_data = None else: last_ip_data = public_ip_data + # Write the public IP data to a file + store_last_data("ip_data", public_ip_data) last_default_route = default_route + store_last_data("default_route", default_route) last_request = now() last_first_hop = hop + store_last_data("first_hop", str(hop)) else: public_ip_data = last_ip_data if hop is not None: diff --git a/.config/sway/workspaces.json##hostname.tycho b/.config/sway/workspaces.json##hostname.tycho index 2566d99..ecbabbf 100644 --- a/.config/sway/workspaces.json##hostname.tycho +++ b/.config/sway/workspaces.json##hostname.tycho @@ -16,7 +16,8 @@ { "index": 8, "name": "slack", - "exec": "slack -s", + "exec": "slack", + "args": ["-a"], "program_name": "slack", "memory_profile": { "high": "800M", @@ -44,27 +45,24 @@ { "index": 4, "name": "project", - "exec": "firefox", + "exec": "firefox-beta", "args": ["--new-window"], - "environ": { - "MOZ_ENABLE_WAYLAND": "0" - }, + "environ": {}, "program_name": "firefox" }, { "index": 3, "name": "internet", - "exec": "firefox", + "exec": "firefox-beta", "args": ["--new-window"], - "environ": { - "MOZ_ENABLE_WAYLAND": "0" - }, + "environ": {}, "program_name": "firefox" }, { "index": 2, "name": "code", - "exec": "emacsclient -nc", + "exec": "emacsclient", + "args": ["-nc"], "program_name": "emacsclient" }, { @@ -91,21 +89,17 @@ { "index": 13, "name": "internet", - "exec": "firefox", + "exec": "firefox-beta", "args": ["--new-window"], - "environ": { - "MOZ_ENABLE_WAYLAND": "0" - }, + "environ": {}, "program_name": "firefox" }, { "index": 14, "name": "project", - "exec": "firefox", + "exec": "firefox-beta", "args": ["--new-window"], - "environ": { - "MOZ_ENABLE_WAYLAND": "0" - }, + "environ": {}, "program_name": "firefox" }, { diff --git a/.config/systemd/user/emacs.service b/.config/systemd/user/emacs.service index fd1f878..da18f78 100644 --- a/.config/systemd/user/emacs.service +++ b/.config/systemd/user/emacs.service @@ -7,7 +7,7 @@ PartOf=graphical-session.target Type=forking ExecStart=/usr/bin/emacs --daemon ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" -Environment=SSH_AUTH_SOCK=%t/keyring/ssh +Environment=SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh Environment=ASDF_DATA_DIR=/home/ezri/.local/share/asdf-vm Restart=on-failure Slice=session.slice diff --git a/.config/zsh/utils.zsh b/.config/zsh/utils.zsh index 4077c0e..5354602 100644 --- a/.config/zsh/utils.zsh +++ b/.config/zsh/utils.zsh @@ -46,3 +46,14 @@ function ssh-clean() { ssh -O exit -S $i -q _ 2>/dev/null done } + +function lsssh() { + # List active ssh connections + for i in $(find ~/.ssh/cm/ -type s); do + fname=$(basename $i) + conn=$(echo $fname | cut -d- -f2-) + user=$(echo $conn | cut -d@ -f1) + host=$(echo $conn | cut -d@ -f2 | cut -d: -f1) + echo "$user@$host" + done +} diff --git a/.emacs.d/settings.org b/.emacs.d/settings.org index c442718..96339a5 100644 --- a/.emacs.d/settings.org +++ b/.emacs.d/settings.org @@ -511,3 +511,9 @@ After installing the ~rust-analyzer~ program, the following can be used: ("C-c C-b" . obsidian-backlink-jump) ("C-c C-l" . obsidian-insert-wikilink))) #+END_SRC + +* TRAMP Customization +#+BEGIN_SRC emacs-lisp + (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) + (add-to-list 'tramp-default-proxies-alist (quote ((,(regexp-quote (system-name)) "\\`root\\'" nil)))) +#+END_SRC