stepping it back
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Blueman
|
||||||
|
Exec=blueman-applet
|
||||||
|
X-GNOME-Autostart-enabled=true
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=kdeconnect
|
||||||
|
Exec=kdeconnectd
|
||||||
|
X-GNOME-Autostart-enabled=true
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
paste_actions filter
|
paste_actions filter
|
||||||
include current-theme.conf
|
include current-theme.conf
|
||||||
|
font_family Terminus
|
||||||
|
font_size 11
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
paste_actions filter
|
||||||
|
include current-theme.conf
|
||||||
|
font_family Terminus
|
||||||
|
font_size 10
|
||||||
@@ -29,3 +29,7 @@ let flatpak_xdg = [
|
|||||||
$env.XDG_DATA_DIRS = ($base_xdg | append $flatpak_xdg | str join ":")
|
$env.XDG_DATA_DIRS = ($base_xdg | append $flatpak_xdg | str join ":")
|
||||||
|
|
||||||
$env.PATH = ( $env.PATH | split row (char env_sep) | prepend "~/.local/bin" | append "/sbin" | append "/usr/sbin/")
|
$env.PATH = ( $env.PATH | split row (char env_sep) | prepend "~/.local/bin" | append "/sbin" | append "/usr/sbin/")
|
||||||
|
|
||||||
|
def pfind [name: string] {
|
||||||
|
ps | where name =~ $name | select name pid
|
||||||
|
}
|
||||||
+92
-3
@@ -1,8 +1,97 @@
|
|||||||
set $base ~/.config/sway/
|
set $base ~/.config/sway/
|
||||||
|
|
||||||
xwayland enable
|
xwayland enable
|
||||||
exec_always env BASE_SWAY=$base XDG_DATA_DIRS=/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share:/usr/local/share:/usr/share /usr/bin/python3 $base/main/boot.py
|
|
||||||
|
floating_modifier Mod4
|
||||||
|
|
||||||
|
default_border none
|
||||||
|
default_floating_border none
|
||||||
|
|
||||||
|
client.focused #ffffff #ffffff #ffffff #ffffff
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for_window [app_id="xpad"] floating enable
|
||||||
|
|
||||||
|
exec_always gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||||
|
exec_always gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'
|
||||||
|
exec_always gsettings set org.gnome.desktop.interface cursor-size 12
|
||||||
|
exec_always gsettings set org.gnome.desktop.interface font-name 'Noto Sans Mono 10'
|
||||||
|
|
||||||
|
exec_always /usr/lib/xdg-desktop-portal -r
|
||||||
|
|
||||||
|
exec_always swaybg -i $base/wallpaper/metrowaymaka.png -m fill
|
||||||
|
exec_always /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||||
|
exec_always dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK
|
||||||
|
|
||||||
|
bindsym Mod4+h focus left
|
||||||
|
bindsym Mod4+j focus down
|
||||||
|
bindsym Mod4+k focus up
|
||||||
|
bindsym Mod4+l focus right
|
||||||
|
bindsym Mod4+Shift+h move left
|
||||||
|
bindsym Mod4+Shift+j move down
|
||||||
|
bindsym Mod4+Shift+k move up
|
||||||
|
bindsym Mod4+Shift+l move right
|
||||||
|
bindsym Mod4+bracketleft workspace prev
|
||||||
|
bindsym Mod4+bracketright workspace next
|
||||||
|
bindsym Mod4+q exec kitty
|
||||||
|
bindsym Mod4+c kill
|
||||||
|
bindsym Mod4+Shift+s exec python3 $base/main/moves.py screenshot --out ~/screenshots/
|
||||||
|
bindsym Mod4+Shift+Escape exit
|
||||||
|
bindsym Mod4+Up exec pamixer --increase 1
|
||||||
|
bindsym Mod4+Down exec pamixer --decrease 1
|
||||||
|
bindsym Mod4+Shift+grave reload
|
||||||
|
bindsym Mod4+Shift+f exec python3 $base/main/moves.py record --fullscreen
|
||||||
|
bindsym Mod4+r exec wofi --show drun --width 400 --height 500 --layer overlay --location 1
|
||||||
|
bindsym Ctrl+Shift+Alt+Mod4+L exec flatpak run io.github.ungoogled_software.ungoogled_chromium https://www.linkedin.com
|
||||||
|
bindsym Mod4+Shift+c exec python3 $base/main/moves.py kill
|
||||||
|
bindsym Mod4+n exec xpad
|
||||||
|
bindsym Mod4+v floating toggle
|
||||||
|
bindsym XF86AudioPlay exec playerctl play-pause
|
||||||
|
bindsym XF86AudioPause exec playerctl play-pause
|
||||||
|
|
||||||
|
exec_always python3 $base/main/swayworkspace.py init 1
|
||||||
|
bindsym Mod4+1 exec python3 $base/main/swayworkspace.py focus 1
|
||||||
|
bindsym Mod4+Shift+1 exec python3 $base/main/swayworkspace.py move 1
|
||||||
|
bindsym Mod4+2 exec python3 $base/main/swayworkspace.py focus 2
|
||||||
|
bindsym Mod4+Shift+2 exec python3 $base/main/swayworkspace.py move 2
|
||||||
|
bindsym Mod4+3 exec python3 $base/main/swayworkspace.py focus 3
|
||||||
|
bindsym Mod4+Shift+3 exec python3 $base/main/swayworkspace.py move 3
|
||||||
|
bindsym Mod4+4 exec python3 $base/main/swayworkspace.py focus 4
|
||||||
|
bindsym Mod4+Shift+4 exec python3 $base/main/swayworkspace.py move 4
|
||||||
|
bindsym Mod4+5 exec python3 $base/main/swayworkspace.py focus 5
|
||||||
|
bindsym Mod4+Shift+5 exec python3 $base/main/swayworkspace.py move 5
|
||||||
|
bindsym Mod4+6 exec python3 $base/main/swayworkspace.py focus 6
|
||||||
|
bindsym Mod4+Shift+6 exec python3 $base/main/swayworkspace.py move 6
|
||||||
|
bindsym Mod4+7 exec python3 $base/main/swayworkspace.py focus 7
|
||||||
|
bindsym Mod4+Shift+7 exec python3 $base/main/swayworkspace.py move 7
|
||||||
|
bindsym Mod4+8 exec python3 $base/main/swayworkspace.py focus 8
|
||||||
|
bindsym Mod4+Shift+8 exec python3 $base/main/swayworkspace.py move 8
|
||||||
|
bindsym Mod4+9 exec python3 $base/main/swayworkspace.py focus 9
|
||||||
|
bindsym Mod4+Shift+9 exec python3 $base/main/swayworkspace.py move 9
|
||||||
|
bindsym Mod4+0 exec python3 $base/main/swayworkspace.py focus 10
|
||||||
|
bindsym Mod4+Shift+0 exec python3 $base/main/swayworkspace.py move 10
|
||||||
|
|
||||||
include ~/.config/mute/*
|
include ~/.config/mute/*
|
||||||
seat seat0 xcursor_theme DMZ-Black 12
|
|
||||||
exec_always env BASE_SWAY=$base /usr/bin/python3 $base/main/boot.py
|
seat seat0 xcursor_theme DMZ-Black 12
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import os
|
|
||||||
import subprocess
|
|
||||||
from swayipc import Swayipc
|
|
||||||
from warehouse import get_base
|
|
||||||
|
|
||||||
Logs = "/tmp/sway_boot.log"
|
|
||||||
|
|
||||||
|
|
||||||
def apply_safe_config(sway):
|
|
||||||
try:
|
|
||||||
sway.cmd("default_border none")
|
|
||||||
sway.cmd("default_floating_border none")
|
|
||||||
sway.cmd("floating_modifier Mod4")
|
|
||||||
sway.cmd("bindsym Mod4+Shift+grave reload")
|
|
||||||
sway.cmd("bindsym Mod4+Shift+escape exit")
|
|
||||||
sway.cmd("bindsym Mod4+q exec kitty")
|
|
||||||
sway.cmd("bindsym Mod4+c kill")
|
|
||||||
sway.cmd("exec notify-send 'Sway FUCKED!' 'Fallback active'")
|
|
||||||
sway.cmd('for_window [app_id="xpad"] floating enable')
|
|
||||||
except Exception:
|
|
||||||
print("truely fucked")
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def boot(base):
|
|
||||||
base = os.path.expanduser(base)
|
|
||||||
with open(Logs, "w") as f:
|
|
||||||
return subprocess.run(
|
|
||||||
["python3", os.path.join(base, "main/swayconfig.py")],
|
|
||||||
stdout=f,
|
|
||||||
stderr=f
|
|
||||||
).returncode
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
sway = Swayipc()
|
|
||||||
base = get_base()
|
|
||||||
if not base:
|
|
||||||
print("BASE_SWAY isnt defined correctly. This WILL cause problems with startup.")
|
|
||||||
return
|
|
||||||
rc = boot(base)
|
|
||||||
|
|
||||||
if rc != 0:
|
|
||||||
apply_safe_config(sway)
|
|
||||||
subprocess.Popen(["xpad", "-f", Logs])
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -8,6 +8,7 @@ import base64
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from warehouse import Media_flag, rand12
|
from warehouse import Media_flag, rand12
|
||||||
|
from swayipc import Swayipc
|
||||||
|
|
||||||
Recordings = Path.home() / "records"
|
Recordings = Path.home() / "records"
|
||||||
Tmp = tempfile.gettempdir()
|
Tmp = tempfile.gettempdir()
|
||||||
@@ -35,17 +36,16 @@ def find_focused_pid(node):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def force_kill():
|
def force_kill():
|
||||||
tree = json.loads(subprocess.check_output(
|
sway = Swayipc()
|
||||||
["swaymsg", "-t", "get_tree"],
|
tree = sway.tree()
|
||||||
text=True
|
|
||||||
))
|
|
||||||
pid = find_focused_pid(tree)
|
pid = find_focused_pid(tree)
|
||||||
|
|
||||||
if not pid:
|
if not pid:
|
||||||
return
|
return
|
||||||
|
|
||||||
os.kill(pid, 9)
|
os.kill(pid, 9)
|
||||||
|
|
||||||
def is_recording():
|
def is_recording():
|
||||||
return subprocess.run(
|
return subprocess.run(
|
||||||
["pgrep", "-x", "wf-recorder"],
|
["pgrep", "-x", "wf-recorder"],
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import os
|
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import socket
|
|
||||||
import struct
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib.request
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from warehouse import Vpn_cache, Media_flag
|
import pulsectl
|
||||||
|
import psutil
|
||||||
|
|
||||||
|
from warehouse import Vpn_cache, Media_flag, http_get
|
||||||
|
|
||||||
class Cached:
|
class Cached:
|
||||||
def __init__(self, ttl):
|
def __init__(self, ttl):
|
||||||
@@ -25,105 +25,122 @@ class Cached:
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
def http_get(url, timeout=2):
|
|
||||||
try:
|
|
||||||
with urllib.request.urlopen(url, timeout=timeout) as r:
|
|
||||||
return r.read().decode().strip()
|
|
||||||
except Exception:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
class StatusBar:
|
class StatusBar:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.cpu = Cached(5)
|
self.cpu = Cached(5)
|
||||||
self.bat = Cached(5)
|
self.ram = Cached(5)
|
||||||
self.vpn = Cached(60)
|
self.bat = Cached(1)
|
||||||
|
self.vpn = Cached(1)
|
||||||
self.rec = Cached(1)
|
self.rec = Cached(1)
|
||||||
|
|
||||||
def run(self, cmd):
|
|
||||||
return subprocess.run(cmd, capture_output=True, text=True).stdout.strip()
|
|
||||||
|
|
||||||
def get_volume(self):
|
def get_volume(self):
|
||||||
return self.run(["pamixer", "--get-volume-human"])
|
with pulsectl.Pulse("statusbar") as pulse:
|
||||||
|
sink = pulse.get_sink_by_name(
|
||||||
|
pulse.server_info().default_sink_name
|
||||||
|
)
|
||||||
|
|
||||||
|
volume = sink.volume.value_flat * 100
|
||||||
|
|
||||||
|
if sink.mute:
|
||||||
|
return "Muted"
|
||||||
|
|
||||||
|
return f"{volume:.0f}%"
|
||||||
|
|
||||||
def get_ram(self):
|
def get_ram(self):
|
||||||
out = self.run(["free", "-m"]).splitlines()
|
def compute():
|
||||||
mem = next((l for l in out if l.startswith("Mem:")), "")
|
mem = psutil.virtual_memory()
|
||||||
parts = mem.split()
|
used = mem.total - mem.available
|
||||||
if len(parts) < 7:
|
|
||||||
return "?"
|
return f"{used // 1024**3}GB/{mem.total // 1024**3}GB"
|
||||||
total = int(parts[1])
|
|
||||||
used = int(parts[2])
|
return self.ram.get(compute)
|
||||||
return f"{used//1000}GB/{total//1000}GB"
|
|
||||||
|
|
||||||
def get_cpu(self):
|
def get_cpu(self):
|
||||||
def compute():
|
def compute():
|
||||||
try:
|
return f"{psutil.cpu_percent(interval=0.2):.1f}%"
|
||||||
out = self.run(["grep", "cpu ", "/proc/stat"])
|
|
||||||
p = out.split()
|
|
||||||
if len(p) < 8:
|
|
||||||
return "0.0%"
|
|
||||||
user, nice, system, idle = map(int, p[1:5])
|
|
||||||
total = user + nice + system + idle
|
|
||||||
busy = total - idle
|
|
||||||
return f"{(busy / total) * 100:.1f}%"
|
|
||||||
except Exception:
|
|
||||||
return "0.0%"
|
|
||||||
|
|
||||||
return self.cpu.get(compute)
|
return self.cpu.get(compute)
|
||||||
|
|
||||||
def get_battery(self):
|
def get_battery(self):
|
||||||
def compute():
|
def compute():
|
||||||
bat = Path("/sys/class/power_supply/BAT0")
|
bat = psutil.sensors_battery()
|
||||||
if not bat.exists():
|
|
||||||
return ""
|
if bat is None:
|
||||||
try:
|
|
||||||
cap = (bat / "capacity").read_text().strip()
|
|
||||||
status = (bat / "status").read_text().strip()
|
|
||||||
return f"{cap}% ({status})"
|
|
||||||
except Exception:
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
if bat.power_plugged:
|
||||||
|
status = "Charging"
|
||||||
|
else:
|
||||||
|
status = "Discharging"
|
||||||
|
|
||||||
|
return f"{bat.percent:.0f}% ({status})"
|
||||||
|
|
||||||
return self.bat.get(compute)
|
return self.bat.get(compute)
|
||||||
|
|
||||||
def get_vpn(self):
|
def get_vpn(self):
|
||||||
def compute():
|
def compute():
|
||||||
if not self.run(["wg", "show", "interfaces"]):
|
try:
|
||||||
|
with open("/proc/net/dev") as f:
|
||||||
|
interfaces = [
|
||||||
|
line.split(":")[0].strip()
|
||||||
|
for line in f.readlines()[2:]
|
||||||
|
]
|
||||||
|
|
||||||
|
vpn = any(
|
||||||
|
iface.startswith(("wg", "tun", "tap", "ppp"))
|
||||||
|
for iface in interfaces
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if not vpn:
|
||||||
if Vpn_cache.exists():
|
if Vpn_cache.exists():
|
||||||
Vpn_cache.unlink()
|
Vpn_cache.unlink()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
country = ""
|
country = ""
|
||||||
if Vpn_cache.exists():
|
|
||||||
country = Vpn_cache.read_text().strip()
|
|
||||||
|
|
||||||
if not country:
|
try:
|
||||||
ip = http_get("https://ifconfig.me")
|
if Vpn_cache.exists():
|
||||||
geo = http_get(f"https://iplookup.stab.ing/api/v1/lookup?ip={ip}")
|
country = Vpn_cache.read_text().strip()
|
||||||
|
|
||||||
if '"country"' in geo:
|
if not country:
|
||||||
try:
|
ip = http_get("https://ifconfig.me")
|
||||||
country = geo.split('"country":"')[1].split('"')[0]
|
geo = http_get(
|
||||||
except Exception:
|
f"https://iplookup.stab.ing/api/v1/lookup?ip={ip}"
|
||||||
country = ""
|
)
|
||||||
|
|
||||||
if country:
|
country = json.loads(geo).get("country", "")
|
||||||
Vpn_cache.write_text(country)
|
|
||||||
|
|
||||||
return f"VPN: {country or 'Unknown'}"
|
if country:
|
||||||
|
Vpn_cache.write_text(country)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
return f"VPN: {country or 'NAY!'}"
|
||||||
|
|
||||||
return self.vpn.get(compute)
|
return self.vpn.get(compute)
|
||||||
|
|
||||||
def get_recording(self):
|
def get_recording(self):
|
||||||
def compute():
|
def compute():
|
||||||
return "RECORDING!" if self.run(["pgrep", "-x", "wf-recorder"]) else ""
|
for proc in psutil.process_iter(["name"]):
|
||||||
|
try:
|
||||||
|
if proc.info["name"] == "wf-recorder":
|
||||||
|
return "RECORDING!"
|
||||||
|
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
||||||
|
pass
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
return self.rec.get(compute)
|
return self.rec.get(compute)
|
||||||
|
|
||||||
def get_time(self):
|
def get_time(self):
|
||||||
if Media_flag.exists():
|
if Media_flag.exists():
|
||||||
return "0001-01-01 12:00 AM"
|
return "0001-01-01 12:00 AM"
|
||||||
return self.run(["date", "+%Y-%m-%d %I:%M %p"])
|
|
||||||
|
return datetime.now().strftime("%Y-%m-%d %I:%M %p")
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
vol = self.get_volume()
|
vol = self.get_volume()
|
||||||
@@ -138,14 +155,15 @@ class StatusBar:
|
|||||||
|
|
||||||
if extra:
|
if extra:
|
||||||
return f"CPU: {cpu} / RAM: {ram} / VOL: {vol} / {extra} / {t}"
|
return f"CPU: {cpu} / RAM: {ram} / VOL: {vol} / {extra} / {t}"
|
||||||
|
|
||||||
return f"CPU: {cpu} / RAM: {ram} / VOL: {vol} / {t}"
|
return f"CPU: {cpu} / RAM: {ram} / VOL: {vol} / {t}"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
bar = StatusBar()
|
bar = StatusBar()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print(bar.render(), flush=True)
|
print(bar.render(), flush=True)
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
from swayipc import Swayipc
|
|
||||||
import swayworkspace
|
|
||||||
from pathlib import Path
|
|
||||||
from warehouse import get_base
|
|
||||||
|
|
||||||
def run_sh(c):
|
|
||||||
subprocess.Popen(c, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
||||||
|
|
||||||
def apply_ui_and_environment(sway):
|
|
||||||
base = os.path.expanduser(get_base())
|
|
||||||
|
|
||||||
sway.cmd("floating_modifier Mod4")
|
|
||||||
sway.cmd("default_border none")
|
|
||||||
sway.cmd("default_floating_border none")
|
|
||||||
|
|
||||||
sway.cmd("client.focused #ffffff #ffffff #ffffff #ffffff")
|
|
||||||
sway.cmd("client.focused_inactive #000000 #000000 #000000 #000000")
|
|
||||||
sway.cmd("client.unfocused #000000 #000000 #000000 #000000")
|
|
||||||
sway.cmd("client.urgent #ffffff #ffffff #ffffff #ffffff")
|
|
||||||
sway.cmd("client.placeholder #000000 #000000 #000000 #000000")
|
|
||||||
|
|
||||||
sway.cmd('for_window [app_id="xpad"] floating enable')
|
|
||||||
|
|
||||||
sway.cmd("exec_always gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'")
|
|
||||||
sway.cmd("exec_always gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'")
|
|
||||||
sway.cmd("exec_always gsettings set org.gnome.desktop.interface cursor-size 12")
|
|
||||||
sway.cmd("exec_always gsettings set org.gnome.desktop.interface font-name 'Noto Sans Mono 10'")
|
|
||||||
run_sh("wl-paste --watch cliphist store")
|
|
||||||
run_sh("/usr/lib/xdg-desktop-portal -r")
|
|
||||||
sway.cmd("setenv GTK_USE_PORTAL 0")
|
|
||||||
sway.cmd("setenv XDG_CURRENT_DESKTOP sway")
|
|
||||||
sway.cmd("setenv XDG_SESSION_TYPE wayland")
|
|
||||||
sway.cmd("setenv XDG_PORTAL_BACKEND wlroots")
|
|
||||||
|
|
||||||
run_sh(f"swaybg -i {base}/wallpaper/metrowaymaka.png -m fill")
|
|
||||||
run_sh("blueman-applet")
|
|
||||||
run_sh("kdeconnectd")
|
|
||||||
run_sh("/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1")
|
|
||||||
swayworkspace.SwaySome().init(1)
|
|
||||||
run_sh("dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK")
|
|
||||||
|
|
||||||
def bind_keys(sway):
|
|
||||||
base = get_base()
|
|
||||||
mod = "Mod4"
|
|
||||||
|
|
||||||
binding_actions = {}
|
|
||||||
script_path = os.path.abspath(__file__)
|
|
||||||
|
|
||||||
def assign_key(key_combo):
|
|
||||||
def decorator(func):
|
|
||||||
result = func()
|
|
||||||
sway.cmd(f"bindsym {key_combo} {result}")
|
|
||||||
return func
|
|
||||||
return decorator
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+h")
|
|
||||||
def focus_left(): return "focus left"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+j")
|
|
||||||
def focus_down(): return "focus down"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+k")
|
|
||||||
def focus_up(): return "focus up"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+l")
|
|
||||||
def focus_right(): return "focus right"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+h")
|
|
||||||
def move_left(): return "move left"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+j")
|
|
||||||
def move_down(): return "move down"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+k")
|
|
||||||
def move_up(): return "move up"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+l")
|
|
||||||
def move_right(): return "move right"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+bracketleft")
|
|
||||||
def workspace_prev(): return "workspace prev"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+bracketright")
|
|
||||||
def workspace_next(): return "workspace next"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Q")
|
|
||||||
def open_terminal(): return "exec kitty"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+c")
|
|
||||||
def kill_window(): return "kill"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+s")
|
|
||||||
def take_screenshot(): return f"exec python3 {base}/main/moves.py screenshot --out ~/screenshots/"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+escape")
|
|
||||||
def exit_sway(): return "exit"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Up")
|
|
||||||
def volume_up(): return "exec pamixer --increase 5"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Down")
|
|
||||||
def volume_down(): return "exec pamixer --decrease 5"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+grave")
|
|
||||||
def reload_sway(): return "reload"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+f")
|
|
||||||
def record_screen(): return f"exec python3 {base}/main/moves.py record --fullscreen"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+r")
|
|
||||||
def open_menu(): return "exec wofi --show drun --width 400 --height 500 --layer overlay --location 1"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+o")
|
|
||||||
def open_menu(): return "exec cliphist list | wofi -S dmenu --width 400 --height 500 --layer overlay --location 3 | cliphist decode | wl-copy"
|
|
||||||
|
|
||||||
@assign_key("Ctrl+Shift+Alt+Mod4+L")
|
|
||||||
def open_linkedin(): return "exec flatpak run io.github.ungoogled_software.ungoogled_chromium https://www.linkedin.com"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+Shift+c")
|
|
||||||
def force_kill(): return f"exec python3 {base}/main/moves.py kill"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+n")
|
|
||||||
def open_notes(): return "exec xpad"
|
|
||||||
|
|
||||||
@assign_key(f"{mod}+v")
|
|
||||||
def toggle_floating(): return "floating toggle"
|
|
||||||
|
|
||||||
@assign_key("XF86AudioPlay")
|
|
||||||
def media_play(): return "exec playerctl play-pause"
|
|
||||||
|
|
||||||
@assign_key("XF86AudioPause")
|
|
||||||
def media_pause(): return "exec playerctl play-pause"
|
|
||||||
|
|
||||||
for i in range(1, 11):
|
|
||||||
num = 0 if i == 10 else i
|
|
||||||
sway.cmd(f"bindsym {mod}+{num} exec python3 {base}/main/swayworkspace.py focus {i}")
|
|
||||||
sway.cmd(f"bindsym {mod}+Shift+{num} exec python3 {base}/main/swayworkspace.py move {i}")
|
|
||||||
|
|
||||||
return binding_actions
|
|
||||||
|
|
||||||
def build_bar(sway):
|
|
||||||
base = os.path.expanduser(get_base())
|
|
||||||
|
|
||||||
sway.cmd("bar bar-main position top")
|
|
||||||
sway.cmd(f"bar bar-main status_command python3 {base}/main/sway_status.py")
|
|
||||||
sway.cmd("bar bar-main font pango:Noto Sans Mono 10")
|
|
||||||
sway.cmd("bar bar-main mode dock")
|
|
||||||
|
|
||||||
sway.cmd("bar bar-main colors background #000000")
|
|
||||||
sway.cmd("bar bar-main colors statusline #ffffff")
|
|
||||||
sway.cmd("bar bar-main colors separator #ffffff")
|
|
||||||
sway.cmd("bar bar-main colors focused_workspace #000000 #ffffff #000000")
|
|
||||||
sway.cmd("bar bar-main colors active_workspace #000000 #ffffff #000000")
|
|
||||||
sway.cmd("bar bar-main colors inactive_workspace #000000 #000000 #ffffff")
|
|
||||||
sway.cmd("bar bar-main colors urgent_workspace #ffffff #ffffff #ffffff")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sway = Swayipc()
|
|
||||||
apply_ui_and_environment(sway)
|
|
||||||
bind_keys(sway)
|
|
||||||
build_bar(sway)
|
|
||||||
@@ -85,6 +85,10 @@ class Swayipc:
|
|||||||
Output(name=o["name"], focused=o.get("focused", False), active=o.get("active", False))
|
Output(name=o["name"], focused=o.get("focused", False), active=o.get("active", False))
|
||||||
for o in data if o.get("active", False)
|
for o in data if o.get("active", False)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def tree(self):
|
||||||
|
self._send(4, "")
|
||||||
|
return json.loads(self._read())
|
||||||
|
|
||||||
def workspaces(self):
|
def workspaces(self):
|
||||||
self._send(1, "")
|
self._send(1, "")
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ def main():
|
|||||||
sway.focus_abs(n)
|
sway.focus_abs(n)
|
||||||
elif cmd == "move-abs":
|
elif cmd == "move-abs":
|
||||||
sway.move_abs(n)
|
sway.move_abs(n)
|
||||||
|
elif cmd == "init":
|
||||||
|
sway.init(n)
|
||||||
else:
|
else:
|
||||||
print(f"Unknown command: {cmd}", file=sys.stderr)
|
print(f"Unknown command: {cmd}", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# probably shouldnt mess with this!
|
|
||||||
# boot depends on it and if u break it u get no safe mode.
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
Vpn_cache = Path("/tmp/vpn_country.cache")
|
Vpn_cache = Path("/tmp/vpn_country.cache")
|
||||||
Media_flag = Path("/tmp/media_active")
|
Media_flag = Path("/tmp/media_active")
|
||||||
|
|
||||||
def get_base():
|
|
||||||
return os.environ.get("BASE_SWAY")
|
|
||||||
|
|
||||||
def rand12():
|
def rand12():
|
||||||
return base64.urlsafe_b64encode(os.urandom(9)).decode()[:12]
|
return base64.urlsafe_b64encode(os.urandom(9)).decode()[:12]
|
||||||
|
|
||||||
|
def http_get(url, timeout=2):
|
||||||
|
with urllib.request.urlopen(url, timeout=timeout) as r:
|
||||||
|
return r.read().decode().strip()
|
||||||
+8
-3
@@ -6,13 +6,18 @@
|
|||||||
killall pipewire 2>/dev/null
|
killall pipewire 2>/dev/null
|
||||||
killall pipewire-pulse 2>/dev/null
|
killall pipewire-pulse 2>/dev/null
|
||||||
killall wireplumber 2>/dev/null
|
killall wireplumber 2>/dev/null
|
||||||
killall blueman-applet 2>/dev/null
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
export GTK_USE_PORTAL=0
|
||||||
|
export XDG_CURRENT_DESKTOP=sway
|
||||||
|
export XDG_SESSION_TYPE=wayland
|
||||||
|
export XDG_PORTAL_BACKEND=wlroots
|
||||||
|
|
||||||
pipewire &
|
pipewire &
|
||||||
pipewire-pulse &
|
pipewire-pulse &
|
||||||
wireplumber &
|
wireplumber &
|
||||||
blueman-applet &
|
|
||||||
exec_always dbus-update-activation-environment --all \
|
dbus-update-activation-environment --all \
|
||||||
DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK
|
DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK
|
||||||
|
|
||||||
exec dbus-run-session sway
|
exec dbus-run-session sway
|
||||||
@@ -11,13 +11,13 @@ install-alpine:
|
|||||||
|
|
||||||
# my apps
|
# my apps
|
||||||
install-stabs-apps:
|
install-stabs-apps:
|
||||||
doas flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
doas apk add flatpak
|
||||||
@echo "installing my apps"
|
doas flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||||
doas flatpak install -y dev.vencord.Vesktop com.valvesoftware.Steam io.gitlab.librewolf-community
|
@echo "installing my apps"
|
||||||
|
doas flatpak install -y flathub dev.vencord.Vesktop com.valvesoftware.Steam
|
||||||
|
|
||||||
@echo "Permissionizing..."
|
@echo "Permissionizing..."
|
||||||
flatpak override --user --filesystem=home io.gitlab.librewolf-community
|
flatpak override --user --filesystem=home dev.vencord.Vesktop
|
||||||
flatpak override --user --filesystem=home dev.vencord.Vesktop
|
|
||||||
|
|
||||||
stow:
|
stow:
|
||||||
mkdir -p ~/.config/
|
mkdir -p ~/.config/
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ pipewire-pulse
|
|||||||
pipewire-spa-tools
|
pipewire-spa-tools
|
||||||
pipewire-spa-bluez
|
pipewire-spa-bluez
|
||||||
python3
|
python3
|
||||||
py3-qt5
|
py3-psutil
|
||||||
|
py3-pulsectl
|
||||||
cargo
|
cargo
|
||||||
flatpak
|
|
||||||
git
|
git
|
||||||
curl
|
curl
|
||||||
jq
|
jq
|
||||||
@@ -40,4 +40,5 @@ libxkbcommon-dev
|
|||||||
wayland-dev
|
wayland-dev
|
||||||
xwayland
|
xwayland
|
||||||
xwayland-satellite
|
xwayland-satellite
|
||||||
font-noto-emoji
|
font-noto-emoji
|
||||||
|
dex
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
# MY DOTS!
|
# MY DOTS!
|
||||||
|
|
||||||
these are my dot files for sway. Its completely overcomplicated and stupid but i think its cool.
|
these are my dot files for sway.
|
||||||
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.
|
also config for kitty, mako, nu, wofi.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user