From eb2d9ab61ae5b0544d3661dd29cef11cb02e31db Mon Sep 17 00:00:00 2001 From: stabosa87 Date: Mon, 8 Jun 2026 13:21:47 -0500 Subject: [PATCH] update --- config/sway/main/boot.py | 7 ++----- config/sway/main/moves.py | 15 +++++---------- config/sway/main/sway_status.py | 20 ++++++++------------ config/sway/main/swayconfig.py | 4 +--- config/sway/main/swayworkspace.py | 1 + config/sway/main/warehouse.py | 13 +++++++++++++ readme.md | 8 ++++++++ 7 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 config/sway/main/warehouse.py create mode 100644 readme.md diff --git a/config/sway/main/boot.py b/config/sway/main/boot.py index 68b2143..0d5d257 100644 --- a/config/sway/main/boot.py +++ b/config/sway/main/boot.py @@ -1,17 +1,14 @@ import os import subprocess from swayipc import Swayipc - - -def get_base(): - return os.environ.get("BASE_SWAY", os.path.expanduser("~/.config/sway")) - +from warehouse import get_base Logs = "/tmp/sway_boot.log" def apply_safe_config(sway): try: + sway.cmd("default_border pixel 0") sway.cmd("floating_modifier Mod4") sway.cmd("bindsym Mod4+Shift+grave reload") sway.cmd("bindsym Mod4+Shift+escape exit") diff --git a/config/sway/main/moves.py b/config/sway/main/moves.py index ffdd0cc..72ae0f6 100644 --- a/config/sway/main/moves.py +++ b/config/sway/main/moves.py @@ -7,15 +7,11 @@ import tempfile import base64 from datetime import datetime from pathlib import Path +from warehouse import Media_flag, rand12 -Recording_flag = "/tmp/screenshot_active" Recordings = Path.home() / "records" Tmp = tempfile.gettempdir() -def rand12(): - return base64.urlsafe_b64encode(os.urandom(9)).decode()[:12] - - def run(cmd): return subprocess.run(cmd) @@ -46,7 +42,6 @@ def force_kill(): pid = find_focused_pid(tree) if not pid: - print("No focused window PID found") return os.kill(pid, 9) @@ -65,12 +60,12 @@ def record(fullscreen=False): if is_recording(): subprocess.run(["killall", "wf-recorder"]) try: - os.remove(Recording_flag) + os.remove(Media_flag) except FileNotFoundError: pass return - Path(Recording_flag).write_text("1") + Path(Media_flag).write_text("1") slurp_cmd = ["slurp"] if fullscreen: @@ -130,7 +125,7 @@ def resolve_output(out): def take_screenshot(output_path): - Path(Recording_flag).write_text("1") + Path(Media_flag).write_text("1") try: time.sleep(0.2) @@ -164,7 +159,7 @@ def take_screenshot(output_path): finally: try: - os.remove(Recording_flag) + os.remove(Media_flag) except FileNotFoundError: pass diff --git a/config/sway/main/sway_status.py b/config/sway/main/sway_status.py index d3070a1..d9a8cd8 100755 --- a/config/sway/main/sway_status.py +++ b/config/sway/main/sway_status.py @@ -6,11 +6,7 @@ import struct import subprocess import urllib.request from pathlib import Path - - -vpncache = Path("/tmp/vpn_country.cache") -screenshotflag = Path("/tmp/screenshot_active") - +from warehouse import Vpn_cache, Media_flag class Cached: def __init__(self, ttl): @@ -93,13 +89,13 @@ class StatusBar: def get_vpn(self): def compute(): if not self.run(["wg", "show", "interfaces"]): - if vpncache.exists(): - vpncache.unlink() + if Vpn_cache.exists(): + Vpn_cache.unlink() return "" country = "" - if vpncache.exists(): - country = vpncache.read_text().strip() + if Vpn_cache.exists(): + country = Vpn_cache.read_text().strip() if not country: ip = http_get("https://ifconfig.me") @@ -112,7 +108,7 @@ class StatusBar: country = "" if country: - vpncache.write_text(country) + Vpn_cache.write_text(country) return f"VPN: {country or 'Unknown'}" @@ -125,8 +121,8 @@ class StatusBar: return self.rec.get(compute) def get_time(self): - if screenshotflag.exists(): - return "REDACTED" + if Media_flag.exists(): + return "0001-01-01 12:00 AM" return self.run(["date", "+%Y-%m-%d %I:%M %p"]) def render(self): diff --git a/config/sway/main/swayconfig.py b/config/sway/main/swayconfig.py index 79b490f..f567a41 100755 --- a/config/sway/main/swayconfig.py +++ b/config/sway/main/swayconfig.py @@ -4,9 +4,7 @@ import sys from swayipc import Swayipc import swayworkspace from pathlib import Path - -def get_base(): - return os.environ.get("BASE_SWAY") +from warehouse import get_base def run_sh(c): subprocess.Popen(c, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) diff --git a/config/sway/main/swayworkspace.py b/config/sway/main/swayworkspace.py index bd09b2f..ce1ae9a 100755 --- a/config/sway/main/swayworkspace.py +++ b/config/sway/main/swayworkspace.py @@ -3,6 +3,7 @@ import sys from dataclasses import dataclass from swayipc import Swayipc, Output, Workspace import pathlib + class SwaySome(Swayipc): def __init__(self): super().__init__() diff --git a/config/sway/main/warehouse.py b/config/sway/main/warehouse.py new file mode 100644 index 0000000..df0ffcd --- /dev/null +++ b/config/sway/main/warehouse.py @@ -0,0 +1,13 @@ +# probably shouldnt mess with this! +# boot depends on it and if u break it u get no safe mode. +from pathlib import Path +import os + +Vpn_cache = Path("/tmp/vpn_country.cache") +Media_flag = Path("/tmp/media_active") + +def get_base(): + return os.environ.get("BASE_SWAY") + +def rand12(): + return base64.urlsafe_b64encode(os.urandom(9)).decode()[:12] \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..345b962 --- /dev/null +++ b/readme.md @@ -0,0 +1,8 @@ +# MY DOTS! + +these are my dot files for sway. Its completely overcomplicated and stupid but i think its cool. +Instead of using the normal config (i kinda do just for bootup) we use python and sways ipc! + + +also config for kitty, mako, nu, wofi. +