Compare commits
No commits in common. "a03d53503413624b541c59836ff3364a48439a82" and "e7a6168d72aa0bde3f555b8548ea4316f353480e" have entirely different histories.
a03d535034
...
e7a6168d72
|
@ -1,4 +1,4 @@
|
||||||
termux: termux-pkgs termux-dots utils-sh rebuild-sh st pip-pkgs git-annex.linux sssg statusbar-polyfill
|
termux: termux-pkgs termux-dots utils-sh rebuild-sh st pip-pkgs git-annex.linux sssg
|
||||||
|
|
||||||
list: options # alias
|
list: options # alias
|
||||||
options:
|
options:
|
||||||
|
@ -87,6 +87,3 @@ git-annex.linux:
|
||||||
sssg:
|
sssg:
|
||||||
-cp ~/git/sssg/sssg.sh ~/.local/bin/sssg
|
-cp ~/git/sssg/sssg.sh ~/.local/bin/sssg
|
||||||
-chmod +x ~/.local/bin/sssg
|
-chmod +x ~/.local/bin/sssg
|
||||||
|
|
||||||
statusbar-polyfill:
|
|
||||||
cp ~/dot_testing/builds/statusbar/termux-statusbar-polyfill ~/.local/bin
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from multiprocessing import Process, Queue
|
from multiprocessing import Process, Queue
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from sys import argv, stdout
|
from sys import argv
|
||||||
|
from sys import stdout
|
||||||
from math import floor
|
from math import floor
|
||||||
from socket import gethostname
|
|
||||||
import datetime
|
import datetime
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -56,10 +56,7 @@ def filemodfactory(filename: str, modname: str):
|
||||||
|
|
||||||
def new_mail(queue, _):
|
def new_mail(queue, _):
|
||||||
while True:
|
while True:
|
||||||
try:
|
dir_output = os.listdir("/home/usr/Mail/main/INBOX/new")
|
||||||
dir_output = os.listdir("/home/usr/Mail/main/INBOX/new")
|
|
||||||
except FileNotFoundError: # we're on the phone, no mail here
|
|
||||||
return
|
|
||||||
dir_output = len(dir_output)
|
dir_output = len(dir_output)
|
||||||
queue.put({
|
queue.put({
|
||||||
"module": "newmail",
|
"module": "newmail",
|
||||||
|
@ -72,10 +69,7 @@ def bspwm(queue, monitor):
|
||||||
socket.AF_UNIX,
|
socket.AF_UNIX,
|
||||||
socket.SOCK_STREAM
|
socket.SOCK_STREAM
|
||||||
)
|
)
|
||||||
try:
|
client.connect("/tmp/bspwm_1_0-socket")
|
||||||
client.connect("/tmp/bspwm_1_0-socket")
|
|
||||||
except: # perhaps we're on the phone?
|
|
||||||
client.connect("/data/data/com.termux/files/usr/tmp/bspwm_1_0-socket")
|
|
||||||
|
|
||||||
message = "subscribe\0".encode()
|
message = "subscribe\0".encode()
|
||||||
client.send(message)
|
client.send(message)
|
||||||
|
@ -149,57 +143,37 @@ def render(modules) -> str:
|
||||||
print(output, end='')
|
print(output, end='')
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
|
|
||||||
def start_statusbars():
|
|
||||||
# is there an actually good xrandr library?
|
|
||||||
xrandr = subprocess.Popen(['xrandr'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
||||||
output = list(xrandr.stdout)
|
|
||||||
output = [i.decode("utf-8") for i in output if " connected" in i.decode("utf-8")]
|
|
||||||
serialized = []
|
|
||||||
for i in output:
|
|
||||||
splitted = i.split(' ')
|
|
||||||
print(splitted)
|
|
||||||
displayname = splitted[0]
|
|
||||||
geometry = splitted[2]
|
|
||||||
if geometry == "primary":
|
|
||||||
geometry = splitted[3]
|
|
||||||
|
|
||||||
try:
|
|
||||||
geometry_splitted = [int(i) for i in geometry.replace('x', '+').split('+')]
|
|
||||||
except ValueError:
|
|
||||||
continue
|
|
||||||
geometry_splitted[1] = 20
|
|
||||||
print(displayname, geometry_splitted)
|
|
||||||
os.system("st -c statusbar -p -g {}x{}+{}+{} -e statusbar {} & disown".format(
|
|
||||||
*map(str, geometry_splitted),
|
|
||||||
displayname
|
|
||||||
))
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
os.mkdir("/home/usr/.cache/statusbar")
|
os.mkdir("/home/usr/.cache/statusbar")
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
pass
|
pass
|
||||||
except FileNotFoundError:
|
|
||||||
# we're on the phone
|
|
||||||
try:
|
|
||||||
os.mkdir("/data/data/com.termux/files/home/.cache/statusbar")
|
|
||||||
except FileExistsError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if argv[1] == "start_statusbars":
|
if argv[1] == "start_statusbars":
|
||||||
hostname = gethostname()
|
# get the monitors
|
||||||
|
xrandr = subprocess.Popen(['xrandr'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
output = list(xrandr.stdout)
|
||||||
|
output = [i.decode("utf-8") for i in output if " connected" in i.decode("utf-8")]
|
||||||
|
serialized = []
|
||||||
|
for i in output:
|
||||||
|
splitted = i.split(' ')
|
||||||
|
print(splitted)
|
||||||
|
displayname = splitted[0]
|
||||||
|
geometry = splitted[2]
|
||||||
|
if geometry == "primary":
|
||||||
|
geometry = splitted[3]
|
||||||
|
|
||||||
if not hostname == "localhost": # if we're not the phone
|
try:
|
||||||
start_statusbars()
|
geometry_splitted = [int(i) for i in geometry.replace('x', '+').split('+')]
|
||||||
else:
|
except ValueError:
|
||||||
# we are the phone
|
continue
|
||||||
os.system("/data/data/com.termux/files/usr/bin/bash -c 'st -c statusbar -p -g {}x{}+{}+{} -e termux-statusbar-polyfill {} & disown'".format(
|
geometry_splitted[1] = 20
|
||||||
1920, 50, 0, 980,
|
print(displayname, geometry_splitted)
|
||||||
"VNC-0"
|
os.system("st -c statusbar -p -g {}x{}+{}+{} -e statusbar {} & disown".format(
|
||||||
|
*map(str, geometry_splitted),
|
||||||
|
displayname
|
||||||
))
|
))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
queue = Queue()
|
queue = Queue()
|
||||||
modules = [bspwm, clock, battery, batterystatus, sxhkdmode, new_mail]
|
modules = [bspwm, clock, battery, batterystatus, sxhkdmode, new_mail]
|
||||||
[Process(target=module, args=(queue, argv[1])).start() for module in modules]
|
[Process(target=module, args=(queue, argv[1])).start() for module in modules]
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
python3 ~/dot_testing/builds/statusbar/statusbar/statusbar.py $@
|
|
|
@ -183,7 +183,6 @@ case "$(hostname)" in
|
||||||
bspc config top_padding 0
|
bspc config top_padding 0
|
||||||
bspc config bottom_padding 100
|
bspc config bottom_padding 100
|
||||||
mkdir -p ~/.cache/statusbar
|
mkdir -p ~/.cache/statusbar
|
||||||
termux-statusbar-polyfill start_statusbars
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue