feat:migrate hyprland config with nwg tools
This commit is contained in:
parent
54ea69dd8e
commit
fc39a811c9
251 changed files with 23198 additions and 118 deletions
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
def get_output(cmd):
|
||||
try:
|
||||
return subprocess.check_output(cmd, shell=True).decode("utf-8").strip().splitlines()
|
||||
except subprocess.CalledProcessError:
|
||||
return ""
|
||||
|
||||
|
||||
o = get_output("rfkill list")
|
||||
for line in o:
|
||||
if "Soft blocked: yes" in line or "Hard blocked: yes" in line:
|
||||
print("airplane-mode-symbolic")
|
||||
print("")
|
||||
break
|
|
@ -0,0 +1,81 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
|
||||
# You may either use the full icon(s) path here, like e.g.:
|
||||
# "/home/piotr/.config/nwg-panel/icons_light/arch-linux.svg"
|
||||
# or just give the icon name, like below.
|
||||
|
||||
# The icon name must either exist in your icon theme, or you may place `icon_name.svg`
|
||||
# custom files in '~/.config/nwg-panel/icons_light/' and '~/.config/nwg-panel/icons_dark/'.
|
||||
|
||||
# This script needs the `au.sh` helper on path or in the same directory. See comments in `au.sh`.
|
||||
|
||||
def main():
|
||||
# Avoid checking on each panel restart: check if 15 minutes passed.
|
||||
# Adjust the time (in seconds) to your liking.
|
||||
# Make sure if the path below matches your temp directory.
|
||||
file = "/tmp/arch-updates"
|
||||
|
||||
if os.path.isfile(file):
|
||||
if int(time.time() - os.stat(file).st_mtime) > 900:
|
||||
arch, aur = check_updates()
|
||||
save_string("{},{}".format(arch, aur), file)
|
||||
else:
|
||||
try:
|
||||
vals = load_string(file).split(",")
|
||||
arch, aur = int(vals[0]), int(vals[1])
|
||||
except:
|
||||
arch, aur = 0, 0
|
||||
else:
|
||||
arch, aur = check_updates()
|
||||
save_string("{},{}".format(arch, aur), file)
|
||||
|
||||
if arch > 0 and aur > 0:
|
||||
print("software-update-urgent")
|
||||
print("{}/{}".format(arch, aur))
|
||||
elif arch > 0:
|
||||
print("software-update-available")
|
||||
print("{}".format(arch))
|
||||
elif aur > 0:
|
||||
print("software-update-available")
|
||||
print("{}".format(aur))
|
||||
|
||||
|
||||
def save_string(string, file):
|
||||
try:
|
||||
file = open(file, "wt")
|
||||
file.write(string)
|
||||
file.close()
|
||||
except:
|
||||
print("Error writing file '{}'".format(file))
|
||||
|
||||
|
||||
def load_string(path):
|
||||
try:
|
||||
with open(path, 'r') as file:
|
||||
data = file.read()
|
||||
return data
|
||||
except:
|
||||
return ""
|
||||
|
||||
|
||||
def check_updates():
|
||||
arch, aur = 0, 0
|
||||
try:
|
||||
arch = len(subprocess.check_output(["checkupdates"]).decode("utf-8").splitlines())
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
aur = len(subprocess.check_output(["trizen", "-Qqu", "-a"]).decode("utf-8").splitlines())
|
||||
except:
|
||||
pass
|
||||
|
||||
return arch, aur
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
18
home/private_dot_config/nwg-panel/executors/executable_au.sh
Normal file
18
home/private_dot_config/nwg-panel/executors/executable_au.sh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
# This is a helper to the arch-updates.py executor
|
||||
# Add `<your-terminal-here> -e "au.sh; swaymsg reload"` as the On left click action
|
||||
|
||||
# Just in case - warn if battery level < threshold
|
||||
l=$(acpi | awk -F ',' '{print $2}')
|
||||
if [[ ! -z "$l" ]]; then
|
||||
level=${l:1:-1}
|
||||
threshold=30
|
||||
if [[ "$level" -lt "$threshold" ]]; then
|
||||
echo -e "\n*** BATTERY LEVEL$l, CONNECT AC! ***\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
trizen -Syu &&
|
||||
rm /tmp/arch-updates
|
||||
echo Press enter to exit!; read;
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
a=$(swaync-client -c)
|
||||
|
||||
if [ "$a" -gt "0" ]; then
|
||||
echo bell
|
||||
echo $a
|
||||
fi
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
# Based on the 'Github notifications' example from Waybar's Wiki
|
||||
# Depends on jq Command-line JSON processor
|
||||
# Obtain a notifications token at https://github.com/settings/tokens
|
||||
# save it to a file as below.
|
||||
|
||||
token=`cat ${HOME}/.config/github/notifications.token`
|
||||
count=`curl -u nwg-piotr:${token} https://api.github.com/notifications -s | jq '. | length'`
|
||||
|
||||
if [[ "$count" != "0" ]]; then
|
||||
echo /home/piotr/.config/nwg-panel/icons_light/github.svg
|
||||
echo $count
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue