From ac037c8cbbec49d3b495a874807c6304acbd68a4 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Thu, 31 Oct 2024 16:38:22 +0300 Subject: [PATCH] Add dwmscripts --- dwmscripts/calc.py | 59 +++++++++ dwmscripts/calc.sh | 1 + dwmscripts/convert.sh | 8 ++ dwmscripts/dictionary.json | 18 +++ dwmscripts/dwmbar/__init__.py | 3 + .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 313 bytes .../dwmbar/__pycache__/bar.cpython-311.pyc | Bin 0 -> 3337 bytes .../dwmbar/__pycache__/dwmbar.cpython-311.pyc | Bin 0 -> 3252 bytes .../__pycache__/modules.cpython-311.pyc | Bin 0 -> 8822 bytes .../dwmbar/__pycache__/other.cpython-311.pyc | Bin 0 -> 517 bytes dwmscripts/dwmbar/bar.py | 48 +++++++ dwmscripts/dwmbar/main.cc | 0 dwmscripts/dwmbar/modules.py | 125 ++++++++++++++++++ dwmscripts/dwmbar/other.py | 8 ++ dwmscripts/emoji.py | 33 +++++ dwmscripts/emojis.txt | 10 ++ dwmscripts/genpass.py | 18 +++ dwmscripts/layout.py | 28 ++++ dwmscripts/out | Bin 0 -> 1802 bytes dwmscripts/prekol.py | 36 +++++ dwmscripts/scrot.py | 74 +++++++++++ dwmscripts/scrot.sh | 7 + dwmscripts/scrotpy.sh | 3 + dwmscripts/sysbar.py | 22 +++ dwmscripts/turnoffscreen.sh | 1 + 25 files changed, 502 insertions(+) create mode 100644 dwmscripts/calc.py create mode 100755 dwmscripts/calc.sh create mode 100755 dwmscripts/convert.sh create mode 100644 dwmscripts/dictionary.json create mode 100644 dwmscripts/dwmbar/__init__.py create mode 100644 dwmscripts/dwmbar/__pycache__/__init__.cpython-311.pyc create mode 100644 dwmscripts/dwmbar/__pycache__/bar.cpython-311.pyc create mode 100644 dwmscripts/dwmbar/__pycache__/dwmbar.cpython-311.pyc create mode 100644 dwmscripts/dwmbar/__pycache__/modules.cpython-311.pyc create mode 100644 dwmscripts/dwmbar/__pycache__/other.cpython-311.pyc create mode 100644 dwmscripts/dwmbar/bar.py create mode 100644 dwmscripts/dwmbar/main.cc create mode 100644 dwmscripts/dwmbar/modules.py create mode 100644 dwmscripts/dwmbar/other.py create mode 100644 dwmscripts/emoji.py create mode 100644 dwmscripts/emojis.txt create mode 100644 dwmscripts/genpass.py create mode 100644 dwmscripts/layout.py create mode 100644 dwmscripts/out create mode 100644 dwmscripts/prekol.py create mode 100644 dwmscripts/scrot.py create mode 100755 dwmscripts/scrot.sh create mode 100755 dwmscripts/scrotpy.sh create mode 100644 dwmscripts/sysbar.py create mode 100755 dwmscripts/turnoffscreen.sh diff --git a/dwmscripts/calc.py b/dwmscripts/calc.py new file mode 100644 index 0000000..7388a4e --- /dev/null +++ b/dwmscripts/calc.py @@ -0,0 +1,59 @@ +import os +from typing import List +import subprocess +import requests + + +def get_ex_rates() -> float: + response = \ + requests.get("https://www.cbr-xml-daily.ru/daily_json.js").json() + out = {} + for valute in response["Valute"]: + out[valute] = response["Valute"][valute]["Value"] + return out + + +def show_command_out(command: str, return_out: str = True) -> str | None: + if not return_out: + os.system(command) + return + return subprocess.check_output( + command, + shell=True + ).decode("utf-8") + + +def show_dmenu_out(question: str, answers: List[str] = None) -> str: + if not answers: + return show_command_out( + 'cat /dev/null | dmenu -p "{}"'.format( + question + ) + )[:-1] + return show_command_out( + 'echo "{}" | dmenu -p "{}"'.format( + "".join([f"{x}\n" for x in answers])[:-1], + question + ) + )[:-1] + + +def main() -> None: + sentence = show_dmenu_out(">") + try: + ex_rates = get_ex_rates() + for ex_rate in ex_rates: + locals()[ex_rate] = ex_rates[ex_rate] + answer = str(eval(sentence)) + except Exception as exc: + answer = str(exc) + do_copy = show_dmenu_out(f"{sentence} = {answer}", ["Exit", "Copy"]) + if do_copy == "Copy": + show_command_out( + f'echo "{answer}" | xclip -selection clipboard -r', + False + ) + + +if __name__ == '__main__': + main() diff --git a/dwmscripts/calc.sh b/dwmscripts/calc.sh new file mode 100755 index 0000000..e6bc338 --- /dev/null +++ b/dwmscripts/calc.sh @@ -0,0 +1 @@ +python /home/naki/dwmscripts/calc.py diff --git a/dwmscripts/convert.sh b/dwmscripts/convert.sh new file mode 100755 index 0000000..19307c9 --- /dev/null +++ b/dwmscripts/convert.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# xclip -o > /tmp/convert.txt; iconv -f WINDOWS-1251 -t UTF-8 /tmp/convert.txt | xclip -selection clipboard +# { echo "." & ms-gen 10 9; } | xclip -selection clipboard +# /home/plaza/dwmscripts/main 10 10 | xclip -selection clipboard +# xclip -o | base64 | xclip -selection clibboard -r +# printf "worried\nthinking\nshrug\nangry\nangrysight\ncuddles\nhappy\ncrying\ndancing\nconfused" | dmenu -l 20 -p "Select emoji" | +python /home/naki/dwmscripts/emoji.py diff --git a/dwmscripts/dictionary.json b/dwmscripts/dictionary.json new file mode 100644 index 0000000..27794e0 --- /dev/null +++ b/dwmscripts/dictionary.json @@ -0,0 +1,18 @@ +{ + "panic": "(つ﹏⊂)", + "thinking": "(;・・)ゞ", + "shrug": "¯\\(ツ)/¯", + "angry": "ヾ(`д´*)ノ", + "angrysight": "(⚞︵⚟)", + "happysight": "(≧ω≦)", + "cuddles": "(つ´∀`)つ", + "happy": "(^▽^)", + "cryinghappy": "(*≧▽≦)", + "confusedhappy": "(.❛ ᴗ ❛.)", + "crying": "( ≧Д≦)", + "dancing": "ヽ(o´∀´)ノ♪♬", + "confused": "(´・_・´)", + "cute": "(⌒ω⌒)", + "sleeping": "(∪。∪)。。。zzz", + "writing": "__φ(..)" +} \ No newline at end of file diff --git a/dwmscripts/dwmbar/__init__.py b/dwmscripts/dwmbar/__init__.py new file mode 100644 index 0000000..6ca8f39 --- /dev/null +++ b/dwmscripts/dwmbar/__init__.py @@ -0,0 +1,3 @@ +from dwmbar.bar import Bar +import dwmbar.modules +from dwmbar.other import get_command_out diff --git a/dwmscripts/dwmbar/__pycache__/__init__.cpython-311.pyc b/dwmscripts/dwmbar/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..747445e74904e5ad0795b8a0b9eafc95457a3a4a GIT binary patch literal 313 zcmZ3^%ge<81o@XbQlfzLV-N=hn4pZ$YCy(xh7^Vr#vF!R#wbQc5SuB7DT*0LGv~16 zvPQ82#h8K_G+ADPG-)#4Vs=U_@&nTR>8U00$@#gtiFqmU`K2YAY`3^l%5#$vi}ZlF zh#9E*79Ug~H$SB`C$;z%8-#z02P&Rll95_e!~#^hlHoJR{9hXS8Tq-X`gw`jnfgFQ z#mPmP1trBGCeTp*`1s7c%#!$cy@JYL95xVB?TUDS8X1AO*cwQDU}j`wyul!K0Tta~ S5WN6HHyAW7U_(Wq5CZ@;MOGF7 literal 0 HcmV?d00001 diff --git a/dwmscripts/dwmbar/__pycache__/bar.cpython-311.pyc b/dwmscripts/dwmbar/__pycache__/bar.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f84f6ae10432ccdf49e5ad3e4392a92cbf6e413d GIT binary patch literal 3337 zcmaJ@TW=f36`t7}uOg|-+E(JrTFwQG8Y)Oq8%bQ-G8`Lm455LIJO~N43}-1*Cb`P& zDy|7C(Sw3g1>4ew0x4($=*g841aX1(PZWI+0X+~42ndiTKLns47bpZ2?m4q0#g*L- zch8)eIWzO^Ip3V&Uj_!E1j^5YKd^r)g#3h!Zh^KayO*F^C5$jyBqcgcDe6*DnwFrJ zi*iYsR!Z`;Oo>FU5T+~(nOEKqR%nO;+++SV1)su0q#Sd41gb@t32Yx z3V_@(bM}1M^<)RIYus|@d3h=)cOYYh?!)%(uR*Mms#GN=XntXIiMV~%ReGO-!{GJH zC2}8>@48I_b9>HY1RzOMxt=jtsqhZNyZZ|et7HZyd_1^7-98&ef?M2`>O-&)z045@ z1VYNZ=26qZeGFso)Wl7@WKEQ_w+a*NcFD={!kp`%`bm~gz?+%7vll&EEI4k?F3p{* z7~rCeX%@-_*EBO{i*_zsbk2d&wHSbfo#P-D$)-N(KO2Kz&8%5>%PZwx*DhF)w9MmB z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bHDvXBI?Trj)kG*kwaC%UXFYB06$&5mwAjJE$IloLSpEyq C>bmCu literal 0 HcmV?d00001 diff --git a/dwmscripts/dwmbar/__pycache__/dwmbar.cpython-311.pyc b/dwmscripts/dwmbar/__pycache__/dwmbar.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93adc12f6a47fa29f0518e1a424d0c3cbe42c958 GIT binary patch literal 3252 zcmaJ?+iP4!7@s+}ybMMG3)T=|iL(w>xLkt!MYdIVZiW zTN)(dMgk_1l86=JOHC2+Nl;M#0bjC^hj1Vu_|&&8sUUsP@0+u`$w^yh&wlgG%r`T? z`L5rkQgH&U`;U*#JY-0|>e`ky>MLHUY!zDaqKmW! zYc*izh((4eBg0aR#0cwVvL!RcQkcrLqQ)W2upyJYDJ3*OHL@m zF)>bA(blds%*A0{E=nu|e1hdzmz8Xtumw&?F%58U^<@BjA64ZOKT!hYu32!#DxNR9 zfL-I3H^wVN1-S(oJ5(Qz*WLv(M`}`yn7{>%(Fx*hkgn0Y6ch&kpq(Lif%(2YB(S%m zOhy2bG*svagA`uY4ga-6K<3B@Y`B=cNxcm+;R9!+sjm0PJ;D(LSV8K2$)~1^m+1PV z{e736veh?g=d1ZXcCG9dcxlvg`!3}<4x#HEz40hMV3%C4;FL#CR&`KNuW6PlCC@Z_ z2W+R1x80M#v?Wq-vbz(=I9bXK1mD8zw?}45v!%|&8mtpT=1J&$mFFuXmahtR8?vvs zmR;ltSQ6_lBG+}D_eCJ%q!}kY+v>_xbVXeMLvHcohH-q^I1aZr zas$h`0a%RJ;m32Zfukz?#MmgydzLAjvtt2RQQ!IJCcxu=&ZMRb}Q zy6rflMucl{58n#Jmu;)Uw;`tmR`Atp9GrpUdkmFtN68(yu8O04TJkkK%)RWQ2>3?J zJNOp3Pp?cul8)8IXio{{^n|K$2Z63y*t&fPTe`x$Q@qJ9c~hu zdQOmOx{~dgJ~tbgOMjVeWcB5&z9hbtWcG`9K7VI&aB8qVxSD%r=ECfS`q|ZF*Yx3q zt&0b~-QC#oQX_eEIeBy`d9;~=3x$XI@`u)q!bYb;UN{xT38V~i1^S@X=(_14Zt2iH zDs*E=fgbjPSSxyifJm6;h~;7Im}WH-#6)KT&vLUsKmk#b?U}01@0+@{6x|&FQ?KUj zF)NhK5SD<33J>6d3;o4mEIyz_pPTURaaS}bJSDC`mn{2iFj04Jjhz&+mTq)3@G5q(3>U1b5t6{U@aL5P11Rs0({ydNt+*6|?@u}?x)z;i?e zx&X{=+NwbZZqi9w;yj zBSCj-IoY^~0p0^M)m>;hkvN`ImJZ{lH-Y>EzDA@}W}PgaYsGt0hWYyW+i%P(^XKkF zW(H>m8!3I^l}74?b!ou~=e++fv}*P`xHESgPd`%0mo0toBf8g6edUT%s)+n19M6{= z*Vo(|F2rd&Vz6BKvNPt1$9&MvVY~4$B8Q2`7zq610QgEe`^CuTBTXrUUm*JFz;E); zXMTzO8f)~QUhY3FCLiEKA0l}mE1CF10tE6vB3F-biCf#+RF>A2-di!^UjnlcxF6Sl(`}$fb(M z`*1rtrLPukC+~@L&CwY-#u~?`ax|2$Tyh+nqb4|JFL8fhY78%q1nY;Jg%}?1{F)ls zxqGEM*NkZDi6#N^XKs5_#eqiBUBPse#M8}KTR=z!BpX%xn*_*0PIQZ&=r)rcMcwmf zD%(_{hhyV#EOI1FlB%i;Dd<5eyR8{PF1Q>y5+-S??wRj~@`Fc(iKeN2h_G*-iEc6I z1pg!wC<|3&Xnx`n1VvyIH_-GkRG=unSUZI(H|h9MbRgJqlAiz(Op`9wfTm0-T_Jmx g!ruysjf>w3*}3$juc;XnUhp`1fO8L@upplBAI7kvi2wiq literal 0 HcmV?d00001 diff --git a/dwmscripts/dwmbar/__pycache__/modules.cpython-311.pyc b/dwmscripts/dwmbar/__pycache__/modules.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2dcf5878eb04fa3c23be9fa80f1589333b49ddc GIT binary patch literal 8822 zcmb_hU2GFq7M@>w;y7^<$4MXr3`q#)C!zcA<2(1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t-9|;E^vo@Ny zQY}i%AB!v0l^|xrzBd#-5l4Oe_}<6)|49m~9&8-&XsyxhGVh3f=%hG7_tYIKocCO9bM4#Ht{oZI zj%0tb|It0iYJegYkb*CeY~yOow`T2i*dZrE`=dvXz-jGu(+zW#tKcZ@0^9H_J(qiC zgtW6guSDyEOjiqYR$~nuXla9>-v!|dcW$O z-J5RRJ{$O3=r5r={5R2C(Ye;X%&G&a!EAj~YH(_BhMzh4MRmHq6E9MOIgx2tk#iLW zsNj8xC$jwEWap>$J8=G zat=-f;UdT?{Bj%zU!aa49B)G00e?S>X!^ycdumjh5?EYTsNZ9%oqlkj$w``XB73ln?mG~#(3Oqa9UXsJs_L=SqkZG+B~j=MPR=MfpgEpp z*(~FkGagx{YJ&c`*G_VjN%p_%fh^-4n))t-x12hwyPiS3O Ighfs8|M<0`#Q*>R literal 0 HcmV?d00001 diff --git a/dwmscripts/dwmbar/__pycache__/other.cpython-311.pyc b/dwmscripts/dwmbar/__pycache__/other.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a338ecb6489e126502736478c64c4f49a9e2f2ce GIT binary patch literal 517 zcmZ`$Jxc>I7*3k|DE+V~*il4qxIu4qP=7*~7KARPy`)}kuQ`$&qBy8@=s&27(5WKz z$A~zT11Bf9lL|s7-_*9a_>w%&lQ(&vyde+yd`oQQSdQ zL{kh?LUGfeM$f3GC@v$%{LqI>vF-67sCQ{>38o^^_3*+(lQtwUrxkz!Qh)Z&R{9FA zc}k5^2#sO>#&D&U8O@Z8plZCTgf@&)#lf*Deb(t*nvrVm9XKS;$fywt?lCFjoaZyI zUE`4oBNbbed7Lr_3*DF0R@<{(*XIFqyY+Ub1ukPwXV1g$?WM`9Vccvnsk(6BP6e_?L_ E1E803OaK4? literal 0 HcmV?d00001 diff --git a/dwmscripts/dwmbar/bar.py b/dwmscripts/dwmbar/bar.py new file mode 100644 index 0000000..85ab3f3 --- /dev/null +++ b/dwmscripts/dwmbar/bar.py @@ -0,0 +1,48 @@ +from dwmbar.modules import BarItem +import os +from time import sleep, time + + +class Bar: + def __init__( + self, + items_count: int = 10, + sep: str = '' + ) -> None: + self.sep = sep + self.items = [BarItem(False) for _ in range(items_count)] + + def start(self, update_time: float = 0) -> None: + """After call this function program will start infinity loop""" + while True: + start = time() + for i in range(len(self.items)): + self[i].update() + self.write() + finish = time() + sleep_time = update_time - (finish - start) + sleep(0 if sleep_time < 0 else sleep_time) + + def __getitem__( + self, + key: int + ) -> BarItem: + return self.items[key] + + def __setitem__( + self, + key: int, + value: BarItem + ) -> None: + self.items[key] = value + + def __len__(self) -> int: + return len(self.items) + + def write(self, reversed: bool = True) -> None: + out = ' ' + ''.join( + [str(self[i]) + ' / ' for i in range(len(self)) + if self[i] + ] + )[:-3] + ' ' + os.system(f"xsetroot -name \"{out}\"") diff --git a/dwmscripts/dwmbar/main.cc b/dwmscripts/dwmbar/main.cc new file mode 100644 index 0000000..e69de29 diff --git a/dwmscripts/dwmbar/modules.py b/dwmscripts/dwmbar/modules.py new file mode 100644 index 0000000..5738136 --- /dev/null +++ b/dwmscripts/dwmbar/modules.py @@ -0,0 +1,125 @@ +from subprocess import CalledProcessError +import psutil +from datetime import datetime +from dwmbar.other import get_command_out + + +class BarItem: + def __init__( + self, + filled: bool = True + ) -> None: + self.filled = bool(filled) + self.out = '' + + def update(self) -> None: + pass + + def __str__(self) -> str: + return self.out + + def __bool__(self) -> bool: + return self.filled + + +class TimeItem(BarItem): + def update(self) -> None: + #  + now = datetime.now() + if now.strftime("%p") == "AM": + self.out = " " + else: + self.out = " " + self.out += datetime.now().strftime("%I:%M") + + +class RAMItem(BarItem): + def __init__(self) -> None: + """RAM in G""" + super().__init__(True) + self.divider = 2**30 + self.total = round(psutil.virtual_memory()[0] / self.divider, 1) + + def update(self) -> None: + used = round(psutil.virtual_memory()[3] / self.divider, 1) + self.out = f" {used}G" + + +class LayoutItem(BarItem): + def update(self) -> None: + self.out = ' ' + get_command_out( + "setxkbmap -query | grep layout" + ).split()[-1].upper() + + +class CPUUsageItem(BarItem): + def update(self) -> None: + usage = psutil.cpu_percent() + usage = f"{usage}" if usage % 1 else f"{int(usage)}.0" + self.out = f" {usage:0>4}%" + + +class DiskUsageItem(BarItem): + def __init__(self, divider: int = 10**9) -> None: + super().__init__(True) + """Disk in GB""" + self.divider = 10**9 + self.total = round(psutil.disk_usage('/').total / self.divider, 1) + + def update(self) -> None: + used = round(psutil.disk_usage('/').used / self.divider, 1) + self.out = F" {used}G/{self.total}G" + + +class BatteryItem(BarItem): + def __init__(self, hide_if_full: bool = False) -> None: + super().__init__(True) + # self.hide_if_full = hide_if_full + + def update(self) -> None: + battery = psutil.sensors_battery() + # plugged = battery.power_plugged + percent = round(battery.percent) + # self.out = f" {'#' if plugged else '*'}{percent}%" + self.out = f" {percent}%" + # self.filled = False if self.hide_if_full and percent == 100 else True + + +class VolumeItem(BarItem): + def update(self) -> None: + volume = get_command_out( + "amixer get Master | awk -F'[][]' 'END{ print $4\":\"$2 }'" + ) + self.out = " " + volume[volume.find(":") + 1:-1] + + +class MusicItem(BarItem): + def update(self) -> None: + try: + status = get_command_out("cmus-remote -Q") + except CalledProcessError: + self.out = " cmus" + return + if "file" not in status: + self.out = " cmus" + return + for var in status.split("\n"): + args = var.split() + if not args: + continue + match args[0]: + case "status": + if args[1] == "playing": + self.out = "" + else: + self.out = "" + case "file": + filename = var[var.rfind("/") + 1:var.rfind(".")] + self.out += " " + filename + + +class InfoItem(BarItem): + def __init__(self, text: str) -> None: + super().__init__() + self.out = text + diff --git a/dwmscripts/dwmbar/other.py b/dwmscripts/dwmbar/other.py new file mode 100644 index 0000000..06a8cd1 --- /dev/null +++ b/dwmscripts/dwmbar/other.py @@ -0,0 +1,8 @@ +import subprocess + + +def get_command_out(command: str) -> None: + return subprocess.check_output( + command, + shell=True + ).decode("utf-8") diff --git a/dwmscripts/emoji.py b/dwmscripts/emoji.py new file mode 100644 index 0000000..d8d9ab9 --- /dev/null +++ b/dwmscripts/emoji.py @@ -0,0 +1,33 @@ +import subprocess +import os +import json + + +def show_command_out(command: str) -> str: + return subprocess.check_output( + command, + shell=True + ).decode("utf-8") + + +def main(): + path = os.path.dirname(os.path.realpath(__file__)) + with open(f"{path}/dictionary.json") as file: + dictionary = json.load(file) + dictionary_list = [x for x in dictionary] + + key = show_command_out( + 'echo "{}"\ +| dmenu -l 20 -p \"Select alias\"'.format(''.join([f'{x}\n' for x + in dictionary_list])[:-1]) + ).strip() + + try: + out = dictionary[key] + except KeyError: + return + os.system(f"echo \"{out}\" | xclip -selection clipboard -r") + + +if __name__ == '__main__': + main() diff --git a/dwmscripts/emojis.txt b/dwmscripts/emojis.txt new file mode 100644 index 0000000..7aeb7c9 --- /dev/null +++ b/dwmscripts/emojis.txt @@ -0,0 +1,10 @@ +worried +thinking +shrug +angry +angrysight +cuddles +happy +crying +dancing +confused \ No newline at end of file diff --git a/dwmscripts/genpass.py b/dwmscripts/genpass.py new file mode 100644 index 0000000..dd6580f --- /dev/null +++ b/dwmscripts/genpass.py @@ -0,0 +1,18 @@ +from random import choice + + +def main() -> None: + SIZE = 64 + ALPHABET = ( + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789!@#$%^&*()[]{},." + ) + + out = '' + for _ in range(SIZE): + out += choice(ALPHABET) + print(out) + + +if __name__ == '__main__': + main() diff --git a/dwmscripts/layout.py b/dwmscripts/layout.py new file mode 100644 index 0000000..1139ae0 --- /dev/null +++ b/dwmscripts/layout.py @@ -0,0 +1,28 @@ +import json +import os +import sys + + +states = ["us", "ru"] + + +def main() -> None: + state = states[1] + if os.path.exists("/tmp/layout.json"): + with open("/tmp/layout.json") as f: + state = json.load(f)["layout"] + for i, val in enumerate(states): + if val == state: + state = states[(i + 1) % len(states)] + break + with open("/tmp/layout.json", 'w') as f: + json.dump({"layout": state}, f, indent=4) + os.system(f"setxkbmap {state}") + + +if __name__ == "__main__": + if len(sys.argv) == 1: + main() + else: + if "-s" in sys.argv: + os.system(f"setxkbmap {states[0]}") diff --git a/dwmscripts/out b/dwmscripts/out new file mode 100644 index 0000000000000000000000000000000000000000..e9ff9e44c9a73149a07f9ea0ab48ab220a629546 GIT binary patch literal 1802 zcmeAS@N?(olHy`uVBq!ia0vp^`xzJ*ML3v%tgk8sCx8@lv6E*A2M5RPhyD*37}ySZ zx;TbZ#J#{g3_w6Av6;yxhj+K|SNw7Y||_Y@e6S3+ZP&$9knW@44sK45|s8^k2`pujcp1 zAJ6CC-!C`+tvGADIiLUf|NV2GKR@4}6c_i;&hEB87hk^2zm?A?cJs4{G2X8hQ#IFJ zFt2Q*9@DGHDR;IsRNXqdi(^H4V9{l!SDE6kl@`o%J?YE6VtMSE?uM#?R$Nhjzlhce%#xvu``qL>z3|P!GQCNo-AX%a#`=1tAlO# zq}gHt{<|Z@8NcdyE_29$a!=NND zKh?&*zOJUO@@Mvb&Vn6A9_{t7DxW-JZgf5HeJ~{^!fE=RY+3oobz8U}#qt4}>(%e~ zmj0gkm&uF$J>Tp5C$9}T|Ij!?KhXESH}&3EanbzqJN7I7I6dim)hB)Rdv$618!jD; zpB7W+ygL(E;tb{j1|v-X<30S7-Ue(*AbM!|=Y#wVK5teA_cNKm%8kL()z4*}Q$iB} D0^V3# literal 0 HcmV?d00001 diff --git a/dwmscripts/prekol.py b/dwmscripts/prekol.py new file mode 100644 index 0000000..f5bbef9 --- /dev/null +++ b/dwmscripts/prekol.py @@ -0,0 +1,36 @@ +import psutil +from pypresence import Presence +import time + + +def main() -> None: + client_id = '1149335280072020078' + RPC = Presence(client_id, pipe=0) + RPC.connect() + + start_time = psutil.boot_time() + while True: + # waiting = time.time() - start_time + # minutes = waiting // 60 + # hours = minutes // 60 + # minutes = minutes % 60 + # waiting_days = int(time.time() - start_time) // 60 // 60 // 24 + waiting_days = int(time.time() - start_time) // 60 // 60 // 24 + # state=f"{int(hours):02}:{int(minutes):02}:{int(waiting % 60):02}", + RPC.update( + # details=details_list[i1], + state=f"{waiting_days} days,", + large_image="superpuper", + large_text="This is a picture, isn't it?", + buttons=[{ + "label": "This is not rickroll", + "url": "https://goo.su/eriA6eD" + }], + start=start_time + ) + RPC.update + time.sleep(10) + + +if __name__ == '__main__': + main() diff --git a/dwmscripts/scrot.py b/dwmscripts/scrot.py new file mode 100644 index 0000000..72ab351 --- /dev/null +++ b/dwmscripts/scrot.py @@ -0,0 +1,74 @@ +import os +from random import choice +# from requests import get + +INDEX_HTML = "/home/naki/server/index.html" +SERVER_PATH = "/home/naki/server/a/" +LULS_PATH = "/home/naki/server/luls/" + +RANDOM_SIZE = 5 +RANDOM_ALPHABET = ( + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" +) + + +def gen_random(size, alphabet) -> str: + out = '' + for _ in range(size): + out += choice(alphabet) + return out + + +def main() -> None: + images = next(os.walk(SERVER_PATH), (None, None, []))[2] + # images = list(map(int, [image[3:-4] for image in images])) + images = [image[:-4] for image in images] + # out = max(images) + 1 if images else 0 + name = '' + while True: + name = gen_random(RANDOM_SIZE, RANDOM_ALPHABET) + if name not in images: + break + os.system(f"/home/naki/dwmscripts/scrotpy.sh '{SERVER_PATH + name + '.png'}'") + + # os.system( + # f"flameshot gui --raw > {SERVER_PATH}img{out}.png" + # ) + + # os.system( + # f"flameshot gui --raw > {SERVER_PATH}{name}.png" + # ) + + ip = "nakidai.ddns.net" # get('https://api.ipify.org').content.decode('utf8') + + os.system( + f"echo \"http://{ip}/a/{name}.png\" |" + f" xclip -selection clipboard -r" + ) + + with open(INDEX_HTML, 'w') as f: + f.write(f""" + + + + + + Nakidai Perumenei + + +
Latest screenshot:
+ + https://{ip}/a/{name}.png + +
Cool things:
+ + {"
".join([f"https://{ip}/luls/{img}
" + for img in os.listdir(LULS_PATH)])} +
+ +""") + + +if __name__ == '__main__': + main() diff --git a/dwmscripts/scrot.sh b/dwmscripts/scrot.sh new file mode 100755 index 0000000..02180ae --- /dev/null +++ b/dwmscripts/scrot.sh @@ -0,0 +1,7 @@ +scrot -o /tmp/scrot.png +feh -F /tmp/scrot.png & +feh_pid=$! +scrot --select '/home/naki/pic/screenshots/%F_%T_$wx$h.png' -e 'xclip -selection clipboard -target image/png -i $f' +kill $feh_pid +# flameshot gui --raw | xclip -selection clipboard -target image/png +# maim -u | feh -F - & sleep 1 && maim -s | xclip -selection clipboard -target image/png && kill $! diff --git a/dwmscripts/scrotpy.sh b/dwmscripts/scrotpy.sh new file mode 100755 index 0000000..f26c9c8 --- /dev/null +++ b/dwmscripts/scrotpy.sh @@ -0,0 +1,3 @@ +#!/bin/bash +scrot -s -f -o $1 + diff --git a/dwmscripts/sysbar.py b/dwmscripts/sysbar.py new file mode 100644 index 0000000..a3f3957 --- /dev/null +++ b/dwmscripts/sysbar.py @@ -0,0 +1,22 @@ +import dwmbar + + +def main() -> None: + # kernel_ver = dwmbar.get_command_out("uname -r")[:-1] + + bar = dwmbar.Bar() + bar[9] = dwmbar.modules.TimeItem() + bar[8] = dwmbar.modules.RAMItem() + # bar[7] = dwmbar.modules.DiskUsageItem() + # bar[6] = dwmbar.modules.CPUUsageItem() + bar[5] = dwmbar.modules.BatteryItem(True) + + # bar[1] = dwmbar.modules.InfoItem(kernel_ver) + bar[2] = dwmbar.modules.VolumeItem() + bar[1] = dwmbar.modules.LayoutItem() + bar[0] = dwmbar.modules.MusicItem() + bar.start(1) + + +if __name__ == '__main__': + main() diff --git a/dwmscripts/turnoffscreen.sh b/dwmscripts/turnoffscreen.sh new file mode 100755 index 0000000..7924182 --- /dev/null +++ b/dwmscripts/turnoffscreen.sh @@ -0,0 +1 @@ +sleep 1 && xset -display :0.0 dpms force off