diff --git a/config/sway/config b/config/sway/config index fec160b..6b85002 100755 --- a/config/sway/config +++ b/config/sway/config @@ -12,24 +12,7 @@ client.focused_inactive #000000 #000000 #000000 #000000 client.unfocused #000000 #000000 #000000 #000000 client.urgent #ffffff #ffffff #ffffff #ffffff client.placeholder #000000 #000000 #000000 #000000 - - -bar top { - position top - status_command python3 $base/main/sway_status.py - font pango:Noto Sans Mono 10 - mode dock - - colors { - background #000000 - statusline #ffffff - separator #ffffff - focused_workspace #000000 #ffffff #000000 - active_workspace #000000 #ffffff #000000 - inactive_workspace #000000 #000000 #ffffff - urgent_workspace #ffffff #ffffff #ffffff - } -} +exec waybar for_window [app_id="xpad"] floating enable diff --git a/config/sway/main/getvpn.py b/config/sway/main/getvpn.py new file mode 100644 index 0000000..7c093c6 --- /dev/null +++ b/config/sway/main/getvpn.py @@ -0,0 +1,16 @@ +import os, json, subprocess +from warehouse import http_get, Vpn_cache + +if "wg" in subprocess.run(["ip","link"], capture_output=True, text=True).stdout: + if not os.path.exists(Vpn_cache) or os.path.getsize(Vpn_cache) == 0: + try: + ip = http_get("https://icanhazip.com").strip() + res = json.loads(http_get(f"https://iplookup.stab.ing/api/v1/lookup?ip={ip}"))["country"] + except: + res = "NAY!" + open(Vpn_cache, "w").write(res) + print(f"VPN: {open(Vpn_cache).read()} / ", end="") +else: + try: os.remove(Vpn_cache) + except: pass + print("", end="") \ No newline at end of file diff --git a/config/waybar/config.jsonc b/config/waybar/config.jsonc new file mode 100644 index 0000000..b44bb98 --- /dev/null +++ b/config/waybar/config.jsonc @@ -0,0 +1,71 @@ +{ + "layer": "top", + "position": "top", + "mode": "dock", + "exclusive": true, + + "modules-left": ["sway/workspaces"], + "modules-center": ["sway/window"], + "modules-right": [ + "custom/recording", + "custom/vpn", + "cpu", + "memory", + "pulseaudio", + "battery", + "clock" + ], + + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": false, + "format": "{name}" + }, + + "sway/window": { + "format": "{}", + "max-length": 50, + "rewrite": { + "": "Desktop" + } + }, + + "cpu": { + "interval": 5, + "format": "CPU: {usage:2}% / " + }, + + "memory": { + "interval": 5, + "format": "RAM: {used:0.1f}GiB/{total:.0f}GiB / " + }, + + "pulseaudio": { + "format": "VOL: {volume}% / ", + "format-muted": "VOL: Muted / " + }, + + "custom/recording": { + "exec": "pgrep -x wf-recorder >/dev/null && echo 'RECORDING! / ' || echo ''", + "interval": 1, + "format": "{}" + }, + + "custom/vpn": { + "exec": "python3 ~/.config/sway/main/getvpn.py", + "interval": 2, + "format": "{alt}{text}" + }, + + "battery": { + "interval": 2, + "format": "{capacity}% ({status}) / ", + "format-charging": "{capacity}% (Charging) / ", + "format-plugged": "{capacity}% (Charging) / " + }, + + "clock": { + "interval": 1, + "format": "{:%Y-%m-%d %I:%M %p}" + } +} \ No newline at end of file diff --git a/config/waybar/style.css b/config/waybar/style.css new file mode 100644 index 0000000..9f47fad --- /dev/null +++ b/config/waybar/style.css @@ -0,0 +1,61 @@ +window#waybar { + background-color: #000000; + color: #ffffff; + font-family: "Noto Sans Mono", monospace; + font-size: 13px; + border-radius: 0; +} + +#workspaces button { + padding: 0 5px; + background-color: #000000; + color: #ffffff; + border: none; + border-radius: 0; + box-shadow: none; + text-shadow: none; + transition: none; +} + +#workspaces button:hover { + background-color: #000000; + color: #ffffff; + border: none; + box-shadow: none; +} + +#workspaces button.focused, +#workspaces button.visible { + background-color: #ffffff; + color: #000000; + border-radius: 0; +} + +#workspaces button.focused:hover, +#workspaces button.visible:hover { + background-color: #ffffff; + color: #000000; +} + +#workspaces button.urgent { + background-color: #ffffff; + color: #ffffff; + border-radius: 0; +} + +#window { + color: #ffffff; + background: transparent; + font-weight: bold; +} + +#cpu, #memory, #pulseaudio, #custom-recording, #custom-vpn, #battery, #clock { + padding: 0; + margin: 0; + background: transparent; + border-radius: 0; +} + +.modules-right { + padding-right: 10px; +} \ No newline at end of file