Compare commits
81 Commits
1fdd9d6151
...
b14cc6b6c5
| Author | SHA1 | Date | |
|---|---|---|---|
| b14cc6b6c5 | |||
| b7b25e8d24 | |||
| 9735e42cdd | |||
| 46392b93e2 | |||
| f8b8022655 | |||
| 4146ca8836 | |||
| 15928f17c7 | |||
| abba10549b | |||
| 48f6adeaad | |||
| b4935c82d7 | |||
| a956955300 | |||
| 284e205fc5 | |||
| 6722cc8e78 | |||
| a002d6d6f0 | |||
| e41044aa69 | |||
| 30339ac3bc | |||
| 3e88eba293 | |||
| 95cfc66b09 | |||
| 54bac08d1f | |||
| 39da9dcac6 | |||
| b63bc7b00b | |||
| a16d6121e5 | |||
| fd730c0e72 | |||
| 7a1284b766 | |||
| e48916ab29 | |||
| 1f3b74ae50 | |||
| 935b95adbb | |||
| 99e3387d9f | |||
| 39c5d71a3c | |||
| 19c180f2df | |||
| f2206037d5 | |||
| 02f2e7ad60 | |||
| cf25a90e9d | |||
| 157b273820 | |||
| 40a8e225d6 | |||
| f78a789c72 | |||
| cefcc8ac2d | |||
| 98477401ca | |||
| 8fa07a3924 | |||
| e7cb9969b2 | |||
| 12044e8f37 | |||
| 75a66885dd | |||
| 048ece4f80 | |||
| 6c973853c6 | |||
| 20fc1e4e75 | |||
| c5d0420593 | |||
| 85876213df | |||
| b44666e31e | |||
| 509ac4a0cf | |||
| 1377c52fdb | |||
| 59530ab13c | |||
| a61401dc85 | |||
| 08f33acd1a | |||
| c3d698e054 | |||
| ddfc914929 | |||
| aaef900cf1 | |||
| 9d86c61423 | |||
| 5cf0939ceb | |||
| 6777e4eb45 | |||
| c0d198846c | |||
| 56465ff233 | |||
| 969950ff55 | |||
| 11ec702b36 | |||
| 3c0db881ac | |||
| 7d6e1df7c4 | |||
| 053ff82192 | |||
| a3b3b0a08c | |||
| 273d521484 | |||
| 95a3407fcd | |||
| 33a83fdb50 | |||
| e18bf938d0 | |||
| f4c149adc9 | |||
| df500456e4 | |||
| 20a063b9e2 | |||
| 7c9ad06f00 | |||
| 505c67d292 | |||
| dadc78f2f4 | |||
| c1c78e4048 | |||
| 5445164b23 | |||
| 831a3e6f1d | |||
| 9e1a00d7a4 |
@ -16,6 +16,10 @@ sysu enable --now django@project
|
||||
#+end_src
|
||||
|
||||
* Backlog
|
||||
** TODO Fix issue with trashing emails in notmuch :email:notmuch:dotfiles:
|
||||
#+begin_src bash
|
||||
opencode -s ses_02fd1d8dbffe7m2AhnSa7FJUHo
|
||||
#+end_src
|
||||
** DONE Figure out why SSH key loading isn't working in terminal Emacs :personal:bug:dotfiles:emacs:ssh:
|
||||
:PROPERTIES:
|
||||
:ID: f4d738a4-ffcb-7352-06f1-4f0dd89dff08
|
||||
|
||||
36
README.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Dotfiles
|
||||
|
||||
## Quick Install
|
||||
|
||||
Install the bootstrap script:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code.lab.unbl.ink/secstate/dotfiles/raw/master/bin/.local/bin/bootstrap.sh | bash
|
||||
```
|
||||
|
||||
Install the setup script:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code.lab.unbl.ink/secstate/dotfiles/raw/master/bin/.local/bin/setup.sh | bash
|
||||
```
|
||||
|
||||
Pull your GPG keys:
|
||||
|
||||
```bash
|
||||
pullkeys
|
||||
```
|
||||
|
||||
Rekey:
|
||||
```bash
|
||||
rekey
|
||||
```
|
||||
|
||||
Setup your public keys on unbl.ink and github.com:
|
||||
|
||||
- https://github.com/settings/keys
|
||||
- https://code.lab.unbl.ink/user/settings/ssh
|
||||
|
||||
##
|
||||
Session adding ntfy to Claude:
|
||||
|
||||
claude --resume 01c9df22-b6ef-41c6-85ba-e07148204774
|
||||
@ -19,6 +19,9 @@ alias gpghup='gpgconf --kill gpg-agent && gpgconf --launch gpg-agent'
|
||||
alias dotup='(cd ~/.dotfiles && git pull public master && make)'
|
||||
alias djlogs="tail -f -n 50 /tmp/django.log"
|
||||
alias clogs="tail -f -n 50 /tmp/celery.log"
|
||||
#alias pullkeys="SSH_ASKPASS_REQUIRE='' scp -r powellc@nfs.service:~/.gnupg ~/"
|
||||
#alias pullvar="SSH_ASKPASS_REQUIRE='' scp -r powellc@nfs.service:~/var ~/"
|
||||
#alias sshp="SSH_ASKPASS_REQUIRE='' ssh $*"
|
||||
|
||||
|
||||
# Vrobbler shortcuts
|
||||
|
||||
@ -55,3 +55,4 @@ export PATH="/home/powellc/.shorebird/bin:$PATH"
|
||||
# Added by LM Studio CLI (lms)
|
||||
export PATH="$PATH:/home/powellc/.lmstudio/bin"
|
||||
# End of LM Studio CLI section
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
@ -56,7 +56,7 @@ fi
|
||||
# -------- Install basics (git, stow, zsh, curl, make) --------
|
||||
install_arch() {
|
||||
log "Installing prerequisites (Arch/EndeavourOS)..."
|
||||
sudo pacman -Sy --needed --noconfirm git stow zsh curl make openssh asdf
|
||||
sudo pacman -Sy --needed --noconfirm git stow zsh curl make openssh
|
||||
}
|
||||
|
||||
install_fedora() {
|
||||
|
||||
83
bin/.local/bin/cbr2cbz-down.py
Normal file
@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
|
||||
def execute(command):
|
||||
os.system(command)
|
||||
|
||||
def print_err(message):
|
||||
execute(">&2 echo \""+message+"\"")
|
||||
|
||||
def print_usage():
|
||||
usage="cbr2cbz A script utility to convert CBR files into CBZ files"
|
||||
usage+="\n\t Usage: cbr2cbz <filename_without_spaces.cbr>"
|
||||
usage+="\n\t\n\t (Please don't use non-free formats like RAR/CBR)"
|
||||
print_err(usage)
|
||||
|
||||
#Extract images from a CBR file into a directory
|
||||
def uncompress(filename, directory):
|
||||
UNRAR="unrar e"
|
||||
command=" ".join([UNRAR, "\""+filename+"\"", directory])
|
||||
#print_err(command)
|
||||
execute(command)
|
||||
|
||||
#Resize a folder of images to 85 quality
|
||||
def resize(directory):
|
||||
IM="magick"
|
||||
ARGS="-compress jpeg -resize 75% -quality 85"
|
||||
|
||||
for file in os.listdir(directory):
|
||||
file = directory + '/"' + file + '"'
|
||||
command=" ".join([IM, file, ARGS, file])
|
||||
execute (command)
|
||||
|
||||
#Compress a folder with images into a CBZ/ZIP file
|
||||
def compress (directory, zip_filename):
|
||||
ZIP="zip"
|
||||
directory=directory+"/*"
|
||||
command=" ".join([ZIP, "\""+zip_filename+"\"", directory ])
|
||||
execute (command)
|
||||
|
||||
def get_filename_without_extension(filename):
|
||||
return filename[:-4]
|
||||
|
||||
|
||||
|
||||
if len(sys.argv)!=2:
|
||||
print_usage();
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
|
||||
|
||||
cbr_filename=sys.argv[1]
|
||||
cbz_filename=get_filename_without_extension(cbr_filename)+".cbz"
|
||||
temp_dir=tempfile.mkdtemp("cbr2cbz")
|
||||
|
||||
print_err("Processing "+cbr_filename)
|
||||
|
||||
#Extract images from CBR/RAR into a directory
|
||||
uncompress(sys.argv[1], temp_dir)
|
||||
|
||||
#Resize/downsample big images
|
||||
resize(temp_dir)
|
||||
#Compress images and put them into a CBZ/ZIP
|
||||
compress(temp_dir, cbz_filename)
|
||||
execute("".join(["rm -Rf ", temp_dir]))
|
||||
|
||||
|
||||
|
||||
def extract (cbr_filename, dir_name):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#execute ("dir")
|
||||
83
bin/.local/bin/cbz2cbz-down.py
Normal file
@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
|
||||
def execute(command):
|
||||
os.system(command)
|
||||
|
||||
def print_err(message):
|
||||
execute(">&2 echo \""+message+"\"")
|
||||
|
||||
def print_usage():
|
||||
usage="cbr2cbz A script utility to convert CBR files into CBZ files"
|
||||
usage+="\n\t Usage: cbr2cbz <filename_without_spaces.cbr>"
|
||||
usage+="\n\t\n\t (Please don't use non-free formats like RAR/CBR)"
|
||||
print_err(usage)
|
||||
|
||||
#Extract images from a CBR file into a directory
|
||||
def uncompress(filename, directory):
|
||||
UNZIP="unzip"
|
||||
command=" ".join([UNZIP, "\""+filename+"\"", directory])
|
||||
#print_err(command)
|
||||
execute(command)
|
||||
|
||||
#Resize a folder of images to 85 quality
|
||||
def resize(directory):
|
||||
IM="magick"
|
||||
ARGS="-compress jpeg -resize 75% -quality 85"
|
||||
|
||||
for file in os.listdir(directory):
|
||||
file = directory + '/"' + file + '"'
|
||||
command=" ".join([IM, file, ARGS, file])
|
||||
execute (command)
|
||||
|
||||
#Compress a folder with images into a CBZ/ZIP file
|
||||
def compress (directory, zip_filename):
|
||||
ZIP="zip"
|
||||
directory=directory+"/*"
|
||||
command=" ".join([ZIP, "\""+zip_filename+"\"", directory ])
|
||||
execute (command)
|
||||
|
||||
def get_filename_without_extension(filename):
|
||||
return filename[:-4]
|
||||
|
||||
|
||||
|
||||
if len(sys.argv)!=2:
|
||||
print_usage();
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
|
||||
|
||||
cbr_filename=sys.argv[1]
|
||||
cbz_filename=get_filename_without_extension(cbr_filename)+".cbz"
|
||||
temp_dir=tempfile.mkdtemp("cbr2cbz")
|
||||
|
||||
print_err("Processing "+cbr_filename)
|
||||
|
||||
#Extract images from CBR/RAR into a directory
|
||||
uncompress(sys.argv[1], temp_dir)
|
||||
|
||||
#Resize/downsample big images
|
||||
resize(temp_dir)
|
||||
#Compress images and put them into a CBZ/ZIP
|
||||
compress(temp_dir, cbz_filename)
|
||||
execute("".join(["rm -Rf ", temp_dir]))
|
||||
|
||||
|
||||
|
||||
def extract (cbr_filename, dir_name):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#execute ("dir")
|
||||
@ -7,9 +7,10 @@ if [ $(pidof $AFEW_SERVICE) ] || [ $(pidof $MBSYNC_SERVICE) ] || [ $(pidof $NOTM
|
||||
echo "Checkmail is already running."
|
||||
else
|
||||
echo "Checking for new mail"
|
||||
afew -m -n
|
||||
mbsync -a
|
||||
mkdir -p ~/Mail/colin@unbl.ink/Junk/{cur,new,tmp}
|
||||
mbsync unblink
|
||||
notmuch new
|
||||
afew -t -n
|
||||
afew -m -n
|
||||
fi
|
||||
exit 0
|
||||
|
||||
52
bin/.local/bin/notify-add-indexes.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# notify-add-indexes.sh - Add recommended indexes to Notify SQLite database
|
||||
# Usage: ./notify-add-indexes.sh [db_path] [--cleanup]
|
||||
#
|
||||
# Options:
|
||||
# --cleanup Also drops the now-redundant message_by_time index
|
||||
#
|
||||
# Default path for Flatpak: ~/.var/app/com.ranfdev.Notify/data/com.ranfdev.Notify.sqlite
|
||||
# Default path for local build: ~/.local/share/com.ranfdev.Notify.sqlite
|
||||
#
|
||||
# Usage:
|
||||
#./notify-add-indexes.sh # Just add indexes
|
||||
#./notify-add-indexes.sh --cleanup # Add indexes + remove old one
|
||||
#./notify-add-indexes.sh ~/.local/share/com.ranfdev.Notify.sqlite --cleanup
|
||||
DB_PATH=""
|
||||
CLEANUP=false
|
||||
# Parse arguments
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--cleanup)
|
||||
CLEANUP=true
|
||||
;;
|
||||
*)
|
||||
DB_PATH="$arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
DB_PATH="${DB_PATH:-$HOME/.var/app/com.ranfdev.Notify/data/com.ranfdev.Notify.sqlite}"
|
||||
if [ ! -f "$DB_PATH" ]; then
|
||||
echo "Error: Database not found at $DB_PATH"
|
||||
exit 1
|
||||
fi
|
||||
echo "Database: $DB_PATH"
|
||||
echo ""
|
||||
# Create composite index for message(server, topic) - used by delete_messages
|
||||
echo "Creating message_server_topic index..."
|
||||
sqlite3 "$DB_PATH" "CREATE INDEX IF NOT EXISTS message_server_topic ON message(server, topic);"
|
||||
# Create covering index for list_messages query
|
||||
echo "Creating message_list_covering index..."
|
||||
sqlite3 "$DB_PATH" "CREATE INDEX IF NOT EXISTS message_list_covering ON message(server, topic, data ->> '\$.time');"
|
||||
# Optional: drop redundant index
|
||||
if [ "$CLEANUP" = true ]; then
|
||||
echo ""
|
||||
echo "Dropping redundant message_by_time index..."
|
||||
sqlite3 "$DB_PATH" "DROP INDEX IF EXISTS message_by_time;"
|
||||
fi
|
||||
# Verify
|
||||
echo ""
|
||||
echo "Current indexes:"
|
||||
sqlite3 "$DB_PATH" "SELECT name FROM sqlite_master WHERE type='index' ORDER BY name;"
|
||||
echo ""
|
||||
echo "Done!"
|
||||
@ -1,19 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
import http.client
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
new_mail_list = json.loads(
|
||||
NTFY_HOST = "ntfy.unbl.ink"
|
||||
NTFY_PATH = "/207-comms"
|
||||
MAILBOX_URL = "https://box.unbl.ink/mail/?_task=mail&_mbox=INBOX"
|
||||
MAX_BODY = 3000
|
||||
SEND_DELAY = 1.5
|
||||
|
||||
|
||||
def extract_text(body_parts):
|
||||
plain = []
|
||||
html = []
|
||||
|
||||
def walk(parts):
|
||||
for part in parts:
|
||||
content_type = part.get("content-type", "")
|
||||
content = part.get("content")
|
||||
if isinstance(content, list):
|
||||
walk(content)
|
||||
elif content:
|
||||
if "text/plain" in content_type:
|
||||
plain.append(content)
|
||||
elif "text/html" in content_type:
|
||||
html.append(content)
|
||||
|
||||
walk(body_parts)
|
||||
return "\n".join(plain) if plain else "\n".join(html)
|
||||
|
||||
|
||||
def send_ntfy(headers, payload):
|
||||
data = payload.encode("utf-8")
|
||||
for attempt in range(3):
|
||||
conn = http.client.HTTPSConnection(NTFY_HOST, timeout=15)
|
||||
try:
|
||||
conn.putrequest("POST", NTFY_PATH, skip_host=True)
|
||||
conn.putheader(b"Host", NTFY_HOST.encode("utf-8"))
|
||||
for name, value in headers.items():
|
||||
conn.putheader(name.encode("utf-8"), value.encode("utf-8"))
|
||||
conn.putheader("Content-Type", b"text/plain; charset=utf-8")
|
||||
conn.putheader("Content-Length", str(len(data)))
|
||||
conn.endheaders(data)
|
||||
resp = conn.getresponse()
|
||||
resp.read()
|
||||
if resp.status == 429:
|
||||
retry = resp.getheader("Retry-After", "5") or "5"
|
||||
time.sleep(float(retry))
|
||||
continue
|
||||
if resp.status < 200 or resp.status >= 300:
|
||||
print(f"ntfy failed: {resp.status}", file=sys.stderr)
|
||||
return
|
||||
except OSError as e:
|
||||
print(f"ntfy error: {e}", file=sys.stderr)
|
||||
time.sleep(attempt + 1)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def main():
|
||||
new_mail = json.loads(
|
||||
subprocess.check_output(
|
||||
["notmuch", "show", "--format=json", "tag:inbox"],
|
||||
).decode('utf-8')
|
||||
["notmuch", "show", "--format=json", "tag:new"],
|
||||
).decode("utf-8")
|
||||
)
|
||||
|
||||
for thread in new_mail:
|
||||
for message_pair in thread:
|
||||
headers = message_pair[0]["headers"]
|
||||
subject = headers.get("Subject", "")
|
||||
sender = headers.get("From", "")
|
||||
date = headers.get("Date", "")
|
||||
body = extract_text(message_pair[0].get("body", []))[:MAX_BODY]
|
||||
|
||||
if new_mail_list:
|
||||
output = "Mail's here!\n\n"
|
||||
for message in new_mail_list:
|
||||
msg = message[0][0]
|
||||
dt = msg['headers']['Date']
|
||||
subj = msg['headers']['Subject']
|
||||
output += f"{dt}\n{subj}\n\n"
|
||||
payload = f"{sender}\n\n{body}\n{date}"
|
||||
send_ntfy(
|
||||
{
|
||||
"Title": subject,
|
||||
"Tags": "envelope",
|
||||
"Click": MAILBOX_URL,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
time.sleep(SEND_DELAY)
|
||||
|
||||
subprocess.run(["dunstify", output])
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
BIN
bin/.local/bin/sesh
Executable file
BIN
bin/.local/bin/sess
Executable file
@ -157,17 +157,22 @@ ensure_flathub() {
|
||||
}
|
||||
|
||||
# -------- Package sets (portable intent) --------
|
||||
EMACS_PKG="emacs"
|
||||
|
||||
# Required by you:
|
||||
CORE_CLI=(fzf direnv stow pass just)
|
||||
|
||||
# Plus from your history / common tooling:
|
||||
EXTRA_CLI=(fd editorconfig git)
|
||||
EXTRA_CLI=(fd git)
|
||||
|
||||
DEV_TOOLS_LINUX=(cmake libtool make gcc gcc-c++)
|
||||
DEV_TOOLS_LINUX=(cmake libtool make gcc gcc-c++ emacs)
|
||||
UTILS_LINUX=(gnuplot graphviz shfmt shellcheck pandoc)
|
||||
|
||||
DESKTOP_LINUX=(kitty alacritty dino syncthing)
|
||||
|
||||
# Mail stack (notmuch search, isync sync, afew tagging, msmtp send)
|
||||
MAIL_LINUX=(notmuch isync afew msmtp)
|
||||
|
||||
FEDORA_EXTRAS=(
|
||||
gnome-extensions-app
|
||||
gnome-tweaks
|
||||
@ -207,6 +212,10 @@ MAC_BREW_PKGS=(
|
||||
postgresql
|
||||
syncthing
|
||||
pinentry-mac
|
||||
emacs
|
||||
notmuch
|
||||
isync
|
||||
msmtp
|
||||
)
|
||||
|
||||
MAC_CASKS=(
|
||||
@ -215,6 +224,7 @@ MAC_CASKS=(
|
||||
slack
|
||||
google-chrome
|
||||
chromium
|
||||
emacs-app
|
||||
)
|
||||
|
||||
# FreeBSD name mapping (best-effort)
|
||||
@ -227,7 +237,7 @@ MAC_CASKS=(
|
||||
# - direnv exists.
|
||||
FREEBSD_CORE=(fzf direnv stow just password-store)
|
||||
FREEBSD_EXTRA=(fd-find editorconfig-core-c git)
|
||||
FREEBSD_DEV=(cmake libtool gmake llvm) # gmake instead of make; llvm as a sane default toolchain
|
||||
FREEBSD_DEV=(cmake libtool gmake llvm emacs) # gmake instead of make; llvm as a sane default toolchain
|
||||
FREEBSD_UTILS=(gnuplot graphviz shfmt shellcheck pandoc)
|
||||
FREEBSD_SECURITY=(gnupg pinentry) # helpful for pass
|
||||
FREEBSD_MISC=(postgresql16-client syncthing)
|
||||
@ -242,6 +252,7 @@ fedora)
|
||||
dnf_install_best_effort "${DEV_TOOLS_LINUX[@]}"
|
||||
dnf_install_best_effort "${UTILS_LINUX[@]}"
|
||||
dnf_install_best_effort "${DESKTOP_LINUX[@]}"
|
||||
dnf_install_best_effort "${MAIL_LINUX[@]}"
|
||||
dnf_install_best_effort "${FEDORA_EXTRAS[@]}"
|
||||
|
||||
ensure_flathub
|
||||
@ -264,6 +275,7 @@ arch)
|
||||
pacman_install_best_effort "${DEV_TOOLS_LINUX[@]}"
|
||||
pacman_install_best_effort "${UTILS_LINUX[@]}"
|
||||
pacman_install_best_effort "${DESKTOP_LINUX[@]}"
|
||||
pacman_install_best_effort "${MAIL_LINUX[@]}"
|
||||
pacman_install_best_effort "${ARCH_EXTRAS[@]}"
|
||||
|
||||
aur_install_if_possible google-chrome slack-desktop || true
|
||||
@ -284,6 +296,11 @@ macos)
|
||||
brew_install "${MAC_BREW_PKGS[@]}"
|
||||
brew_cask "${MAC_CASKS[@]}" || true
|
||||
|
||||
if ! have afew && have pipx; then
|
||||
log "Installing afew via pipx..."
|
||||
pipx install afew || true
|
||||
fi
|
||||
|
||||
if [[ -f "$(brew --prefix)/opt/fzf/install" ]]; then
|
||||
log "Tip: run fzf install helper if you want keybindings/completion:"
|
||||
echo " $(brew --prefix)/opt/fzf/install"
|
||||
@ -315,6 +332,7 @@ freebsd)
|
||||
|
||||
# Optional stuff from your history where it makes sense
|
||||
pkg_install_best_effort "${FREEBSD_MISC[@]}"
|
||||
pkg_install_best_effort "notmuch isync msmtp"
|
||||
|
||||
log "Final system upgrade..."
|
||||
sudo pkg upgrade -y
|
||||
@ -346,7 +364,12 @@ EOF
|
||||
|
||||
log "Done."
|
||||
|
||||
# -------- Doom Emacs --------
|
||||
# -------- Doom Emacs (requires emacs binary) --------
|
||||
if ! have emacs; then
|
||||
log "WARNING: emacs binary not found in PATH — skipping Doom Emacs installation."
|
||||
log "Install emacs via your package manager and re-run this script, or run:"
|
||||
log " ~/.emacs.d/bin/doom install"
|
||||
else
|
||||
DOOM_DIR="${DOOM_DIR:-$HOME/.emacs.d}"
|
||||
if [[ -d "$DOOM_DIR/.git" ]]; then
|
||||
log "Doom Emacs already present at $DOOM_DIR (updating)..."
|
||||
@ -363,3 +386,18 @@ if [[ -d "$DOOM_DIR" ]]; then
|
||||
log "Installing Doom Emacs..."
|
||||
"$DOOM_DIR/bin/doom" install
|
||||
fi
|
||||
fi
|
||||
|
||||
# -------- asdf plugins --------
|
||||
if have asdf; then
|
||||
log "Configuring asdf plugins..."
|
||||
asdf plugin add python || true
|
||||
fi
|
||||
|
||||
# -------- Python tools --------
|
||||
if have pip; then
|
||||
log "Installing Python tools..."
|
||||
pip install git-cu || true
|
||||
fi
|
||||
|
||||
log "Done."
|
||||
|
||||
67
bin/.local/bin/tile2letter.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "Usage: tile-letter IMAGE [dpi=300] [overlap_inches=0] [orientation=portrait|landscape] [pdf=yes]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v magick >/dev/null || { echo "ImageMagick required"; exit 1; }
|
||||
command -v img2pdf >/dev/null || { echo "img2pdf required (optional if pdf=no)"; }
|
||||
|
||||
input="$1"
|
||||
dpi="${2:-300}"
|
||||
overlap_in="${3:-0}"
|
||||
orientation="${4:-landscape}"
|
||||
make_pdf="${5:-yes}"
|
||||
|
||||
[[ -f "$input" ]] || usage
|
||||
|
||||
base=$(basename "$input")
|
||||
name="${base%.*}"
|
||||
|
||||
# Letter size in inches
|
||||
portrait_w=8.5
|
||||
portrait_h=11
|
||||
|
||||
if [[ "$orientation" == "landscape" ]]; then
|
||||
letter_w=11
|
||||
letter_h=8.5
|
||||
else
|
||||
letter_w=$portrait_w
|
||||
letter_h=$portrait_h
|
||||
fi
|
||||
|
||||
tile_w=$(awk "BEGIN {print int($letter_w * $dpi)}")
|
||||
tile_h=$(awk "BEGIN {print int($letter_h * $dpi)}")
|
||||
|
||||
overlap_px=$(awk "BEGIN {print int($overlap_in * $dpi)}")
|
||||
|
||||
echo "Input: $input"
|
||||
echo "DPI: $dpi"
|
||||
echo "Orientation: $orientation"
|
||||
echo "Page size: ${tile_w}x${tile_h}"
|
||||
echo "Overlap: ${overlap_in}in (${overlap_px}px)"
|
||||
|
||||
mkdir -p "${name}_tiles"
|
||||
|
||||
crop_w=$((tile_w + overlap_px))
|
||||
crop_h=$((tile_h + overlap_px))
|
||||
|
||||
magick "$input" \
|
||||
-crop ${crop_w}x${crop_h} \
|
||||
-background white \
|
||||
-gravity northwest \
|
||||
-extent ${tile_w}x${tile_h} \
|
||||
+repage \
|
||||
"${name}_tiles/${name}_%03d.jpg"
|
||||
|
||||
echo "Tiles written to ${name}_tiles/"
|
||||
|
||||
if [[ "$make_pdf" == "yes" ]]; then
|
||||
pdf="${name}_poster.pdf"
|
||||
img2pdf "${name}_tiles"/*.jpg -o "$pdf"
|
||||
echo "PDF written to $pdf"
|
||||
fi
|
||||
|
||||
@ -31,6 +31,9 @@ WEBCAMS=(
|
||||
"firewood"
|
||||
"garden"
|
||||
"diningroom"
|
||||
"office"
|
||||
"office_birds"
|
||||
"ducks"
|
||||
)
|
||||
TIMELAPSE_SCRIPT="/usr/local/bin/make_timelapse"
|
||||
|
||||
|
||||
125
claude/.claude/scripts/ntfy-recap.py
Normal file
@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
NTFY_URL = "https://ntfy.unbl.ink/hr-agents"
|
||||
|
||||
|
||||
def read_jsonl(path):
|
||||
entries = []
|
||||
try:
|
||||
with open(path) as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
try:
|
||||
entries.append(json.loads(line))
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
except OSError:
|
||||
pass
|
||||
return entries
|
||||
|
||||
|
||||
def load_jsonl(path, has_assistant_text=None):
|
||||
if not path:
|
||||
return []
|
||||
entries = read_jsonl(path)
|
||||
if has_assistant_text is not None:
|
||||
for _ in range(4):
|
||||
if has_assistant_text(entries):
|
||||
break
|
||||
time.sleep(0.5)
|
||||
entries = read_jsonl(path)
|
||||
return entries
|
||||
|
||||
|
||||
def text_blocks(entry):
|
||||
content = entry.get("message", {}).get("content")
|
||||
if isinstance(content, str):
|
||||
yield content
|
||||
elif isinstance(content, list):
|
||||
for c in content:
|
||||
if isinstance(c, dict) and c.get("type") == "text":
|
||||
yield c.get("text", "")
|
||||
|
||||
|
||||
def first_text(entries, role):
|
||||
for e in entries:
|
||||
if e.get("type") != role:
|
||||
continue
|
||||
for t in text_blocks(e):
|
||||
if t.strip():
|
||||
return t.strip()
|
||||
return ""
|
||||
|
||||
|
||||
def last_text(entries, role):
|
||||
for e in reversed(entries):
|
||||
if e.get("type") != role:
|
||||
continue
|
||||
for t in text_blocks(e):
|
||||
if t.strip():
|
||||
return t.strip()
|
||||
return ""
|
||||
|
||||
|
||||
def truncate(s, n):
|
||||
s = " ".join(s.split())
|
||||
return s if len(s) <= n else s[: n - 1] + "…"
|
||||
|
||||
|
||||
def post(title, message, tags, priority=None):
|
||||
req = urllib.request.Request(
|
||||
NTFY_URL, data=message.encode("utf-8"), method="POST"
|
||||
)
|
||||
req.add_header("Title", title)
|
||||
req.add_header("Tags", tags)
|
||||
if priority:
|
||||
req.add_header("Priority", priority)
|
||||
urllib.request.urlopen(req, timeout=10)
|
||||
|
||||
|
||||
def main():
|
||||
payload = json.load(sys.stdin)
|
||||
is_subagent = bool(payload.get("agent_transcript_path")) or (
|
||||
payload.get("hook_event_name") == "SubagentStop"
|
||||
)
|
||||
|
||||
if is_subagent:
|
||||
agent_type = payload.get("agent_type", "subagent")
|
||||
entries = load_jsonl(
|
||||
payload.get("agent_transcript_path"),
|
||||
has_assistant_text=lambda e: bool(last_text(e, "assistant")),
|
||||
)
|
||||
task = truncate(first_text(entries, "user"), 200)
|
||||
result = truncate(last_text(entries, "assistant"), 500)
|
||||
message = (
|
||||
"\n\n".join(p for p in (f"Task: {task}" if task else "", f"Result: {result}" if result else ""))
|
||||
or "(no transcript content found)"
|
||||
)
|
||||
post(f"Subagent finished: {agent_type}", message, "robot", priority="low")
|
||||
else:
|
||||
entries = load_jsonl(
|
||||
payload.get("transcript_path"),
|
||||
has_assistant_text=lambda e: bool(last_text(e, "assistant")),
|
||||
)
|
||||
request = truncate(last_text(entries, "user"), 200)
|
||||
response = truncate(last_text(entries, "assistant"), 500)
|
||||
message = (
|
||||
"\n\n".join(p for p in (f"Last request: {request}" if request else "", f"Last reply: {response}" if response else ""))
|
||||
or "(no transcript content found)"
|
||||
)
|
||||
reason = payload.get("reason", "")
|
||||
title = f"Claude Code: session ended ({reason})" if reason else "Claude Code: session ended"
|
||||
post(title, message, "white_check_mark")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except Exception:
|
||||
pass
|
||||
56
claude/.claude/settings.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"env": {
|
||||
"CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-4-6"
|
||||
},
|
||||
"model": "opus[1m]",
|
||||
"hooks": {
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "sh -c 'h=$(git rev-parse HEAD 2>/dev/null); [ -z \"$h\" ] && exit 0; f=\"$(git rev-parse --git-dir 2>/dev/null)/.sesh_last_capture_head\"; [ \"$h\" = \"$(cat \"$f\" 2>/dev/null)\" ] && exit 0; sesh capture --commit HEAD && echo \"$h\" > \"$f\"'"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"SubagentStop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "python3 ~/.claude/scripts/ntfy-recap.py 2>/dev/null || true",
|
||||
"timeout": 15,
|
||||
"async": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"SessionEnd": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "python3 ~/.claude/scripts/ntfy-recap.py 2>/dev/null || true",
|
||||
"timeout": 15,
|
||||
"async": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"enabledPlugins": {
|
||||
"pyright-lsp@claude-plugins-official": true,
|
||||
"caveman@caveman": true
|
||||
},
|
||||
"extraKnownMarketplaces": {
|
||||
"caveman": {
|
||||
"source": {
|
||||
"source": "github",
|
||||
"repo": "JuliusBrussee/caveman"
|
||||
}
|
||||
}
|
||||
},
|
||||
"theme": "dark-daltonized",
|
||||
"skipAutoPermissionPrompt": true
|
||||
}
|
||||
248
emacs/.config/doom/+org-reminders.el
Normal file
@ -0,0 +1,248 @@
|
||||
;;; +org-reminders.el --- Send org task reminders via ntfy -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Scans org-agenda-files for TODO entries that carry a timestamp
|
||||
;; (SCHEDULED:, DEADLINE:, or an inline active timestamp under the heading)
|
||||
;; and publishes ntfy notifications ahead of time.
|
||||
;;
|
||||
;; Every timed entry gets a default reminder (`org-reminder-default-interval'),
|
||||
;; plus any offsets listed in a `:REMINDER:' property. Example:
|
||||
;;
|
||||
;; ** TODO Book vet appointment :errand:
|
||||
;; :PROPERTIES:
|
||||
;; :ID: abcd-1234
|
||||
;; :REMINDER: 2d 3h 30m
|
||||
;; :END:
|
||||
;; <2026-08-20 Wed 9:00-9:30>
|
||||
;;
|
||||
;; fires ntfy 2 days, 3 hours and 30 minutes before 2026-08-20 09:00 (and
|
||||
;; the default 15m before too). `:REMINDER: none' suppresses everything.
|
||||
|
||||
;;; Code:
|
||||
(require 'cl-lib)
|
||||
(require 'seq)
|
||||
(require 'org)
|
||||
|
||||
(defvar org-reminder-ntfy-base "https://ntfy.unbl.ink"
|
||||
"Base URL of the ntfy server.")
|
||||
|
||||
(defvar org-reminder-ntfy-topic "org-tasks"
|
||||
"ntfy topic to publish task reminders to.")
|
||||
|
||||
(defvar org-reminder-state-file "~/.cache/org-reminders.el"
|
||||
"File persisting already-sent reminders.")
|
||||
|
||||
(defvar org-reminder-grace-minutes 10
|
||||
"A reminder may be fired up to this many minutes late and still send.
|
||||
Avoids a backlog flood after the Emacs daemon was down.")
|
||||
|
||||
(defvar org-reminder-default-interval "15m"
|
||||
"Default reminder offset for timed entries lacking a :REMINDER: property.
|
||||
Set to \"none\" to disable the default entirely.")
|
||||
|
||||
(defvar org-reminder-state (make-hash-table :test 'equal)
|
||||
"Hash of already-sent reminders: key (ID::LABEL) -> fire time.")
|
||||
|
||||
(defvar org-reminder-file-cache (make-hash-table :test 'equal)
|
||||
"Maps file -> (MTIME . SPECS) so unchanged files are only parsed once.")
|
||||
|
||||
(defvar org-reminder-last-refresh 0
|
||||
"Timestamp of the last org-agenda-files refresh.")
|
||||
|
||||
(defun org-reminder-parse-intervals (str)
|
||||
"Parse reminder offset string STR into a list of (LABEL . SECONDS).
|
||||
STR looks like \"2d 3h 30m\" (also accepts commas or semicolons).
|
||||
Unrecognized tokens are ignored."
|
||||
(let ((intervals nil))
|
||||
(dolist (tok (split-string str "[,; ]+" t))
|
||||
(when (string-match "\\`\\([0-9]+\\)\\([wdhm]\\)\\'" tok)
|
||||
(let* ((n (string-to-number (match-string 1 tok)))
|
||||
(unit (match-string 2 tok))
|
||||
(secs (* n (pcase unit
|
||||
("w" 604800)
|
||||
("d" 86400)
|
||||
("h" 3600)
|
||||
("m" 60)))))
|
||||
(push (cons tok secs) intervals))))
|
||||
(nreverse intervals)))
|
||||
|
||||
(defun org-reminder-default-intervals ()
|
||||
"Return the default reminder interval list."
|
||||
(if (and org-reminder-default-interval
|
||||
(not (string-match-p "\\`none\\'"
|
||||
(downcase (string-trim org-reminder-default-interval)))))
|
||||
(org-reminder-parse-intervals org-reminder-default-interval)
|
||||
nil))
|
||||
|
||||
(defun org-reminder-task-intervals (rem)
|
||||
"Return reminder intervals for a task given its :REMINDER: value REM.
|
||||
The default interval is appended unless REM suppresses it."
|
||||
(cond
|
||||
((null rem) (org-reminder-default-intervals))
|
||||
((string-match-p "\\`none\\'" (downcase (string-trim rem))) nil)
|
||||
(t (append (org-reminder-parse-intervals rem)
|
||||
(org-reminder-default-intervals)))))
|
||||
|
||||
(defun org-reminder-ts-to-seconds (ts)
|
||||
"Parse org timestamp string TS into epoch seconds (range start)."
|
||||
(when ts
|
||||
(float-time (encode-time (org-parse-time-string ts)))))
|
||||
|
||||
(defconst org-reminder-ts-regexp "<[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^>\n]*>"
|
||||
"Regex matching a single active org timestamp.")
|
||||
|
||||
(defun org-reminder-first-inline-ts (limit)
|
||||
"Return epoch seconds of first active timestamp at/after point, before LIMIT."
|
||||
(save-excursion
|
||||
(let ((found nil))
|
||||
(while (and (not found)
|
||||
(re-search-forward org-reminder-ts-regexp limit t))
|
||||
(setq found (match-string 0)))
|
||||
(and found (org-reminder-ts-to-seconds found)))))
|
||||
|
||||
(defun org-reminder-parse-file (file)
|
||||
"Parse FILE and return its list of reminder specs.
|
||||
Each spec is (ID HEADING FIRE-TIME LABEL SECONDS)."
|
||||
(let (specs)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(delay-mode-hooks (org-mode))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "^\\*+ " nil t)
|
||||
(let ((subtree-end (save-excursion (org-end-of-subtree t t))))
|
||||
(if (and (org-get-todo-state) (not (org-entry-is-done-p)))
|
||||
(let* ((heading (string-trim (org-get-heading t t t t)))
|
||||
(id (or (org-entry-get nil "ID" t)
|
||||
(format "%s|%s" file heading)))
|
||||
(rem (org-entry-get nil "REMINDER" t))
|
||||
(anchor (progn
|
||||
(org-end-of-meta-data t)
|
||||
(org-reminder-first-inline-ts subtree-end))))
|
||||
(when anchor
|
||||
(dolist (interval (org-reminder-task-intervals rem))
|
||||
(push (list id heading
|
||||
(- anchor (cdr interval))
|
||||
(car interval) (cdr interval))
|
||||
specs)))
|
||||
(goto-char subtree-end))
|
||||
(goto-char (line-end-position))))))
|
||||
(nreverse specs))))
|
||||
|
||||
(defun org-reminder-agenda-files ()
|
||||
"Return the list of agenda files, refreshing it (throttled) from vulpea."
|
||||
(when (> (- (float-time) org-reminder-last-refresh) 600)
|
||||
(setq org-reminder-last-refresh (float-time))
|
||||
(condition-case nil
|
||||
(when (fboundp 'vulpea-agenda-files-update)
|
||||
(vulpea-agenda-files-update))
|
||||
(error nil)))
|
||||
(condition-case nil (org-agenda-files) (error nil)))
|
||||
|
||||
(defun org-reminder-collect (&optional files)
|
||||
"Return reminder specs for FILES (default: `org-reminder-agenda-files').
|
||||
|
||||
Uses an mtime cache so unchanged files are not re-parsed."
|
||||
(let ((specs nil)
|
||||
(files (seq-uniq (or files (org-reminder-agenda-files)))))
|
||||
(dolist (file files)
|
||||
(when (file-exists-p file)
|
||||
(let* ((mtime (nth 5 (file-attributes file)))
|
||||
(cached (gethash file org-reminder-file-cache)))
|
||||
(if (and cached (equal (cdr cached) mtime))
|
||||
(setq specs (append specs (cddr cached)))
|
||||
(let ((new (org-reminder-parse-file file)))
|
||||
(puthash file (cons mtime new) org-reminder-file-cache)
|
||||
(setq specs (append specs new)))))))
|
||||
specs))
|
||||
|
||||
(defun org-reminder-human-delta (secs)
|
||||
"Format SECS as a human friendly duration."
|
||||
(let* ((s (round secs))
|
||||
(m (/ s 60))
|
||||
(h (/ m 60))
|
||||
(d (/ h 24)))
|
||||
(cond
|
||||
((>= d 1) (format "%dd %dh" d (mod h 24)))
|
||||
((>= h 1) (format "%dh %dm" h (mod m 60)))
|
||||
((>= m 1) (format "%dm" m))
|
||||
(t (format "%ds" s)))))
|
||||
|
||||
(defun org-reminder-send (title body)
|
||||
"Send a ntfy notification with TITLE and BODY."
|
||||
(let* ((url (format "%s/%s" org-reminder-ntfy-base org-reminder-ntfy-topic))
|
||||
(buf (get-buffer-create "*org-reminders-ntfy*"))
|
||||
(exit (call-process "curl" nil buf nil
|
||||
"-s" "-f"
|
||||
"-H" (format "Title: %s" (substring-no-properties title))
|
||||
"-H" "Tags: bell"
|
||||
"-d" body
|
||||
url)))
|
||||
(unless (zerop exit)
|
||||
(message "org-reminders: ntfy send failed (%s): %s"
|
||||
exit (with-current-buffer buf (buffer-string))))
|
||||
(kill-buffer buf)))
|
||||
|
||||
(defun org-reminder-state-load ()
|
||||
"Load the sent-reminder state from `org-reminder-state-file'."
|
||||
(setq org-reminder-state (make-hash-table :test 'equal))
|
||||
(let ((file (expand-file-name org-reminder-state-file)))
|
||||
(when (file-exists-p file)
|
||||
(condition-case nil
|
||||
(let ((alist (read (with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(buffer-string)))))
|
||||
(dolist (pair alist)
|
||||
(puthash (car pair) (cdr pair) org-reminder-state)))
|
||||
(error (message "org-reminders: could not read state file %s" file))))))
|
||||
|
||||
(defun org-reminder-state-save ()
|
||||
"Persist `org-reminder-state' to `org-reminder-state-file'."
|
||||
(let ((file (expand-file-name org-reminder-state-file))
|
||||
(alist nil))
|
||||
(maphash (lambda (k v) (push (cons k v) alist)) org-reminder-state)
|
||||
(make-directory (file-name-directory file) t)
|
||||
(with-temp-file file
|
||||
(prin1 alist (current-buffer)))))
|
||||
|
||||
(defun org-reminder-prune-state (now)
|
||||
"Drop sent-reminder entries older than 30 days."
|
||||
(maphash (lambda (k v)
|
||||
(when (< v (- now (* 30 86400)))
|
||||
(remhash k org-reminder-state)))
|
||||
org-reminder-state))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-reminder-check ()
|
||||
"Send any due org task reminders via ntfy."
|
||||
(interactive)
|
||||
(condition-case err
|
||||
(let ((now (float-time)))
|
||||
(dolist (spec (org-reminder-collect))
|
||||
(pcase spec
|
||||
(`(,id ,heading ,fire ,label ,secs)
|
||||
(let ((key (format "%s::%s" id label)))
|
||||
(when (and (<= fire now)
|
||||
(< now (+ fire (* org-reminder-grace-minutes 60)))
|
||||
(not (gethash key org-reminder-state)))
|
||||
(org-reminder-send
|
||||
(format "Reminder: %s" heading)
|
||||
(format "Due %s — %s away"
|
||||
(format-time-string "%a %b %e %H:%M" (+ fire secs))
|
||||
(org-reminder-human-delta (- (+ fire secs) now))))
|
||||
(puthash key now org-reminder-state)
|
||||
(org-reminder-state-save)
|
||||
(message "org-reminders: sent '%s' (%s)" heading label)))))
|
||||
(org-reminder-prune-state now)))
|
||||
(error (message "org-reminders: check failed: %S" err))))
|
||||
|
||||
(defun org-reminder-start ()
|
||||
"Load state and start the periodic reminder check."
|
||||
(org-reminder-state-load)
|
||||
(run-with-timer 60 60 #'org-reminder-check))
|
||||
|
||||
(provide '+org-reminders)
|
||||
|
||||
(org-reminder-start)
|
||||
|
||||
;;; +org-reminders.el ends here
|
||||
@ -1,5 +1,9 @@
|
||||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun powellc/reload-config ()
|
||||
(interactive)
|
||||
(load-file (expand-file-name "config.el" doom-private-dir)))
|
||||
|
||||
(setq user-full-name "Colin Powell"
|
||||
user-mail-address "colin@unbl.ink")
|
||||
|
||||
@ -38,15 +42,52 @@
|
||||
(setq org-directory "~/var/org/")
|
||||
|
||||
(load! "+agenda-fix")
|
||||
(load! "+org-reminders")
|
||||
(defun vulpea-agenda-files-update (&rest _)
|
||||
(setq org-agenda-files vulpea-project-files))
|
||||
|
||||
(setq org-roam-directory "~/var/org/"
|
||||
org-roam-dailies-directory "dailies")
|
||||
org-roam-dailies-directory "journals")
|
||||
|
||||
(setq org-roam-dailies-capture-templates
|
||||
'(("d" "default" entry
|
||||
"* Meetings :work:hungryroot:meeting:\n* Tasks :work:hungryroot:\n** %?"
|
||||
:target (file+head "%<%Y_%m_%d>.org"
|
||||
"#+title: %<%Y_%m_%d>\n")
|
||||
:empty-lines 1)))
|
||||
|
||||
; Capture templates
|
||||
(setq org-capture-templates
|
||||
'(("i" "Send to inbox" entry (file "~/var/org/inbox.org")
|
||||
"* TODO %?\n %i\n %a")
|
||||
|
||||
("d" "Add an idea" entry (file "~/var/org/ideas.org")
|
||||
|
||||
"* %?\nEntered on %U\n %i\n")
|
||||
|
||||
))
|
||||
|
||||
(setq org-roam-capture-templates
|
||||
'(("d" "default" plain "%?"
|
||||
:target (file+head "pages/${slug}.org"
|
||||
"#+title: ${title}\n")
|
||||
:unnarrowed t)))
|
||||
|
||||
(advice-add 'org-agenda :before #'vulpea-agenda-files-update)
|
||||
(advice-add 'org-todo-list :before #'vulpea-agenda-files-update)
|
||||
|
||||
;; Effort tracking: preset levels for C-c C-x e, progress in modeline,
|
||||
;; and agenda sorted by estimate.
|
||||
(setq org-global-properties
|
||||
'(("Effort_ALL" . "0:10 0:30 1:00 2:00 3:00 4:00"))
|
||||
org-clock-modeline-total-effort t
|
||||
org-clock-out-when-done t
|
||||
org-agenda-sorting-strategy
|
||||
'((agenda habit-down time-up effort-up priority-down category-keep)
|
||||
(todo priority-down category-keep)
|
||||
(tags priority-down category-keep)
|
||||
(search category-keep)))
|
||||
|
||||
;; Open HR term popup (vterm with hrdjsh)
|
||||
(defun powellc/open-hr-term ()
|
||||
"Open a vterm popup and run hrdjsh."
|
||||
@ -105,7 +146,7 @@
|
||||
:desc "Open curosr shell" "c" #'powellc/open-opencode-agent
|
||||
:desc "Open Hungryroot shell" "S" #'powellc/open-hr-term)
|
||||
(:prefix "g"
|
||||
:desc "PR comments for branch" "c" #'powellc/gh-pr-comments-for-branch))
|
||||
:desc "PR comments for branch" "p" #'powellc/gh-pr-comments-for-branch))
|
||||
|
||||
(defun unfill-paragraph ()
|
||||
"Takes a multi-line paragraph and makes it into a single line of text."
|
||||
@ -450,9 +491,8 @@ Returns the ID string."
|
||||
(request
|
||||
endpoint
|
||||
:type "POST"
|
||||
:headers '(("Content-Type" . "application/json"))
|
||||
:data (json-encode data)
|
||||
:headers '(("Authorization" . "Token 58e898c0e88bd6333b1a9e8de82e81f36c4b64e")
|
||||
:headers '(("Authorization" . "Token 58e898c0e88bd6333b1a9e8de82e81f36c4b64e4")
|
||||
("Content-Type" . "application/json"))
|
||||
:parser 'json-read
|
||||
:success (cl-function
|
||||
@ -460,7 +500,7 @@ Returns the ID string."
|
||||
(message "Sent TODO: %s" data)))
|
||||
:error (cl-function
|
||||
(lambda (&rest args &key error-thrown &allow-other-keys)
|
||||
(message "Error sending TODO: %S" error-thrown))))))
|
||||
(message "Error sending TODO: %S with %S" error-thrown args))))))
|
||||
(org-clock-on-state-change)
|
||||
)))
|
||||
|
||||
@ -562,3 +602,69 @@ Always open the result in `eww`."
|
||||
(setq agent-shell-google-authentication
|
||||
(agent-shell-google-make-authentication
|
||||
:api-key (lambda () (+pass-line1 "work/hungryroot/apikeys/gemini")))))
|
||||
|
||||
(defun powellc/gh-pr-comments-for-branch ()
|
||||
"Select a branch via projectile and pull its PR comments into a new buffer."
|
||||
(interactive)
|
||||
(require 'projectile)
|
||||
(let* ((project-root (projectile-project-root))
|
||||
(default-directory (or project-root default-directory)))
|
||||
(unless project-root
|
||||
(user-error "Not in a projectile project"))
|
||||
(let* ((branch-output (shell-command-to-string "git for-each-ref --format='%(refname:short)' refs/heads/ 2>/dev/null"))
|
||||
(branches (seq-filter (lambda (s) (and (not (string-empty-p s)) (not (string-prefix-p " " s))))
|
||||
(split-string branch-output "\n" t))))
|
||||
(unless branches
|
||||
(user-error "No branches found"))
|
||||
(let* ((branch (projectile-completing-read "Select branch:" branches))
|
||||
(pr-json (shell-command-to-string
|
||||
(format "gh pr list --state all --json id,number,title,headRefName 2>/dev/null")))
|
||||
(pr-list (ignore-errors (mapcar #'json-parse-object (json-read-from-string pr-json))))
|
||||
(matching-pr (seq-find (lambda (pr) (string= (alist-get 'headRefName pr) branch)) pr-list)))
|
||||
(if (or (null matching-pr) (not matching-pr))
|
||||
(user-error "No PR found for branch: %s" branch)
|
||||
(let* ((pr matching-pr)
|
||||
(pr-id (alist-get 'id pr))
|
||||
(pr-number (number-to-string (alist-get 'number pr)))
|
||||
(pr-title (alist-get 'title pr))
|
||||
(comments-output (shell-command-to-string
|
||||
(format "gh pr view %s --comments --json body,author,createdAt,path,line 2>/dev/null"
|
||||
(shell-quote-argument pr-id))))
|
||||
(comments (ignore-errors (mapcar #'json-parse-object (json-read-from-string comments-output)))))
|
||||
(if (or (null comments) (seq-empty-p comments))
|
||||
(user-error "No comments found for PR #%s" pr-number)
|
||||
(let ((buf (get-buffer-create (format "*PR #%s Comments*" pr-number))))
|
||||
(with-current-buffer buf
|
||||
(erase-buffer)
|
||||
(insert (format "# PR #%s: %s\n" pr-number pr-title))
|
||||
(insert (format "Branch: %s\n\n" branch))
|
||||
(insert "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n"))
|
||||
(dolist (comment comments)
|
||||
(let ((author (alist-get 'author comment))
|
||||
(body (alist-get 'body comment))
|
||||
(created-at (alist-get 'createdAt comment))
|
||||
(path (alist-get 'path comment))
|
||||
(line (alist-get 'line comment)))
|
||||
(with-current-buffer buf
|
||||
(insert (format "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"))
|
||||
(insert (format "Author: %s\n" (if (stringp author) author (alist-get 'login author))))
|
||||
(insert (format "Date: %s\n" created-at))
|
||||
(when path
|
||||
(insert (format "File: %s" path))
|
||||
(when line (insert (format ":%s" line)))
|
||||
(insert "\n"))
|
||||
(insert "\n")
|
||||
(insert (or body ""))
|
||||
(insert "\n\n")))
|
||||
(pop-to-buffer buf))))))))))
|
||||
(setq send-mail-function 'sendmail-send-it
|
||||
sendmail-program "/usr/bin/msmtp"
|
||||
mail-specify-envelope-from t
|
||||
message-sendmail-f-is-evil t
|
||||
message-sendmail-envelope-from 'header
|
||||
message-sendmail-extra-arguments '("--read-envelope-from")
|
||||
mail-envelope-from 'header)
|
||||
|
||||
(use-package! repeat-todo
|
||||
:after org
|
||||
(repeat-todo-mode-enable))
|
||||
|
||||
@ -263,7 +263,20 @@ easier. I just need to level up with Zettels and web publishing of my notes.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-roam-directory "~/var/org/")
|
||||
(setq org-roam-dailies-directory "dailies")
|
||||
(setq org-roam-dailies-directory "journals")
|
||||
|
||||
(setq org-roam-dailies-capture-templates
|
||||
'(("d" "default" entry
|
||||
"* Meetings :work:hungryroot:meeting:\n* Tasks :work:hungryroot:\n** %?"
|
||||
:target (file+head "%<%Y_%m_%d>.org"
|
||||
"#+title: %<%Y_%m_%d>\n")
|
||||
:empty-lines 1)))
|
||||
|
||||
(setq org-roam-capture-templates
|
||||
'(("d" "default" plain "%?"
|
||||
:target (file+head "pages/${slug}.org"
|
||||
"#+title: ${title}\n")
|
||||
:unnarrowed t)))
|
||||
#+END_SRC
|
||||
|
||||
* Novel
|
||||
@ -333,7 +346,7 @@ We'll use `msmtp` to send our email. Again, make sure this is installed.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; sendmail-program "/usr/local/bin/msmtpq" <--- this doesn't work as advertised right now
|
||||
(setq send-mail-function 'sendmail-send-it
|
||||
sendmail-program "/usr/local/bin/msmtp"
|
||||
sendmail-program "/usr/bin/msmtp"
|
||||
mail-specify-envelope-from t
|
||||
message-sendmail-f-is-evil t
|
||||
message-sendmail-envelope-from 'header
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
;; If there is more than one, they won't work right.
|
||||
'(magit-todos-insert-after '(bottom) nil nil "Changed by setter of obsolete option `magit-todos-insert-at'")
|
||||
'(package-selected-packages
|
||||
'(csv-mode acp agent-shell direnv ef-themes helix-theme just-mode justl magit-todos nov pinentry vulpea w3m))
|
||||
'(acp agent-shell csv-mode direnv eca ef-themes helix-theme just-mode justl
|
||||
magit-todos nov pinentry vulpea w3m))
|
||||
'(safe-local-variable-values '((pytest-global-name . "docker-compose run --rm test --"))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
|
||||
@ -30,9 +30,9 @@
|
||||
:ui
|
||||
;;deft ; notational velocity for Emacs
|
||||
doom ; what makes DOOM look the way it does
|
||||
doom-dashboard ; a nifty splash screen for Emacs
|
||||
dashboard ; a nifty splash screen for Emacs
|
||||
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
|
||||
(emoji +unicode) ; 🙂
|
||||
;;(emoji +unicode) ; 🙂
|
||||
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
|
||||
hydra
|
||||
;;indent-guides ; highlighted indent columns
|
||||
@ -148,7 +148,7 @@
|
||||
;;kotlin ; a better, slicker Java(Script)
|
||||
;;latex ; writing papers in Emacs has never been so fun
|
||||
;;lean ; for folks with too much to prove
|
||||
;;ledger ; be audit you can be
|
||||
ledger ; be audit you can be
|
||||
;;lua ; one-based indices? one-based indices
|
||||
markdown ; writing docs for people to ignore
|
||||
;;nim ; python + lisp at the speed of c
|
||||
|
||||
@ -23,11 +23,9 @@
|
||||
(package! agent-shell)
|
||||
(package! auth-source-pass)
|
||||
|
||||
(package! org-todoist
|
||||
(package! repeat-todo
|
||||
:recipe (:host github
|
||||
:repo "lillenne/org-todoist"
|
||||
:branch "main"
|
||||
:files ("org-todoist.el")))
|
||||
:repo "cashpw/repeat-todo"))
|
||||
|
||||
;; To install a package directly from a remote git repo, you must specify a
|
||||
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
|
||||
|
||||
1
fish/.config/fish/conf.d/rustup.fish
Normal file
@ -0,0 +1 @@
|
||||
source "$HOME/.cargo/env.fish"
|
||||
@ -1,3 +1,3 @@
|
||||
[user]
|
||||
email = colin.powell@hungryroot.com
|
||||
signingkey = 087BAEDCEB065D3039A6B0840B9C9536EC0B6A3B
|
||||
signingkey = BB257E06080FE639030D9291819A121699A1FD39
|
||||
|
||||
@ -36,3 +36,10 @@ ssh/.ssh/known_hosts
|
||||
*.key
|
||||
emoijis
|
||||
SCRATCH.org
|
||||
personal-org
|
||||
bin/.local/bin/agent
|
||||
bin/.local/bin/claude
|
||||
bin/.local/bin/cursor
|
||||
bin/.local/bin/cursor-agent
|
||||
|
||||
**/.claude/settings.local.json
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// This extension is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
// See the GNU General Public License, version 3 or later for details.
|
||||
|
||||
import St from 'gi://St';
|
||||
import Gio from 'gi://Gio';
|
||||
|
||||
const CLIPBOARD_TYPE = St.ClipboardType.CLIPBOARD;
|
||||
|
||||
export default class BWClipboard {
|
||||
constructor() {
|
||||
this.clipboard = St.Clipboard.get_default();
|
||||
}
|
||||
|
||||
setImage(filename) {
|
||||
try {
|
||||
let file = Gio.File.new_for_path(filename);
|
||||
let [success, image_data] = file.load_contents(null);
|
||||
//console.log('error: '+success);
|
||||
if (success)
|
||||
this.clipboard.set_content(CLIPBOARD_TYPE, 'image/jpeg', image_data);
|
||||
} catch (err) {
|
||||
console.log('unable to set clipboard to data in '+filename);
|
||||
}
|
||||
}
|
||||
|
||||
setText(text) {
|
||||
this.clipboard.set_text(CLIPBOARD_TYPE, text);
|
||||
}
|
||||
};
|
||||
@ -15,11 +15,9 @@ Also, check out my related [Google Earth View wallpaper extension](https://githu
|
||||
* Automatically sets the Bing [Image of the Day](https://www.microsoft.com/en-us/bing/bing-wallpaper) as both lock screen and desktop wallpapers
|
||||
* Only attempts to download wallpapers when they have been updated - doesn't poll continuously
|
||||
* Shuffle/randomise wallpapers at adjustable intervals (including from your stored Bing images)
|
||||
* Image gallery to view, select and curate stored images
|
||||
* Optionally delete old images after a week, or you can keep (and curate) them forever
|
||||
* Override the lockscreen blur (NEW: lockscreen blur is now dynamic!)
|
||||
* Language support: English (en), German (de), Dutch (nl), Italian (it), Polish (pl), Chinese (zh_CN, zh_TW), French (fr_FR), Portuguese (pt, pt_BR), Ukrainian (uk), Russian (ru_RU), Spanish (es), Korean (ko), Indonesian (id), Catalan (ca), Norwegian Bokmål (nb) & Nynorsk (nn), Swedish (sv), Arabic (ar), Hungarian (hu), Japanese (ja), Czech (cs_CZ), Finnish (fi_FI) and Turkish (tr), Persian (fa_ir) - a HUGE thanks to the translators
|
||||
* Image preview in menus & ability to manually set wallpapers individually or copy image to clipboard
|
||||
* Image preview in menus & ability to manually set wallpapers individually
|
||||
* A selection of different theme-aware indicator (tray) icons to choose (or hide it completely)
|
||||
|
||||
## Quickstart guide
|
||||
@ -69,7 +67,7 @@ The 5 buttons in the gallery (3rd page in the preferences) do have tool-tips but
|
||||
|
||||
## System Requirements
|
||||
|
||||
GNOME 3.36+ or 40+ (Ubuntu 20.04 LTS or later, older versions of the extension work with 3.18+, but are no longer supported).
|
||||
GNOME 45+ (Ubuntu 24.04 LTS or later, older versions of the extension work with 3.18+, but are no longer supported).
|
||||
|
||||
## Package dependencies
|
||||
|
||||
@ -110,26 +108,12 @@ GSETTINGS_SCHEMA_DIR=$HOME/.local/share/gnome-shell/extensions/BingWallpaper@ine
|
||||
Please include logs from your journal when submitting bug notices (make sure nothing sensitive is included in the text!).
|
||||
|
||||
## Screenshots
|
||||
|
||||
### Image gallery
|
||||
|
||||

|
||||
|
||||
### Preferences
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
### Lockscreen blur control
|
||||
From left to right:
|
||||
* no blur/no dimming
|
||||
* slight blur/default dimming
|
||||
* default blur/default dimming
|
||||

|
||||
|
||||
## Toss a coin to your coder
|
||||
|
||||
Do you like this extension and want to show that you appreciate the work that goes into adding new features and keeping it maintained? Please consider buying me a coffee on [GitHub Sponsors](https://github.com/sponsors/neffo) or on [Flattr](https://flattr.com/@neffo).
|
||||
@ -141,7 +125,7 @@ This extension is unofficial and not affiliated with Bing or Microsoft in any wa
|
||||
## Special Thanks
|
||||
|
||||
This extension is based on the NASA APOD extension by [Elinvention](https://github.com/Elinvention)
|
||||
and inspired by Bing Desktop WallpaperChanger by [Utkarsh Gupta](https://github.com/UtkarshGpta). Lockscreen blur code is based on [Pratap-Kumar's extension](https://github.com/PRATAP-KUMAR/Control_Blur_Effect_On_Lock_Screen). I'd like to give a special shout out to those who have [contributed code and translations](https://github.com/neffo/bing-wallpaper-gnome-extension/graphs/contributors) as well as everyone who has reported bugs or provided feedback and suggestions for improvements. Also, thanks to Microsoft for this great API and wallpaper collection.
|
||||
and inspired by Bing Desktop WallpaperChanger by [Utkarsh Gupta](https://github.com/UtkarshGpta). I'd like to give a special shout out to those who have [contributed code and translations](https://github.com/neffo/bing-wallpaper-gnome-extension/graphs/contributors) as well as everyone who has reported bugs or provided feedback and suggestions for improvements. Also, thanks to Microsoft for this great API and wallpaper collection.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@ -1,159 +0,0 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// This extension is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
// See the GNU General Public License, version 3 or later for details.
|
||||
// Based on GNOME shell extension NASA APOD by Elia Argentieri https://github.com/Elinvention/gnome-shell-extension-nasa-apod
|
||||
// This code based on https://github.com/PRATAP-KUMAR/Control_Blur_Effect_On_Lock_Screen
|
||||
// and https://github.com/sunwxg/gnome-shell-extension-unlockDialogBackground
|
||||
|
||||
import St from 'gi://St';
|
||||
import * as UnlockDialog from 'resource:///org/gnome/shell/ui/unlockDialog.js';
|
||||
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
|
||||
var _updateBackgroundEffects = UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects;
|
||||
var _showClock = UnlockDialog.UnlockDialog.prototype._showClock;
|
||||
var _showPrompt = UnlockDialog.UnlockDialog.prototype._showPrompt;
|
||||
|
||||
var shellVersionMajor = parseInt(Config.PACKAGE_VERSION.split('.')[0]);
|
||||
var shellVersionMinor = parseInt(Config.PACKAGE_VERSION.split('.')[1]);
|
||||
var shellVersionPoint = parseInt(Config.PACKAGE_VERSION.split('.')[2]);
|
||||
|
||||
var blurField = shellVersionMajor >= 46 ? "radius" : "sigma";
|
||||
// default BWP mild blur
|
||||
var BWP_BLUR_SIGMA = 2;
|
||||
var BWP_BLUR_BRIGHTNESS = 55;
|
||||
// GNOME defaults
|
||||
var BLUR_BRIGHTNESS = 0.55;
|
||||
var BLUR_SIGMA = 60;
|
||||
var debug = false;
|
||||
|
||||
var promptActive = false; // default GNOME method of testing this relies on state of a transisiton
|
||||
// so we are being explicit here (do not want any races, thanks)
|
||||
|
||||
function BingLog(msg) {
|
||||
if (debug) // set 'debug' above to false to keep the noise down in journal
|
||||
console.log("BingWallpaper extension/Blur: " + msg);
|
||||
}
|
||||
|
||||
// we patch UnlockDialog._updateBackgroundEffects()
|
||||
export function _updateBackgroundEffects_BWP(monitorIndex) {
|
||||
// GNOME shell 3.36.4 and above
|
||||
BingLog("_updateBackgroundEffects_BWP() called for shell >= 3.36.4");
|
||||
const themeContext = St.ThemeContext.get_for_stage(global.stage);
|
||||
for (const widget of this._backgroundGroup.get_children()) {
|
||||
// set blur effects, we have two modes in lockscreen: login prompt or clock
|
||||
// blur on when clock is visible is adjustable
|
||||
const effect = widget.get_effect('blur');
|
||||
if (promptActive) {
|
||||
BingLog('default blur active');
|
||||
if (effect) {
|
||||
effect.set({ // GNOME defaults when login prompt is visible
|
||||
brightness: BLUR_BRIGHTNESS,
|
||||
[blurField]: BLUR_SIGMA * themeContext.scale_factor,
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
BingLog('adjustable blur active');
|
||||
if (effect) {
|
||||
effect.set({ // adjustable blur when clock is visible
|
||||
brightness: BWP_BLUR_BRIGHTNESS * 0.01, // we use 0-100 rather than 0-1, so divide by 100
|
||||
[blurField]: BWP_BLUR_SIGMA * themeContext.scale_factor,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// we patch both UnlockDialog._showClock() and UnlockDialog._showPrompt() to let us
|
||||
// adjustable blur in a Windows-like way (this ensures login prompt is readable)
|
||||
export function _showClock_BWP() {
|
||||
promptActive = false;
|
||||
this._showClock_GNOME(); // pass to default GNOME function
|
||||
this._updateBackgroundEffects();
|
||||
}
|
||||
|
||||
export function _showPrompt_BWP() {
|
||||
promptActive = true;
|
||||
this._showPrompt_GNOME(); // pass to default GNOME function
|
||||
this._updateBackgroundEffects();
|
||||
}
|
||||
|
||||
export function _clampValue(value) {
|
||||
// valid values are 0 to 100
|
||||
if (value > 100)
|
||||
value = 100;
|
||||
if (value < 0 )
|
||||
value = 0;
|
||||
return value;
|
||||
}
|
||||
export default class Blur {
|
||||
constructor() {
|
||||
this.enabled = false;
|
||||
BingLog('Bing Wallpaper adjustable blur is '+(supportedVersion()?'available':'not available'));
|
||||
}
|
||||
|
||||
set_blur_strength(value) {
|
||||
BWP_BLUR_SIGMA = _clampValue(value);
|
||||
BingLog("lockscreen blur strength set to "+BWP_BLUR_SIGMA);
|
||||
}
|
||||
|
||||
set_blur_brightness(value) {
|
||||
BWP_BLUR_BRIGHTNESS = _clampValue(value);
|
||||
BingLog("lockscreen brightness set to " + BWP_BLUR_BRIGHTNESS);
|
||||
}
|
||||
|
||||
_switch(enabled) {
|
||||
if (enabled && !this.enabled) {
|
||||
this._enable();
|
||||
}
|
||||
else {
|
||||
this._disable();
|
||||
}
|
||||
}
|
||||
|
||||
_enable() {
|
||||
if (supportedVersion()) {
|
||||
BingLog("Blur._enable() called on GNOME "+Config.PACKAGE_VERSION);
|
||||
UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects = _updateBackgroundEffects_BWP;
|
||||
// we override _showClock and _showPrompt to patch in updates to blur effect before calling the GNOME functions
|
||||
UnlockDialog.UnlockDialog.prototype._showClock = _showClock_BWP;
|
||||
UnlockDialog.UnlockDialog.prototype._showPrompt = _showPrompt_BWP;
|
||||
|
||||
// this are the original functions which we call into from our versions above
|
||||
UnlockDialog.UnlockDialog.prototype._showClock_GNOME = _showClock;
|
||||
UnlockDialog.UnlockDialog.prototype._showPrompt_GNOME = _showPrompt;
|
||||
|
||||
}
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
_disable() {
|
||||
if (!this.enabled)
|
||||
return;
|
||||
BingLog("_lockscreen_blur_disable() called");
|
||||
if (supportedVersion()) {
|
||||
// restore default functions
|
||||
UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects = _updateBackgroundEffects;
|
||||
UnlockDialog.UnlockDialog.prototype._showClock = _showClock;
|
||||
UnlockDialog.UnlockDialog.prototype._showPrompt = _showPrompt;
|
||||
// clean up unused functions we created
|
||||
UnlockDialog.UnlockDialog.prototype._showClock_GNOME = null;
|
||||
delete UnlockDialog.UnlockDialog.prototype._showClock_GNOME;
|
||||
UnlockDialog.UnlockDialog.prototype._showPrompt_GNOME = null;
|
||||
delete UnlockDialog.UnlockDialog.prototype._showPrompt_GNOME;
|
||||
}
|
||||
this.enabled = false;
|
||||
}
|
||||
};
|
||||
|
||||
function supportedVersion() { // when current lockscren blur implementation was first shipped (we ignore earlier weird version)
|
||||
if (shellVersionMajor >= 40 ||
|
||||
(shellVersionMajor == 3 && shellVersionMinor == 36 && shellVersionPoint >= 4)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1,203 +0,0 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// This extension is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
// See the GNU General Public License, version 3 or later for details.
|
||||
// Based on GNOME shell extension NASA APOD by Elia Argentieri https://github.com/Elinvention/gnome-shell-extension-nasa-apod
|
||||
|
||||
import Gtk from 'gi://Gtk';
|
||||
import GdkPixbuf from 'gi://GdkPixbuf';
|
||||
import Gio from 'gi://Gio';
|
||||
import * as Utils from './utils.js';
|
||||
import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
|
||||
const default_dimensions = [30, 30, 1650, 800]; // TODO: pull from and save dimensions to settings, but perhaps verify that dimensions are ok
|
||||
|
||||
const GALLERY_THUMB_WIDTH = 320;
|
||||
const GALLERY_THUMB_HEIGHT = 180;
|
||||
|
||||
export default class Carousel {
|
||||
constructor(settings, button = null, callbackfunc = null, prefs_flowbox = null, extensionPath = null) {
|
||||
//create_gallery(widget, settings);
|
||||
this.settings = settings;
|
||||
this.button = button;
|
||||
this.callbackfunc = callbackfunc;
|
||||
this.flowBox = null;
|
||||
this.window = null;
|
||||
this.imageList = Utils.imageListSortByDate(Utils.getImageList(this.settings)).reverse(); // get images and reverse order
|
||||
this.searchEntry = null;
|
||||
this.extensionPath = extensionPath
|
||||
|
||||
this._log('create carousel...');
|
||||
|
||||
this.flowBox = prefs_flowbox;
|
||||
this.flowBox.insert(this._create_placeholder_item(), -1);
|
||||
}
|
||||
|
||||
_enable_button() {
|
||||
if (this.button) {
|
||||
this.button.set_sensitive(state);
|
||||
}
|
||||
}
|
||||
|
||||
_create_gallery() {
|
||||
this.imageList.forEach((image) => {
|
||||
let item = this._create_gallery_item(image);
|
||||
this.flowBox.insert(item, -1);
|
||||
});
|
||||
}
|
||||
|
||||
_create_gallery_item(image) {
|
||||
let buildable = new Gtk.Builder();
|
||||
|
||||
// grab appropriate object from UI file
|
||||
buildable.add_objects_from_file(this.extensionPath + '/ui/carousel4.ui', ["flowBoxChild"]);
|
||||
|
||||
// assign variables to the UI objects we've just loaded
|
||||
let galleryImage = buildable.get_object('galleryImage');
|
||||
let filename = Utils.imageToFilename(this.settings, image);
|
||||
let viewButton = buildable.get_object('viewButton');
|
||||
let applyButton = buildable.get_object('applyButton');
|
||||
let infoButton = buildable.get_object('infoButton');
|
||||
let deleteButton = buildable.get_object('deleteButton');
|
||||
let favButton = buildable.get_object('favButton');
|
||||
let unfavButton = buildable.get_object('unfavButton');
|
||||
|
||||
if (Utils.isFavourite(image)) {
|
||||
favButton.set_visible(false);
|
||||
this._log('image is favourited');
|
||||
}
|
||||
else {
|
||||
unfavButton.set_visible(false);
|
||||
}
|
||||
|
||||
try {
|
||||
this._load_image(galleryImage, filename);
|
||||
}
|
||||
catch (e) {
|
||||
galleryImage.set_from_icon_name('image-missing');
|
||||
galleryImage.set_icon_size = 2; // Gtk.GTK_ICON_SIZE_LARGE;
|
||||
this._log('create_gallery_image: '+e);
|
||||
}
|
||||
|
||||
galleryImage.set_tooltip_text(image.copyright);
|
||||
|
||||
// set up actions for when a image button is clicked
|
||||
viewButton.connect('clicked', () => {
|
||||
Utils.openInSystemViewer(filename);
|
||||
});
|
||||
|
||||
applyButton.connect('clicked', () => {
|
||||
this.settings.set_string('selected-image', Utils.getImageUrlBase(image));
|
||||
this._log('gallery selected '+Utils.getImageUrlBase(image));
|
||||
});
|
||||
|
||||
infoButton.connect('clicked', () => {
|
||||
Utils.openInSystemViewer(image.copyrightlink, false);
|
||||
this._log('info page link opened '+image.copyrightlink);
|
||||
});
|
||||
|
||||
deleteButton.connect('clicked', (widget) => {
|
||||
this._log('Delete requested for '+filename);
|
||||
Utils.deleteImage(filename);
|
||||
Utils.setImageHiddenStatus(this.settings, image.urlbase, true);
|
||||
Utils.purgeImages(this.settings); // hide image instead
|
||||
widget.get_parent().get_parent().set_visible(false); // bit of a hack
|
||||
if (this.callbackfunc)
|
||||
this.callbackfunc();
|
||||
});
|
||||
|
||||
// button is unchecked, so we want to make the checked one visible
|
||||
favButton.connect('clicked', (widget) => {
|
||||
this._log('favourited '+Utils.getImageUrlBase(image));
|
||||
widget.set_visible(false);
|
||||
unfavButton.set_visible(true);
|
||||
Utils.setImageFavouriteStatus(this.settings, image.urlbase, true);
|
||||
});
|
||||
|
||||
// button is checked, so we want to make the unchecked one visible
|
||||
unfavButton.connect('clicked', (widget) => {
|
||||
this._log('unfavourited '+Utils.getImageUrlBase(image));
|
||||
widget.set_visible(false);
|
||||
favButton.set_visible(true);
|
||||
Utils.setImageFavouriteStatus(this.settings, image.urlbase, false);
|
||||
});
|
||||
|
||||
let item = buildable.get_object('flowBoxChild');
|
||||
return item;
|
||||
}
|
||||
|
||||
_create_placeholder_item() {
|
||||
let buildable = new Gtk.Builder();
|
||||
this.flowBox.set_max_children_per_line(1);
|
||||
|
||||
// grab appropriate object from UI file
|
||||
buildable.add_objects_from_file(this.extensionPath + '/ui/carousel4.ui', ["flowBoxPlaceholder"]);
|
||||
|
||||
let loadButton = buildable.get_object('loadButton');
|
||||
|
||||
loadButton.connect('clicked', (widget) => {
|
||||
widget.set_label(_("Loading...")); // does this work???
|
||||
this.flowBox.remove(widget.get_parent());
|
||||
this.flowBox.set_max_children_per_line(2);
|
||||
this._create_gallery();
|
||||
|
||||
});
|
||||
|
||||
let item = buildable.get_object('flowBoxPlaceholder');
|
||||
return item;
|
||||
}
|
||||
|
||||
_load_image(galleryImage, filename) {
|
||||
let thumb_path = Utils.getWallpaperDir(this.settings)+'.thumbs/';
|
||||
let thumb_dir = Gio.file_new_for_path(thumb_path);
|
||||
let save_thumbs = !this.settings.get_boolean('delete-previous') && this.settings.get_boolean('create-thumbs'); // create thumbs only if not deleting previous and thumbs are enabled
|
||||
|
||||
if (!thumb_dir.query_exists(null)) {
|
||||
thumb_dir.make_directory_with_parents(null);
|
||||
}
|
||||
|
||||
let image_file = Gio.file_new_for_path(filename);
|
||||
|
||||
// load gallery image or create new thumbnail if it doesn't
|
||||
if (!image_file.query_exists(null)){
|
||||
this._set_blank_image(galleryImage);
|
||||
}
|
||||
else {
|
||||
let image_thumb_path = thumb_path + image_file.get_basename();
|
||||
let image_thumb = Gio.file_new_for_path(image_thumb_path);
|
||||
|
||||
try {
|
||||
let pixbuf;
|
||||
|
||||
// use thumbnail if available
|
||||
if (image_thumb.query_exists(null)) {
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_thumb_path);
|
||||
}
|
||||
else { // save changed thumbnail significantly speeds up gallery loading, but costs some addtional disk space
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename, GALLERY_THUMB_WIDTH, GALLERY_THUMB_HEIGHT);
|
||||
if (save_thumbs)
|
||||
pixbuf.savev(image_thumb_path,'jpeg',['quality'], ['90']);
|
||||
}
|
||||
|
||||
galleryImage.set_pixbuf(pixbuf);
|
||||
}
|
||||
catch (e) {
|
||||
this._set_blank_image(galleryImage);
|
||||
this._log('create_gallery_image: '+e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_set_blank_image(galleryImage) {
|
||||
//galleryImage.set_from_icon_name('image-missing');
|
||||
//galleryImage.set_icon_size = 2; // Gtk.GTK_ICON_SIZE_LARGE;
|
||||
}
|
||||
|
||||
_log(msg) {
|
||||
if (this.settings.get_boolean('debug-logging'))
|
||||
console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal
|
||||
}
|
||||
};
|
||||
@ -23,9 +23,7 @@ import * as Config from 'resource:///org/gnome/shell/misc/config.js';
|
||||
|
||||
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
import * as Utils from './utils.js';
|
||||
import Blur from './blur.js';
|
||||
import Thumbnail from './thumbnail.js';
|
||||
import BWClipboard from './BWClipboard.js';
|
||||
|
||||
const BingImageURL = Utils.BingImageURL;
|
||||
const BingURL = 'https://www.bing.com';
|
||||
@ -38,7 +36,6 @@ const ICON_NEXT_BUTTON = 'media-seek-forward-symbolic';
|
||||
const ICON_CURRENT_BUTTON = 'media-skip-forward-symbolic';
|
||||
|
||||
let bingWallpaperIndicator = null;
|
||||
let blur = null;
|
||||
|
||||
const newMenuItem = (label) => {
|
||||
return new PopupMenu.PopupMenuItem(label);
|
||||
@ -107,7 +104,6 @@ class BingWallpaperIndicator extends Button {
|
||||
this.thumbnail = null;
|
||||
this.thumbnailItem = null;
|
||||
this.selected_image = "current";
|
||||
this.clipboard = new BWClipboard();
|
||||
this.imageIndex = null;
|
||||
this.logger = null;
|
||||
this.favourite_status = false;
|
||||
@ -122,9 +118,6 @@ class BingWallpaperIndicator extends Button {
|
||||
this.ICON_TRASH_BUTTON = extensionIconsPath + '/'+'trash-empty-symbolic.svg';
|
||||
this.ICON_UNTRASH_BUTTON = extensionIconsPath + '/'+'trash-full-symbolic.svg';
|
||||
|
||||
if (!blur) // as Blur isn't disabled on screen lock (like the rest of the extension is)
|
||||
blur = new Blur();
|
||||
|
||||
// take a variety of actions when the gsettings values are modified by prefs
|
||||
this._settings = this._extension.getSettings();
|
||||
|
||||
@ -136,8 +129,6 @@ class BingWallpaperIndicator extends Button {
|
||||
this.refreshDueItem = newMenuItem(_("<No refresh scheduled>"));
|
||||
this.explainItem = newMenuItem(_("Awaiting refresh..."));
|
||||
this.copyrightItem = newMenuItem(_("Awaiting refresh..."));
|
||||
this.clipboardImageItem = newMenuItem(_("Copy image to clipboard"));
|
||||
this.clipboardURLItem = newMenuItem(_("Copy image URL to clipboard"));
|
||||
this.folderItem = newMenuItem(_("Open image folder"));
|
||||
this.dwallpaperItem = newMenuItem(_("Set background image"));
|
||||
this.swallpaperItem = newMenuItem(_("Set lock screen image"));
|
||||
@ -149,7 +140,7 @@ class BingWallpaperIndicator extends Button {
|
||||
|
||||
this.titleItem = new PopupMenu.PopupSubMenuMenuItem(_("Awaiting refresh..."), false);
|
||||
[this.imageResolutionItem, this.openImageInfoLinkItem, this.openImageItem, this.folderItem,
|
||||
this.clipboardImageItem, this.clipboardURLItem, this.dwallpaperItem]
|
||||
this.dwallpaperItem]
|
||||
.forEach(e => this.titleItem.menu.addMenuItem(e));
|
||||
|
||||
// quick settings submenu
|
||||
@ -238,9 +229,6 @@ class BingWallpaperIndicator extends Button {
|
||||
{signal: 'changed::icon-name', call: this._setIcon},
|
||||
{signal: 'changed::market', call: this._refresh},
|
||||
{signal: 'changed::set-background', call: this._setBackground},
|
||||
{signal: 'changed::override-lockscreen-blur', call: this._setBlur},
|
||||
{signal: 'changed::lockscreen-blur-strength', call: this._setBlur},
|
||||
{signal: 'changed::lockscreen-blur-brightness', call: this._setBlur},
|
||||
{signal: 'changed::selected-image', call: this._setImage},
|
||||
{signal: 'changed::delete-previous', call: this._cleanUpImages},
|
||||
{signal: 'changed::notify', call: this._notifyCurrentImage},
|
||||
@ -263,7 +251,6 @@ class BingWallpaperIndicator extends Button {
|
||||
|
||||
// ensure we're in a sensible initial state
|
||||
this._setIcon();
|
||||
this._setBlur();
|
||||
this._setImage();
|
||||
this._cleanUpImages();
|
||||
|
||||
@ -307,14 +294,6 @@ class BingWallpaperIndicator extends Button {
|
||||
});
|
||||
|
||||
this.folderItem.connect('activate', Utils.openImageFolder.bind(this, this._settings));
|
||||
if (this.clipboard.clipboard) { // only if we have a clipboard
|
||||
this.clipboardImageItem.connect('activate', this._copyImageToClipboard.bind(this));
|
||||
this.clipboardURLItem.connect('activate', this._copyURLToClipboard.bind(this));
|
||||
}
|
||||
else {
|
||||
[this.clipboardImageItem, this.clipboardURLItem].
|
||||
forEach(e => e.setSensitive(false));
|
||||
}
|
||||
}
|
||||
|
||||
_setBooleanSetting(key, state) {
|
||||
@ -349,8 +328,6 @@ class BingWallpaperIndicator extends Button {
|
||||
_openMenu() {
|
||||
// Grey out menu items if an update is pending
|
||||
this.refreshItem.setSensitive(!this._updatePending);
|
||||
this.clipboardImageItem.setSensitive(!this._updatePending && this.imageURL != "");
|
||||
this.clipboardURLItem.setSensitive(!this._updatePending && this.imageURL != "");
|
||||
this.thumbnailItem.setSensitive(!this._updatePending && this.imageURL != "");
|
||||
this.dwallpaperItem.setSensitive(!this._updatePending && this.filename != "");
|
||||
this.swallpaperItem.setSensitive(!this._updatePending && this.filename != "");
|
||||
@ -370,12 +347,6 @@ class BingWallpaperIndicator extends Button {
|
||||
this.refreshDueItem.label.set_text(this.refreshduetext);
|
||||
}
|
||||
|
||||
_setBlur() {
|
||||
blur._switch(this._settings.get_boolean('override-lockscreen-blur'));
|
||||
blur.set_blur_strength(this._settings.get_int('lockscreen-blur-strength'));
|
||||
blur.set_blur_brightness(this._settings.get_int('lockscreen-blur-brightness'));
|
||||
}
|
||||
|
||||
_setImage() {
|
||||
Utils.validate_imagename(this._settings);
|
||||
this.selected_image = this._settings.get_string('selected-image');
|
||||
@ -421,14 +392,6 @@ class BingWallpaperIndicator extends Button {
|
||||
doSetBackground(this.filename, Utils.DESKTOP_SCHEMA);
|
||||
}
|
||||
|
||||
_copyURLToClipboard() {
|
||||
this.clipboard.setText(this.imageURL);
|
||||
}
|
||||
|
||||
_copyImageToClipboard() {
|
||||
this.clipboard.setImage(this.filename);
|
||||
}
|
||||
|
||||
// set a timer on when the current image is going to expire
|
||||
_restartTimeoutFromLongDate(longdate) {
|
||||
// all Bing times are in UTC (+0)
|
||||
@ -680,7 +643,7 @@ class BingWallpaperIndicator extends Button {
|
||||
}
|
||||
|
||||
// download Bing metadata
|
||||
_refresh() {
|
||||
async _refresh() {
|
||||
if (this._updatePending)
|
||||
return;
|
||||
this._updatePending = true;
|
||||
@ -703,7 +666,7 @@ class BingWallpaperIndicator extends Button {
|
||||
request.request_headers.append('Accept', 'application/json');
|
||||
|
||||
try {
|
||||
this.httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => {
|
||||
await this.httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => {
|
||||
this._processMessageRefresh(message);
|
||||
});
|
||||
}
|
||||
@ -1074,7 +1037,7 @@ class BingWallpaperIndicator extends Button {
|
||||
|
||||
// download and process new image
|
||||
// FIXME: improve error handling
|
||||
_downloadImage(url, file, set_background) {
|
||||
async _downloadImage(url, file, set_background) {
|
||||
let BingWallpaperDir = Utils.getWallpaperDir(this._settings);
|
||||
let dir = Gio.file_new_for_path(BingWallpaperDir);
|
||||
if (!dir.query_exists(null)) {
|
||||
@ -1088,7 +1051,7 @@ class BingWallpaperIndicator extends Button {
|
||||
// queue the http request
|
||||
try {
|
||||
if (Soup.MAJOR_VERSION >= 3) {
|
||||
this.httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => {
|
||||
await this.httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => {
|
||||
this._processFileDownload(message, file, set_background);
|
||||
});
|
||||
}
|
||||
@ -1104,13 +1067,13 @@ class BingWallpaperIndicator extends Button {
|
||||
}
|
||||
}
|
||||
|
||||
_processFileDownload(message, file, set_background) {
|
||||
async _processFileDownload(message, file, set_background) {
|
||||
try {
|
||||
let data = (Soup.MAJOR_VERSION >= 3) ?
|
||||
this.httpSession.send_and_read_finish(message).get_data():
|
||||
message.response_body.flatten().get_as_bytes();
|
||||
|
||||
file.replace_contents_bytes_async(
|
||||
const [etag] = await file.replace_contents_bytes_async(
|
||||
data,
|
||||
null,
|
||||
false,
|
||||
@ -1157,8 +1120,6 @@ class BingWallpaperIndicator extends Button {
|
||||
this._timeout = undefined;
|
||||
this._shuffleTimeout = undefined;
|
||||
this.menu.removeAll();
|
||||
blur._disable(); // disable blur (blur.js) override and cleanup
|
||||
blur = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"_generated": "Generated by SweetTooth, do not edit",
|
||||
"description": "Sync your wallpaper to today's Microsoft Bing image of the day (the image you see when you visit Bing.com).\n\n *Disclaimer*: this extension is unofficial and not affiliated with Bing or Microsoft in any way. Images are protected by copyright and are licensed only for use as wallpapers.\n\nFeatures:\n* UHD resolution wallpapers\n* Automatically fetches current Bing wallpaper of the day and sets as both lock screen and desktop wallpaper (user selectable on GNOME versions that support it)\n* Doesn't poll continuously - only once per day and on startup (schedules a refresh when Bing is due to update)\n * random mode (from previously downloaded wallpapers)\n *NEW: select/cycle wallpaper through previously downloaded images\n* Language support: English (en), German (de), Dutch (nl), Italian (it), Polish (pl), Chinese (zh_CN, zh_TW), French (fr), Portuguese (pt), Ukrainian (uk), Russian (ru_RU), Spanish (es), Korean (ko), Indonesian (id), Catalan (ca), Norwegian Bokm\u00e5l (nb) & Nynorsk (ni), Swedish (sv), Arabic (ar), Hungarian (hu) and Japanese (ja) - a HUGE thanks to the translators\n\nThis extension was forked from the NASA APOD extension by Elinvention (https://github.com/Elinvention) and inspired by Bing Desktop Wallpaper Changer by Utkarsh Gupta (https://github.com/UtkarshGpta).\n\nAlways restart GNOME after manually updating extensions. Please report bugs to the GitHub page below:",
|
||||
"description": "Sync your wallpaper to today's Microsoft Bing image of the day (the image you see when you visit Bing.com).\n\n *Disclaimer*: this extension is unofficial and not affiliated with Bing or Microsoft in any way. Images are protected by copyright and are licensed only for use as wallpapers.\n\nFeatures:\n* UHD resolution wallpapers\n* Automatically fetches current Bing wallpaper of the day and sets as both lock screen and desktop wallpaper (user selectable on GNOME versions that support it)\n* Doesn't poll continuously - only once per day and on startup (schedules a refresh when Bing is due to update)\n * random mode (from previously downloaded wallpapers)\n * select/cycle wallpaper through previously downloaded images\n* Language support: English (en), German (de), Dutch (nl), Italian (it), Polish (pl), Chinese (zh_CN, zh_TW), French (fr), Portuguese (pt), Ukrainian (uk), Russian (ru_RU), Spanish (es), Korean (ko), Indonesian (id), Catalan (ca), Norwegian Bokm\u00e5l (nb) & Nynorsk (ni), Swedish (sv), Arabic (ar), Hungarian (hu) and Japanese (ja) - a HUGE thanks to the translators\n\nThis extension was forked from the NASA APOD extension by Elinvention (https://github.com/Elinvention) and inspired by Bing Desktop Wallpaper Changer by Utkarsh Gupta (https://github.com/UtkarshGpta).\n\nAlways restart GNOME after manually updating extensions. Please report bugs to the GitHub page below:",
|
||||
"gettext-domain": "BingWallpaper",
|
||||
"name": "Bing Wallpaper",
|
||||
"settings-schema": "org.gnome.shell.extensions.bingwallpaper",
|
||||
@ -9,9 +9,10 @@
|
||||
"46",
|
||||
"47",
|
||||
"48",
|
||||
"49"
|
||||
"49",
|
||||
"50"
|
||||
],
|
||||
"url": "https://github.com/neffo/bing-wallpaper-gnome-extension",
|
||||
"uuid": "BingWallpaper@ineffable-gmail.com",
|
||||
"version": 52
|
||||
"version": 53
|
||||
}
|
||||
@ -15,7 +15,7 @@ import Adw from 'gi://Adw';
|
||||
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
import * as Config from 'resource:///org/gnome/Shell/Extensions/js/misc/config.js';
|
||||
import * as Utils from './utils.js';
|
||||
import Carousel from './carousel.js';
|
||||
/*import Carousel from './carousel.js';*/
|
||||
|
||||
const BingImageURL = Utils.BingImageURL;
|
||||
|
||||
@ -41,7 +41,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
provider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
let carousel = null;
|
||||
/*let carousel = null;*/
|
||||
let httpSession = null;
|
||||
|
||||
let BingLog = (msg) => { // avoids need for globals
|
||||
@ -62,13 +62,6 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
const shuffleSwitch = buildable.get_object('shuffleSwitch');
|
||||
const shuffleInterval = buildable.get_object('shuffleInterval');
|
||||
const folderRow = buildable.get_object('folderRow');
|
||||
const lockscreen_page = buildable.get_object('lockscreen_page');
|
||||
const overrideSwitch = buildable.get_object('overrideSwitch');
|
||||
const blurPresets = buildable.get_object('blurPresets');
|
||||
const strengthEntry = buildable.get_object('strengthEntry');
|
||||
const brightnessEntry = buildable.get_object('brightnessEntry');
|
||||
const blurAdjustment = buildable.get_object('blurAdjustment');
|
||||
const brightnessAdjustment = buildable.get_object('brightnessAdjustment');
|
||||
const resolutionEntry = buildable.get_object('resolutionEntry');
|
||||
const debugSwitch = buildable.get_object('debug_switch');
|
||||
const revertSwitch = buildable.get_object('revert_switch');
|
||||
@ -76,8 +69,6 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
const delete_previous_switch = buildable.get_object('delete_previous_switch');
|
||||
const delete_previous_adjustment = buildable.get_object('delete_previous_adjustment');
|
||||
const always_export_switch = buildable.get_object('always_export_switch');
|
||||
const gallery_page = buildable.get_object('gallery_page');
|
||||
const carouselFlowBox = buildable.get_object('carouselFlowBox');
|
||||
const randomIntervalEntry = buildable.get_object('entry_random_interval');
|
||||
const debug_page = buildable.get_object('debug_page');
|
||||
const json_actionrow = buildable.get_object('json_actionrow');
|
||||
@ -86,8 +77,8 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
const change_log = buildable.get_object('change_log');
|
||||
|
||||
window.add(settings_page);
|
||||
window.add(lockscreen_page);
|
||||
window.add(gallery_page);
|
||||
/*window.add(lockscreen_page);
|
||||
window.add(gallery_page);*/
|
||||
window.add(debug_page);
|
||||
window.add(about_page);
|
||||
|
||||
@ -117,30 +108,6 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
folderRow.add_suffix(openBtn);
|
||||
folderRow.add_suffix(changeBtn);
|
||||
|
||||
blurAdjustment.set_value(settings.get_int('lockscreen-blur-strength'));
|
||||
brightnessAdjustment.set_value(settings.get_int('lockscreen-blur-brightness'));
|
||||
|
||||
const defaultBtn = new Gtk.Button( {
|
||||
label: _('Default'),
|
||||
valign: Gtk.Align.CENTER,
|
||||
halign: Gtk.Align.CENTER,
|
||||
});
|
||||
const noBlurBtn = new Gtk.Button( {
|
||||
label: _('No blur, slight dim'),
|
||||
valign: Gtk.Align.CENTER,
|
||||
halign: Gtk.Align.CENTER,
|
||||
});
|
||||
const slightBlurBtn = new Gtk.Button( {
|
||||
label: _('Slight blur & dim'),
|
||||
valign: Gtk.Align.CENTER,
|
||||
halign: Gtk.Align.CENTER,
|
||||
});
|
||||
|
||||
// add to presets row
|
||||
blurPresets.add_suffix(defaultBtn);
|
||||
blurPresets.add_suffix(noBlurBtn);
|
||||
blurPresets.add_suffix(slightBlurBtn);
|
||||
|
||||
randomIntervalEntry.set_value(settings.get_int('random-interval'));
|
||||
|
||||
// these buttons either export or import saved JSON data
|
||||
@ -202,9 +169,6 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
Utils.openImageFolder(settings);
|
||||
});
|
||||
|
||||
// we populate the tab (gtk4+, gnome 40+), this was previously a button to open a new window in gtk3
|
||||
carousel = new Carousel(settings, null, null, carouselFlowBox, this.dir.get_path()); // auto load carousel
|
||||
|
||||
// this is intended for migrating image folders between computers (or even sharing) or backups
|
||||
// we export the Bing JSON data to the image directory, so this folder becomes portable
|
||||
buttonImportData.connect('clicked', () => {
|
||||
@ -255,23 +219,6 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
shuffleInterval.set_selected(Utils.randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode')));
|
||||
});
|
||||
|
||||
// GDM3 lockscreen blur override
|
||||
settings.bind('override-lockscreen-blur', overrideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind('lockscreen-blur-strength', strengthEntry, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind('lockscreen-blur-brightness', brightnessEntry, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind('previous-days', delete_previous_adjustment, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
// add a couple of preset buttons
|
||||
defaultBtn.connect('clicked', (widget) => {
|
||||
Utils.set_blur_preset(settings, Utils.PRESET_GNOME_DEFAULT);
|
||||
});
|
||||
noBlurBtn.connect('clicked', (widget) => {
|
||||
Utils.set_blur_preset(settings, Utils.PRESET_NO_BLUR);
|
||||
});
|
||||
slightBlurBtn.connect('clicked', (widget) => {
|
||||
Utils.set_blur_preset(settings, Utils.PRESET_SLIGHT_BLUR);
|
||||
});
|
||||
|
||||
// fetch change log (on about page)
|
||||
|
||||
if (httpSession)
|
||||
|
||||
@ -1,212 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2
|
||||
|
||||
Copyright (C) 2017-2021
|
||||
|
||||
This file is part of Bing Wallpaper.
|
||||
|
||||
Bing Wallpaper is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bing Wallpaper is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bing Wallpaper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Author: Michael Carroll
|
||||
|
||||
-->
|
||||
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkScrolledWindow" id="carouselScrollable">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="child">
|
||||
<object class="GtkViewport" id="carouselViewPort">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="vexpand">0</property>
|
||||
<property name="height-request">500</property>
|
||||
<property name="child">
|
||||
<object class="GtkFlowBox" id="carouselFlowBox">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="homogeneous">1</property>
|
||||
<!-- <property name="max-children-per-line">5</property> -->
|
||||
<property name="min-children-per-line">2</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="column-spacing">4</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
<object class="GtkFlowBoxChild" id="flowBoxChild">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="imageGrid">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="homogeneous">0</property>
|
||||
<property name="spacing">5</property>
|
||||
<!-- <property name="orientation">vertical</property> -->
|
||||
<child>
|
||||
<object class="GtkPicture" id="galleryImage">
|
||||
<property name="width-request">320</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="can-focus">0</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="buttonBar">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton" id="favButton">
|
||||
<property name="tooltip-text" translatable="yes">Favorite</property>
|
||||
<property name='icon-name'>checkbox</property>
|
||||
<!-- <property name='icon-name'>checkbox-checked</property> -->
|
||||
<property name="receives-default">1</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="halign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="unfavButton">
|
||||
<property name="tooltip-text" translatable="yes">Favorite</property>
|
||||
<property name='icon-name'>checkbox-checked</property>
|
||||
<!-- <property name='icon-name'>checkbox-checked</property> -->
|
||||
<property name="receives-default">1</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="halign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="applyButton">
|
||||
<property name="tooltip-text" translatable="yes">Apply</property>
|
||||
<property name='icon-name'>preferences-desktop-wallpaper</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="halign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="viewButton">
|
||||
<property name="tooltip-text" translatable="yes">View</property>
|
||||
<property name='icon-name'>view-reveal</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="halign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="infoButton">
|
||||
<property name="tooltip-text" translatable="yes">Info</property>
|
||||
<property name='icon-name'>preferences-system-details</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="halign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="deleteButton">
|
||||
<property name="tooltip-text" translatable="yes">Delete</property>
|
||||
<property name='icon-name'>edit-delete</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="halign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
<object class="GtkFlowBoxChild" id="flowBoxRandom">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="child">
|
||||
<object class="GtkGrid" id="imageGrid">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="randomImage">
|
||||
<property name="width-request">320</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="can-focus">0</property>
|
||||
<property name="icon-name">media-playlist-shuffle</property>
|
||||
<property name="icon_size">2</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="randomLabel">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="label" translatable="yes"><image name here></property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="randomButton">
|
||||
<property name="label" translatable="yes">Image shuffle mode</property>
|
||||
<property name="receives-default">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
<object class="GtkFlowBoxChild" id="flowBoxPlaceholder">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="child">
|
||||
<object class="GtkGrid" id="loadGrid">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="loadImage">
|
||||
<property name="width-request">320</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="can-focus">0</property>
|
||||
<property name="icon-name">preferences-desktop-wallpaper-symbolic</property>
|
||||
<property name="icon_size">2</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="loadButton">
|
||||
<property name="label" translatable="yes">Load image gallery</property>
|
||||
<property name="receives-default">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</interface>
|
||||
@ -109,86 +109,6 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="lockscreen_page">
|
||||
<property name="icon-name">system-lock-screen-symbolic</property>
|
||||
<property name="title" translatable="yes">Lock screen</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="ls_group">
|
||||
<property name="title" translatable="yes">Lockscreen blur</property>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="overrideSwitch">
|
||||
<property name="title" translatable="yes">Dynamic lockscreen blur</property>
|
||||
<property name="subtitle" translatable="yes">Whether to enable dynamic blur mode on lock screen</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSpinRow" id="strengthEntry">
|
||||
<property name="title" translatable="yes">Blur strength</property>
|
||||
<property name="subtitle" translatable="yes">Blur strength when login prompt is not visible</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="blurAdjustment">
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">50</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSpinRow" id="brightnessEntry">
|
||||
<property name="title" translatable="yes">Wallpaper brightness</property>
|
||||
<property name="subtitle" translatable="yes">Dim wallpaper when login prompt is not visible</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="brightnessAdjustment">
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="ps_group">
|
||||
<!-- <property name="title" translatable="yes">Presets</property> -->
|
||||
<child>
|
||||
<object class="AdwActionRow" id="blurPresets">
|
||||
<property name="title" translatable="yes">Presets</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="gallery_page">
|
||||
<property name="icon-name">emblem-photos-symbolic</property>
|
||||
<property name="title" translatable="yes">Gallery</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="carouselViewPort">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="height_request">500</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="vexpand">0</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkFlowBox" id="carouselFlowBox">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="max-children-per-line">2</property>
|
||||
<property name="min-children-per-line">2</property>
|
||||
<property name="row-spacing">2</property>
|
||||
<property name="column-spacing">2</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="debug_page">
|
||||
<property name="icon-name">preferences-other-symbolic</property>
|
||||
<property name="title" translatable="yes">Debug</property>
|
||||
|
||||
@ -12,16 +12,9 @@ import GLib from 'gi://GLib';
|
||||
import Soup from 'gi://Soup';
|
||||
import GdkPixbuf from 'gi://GdkPixbuf';
|
||||
|
||||
export var PRESET_GNOME_DEFAULT = { blur: 45, dim: 65 }; // as at GNOME 40
|
||||
export var PRESET_NO_BLUR = { blur: 0, dim: 65 };
|
||||
export var PRESET_SLIGHT_BLUR = { blur: 2, dim: 30 };
|
||||
|
||||
export var BING_SCHEMA = 'org.gnome.shell.extensions.bingwallpaper';
|
||||
export var DESKTOP_SCHEMA = 'org.gnome.desktop.background';
|
||||
|
||||
var vertical_blur = null;
|
||||
var horizontal_blur = null;
|
||||
|
||||
let gitreleaseurl = 'https://api.github.com/repos/neffo/bing-wallpaper-gnome-extension/releases/tags/';
|
||||
let debug = false;
|
||||
|
||||
@ -111,7 +104,7 @@ export function get_current_bg(schema) {
|
||||
return (cur);
|
||||
}
|
||||
|
||||
export function fetch_change_log(version, label, httpSession) {
|
||||
export async function fetch_change_log(version, label, httpSession) {
|
||||
const decoder = new TextDecoder();
|
||||
// create an http message
|
||||
let url = gitreleaseurl + "v" + version;
|
||||
@ -121,7 +114,7 @@ export function fetch_change_log(version, label, httpSession) {
|
||||
// queue the http request
|
||||
try {
|
||||
if (Soup.MAJOR_VERSION >= 3) {
|
||||
httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => {
|
||||
await httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => {
|
||||
let data = decoder.decode(httpSession.send_and_read_finish(message).get_data());
|
||||
let text = JSON.parse(data).body;
|
||||
if (text)
|
||||
@ -143,12 +136,6 @@ export function fetch_change_log(version, label, httpSession) {
|
||||
}
|
||||
}
|
||||
|
||||
export function set_blur_preset(settings, preset) {
|
||||
settings.set_int('lockscreen-blur-strength', preset.blur);
|
||||
settings.set_int('lockscreen-blur-brightness', preset.dim);
|
||||
BingLog("Set blur preset to " + preset.blur + " brightness to " + preset.dim);
|
||||
}
|
||||
|
||||
export function imageHasBasename(image_item, i, b) {
|
||||
//log("imageHasBasename : " + image_item.urlbase + " =? " + this);
|
||||
if (this && this.search(image_item.urlbase.replace('th?id=OHR.', '')))
|
||||
@ -595,33 +582,48 @@ export function openInSystemViewer(filename, is_file = true) {
|
||||
Gio.AppInfo.launch_default_for_uri(filename, context);
|
||||
}
|
||||
|
||||
export function exportBingJSON(settings) {
|
||||
export async function exportBingJSON(settings) {
|
||||
let json = settings.get_string('bing-json');
|
||||
let filepath = getWallpaperDir(settings) + 'bing.json';
|
||||
let file = Gio.file_new_for_path(filepath);
|
||||
let [success, error] = file.replace_contents(json, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null);
|
||||
if (!success) {
|
||||
BingLog('error saving bing-json from '+filepath+': '+error);
|
||||
|
||||
const [etag] = await file.replace_contents_async(
|
||||
json,
|
||||
null,
|
||||
false,
|
||||
Gio.FileCreateFlags.REPLACE_DESTINATION,
|
||||
null,
|
||||
(file, res) => {
|
||||
try {
|
||||
file.replace_contents_finish(res);
|
||||
}
|
||||
catch(e) {
|
||||
BingLog('error saving bing-json from '+filepath+': '+e);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function importBingJSON(settings) {
|
||||
export async function importBingJSON(settings) {
|
||||
const decoder = new TextDecoder();
|
||||
let filepath = getWallpaperDir(settings) + 'bing.json';
|
||||
let file = Gio.file_new_for_path(filepath);
|
||||
if (file.query_exists(null)) {
|
||||
let [success, contents, etag_out] = file.load_contents(null);
|
||||
if (!success) {
|
||||
BingLog('error loading bing-json '+filepath+' - '+etag_out);
|
||||
}
|
||||
else {
|
||||
const [contents, etag] = await file.load_contents_async(null,
|
||||
(file, res) => {
|
||||
try {
|
||||
BingLog('JSON import success');
|
||||
let parsed = JSON.parse(decoder.decode(contents)); // FIXME: triggers GJS warning without the conversion, need to investigate
|
||||
// need to implement some checks for validity here
|
||||
mergeImageLists(settings, parsed);
|
||||
purgeImages(settings); // remove the older missing images
|
||||
//cleanupImageList(settings);
|
||||
file.load_contents_finish(res);
|
||||
}
|
||||
catch (e) {
|
||||
BingLog('error loading bing-json '+filepath+' - '+e);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
BingLog('JSON import file not found');
|
||||
|
||||
@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@ -1,662 +0,0 @@
|
||||
import Clutter from 'gi://Clutter';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
import St from 'gi://St'
|
||||
|
||||
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
|
||||
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
|
||||
|
||||
import * as Sensors from './sensors.js';
|
||||
|
||||
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
|
||||
import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js';
|
||||
import * as Values from './values.js';
|
||||
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
|
||||
import * as MenuItem from './menuItem.js';
|
||||
|
||||
let vitalsMenu;
|
||||
|
||||
var VitalsMenuButton = GObject.registerClass({
|
||||
GTypeName: 'VitalsMenuButton',
|
||||
}, class VitalsMenuButton extends PanelMenu.Button {
|
||||
_init(extensionObject) {
|
||||
super._init(Clutter.ActorAlign.FILL);
|
||||
|
||||
this._extensionObject = extensionObject;
|
||||
this._settings = extensionObject.getSettings();
|
||||
|
||||
this._sensorIcons = {
|
||||
'temperature' : { 'icon': 'temperature-symbolic.svg' },
|
||||
'voltage' : { 'icon': 'voltage-symbolic.svg' },
|
||||
'fan' : { 'icon': 'fan-symbolic.svg' },
|
||||
'memory' : { 'icon': 'memory-symbolic.svg' },
|
||||
'processor' : { 'icon': 'cpu-symbolic.svg' },
|
||||
'system' : { 'icon': 'system-symbolic.svg' },
|
||||
'network' : { 'icon': 'network-symbolic.svg',
|
||||
'icon-rx': 'network-download-symbolic.svg',
|
||||
'icon-tx': 'network-upload-symbolic.svg' },
|
||||
'storage' : { 'icon': 'storage-symbolic.svg' },
|
||||
'battery' : { 'icon': 'battery-symbolic.svg' },
|
||||
'gpu' : { 'icon': 'gpu-symbolic.svg' }
|
||||
}
|
||||
|
||||
// list with the prefixes for the according themes, the index of each
|
||||
// item must match the index on the combo box
|
||||
this._sensorsIconPathPrefix = ['/icons/original/', '/icons/gnome/'];
|
||||
|
||||
this._warnings = [];
|
||||
this._sensorMenuItems = {};
|
||||
this._hotLabels = {};
|
||||
this._hotIcons = {};
|
||||
this._groups = {};
|
||||
this._widths = {};
|
||||
this._numGpus = 1;
|
||||
this._newGpuDetected = false;
|
||||
this._newGpuDetectedCount = 0;
|
||||
this._last_query = new Date().getTime();
|
||||
|
||||
this._sensors = new Sensors.Sensors(this._settings, this._sensorIcons);
|
||||
this._values = new Values.Values(this._settings, this._sensorIcons);
|
||||
this._menuLayout = new St.BoxLayout({
|
||||
vertical: false,
|
||||
clip_to_allocation: true,
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
reactive: true,
|
||||
x_expand: true
|
||||
});
|
||||
|
||||
this._drawMenu();
|
||||
this.add_child(this._menuLayout);
|
||||
this._settingChangedSignals = [];
|
||||
this._refreshTimeoutId = null;
|
||||
|
||||
this._addSettingChangedSignal('update-time', this._updateTimeChanged.bind(this));
|
||||
this._addSettingChangedSignal('position-in-panel', this._positionInPanelChanged.bind(this));
|
||||
this._addSettingChangedSignal('menu-centered', this._positionInPanelChanged.bind(this));
|
||||
this._addSettingChangedSignal('icon-style', this._iconStyleChanged.bind(this));
|
||||
|
||||
let settings = [ 'use-higher-precision', 'alphabetize', 'hide-zeros', 'fixed-widths', 'hide-icons', 'unit', 'memory-measurement', 'include-public-ip', 'network-speed-format', 'storage-measurement', 'include-static-info', 'include-static-gpu-info' ];
|
||||
for (let setting of Object.values(settings))
|
||||
this._addSettingChangedSignal(setting, this._redrawMenu.bind(this));
|
||||
|
||||
// add signals for show- preference based categories
|
||||
for (let sensor in this._sensorIcons)
|
||||
this._addSettingChangedSignal('show-' + sensor, this._showHideSensorsChanged.bind(this));
|
||||
|
||||
this._initializeMenu();
|
||||
|
||||
// start off with fresh sensors
|
||||
this._querySensors();
|
||||
|
||||
// start monitoring sensors
|
||||
this._initializeTimer();
|
||||
}
|
||||
|
||||
_initializeMenu() {
|
||||
// display sensor categories
|
||||
for (let sensor in this._sensorIcons) {
|
||||
// groups associated sensors under accordion menu
|
||||
if (sensor in this._groups) continue;
|
||||
|
||||
//handle gpus separately.
|
||||
if (sensor === 'gpu') continue;
|
||||
|
||||
this._initializeMenuGroup(sensor, sensor);
|
||||
}
|
||||
|
||||
for (let i = 1; i <= this._numGpus; i++)
|
||||
this._initializeMenuGroup('gpu#' + i, 'gpu', (this._numGpus > 1 ? ' ' + i : ''));
|
||||
|
||||
// add separator
|
||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||
|
||||
let item = new PopupMenu.PopupBaseMenuItem({
|
||||
reactive: false,
|
||||
style_class: 'vitals-menu-button-container'
|
||||
});
|
||||
|
||||
let customButtonBox = new St.BoxLayout({
|
||||
style_class: 'vitals-button-box',
|
||||
vertical: false,
|
||||
clip_to_allocation: true,
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
reactive: true,
|
||||
x_expand: true
|
||||
});
|
||||
|
||||
// custom round refresh button
|
||||
let refreshButton = this._createRoundButton('view-refresh-symbolic', _('Refresh'));
|
||||
refreshButton.connect('clicked', (self) => {
|
||||
// force refresh by clearing history
|
||||
this._sensors.resetHistory();
|
||||
this._values.resetHistory(this._numGpus);
|
||||
|
||||
// make sure timer fires at next full interval
|
||||
this._updateTimeChanged();
|
||||
|
||||
// refresh sensors now
|
||||
this._querySensors();
|
||||
});
|
||||
customButtonBox.add_child(refreshButton);
|
||||
|
||||
// custom round monitor button
|
||||
let monitorButton = this._createRoundButton('org.gnome.SystemMonitor-symbolic', _('System Monitor'));
|
||||
monitorButton.connect('clicked', (self) => {
|
||||
this.menu._getTopMenu().close();
|
||||
Util.spawn(this._settings.get_string('monitor-cmd').split(" "));
|
||||
});
|
||||
customButtonBox.add_child(monitorButton);
|
||||
|
||||
// custom round preferences button
|
||||
let prefsButton = this._createRoundButton('preferences-system-symbolic', _('Preferences'));
|
||||
prefsButton.connect('clicked', (self) => {
|
||||
this.menu._getTopMenu().close();
|
||||
this._extensionObject.openPreferences();
|
||||
});
|
||||
customButtonBox.add_child(prefsButton);
|
||||
|
||||
// now add the buttons to the top bar
|
||||
item.actor.add_child(customButtonBox);
|
||||
|
||||
// add buttons
|
||||
this.menu.addMenuItem(item);
|
||||
|
||||
// query sensors on menu open
|
||||
this._menuStateChangeId = this.menu.connect('open-state-changed', (self, isMenuOpen) => {
|
||||
if (isMenuOpen) {
|
||||
// make sure timer fires at next full interval
|
||||
this._updateTimeChanged();
|
||||
|
||||
// refresh sensors now
|
||||
this._querySensors();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_initializeMenuGroup(groupName, optionName, menuSuffix = '', position = -1) {
|
||||
this._groups[groupName] = new PopupMenu.PopupSubMenuMenuItem(_(this._ucFirst(groupName) + menuSuffix), true);
|
||||
this._groups[groupName].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(groupName));
|
||||
|
||||
// hide menu items that user has requested to not include
|
||||
if (!this._settings.get_boolean('show-' + optionName))
|
||||
this._groups[groupName].actor.hide();
|
||||
|
||||
if (!this._groups[groupName].status) {
|
||||
this._groups[groupName].status = this._defaultLabel();
|
||||
this._groups[groupName].actor.insert_child_at_index(this._groups[groupName].status, 4);
|
||||
this._groups[groupName].status.text = _('No Data');
|
||||
}
|
||||
|
||||
if(position == -1) this.menu.addMenuItem(this._groups[groupName]);
|
||||
else this.menu.addMenuItem(this._groups[groupName], position);
|
||||
}
|
||||
|
||||
_createRoundButton(iconName) {
|
||||
let button = new St.Button({
|
||||
style_class: 'message-list-clear-button button vitals-button-action'
|
||||
});
|
||||
|
||||
button.child = new St.Icon({
|
||||
icon_name: iconName
|
||||
});
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
_removeMissingHotSensors(hotSensors) {
|
||||
for (let i = hotSensors.length - 1; i >= 0; i--) {
|
||||
let sensor = hotSensors[i];
|
||||
|
||||
// make sure default icon (if any) stays visible
|
||||
if (sensor == '_default_icon_') continue;
|
||||
|
||||
// removes sensors that are no longer available
|
||||
if (!this._sensorMenuItems[sensor]) {
|
||||
hotSensors.splice(i, 1);
|
||||
this._removeHotLabel(sensor);
|
||||
this._removeHotIcon(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
return hotSensors;
|
||||
}
|
||||
|
||||
_saveHotSensors(hotSensors) {
|
||||
// removes any sensors that may not currently be available
|
||||
hotSensors = this._removeMissingHotSensors(hotSensors);
|
||||
|
||||
this._settings.set_strv('hot-sensors', hotSensors.filter(
|
||||
function(item, pos) {
|
||||
return hotSensors.indexOf(item) == pos;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
_initializeTimer() {
|
||||
// used to query sensors and update display
|
||||
let update_time = this._settings.get_int('update-time');
|
||||
this._refreshTimeoutId = GLib.timeout_add_seconds(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
update_time,
|
||||
(self) => {
|
||||
// only update menu if we have hot sensors
|
||||
if (Object.values(this._hotLabels).length > 0)
|
||||
this._querySensors();
|
||||
// keep the timer running
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
_createHotItem(key, value) {
|
||||
let icon = this._defaultIcon(key);
|
||||
this._hotIcons[key] = icon;
|
||||
this._menuLayout.add_child(icon)
|
||||
|
||||
// don't add a label when no sensors are in the panel
|
||||
if (key == '_default_icon_') return;
|
||||
|
||||
let label = new St.Label({
|
||||
style_class: 'vitals-panel-label',
|
||||
text: (value)?value:'\u2026', // ...
|
||||
y_expand: true,
|
||||
y_align: Clutter.ActorAlign.CENTER
|
||||
});
|
||||
|
||||
// attempt to prevent ellipsizes
|
||||
label.get_clutter_text().ellipsize = 0;
|
||||
|
||||
// keep track of label for removal later
|
||||
this._hotLabels[key] = label;
|
||||
|
||||
// prevent "called on the widget" "which is not in the stage" errors by adding before width below
|
||||
this._menuLayout.add_child(label);
|
||||
|
||||
// support for fixed widths #55, save label (text) width
|
||||
this._widths[key] = label.width;
|
||||
}
|
||||
|
||||
_showHideSensorsChanged(self, sensor) {
|
||||
this._sensors.resetHistory();
|
||||
|
||||
const sensorName = sensor.substr(5);
|
||||
if(sensorName === 'gpu') {
|
||||
for(let i = 1; i <= this._numGpus; i++)
|
||||
this._groups[sensorName + '#' + i].visible = this._settings.get_boolean(sensor);
|
||||
} else
|
||||
this._groups[sensorName].visible = this._settings.get_boolean(sensor);
|
||||
}
|
||||
|
||||
_positionInPanelChanged() {
|
||||
this.container.get_parent().remove_child(this.container);
|
||||
let position = this._positionInPanel();
|
||||
|
||||
// allows easily addressable boxes
|
||||
let boxes = {
|
||||
left: Main.panel._leftBox,
|
||||
center: Main.panel._centerBox,
|
||||
right: Main.panel._rightBox
|
||||
};
|
||||
|
||||
// update position when changed from preferences
|
||||
boxes[position[0]].insert_child_at_index(this.container, position[1]);
|
||||
}
|
||||
|
||||
_redrawDetailsMenuIcons() {
|
||||
// updates the icons on the 'details' menu, the one
|
||||
// you have to click to appear
|
||||
this._sensors.resetHistory();
|
||||
for (const sensor in this._sensorIcons) {
|
||||
if (sensor == "gpu") continue;
|
||||
this._groups[sensor].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(sensor));
|
||||
}
|
||||
|
||||
// gpu's are indexed differently, handle them here
|
||||
const gpuKeys = Object.keys(this._groups).filter(key => key.startsWith("gpu#"));
|
||||
gpuKeys.forEach((gpuKey) => {
|
||||
this._groups[gpuKey].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath("gpu"));
|
||||
});
|
||||
}
|
||||
|
||||
_iconStyleChanged() {
|
||||
this._redrawDetailsMenuIcons();
|
||||
this._redrawMenu();
|
||||
}
|
||||
|
||||
_removeHotLabel(key) {
|
||||
if (key in this._hotLabels) {
|
||||
let label = this._hotLabels[key];
|
||||
delete this._hotLabels[key];
|
||||
// make sure set_label is not called on non existent actor
|
||||
label.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
_removeHotLabels() {
|
||||
for (let key in this._hotLabels)
|
||||
this._removeHotLabel(key);
|
||||
}
|
||||
|
||||
_removeHotIcon(key) {
|
||||
if (key in this._hotIcons) {
|
||||
this._hotIcons[key].destroy();
|
||||
delete this._hotIcons[key];
|
||||
}
|
||||
}
|
||||
|
||||
_removeHotIcons() {
|
||||
for (let key in this._hotIcons)
|
||||
this._removeHotIcon(key);
|
||||
}
|
||||
|
||||
_redrawMenu() {
|
||||
this._removeHotIcons();
|
||||
this._removeHotLabels();
|
||||
|
||||
for (let key in this._sensorMenuItems) {
|
||||
if (key.includes('-group')) continue;
|
||||
this._sensorMenuItems[key].destroy();
|
||||
delete this._sensorMenuItems[key];
|
||||
}
|
||||
|
||||
this._drawMenu();
|
||||
this._sensors.resetHistory();
|
||||
this._values.resetHistory(this._numGpus);
|
||||
this._querySensors();
|
||||
}
|
||||
|
||||
_drawMenu() {
|
||||
// grab list of selected menubar icons
|
||||
let hotSensors = this._settings.get_strv('hot-sensors');
|
||||
for (let key of Object.values(hotSensors)) {
|
||||
// fixes issue #225 which started when _max_ was moved to the end
|
||||
if (key == '__max_network-download__') key = '__network-rx_max__';
|
||||
if (key == '__max_network-upload__') key = '__network-tx_max__';
|
||||
|
||||
this._createHotItem(key);
|
||||
}
|
||||
}
|
||||
|
||||
_destroyTimer() {
|
||||
// invalidate and reinitialize timer
|
||||
if (this._refreshTimeoutId != null) {
|
||||
GLib.Source.remove(this._refreshTimeoutId);
|
||||
this._refreshTimeoutId = null;
|
||||
}
|
||||
}
|
||||
|
||||
_updateTimeChanged() {
|
||||
this._destroyTimer();
|
||||
this._initializeTimer();
|
||||
}
|
||||
|
||||
_addSettingChangedSignal(key, callback) {
|
||||
this._settingChangedSignals.push(this._settings.connect('changed::' + key, callback));
|
||||
}
|
||||
|
||||
_updateDisplay(label, value, type, key) {
|
||||
// update sensor value in menubar
|
||||
if (this._hotLabels[key]) {
|
||||
this._hotLabels[key].set_text(value);
|
||||
|
||||
// support for fixed widths #55
|
||||
if (this._settings.get_boolean('fixed-widths')) {
|
||||
// grab text box width and see if new text is wider than old text
|
||||
let width2 = this._hotLabels[key].get_clutter_text().width;
|
||||
if (width2 > this._widths[key]) {
|
||||
this._hotLabels[key].set_width(width2);
|
||||
this._widths[key] = width2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// have we added this sensor before?
|
||||
let item = this._sensorMenuItems[key];
|
||||
if (item) {
|
||||
// update sensor value in the group
|
||||
item.value = value;
|
||||
} else if (type.includes('-group')) {
|
||||
// update text next to group header
|
||||
let group = type.split('-')[0];
|
||||
if (this._groups[group]) {
|
||||
this._groups[group].status.text = value;
|
||||
this._sensorMenuItems[type] = this._groups[group];
|
||||
}
|
||||
} else {
|
||||
// add item to group for the first time
|
||||
let sensor = { 'label': label, 'value': value, 'type': type }
|
||||
this._appendMenuItem(sensor, key);
|
||||
}
|
||||
}
|
||||
|
||||
_appendMenuItem(sensor, key) {
|
||||
let split = sensor.type.split('-');
|
||||
let type = split[0];
|
||||
let icon = (split.length == 2)?'icon-' + split[1]:'icon';
|
||||
let gicon = Gio.icon_new_for_string(this._sensorIconPath(type, icon));
|
||||
|
||||
let item = new MenuItem.MenuItem(gicon, key, sensor.label, sensor.value, this._hotLabels[key]);
|
||||
item.connect('toggle', (self) => {
|
||||
let hotSensors = this._settings.get_strv('hot-sensors');
|
||||
|
||||
if (self.checked) {
|
||||
// add selected sensor to panel
|
||||
hotSensors.push(self.key);
|
||||
this._createHotItem(self.key, self.value);
|
||||
} else {
|
||||
// remove selected sensor from panel
|
||||
hotSensors.splice(hotSensors.indexOf(self.key), 1);
|
||||
this._removeHotLabel(self.key);
|
||||
this._removeHotIcon(self.key);
|
||||
}
|
||||
|
||||
if (hotSensors.length <= 0) {
|
||||
// add generic icon to panel when no sensors are selected
|
||||
hotSensors.push('_default_icon_');
|
||||
this._createHotItem('_default_icon_');
|
||||
} else {
|
||||
let defIconPos = hotSensors.indexOf('_default_icon_');
|
||||
if (defIconPos >= 0) {
|
||||
// remove generic icon from panel when sensors are selected
|
||||
hotSensors.splice(defIconPos, 1);
|
||||
this._removeHotIcon('_default_icon_');
|
||||
}
|
||||
}
|
||||
|
||||
// this code is called asynchronously - make sure to save it for next round
|
||||
this._saveHotSensors(hotSensors);
|
||||
});
|
||||
|
||||
this._sensorMenuItems[key] = item;
|
||||
let i = Object.keys(this._sensorMenuItems[key]).length;
|
||||
|
||||
// alphabetize the sensors for these categories
|
||||
if (this._settings.get_boolean('alphabetize')) {
|
||||
let menuItems = this._groups[type].menu._getMenuItems();
|
||||
for (i = 0; i < menuItems.length; i++)
|
||||
// use natural sort order for system load, etc
|
||||
if (menuItems[i].label.localeCompare(item.label, undefined, { numeric: true, sensitivity: 'base' }) > 0)
|
||||
break;
|
||||
}
|
||||
|
||||
this._groups[type].menu.addMenuItem(item, i);
|
||||
}
|
||||
|
||||
_defaultLabel() {
|
||||
return new St.Label({
|
||||
y_expand: true,
|
||||
y_align: Clutter.ActorAlign.CENTER
|
||||
});
|
||||
}
|
||||
|
||||
_defaultIcon(key) {
|
||||
let split = key.replaceAll('_', ' ').trim().split(' ')[0].split('-');
|
||||
let type = split[0];
|
||||
|
||||
let icon = new St.Icon({
|
||||
style_class: 'system-status-icon vitals-panel-icon-' + type,
|
||||
reactive: true
|
||||
});
|
||||
|
||||
// second condition prevents crash due to issue #225, which started when _max_ was moved to the end
|
||||
// don't use the default system icon if the type is a gpu; use the universal gpu icon instead
|
||||
if (type == 'default' || (!(type in this._sensorIcons) && !type.startsWith('gpu'))) {
|
||||
icon.gicon = Gio.icon_new_for_string(this._sensorIconPath('system'));
|
||||
} else if (!this._settings.get_boolean('hide-icons')) { // support for hide icons #80
|
||||
let iconObj = (split.length == 2)?'icon-' + split[1]:'icon';
|
||||
icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(type, iconObj));
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
_sensorIconPath(sensor, icon = 'icon') {
|
||||
// If the sensor is a numbered gpu, use the gpu icon. Otherwise use whatever icon associated with the sensor name.
|
||||
let sensorKey = sensor;
|
||||
if(sensor.startsWith('gpu')) sensorKey = 'gpu';
|
||||
|
||||
const iconPathPrefixIndex = this._settings.get_int('icon-style');
|
||||
return this._extensionObject.path + this._sensorsIconPathPrefix[iconPathPrefixIndex] + this._sensorIcons[sensorKey][icon];
|
||||
}
|
||||
|
||||
_ucFirst(string) {
|
||||
if(string.startsWith('gpu')) return 'Graphics';
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
_positionInPanel() {
|
||||
let alignment = '';
|
||||
let gravity = 0;
|
||||
let arrow_pos = 0;
|
||||
|
||||
switch (this._settings.get_int('position-in-panel')) {
|
||||
case 0: // left
|
||||
alignment = 'left';
|
||||
gravity = -1;
|
||||
arrow_pos = 1;
|
||||
break;
|
||||
case 1: // center
|
||||
alignment = 'center';
|
||||
gravity = -1;
|
||||
arrow_pos = 0.5;
|
||||
break;
|
||||
case 2: // right
|
||||
alignment = 'right';
|
||||
gravity = 0;
|
||||
arrow_pos = 0;
|
||||
break;
|
||||
case 3: // far left
|
||||
alignment = 'left';
|
||||
gravity = 0;
|
||||
arrow_pos = 1;
|
||||
break;
|
||||
case 4: // far right
|
||||
alignment = 'right';
|
||||
gravity = -1;
|
||||
arrow_pos = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
let centered = this._settings.get_boolean('menu-centered')
|
||||
if (centered) arrow_pos = 0.5;
|
||||
|
||||
// set arrow position when initializing and moving vitals
|
||||
this.menu._arrowAlignment = arrow_pos;
|
||||
|
||||
return [alignment, gravity];
|
||||
}
|
||||
|
||||
_querySensors() {
|
||||
// figure out last run time
|
||||
let now = new Date().getTime();
|
||||
let dwell = (now - this._last_query) / 1000;
|
||||
this._last_query = now;
|
||||
|
||||
this._sensors.query((label, value, type, format) => {
|
||||
const typeKey = type.replace('-group', '');
|
||||
let key = '_' + typeKey + '_' + label.replace(' ', '_').toLowerCase() + '_';
|
||||
|
||||
// if a sensor is disabled, gray it out
|
||||
if (key in this._sensorMenuItems) {
|
||||
this._sensorMenuItems[key].setSensitive((value!='disabled'));
|
||||
|
||||
// don't continue below, last known value is shown
|
||||
if (value == 'disabled') return;
|
||||
}
|
||||
|
||||
// add/initialize any gpu groups that we haven't added yet
|
||||
if(typeKey.startsWith('gpu') && typeKey !== 'gpu#1') {
|
||||
const split = typeKey.split('#');
|
||||
if(split.length == 2 && this._numGpus < parseInt(split[1])) {
|
||||
// occasionally two lines from nvidia-smi will be read at once
|
||||
// so we only actually update the number of gpus if we have recieved multiple lines at least 3 times in a row
|
||||
// i.e. we make sure that mutiple queries have detected a new gpu back-to-back
|
||||
if(this._newGpuDetectedCount < 2) {
|
||||
this._newGpuDetected = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this._numGpus = parseInt(split[1]);
|
||||
this._newGpuDetectedCount = 0;
|
||||
this._newGpuDetected = false;
|
||||
// change label for gpu 1 from "Graphics" to "Graphics 1" since we have multiple gpus now
|
||||
this._groups['gpu#1'].label.text = this._ucFirst('gpu#1') + ' 1';
|
||||
for(let i = 2; i <= this._numGpus; i++)
|
||||
if(!('gpu#' + i in this._groups))
|
||||
this._initializeMenuGroup('gpu#' + i, 'gpu', ' ' + i, Object.keys(this._groups).length);
|
||||
}
|
||||
}
|
||||
|
||||
let items = this._values.returnIfDifferent(dwell, label, value, type, format, key);
|
||||
for (let item of Object.values(items))
|
||||
this._updateDisplay(_(item[0]), item[1], item[2], item[3]);
|
||||
}, dwell);
|
||||
|
||||
//if a new gpu has been detected during the last query, then increment the amount of times we've detected a new gpu
|
||||
if(this._newGpuDetected) this._newGpuDetectedCount++;
|
||||
else this._newGpuDetectedCount = 0;
|
||||
this._newGpuDetected = false;
|
||||
|
||||
if (this._warnings.length > 0) {
|
||||
this._notify('Vitals', this._warnings.join("\n"), 'folder-symbolic');
|
||||
this._warnings = [];
|
||||
}
|
||||
}
|
||||
|
||||
_notify(msg, details, icon) {
|
||||
let source = new MessageTray.Source('MyApp Information', icon);
|
||||
Main.messageTray.add(source);
|
||||
let notification = new MessageTray.Notification(source, msg, details);
|
||||
notification.setTransient(true);
|
||||
source.notify(notification);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this._destroyTimer();
|
||||
this._sensors.destroy();
|
||||
|
||||
for (let signal of Object.values(this._settingChangedSignals))
|
||||
this._settings.disconnect(signal);
|
||||
|
||||
super.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
export default class VitalsExtension extends Extension {
|
||||
enable() {
|
||||
vitalsMenu = new VitalsMenuButton(this);
|
||||
let position = vitalsMenu._positionInPanel();
|
||||
Main.panel.addToStatusArea('vitalsMenu', vitalsMenu, position[1], position[0]);
|
||||
}
|
||||
|
||||
disable() {
|
||||
vitalsMenu.destroy();
|
||||
vitalsMenu = null;
|
||||
}
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib'
|
||||
|
||||
// convert Uint8Array into a literal string
|
||||
function convertUint8ArrayToString(contents) {
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
return decoder.decode(contents).trim();
|
||||
}
|
||||
|
||||
export function File(path) {
|
||||
if (path.indexOf('https://') == -1)
|
||||
this.file = Gio.File.new_for_path(path);
|
||||
else
|
||||
this.file = Gio.File.new_for_uri(path);
|
||||
}
|
||||
|
||||
File.prototype.read = function(delimiter = '', strip_header = false) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.file.load_contents_async(null, function(file, res) {
|
||||
try {
|
||||
// grab contents of file or website
|
||||
let contents = file.load_contents_finish(res)[1];
|
||||
|
||||
// convert contents to string
|
||||
contents = convertUint8ArrayToString(contents);
|
||||
|
||||
// split contents by delimiter if passed in
|
||||
if (delimiter) contents = contents.split(delimiter);
|
||||
|
||||
// optionally strip header when converting to a list
|
||||
if (strip_header) contents.shift();
|
||||
|
||||
// return results
|
||||
resolve(contents);
|
||||
} catch (e) {
|
||||
reject(e.message);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
reject(e.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
File.prototype.list = function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let max_items = 125, results = [];
|
||||
|
||||
try {
|
||||
this.file.enumerate_children_async(Gio.FILE_ATTRIBUTE_STANDARD_NAME, Gio.FileQueryInfoFlags.NONE, GLib.PRIORITY_LOW, null, function(file, res) {
|
||||
try {
|
||||
let enumerator = file.enumerate_children_finish(res);
|
||||
|
||||
let callback = function(enumerator, res) {
|
||||
try {
|
||||
let files = enumerator.next_files_finish(res);
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
results.push(files[i].get_attribute_as_string(Gio.FILE_ATTRIBUTE_STANDARD_NAME));
|
||||
}
|
||||
|
||||
if (files.length == 0) {
|
||||
enumerator.close_async(GLib.PRIORITY_LOW, null, function(){});
|
||||
resolve(results);
|
||||
} else {
|
||||
enumerator.next_files_async(max_items, GLib.PRIORITY_LOW, null, callback);
|
||||
}
|
||||
} catch (e) {
|
||||
reject(e.message);
|
||||
}
|
||||
};
|
||||
|
||||
enumerator.next_files_async(max_items, GLib.PRIORITY_LOW, null, callback);
|
||||
} catch (e) {
|
||||
reject(e.message);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
reject(e.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -1,54 +0,0 @@
|
||||
import GLib from 'gi://GLib';
|
||||
import Gio from 'gi://Gio';
|
||||
|
||||
// convert Uint8Array into a literal string
|
||||
function convertUint8ArrayToString(contents) {
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
return decoder.decode(contents).trim();
|
||||
}
|
||||
|
||||
export function SubProcess(command) {
|
||||
this.sub_process = Gio.Subprocess.new(command, Gio.SubprocessFlags.STDOUT_PIPE);
|
||||
this.stdout = this.sub_process.get_stdout_pipe();
|
||||
}
|
||||
|
||||
SubProcess.prototype.read = function(delimiter = '') {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.stdout.read_bytes_async(512, GLib.PRIORITY_LOW, null, function(stdout, res) {
|
||||
try {
|
||||
let read_bytes = stdout.read_bytes_finish(res).get_data();
|
||||
|
||||
// convert contents to string
|
||||
let read_str = convertUint8ArrayToString(read_bytes);
|
||||
|
||||
// split read_str by delimiter if passed in
|
||||
if (delimiter) {
|
||||
if (read_str == '')
|
||||
read_str = []; // EOF, ''.split(delimiter) would return ['']
|
||||
else
|
||||
read_str = read_str.split(delimiter);
|
||||
}
|
||||
|
||||
// return results
|
||||
resolve(read_str);
|
||||
} catch (e) {
|
||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING)) {
|
||||
// previous read attempt is still waiting for something from stdout
|
||||
// ignore second attempt, return empty data (like EOF)
|
||||
if (delimiter) resolve([]);
|
||||
else resolve('');
|
||||
} else {
|
||||
reject(e.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
SubProcess.prototype.terminate = function() {
|
||||
const SIGINT = 2;
|
||||
this.sub_process.send_signal(SIGINT);
|
||||
this.sub_process = null;
|
||||
this.stdout.close_async(GLib.PRIORITY_LOW, null, null);
|
||||
this.stdout = null;
|
||||
};
|
||||
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M7 0C6 0 6 1 6 1v1H5s-.707-.016-1.45.355C2.814 2.727 2 3.668 2 5v8s-.016.707.355 1.45C2.727 15.187 3.668 16 5 16h6s.707.016 1.45-.355C13.187 15.273 14 14.332 14 13V5c0-1.332-.812-2.273-1.55-2.645C11.706 1.985 11 2 11 2h-1V1c0-1-1-1-1-1zM5 4h6c.555 0 1 .445 1 1v8c0 .555-.445 1-1 1H5c-.555 0-1-.445-1-1V5c0-.555.445-1 1-1m0 1v2h6V5zm0 3v2h6V8zm0 3v2h6v-2zm0 0"/></svg>
|
||||
|
Before Width: | Height: | Size: 451 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#222"><path d="M5 5h6v6H5zm8 0h3v1h-3zm0 2h3v1h-3zm0 2h3v1h-3zM0 6h3v1H0zm0 2h3v1H0zm0 2h3v1H0zM5 0h1v3H5zm2 0h1v3H7zm2 0h1v3H9zm1 13h1v3h-1zm-2 0h1v3H8zm-2 0h1v3H6zm0 0"/><path d="M5 2C3.355 2 2 3.355 2 5v6c0 1.645 1.355 3 3 3h6c1.645 0 3-1.355 3-3V5c0-1.645-1.355-3-3-3zm0 2h6c.57 0 1 .43 1 1v6c0 .57-.43 1-1 1H5c-.57 0-1-.43-1-1V5c0-.57.43-1 1-1m0 0"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 437 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#222"><path d="M8 0c-.234 0-.459.012-.688.031-1.832 1.216-1.77 3.335-.859 5.405A3 3 0 0 1 8 5a3 3 0 0 1 .418.031c.919-2.154 2.91-3.702 3.55-3.968A7.96 7.96 0 0 0 8 0M4 1.094a8 8 0 0 0-3.219 3.5c.12 2.215 1.974 3.23 4.225 3.472L5 8a3 3 0 0 1 .646-1.85C4.248 4.28 3.912 1.787 4 1.094m9.156 1.968c-1.423-.044-2.706.924-3.719 2.305a3 3 0 0 1 1.35 1.528C13.127 6.624 15.48 7.587 16 8a7.96 7.96 0 0 0-1.438-4.563 3.4 3.4 0 0 0-1.406-.374zm-2.158 4.872L11 8a3 3 0 0 1-.646 1.85c1.398 1.87 1.734 4.363 1.646 5.056a8 8 0 0 0 3.219-3.5c-.12-2.214-1.972-3.228-4.221-3.472M0 8c0 1.698.536 3.268 1.438 4.563 1.973.987 3.79-.113 5.128-1.936A3 3 0 0 1 5.22 9.105C2.877 9.38.52 8.413 0 8m9.547 2.564A3 3 0 0 1 8 11a3 3 0 0 1-.418-.031c-.919 2.154-2.91 3.702-3.55 3.969a7.96 7.96 0 0 0 4.655 1.03c1.833-1.215 1.772-3.334.86-5.404"/><circle cx="8" cy="8" r="2"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 926 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M0 0v2h.086c.5 0 .914.414.914.914V16h2v-2.008h1c0 1.11.89 2 2 2h5c1.11 0 2-.89 2-2 1.66 0 3-1.34 3-3v-6c0-1.66-1.34-3-3-3H2.848A2.9 2.9 0 0 0 .086 0zm3 3.992h10c.547 0 1 .453 1 1v6c0 .547-.453 1-1 1h-2v2h-1v-2H9v2H8v-2H7v2H6v-2H3zm3 1v1H5v3h1v1h1v-1h1v1h1v-1h1v1h1v-1h1v-3h-1v-1h-1v1H9v-1H8v1H7v-1zm0 0"/></svg>
|
||||
|
Before Width: | Height: | Size: 395 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#222"><path d="M3 2C1.34 2 0 3.34 0 5v4c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3zm0 2h10c.555 0 1 .445 1 1v4c0 .555-.445 1-1 1H3c-.555 0-1-.445-1-1V5c0-.555.445-1 1-1"/><path fill-opacity=".5" d="M4 5h2v4H4zm3 0h2v4H7zm3 0h2v4h-2z"/><path d="M2 10h12v4H2z"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 358 B |
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0" fill-opacity="0.34902"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0" fill-opacity="0.34902"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M4 0C2.355 0 1 1.355 1 3v10c0 1.645 1.355 3 3 3h8c1.645 0 3-1.355 3-3V3c0-1.645-1.355-3-3-3zm0 2h8c.57 0 1 .43 1 1v9c0 .57-.43 1-1 1H4c-.555 0-1-.445-1-1V3c0-.555.445-1 1-1m4 1C5.79 3 4 4.79 4 7v4h4c2.5 0 4-1.79 4-4s-1.79-4-4-4m0 2a2 2 0 1 1-2 2 2 2 0 0 1 2-2m0 0"/></svg>
|
||||
|
Before Width: | Height: | Size: 356 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M3 0C1.34 0 0 1.34 0 3v7c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3c0-1.66-1.34-3-3-3zm0 2h10c.555 0 1 .445 1 1v7c0 .555-.445 1-1 1H3c-.555 0-1-.445-1-1V3c0-.555.445-1 1-1m2 12a2 2 0 0 0-2 2h10a2 2 0 0 0-2-2zm0 0"/></svg>
|
||||
|
Before Width: | Height: | Size: 303 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M8 0C6.338 0 5 1.338 5 3v6q0 .174.02.342A4 4 0 0 0 4 12a4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-1.018-2.666A3 3 0 0 0 11 9V3c0-1.662-1.338-3-3-3m0 2c.554 0 1 .446 1 1v1H8v1h1v1H8v1h1v1H8v1h1v1.27a2 2 0 0 1 .316.23l.082.082a2 2 0 0 1 .182.203 2 2 0 0 1 .08.117 2 2 0 0 1 .125.215 2 2 0 0 1 .063.135A2 2 0 0 1 10 12a2 2 0 0 1-2 2 2 2 0 0 1-2-2 2 2 0 0 1 .15-.732 2 2 0 0 1 .07-.155 2 2 0 0 1 .12-.205 2 2 0 0 1 .082-.119 2 2 0 0 1 .197-.219l.06-.06A2 2 0 0 1 7 10.277V3c0-.554.446-1 1-1m0 9a1 1 0 0 0-1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0-1-1"/></svg>
|
||||
|
Before Width: | Height: | Size: 635 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M4 .004v3H2.977A1.97 1.97 0 0 0 1 4.977v2.05q0 .194.035.375A4.99 4.99 0 0 0 6 13.004 3.015 3.015 0 0 0 9 16h2c1.094 0 2-.906 2-2h1v2h2v-2c0-1.094-.906-2-2-2h-1c-1.094 0-2 .906-2 2H9c-.563 0-1-.434-1-.996a4.99 4.99 0 0 0 4.965-5.602A2 2 0 0 0 13 7.027v-2.05a1.97 1.97 0 0 0-1.977-1.973H10v-3H8v3H6v-3Zm0 0"/></svg>
|
||||
|
Before Width: | Height: | Size: 397 B |
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16" height="16.001" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="#474747">
|
||||
<path d="M5 5v2h6V5z" overflow="visible"/>
|
||||
<path d="M5.469 0c-.49 0-.797.216-1.032.456C4.202.696 4 1.012 4 1.486V2H2v14h12V2h-2v-.406l-.002-.028a1.616 1.616 0 0 0-.416-1.011c-.236-.28-.62-.585-1.2-.553L10.438 0zm.53 2h4v2h2v10H4V4h2z" color="#bebebe" font-family="sans-serif" font-weight="400" overflow="visible" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none" white-space="normal"/>
|
||||
<path d="m5 8v2h6v-2zm0 3v2h6v-2z" overflow="visible"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 909 B |
@ -1 +0,0 @@
|
||||
<?xml version="1.0" ?><svg enable-background="new 0 0 52 52" id="Layer_1" version="1.1" viewBox="0 0 52 52" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M38.9799805,2H2v48h48V13.0200195L38.9799805,2z M25.0005493,6.0021362h3v2h-3V6.0021362z M25.0005493,10.0021362h3v2h-3 V10.0021362z M25.0005493,14.0021362h3v2h-3V14.0021362z M19.0005493,6.0021362h3v2h-3V6.0021362z M19.0005493,10.0021362h3v2h-3 V10.0021362z M19.0005493,14.0021362h3v2h-3V14.0021362z M10.0005493,46.0021362h-3v-2h3V46.0021362z M10.0005493,42.0021362h-3v-2 h3V42.0021362z M10.0005493,38.0021362h-3v-2h3V38.0021362z M10.0005493,34.0021362h-3v-2h3V34.0021362z M10.0005493,30.0021362h-3 v-2h3V30.0021362z M10.0005493,25.0021362h-3v-2h3V25.0021362z M10.0005493,21.0021362h-3v-2h3V21.0021362z M10.0005493,16.0021362 h-3v-2h3V16.0021362z M10.0005493,12.0021362h-3v-2h3V12.0021362z M10.0005493,8.0021362h-3v-2h3V8.0021362z M16.0005493,46.0021362 h-3v-2h3V46.0021362z M16.0005493,42.0021362h-3v-2h3V42.0021362z M16.0005493,38.0021362h-3v-2h3V38.0021362z M16.0005493,34.0021362h-3v-2h3V34.0021362z M16.0005493,30.0021362h-3v-2h3V30.0021362z M16.0005493,25.0021362h-3v-2h3 V25.0021362z M16.0005493,21.0021362h-3v-2h3V21.0021362z M16.0005493,16.0021362h-3v-2h3V16.0021362z M16.0005493,12.0021362h-3v-2 h3V12.0021362z M16.0005493,8.0021362h-3v-2h3V8.0021362z M19,19h14v14H19V19z M22.0005493,46.0021362h-3v-2h3V46.0021362z M22.0005493,42.0021362h-3v-2h3V42.0021362z M22.0005493,38.0021362h-3v-2h3V38.0021362z M28.0005493,46.0021362h-3v-2h3 V46.0021362z M28.0005493,42.0021362h-3v-2h3V42.0021362z M28.0005493,38.0021362h-3v-2h3V38.0021362z M34.0005493,46.0021362h-3v-2 h3V46.0021362z M34.0005493,42.0021362h-3v-2h3V42.0021362z M34.0005493,38.0021362h-3v-2h3V38.0021362z M34.0005493,16.0021362h-3 v-2h3V16.0021362z M34.0005493,12.0021362h-3v-2h3V12.0021362z M34.0005493,8.0021362h-3v-2h3V8.0021362z M40.0005493,46.0021362h-3 v-2h3V46.0021362z M40.0005493,42.0021362h-3v-2h3V42.0021362z M40.0005493,38.0021362h-3v-2h3V38.0021362z M40.0005493,34.0021362 h-3v-2h3V34.0021362z M40.0005493,30.0021362h-3v-2h3V30.0021362z M40.0005493,25.0021362h-3v-2h3V25.0021362z M40.0005493,21.0021362h-3v-2h3V21.0021362z M40.0005493,16.0021362h-3v-2h3V16.0021362z M40.0005493,12.0021362h-3v-2h3 V12.0021362z M46.0005493,46.0021362h-3v-2h3V46.0021362z M46.0005493,42.0021362h-3v-2h3V42.0021362z M46.0005493,38.0021362h-3v-2 h3V38.0021362z M46.0005493,34.0021362h-3v-2h3V34.0021362z M46.0005493,30.0021362h-3v-2h3V30.0021362z M46.0005493,25.0021362h-3 v-2h3V25.0021362z M46.0005493,21.0021362h-3v-2h3V21.0021362z M46.0005493,16.0021362h-3v-2h3V16.0021362z"/></svg>
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
@ -1,133 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="svg7384"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
height="16"
|
||||
sodipodi:docname="fan.svg"
|
||||
width="16">
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
inkscape:object-paths="true"
|
||||
inkscape:cy="7.9523753"
|
||||
inkscape:current-layer="svg7384"
|
||||
inkscape:window-width="1680"
|
||||
pagecolor="#555753"
|
||||
showborder="false"
|
||||
showguides="true"
|
||||
inkscape:snap-nodes="false"
|
||||
objecttolerance="10"
|
||||
showgrid="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-x="0"
|
||||
inkscape:snap-bbox="true"
|
||||
bordercolor="#666666"
|
||||
id="namedview88"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:window-y="27"
|
||||
gridtolerance="10"
|
||||
inkscape:zoom="45.254834"
|
||||
inkscape:window-height="991"
|
||||
borderopacity="1"
|
||||
guidetolerance="10"
|
||||
inkscape:snap-bbox-midpoints="false"
|
||||
inkscape:cx="6.4701314"
|
||||
inkscape:bbox-paths="false"
|
||||
inkscape:snap-grids="true"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:snap-to-guides="true">
|
||||
<inkscape:grid
|
||||
visible="true"
|
||||
spacingx="1px"
|
||||
type="xygrid"
|
||||
spacingy="1px"
|
||||
id="grid4866"
|
||||
empspacing="2"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true" />
|
||||
</sodipodi:namedview>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer9"
|
||||
inkscape:label="status"
|
||||
style="display:inline" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer10"
|
||||
inkscape:label="devices" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer11"
|
||||
inkscape:label="apps" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer12"
|
||||
inkscape:label="actions" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer13"
|
||||
inkscape:label="places" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer14"
|
||||
inkscape:label="mimetypes" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer15"
|
||||
inkscape:label="emblems"
|
||||
style="display:inline" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="g4953"
|
||||
inkscape:label="categories"
|
||||
style="display:inline" />
|
||||
<path
|
||||
style="fill:#bebebe;fill-opacity:1;stroke:none"
|
||||
d="M 8 0 C 7.7662783 -3.1322393e-17 7.5411335 0.011610998 7.3125 0.03125 C 5.2102943 1.4256475 5.5987411 4.0108346 6.90625 6.34375 C 7.2209706 6.1372503 7.5954602 6 8 6 C 8.0316752 6 8.062435 5.9985435 8.09375 6 C 8.7335699 3.3508722 11.235427 1.3679906 11.96875 1.0625 C 10.798244 0.39154001 9.4458996 -7.7509341e-16 8 0 z M 4 1.09375 C 2.5986515 1.9071018 1.4765974 3.1207274 0.78125 4.59375 C 0.9182133 7.1283275 3.3250439 8.0908827 6 8.125 C 5.9974202 8.0834163 6 8.0422335 6 8 C 6 7.6007368 6.1109237 7.2184502 6.3125 6.90625 C 4.3514736 5.0277432 3.8996391 1.8856213 4 1.09375 z M 13.15625 3.0625 C 11.454675 3.0097524 9.9536158 4.4003424 8.875 6.21875 C 9.2647725 6.4100014 9.5848814 6.7069783 9.78125 7.09375 C 12.408696 6.3344077 15.40554 7.5273725 16 8 C 16 6.3023731 15.464331 4.7324062 14.5625 3.4375 C 14.086383 3.1993071 13.609414 3.0765477 13.15625 3.0625 z M 10 7.875 C 10.00258 7.9165837 10 7.9577665 10 8 C 10 8.3992632 9.8890763 8.7815498 9.6875 9.09375 C 11.648527 10.972257 12.100361 14.114379 12 14.90625 C 13.401349 14.092898 14.523403 12.879273 15.21875 11.40625 C 15.081787 8.8716722 12.674956 7.9091173 10 7.875 z M 0 8 C -4.5501758e-16 9.6976269 0.53566854 11.267594 1.4375 12.5625 C 3.7013779 13.695079 5.7591272 12.083936 7.125 9.78125 C 6.7352275 9.5899986 6.4151186 9.2930217 6.21875 8.90625 C 3.5913037 9.6655923 0.5944604 8.4726275 0 8 z M 9.09375 9.65625 C 8.7790294 9.8627497 8.4045398 10 8 10 C 7.9683248 10 7.937565 10.001457 7.90625 10 C 7.26643 12.649128 4.7645729 14.632009 4.03125 14.9375 C 5.2017564 15.60846 6.5541004 16 8 16 C 8.2337217 16 8.4588665 15.988389 8.6875 15.96875 C 10.789706 14.574352 10.401259 11.989165 9.09375 9.65625 z "
|
||||
id="path3830" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:#bebebe;fill-opacity:1;stroke:none"
|
||||
id="path3896"
|
||||
sodipodi:cx="8.0433397"
|
||||
sodipodi:cy="8.0008545"
|
||||
sodipodi:rx="0.9722718"
|
||||
sodipodi:ry="0.95017475"
|
||||
d="m 9.0156115,8.0008545 a 0.9722718,0.95017475 0 1 1 -1.9445436,0 0.9722718,0.95017475 0 1 1 1.9445436,0 z"
|
||||
transform="matrix(1.028519,0,0,1.052438,-0.27272757,-0.42040319)" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.4 KiB |
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<g transform="matrix(3.38015e-16,5.5202,-5.5202,3.38015e-16,526.335,-21.2284)">
|
||||
<path d="M18,18L18,8L6,8L6,12L14,12L14,24L6,24L6,41.942L14,41.942L14,50.565L6,50.565L6,68.188L14,68.188L14,84L18,84L18,76L43,76L43,83C43.262,84.981 44.621,85.866 46.73,86L76.27,86C77.384,86 78.257,85.827 78.879,85.369C79.549,84.876 80,84.108 80,83L80,76L84.83,76C88.477,76.314 90.397,75.227 91.886,73.383C93.128,71.845 94.269,69.879 94,66.83L94,18L18,18ZM14,64.188L10,64.188L10,54.565L14,54.565L14,64.188ZM14,37.942L10,37.942L10,28L14,28L14,37.942ZM76,81.05C76,81.783 75.758,82.05 74.84,82.05L48.16,82.05C46.867,82.364 46.769,81.824 47,81.05L47,76L76,76L76,81.05ZM90,65.17C90.472,69.878 88.349,72.291 83.17,72L18,72L18,22L90,22L90,65.17Z" style="fill-rule:nonzero;"/>
|
||||
</g>
|
||||
<g transform="matrix(2.90206e-16,4.73942,-4.73942,2.90206e-16,491.213,161.673)">
|
||||
<path d="M44,66.88C54.906,66.88 63.88,57.906 63.88,47C63.88,36.094 54.906,27.12 44,27.12C33.094,27.12 24.12,36.094 24.12,47C24.131,57.902 33.098,66.869 44,66.88ZM42,62.74C37.914,62.223 34.185,60.135 31.61,56.92L37.67,52.92C38.832,54.175 40.338,55.062 42,55.47L42,62.74ZM46,62.74L46,55.46C47.653,55.082 49.159,54.227 50.33,53L56.39,57C53.801,60.185 50.074,62.244 46,62.74ZM58.06,39.65C60.332,43.951 60.484,49.072 58.47,53.5L52.34,49.5C52.582,48.689 52.707,47.847 52.71,47C52.712,45.831 52.474,44.673 52.01,43.6L58.06,39.65ZM46,31.26C49.762,31.74 53.23,33.554 55.77,36.37L49.63,40.37C48.581,39.483 47.337,38.856 46,38.54L46,31.26ZM48.71,47C48.71,49.584 46.584,51.71 44,51.71C41.416,51.71 39.29,49.584 39.29,47C39.29,44.416 41.416,42.29 44,42.29C46.582,42.295 48.705,44.418 48.71,47ZM42,31.26L42,38.53C40.664,38.854 39.421,39.484 38.37,40.37L32.23,36.37C34.77,33.554 38.238,31.74 42,31.26ZM36,43.6C35.536,44.673 35.298,45.831 35.3,47C35.304,47.843 35.429,48.682 35.67,49.49L29.53,53.49C27.53,49.059 27.681,43.945 29.94,39.64L36,43.6Z" style="fill-rule:nonzero;"/>
|
||||
</g>
|
||||
<g transform="matrix(2.65262e-16,4.33206,-4.33206,2.65262e-16,472.204,-12.7952)">
|
||||
<g>
|
||||
<path d="M44,66.88C54.906,66.88 63.88,57.906 63.88,47C63.88,36.094 54.906,27.12 44,27.12C33.094,27.12 24.12,36.094 24.12,47C24.131,57.902 33.098,66.869 44,66.88ZM42,62.74C37.914,62.223 34.185,60.135 31.61,56.92L37.67,52.92C38.832,54.175 40.338,55.062 42,55.47L42,62.74ZM46,62.74L46,55.46C47.653,55.082 49.159,54.227 50.33,53L56.39,57C53.801,60.185 50.074,62.244 46,62.74ZM58.06,39.65C60.332,43.951 60.484,49.072 58.47,53.5L52.34,49.5C52.582,48.689 52.707,47.847 52.71,47C52.712,45.831 52.474,44.673 52.01,43.6L58.06,39.65ZM46,31.26C49.762,31.74 53.23,33.554 55.77,36.37L49.63,40.37C48.581,39.483 47.337,38.856 46,38.54L46,31.26ZM48.71,47C48.71,49.584 46.584,51.71 44,51.71C41.416,51.71 39.29,49.584 39.29,47C39.29,44.416 41.416,42.29 44,42.29C46.582,42.295 48.705,44.418 48.71,47ZM42,31.26L42,38.53C40.664,38.854 39.421,39.484 38.37,40.37L32.23,36.37C34.77,33.554 38.238,31.74 42,31.26ZM36,43.6C35.536,44.673 35.298,45.831 35.3,47C35.304,47.843 35.429,48.682 35.67,49.49L29.53,53.49C27.53,49.059 27.681,43.945 29.94,39.64L36,43.6Z" style="fill-rule:nonzero;"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.5 KiB |
@ -1 +0,0 @@
|
||||
<?xml version="1.0" ?><svg enable-background="new 0 0 52 52" id="Layer_1" version="1.1" viewBox="0 0 52 52" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M50,41.0999756V11.4000244h-6.9978638V7.7766113C44.164978,7.364502,45,6.2706909,45,4.9799805 C45,3.3400269,43.6600342,2,42,2c-1.6499634,0-3,1.3400269-3,2.9799805c0,1.2908936,0.8413696,2.3848267,2.0021362,2.796814v3.62323 h-8V7.7766113C34.164978,7.364502,35,6.2706909,35,4.9799805C35,3.3400269,33.6600342,2,32,2c-1.6499634,0-3,1.3400269-3,2.9799805 c0,1.2908936,0.8413696,2.3848267,2.0021362,2.796814v3.62323h-8V7.7766113C24.164978,7.364502,25,6.2706909,25,4.9799805 C25,3.3400269,23.6600342,2,22,2c-1.6499634,0-3,1.3400269-3,2.9799805c0,1.2908936,0.8413696,2.3848267,2.0021362,2.796814v3.62323 h-8V7.7766113C14.164978,7.364502,15,6.2706909,15,4.9799805C15,3.3400269,13.6600342,2,12,2c-1.6499634,0-3,1.3400269-3,2.9799805 c0,1.2908936,0.8413696,2.3848267,2.0021362,2.796814v3.62323H2v29.6999512h9.0021362v3.1321411 C9.8413696,44.6417847,9,45.7312622,9,47.0299683C9,48.6699829,10.3500366,50,12,50c1.6600342,0,3-1.3300171,3-2.9700317 c0-1.298584-0.835022-2.3878784-1.9978638-2.7977295v-3.1322632h8v3.1321411C19.8413696,44.6417847,19,45.7312622,19,47.0299683 C19,48.6699829,20.3500366,50,22,50c1.6600342,0,3-1.3300171,3-2.9700317c0-1.298584-0.835022-2.3878784-1.9978638-2.7977295 v-3.1322632h8v3.1321411C29.8413696,44.6417847,29,45.7312622,29,47.0299683C29,48.6699829,30.3500366,50,32,50 c1.6600342,0,3-1.3300171,3-2.9700317c0-1.298584-0.835022-2.3878784-1.9978638-2.7977295v-3.1322632h8v3.1321411 C39.8413696,44.6417847,39,45.7312622,39,47.0299683C39,48.6699829,40.3500366,50,42,50c1.6600342,0,3-1.3300171,3-2.9700317 c0-1.298584-0.835022-2.3878784-1.9978638-2.7977295v-3.1322632H50z M7,16.3500366h38v19.7999878H7V16.3500366z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@ -1 +0,0 @@
|
||||
<?xml version="1.0" ?><svg height="16px" version="1.1" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><defs/><g fill="none" fill-rule="evenodd" id="Icons with numbers" stroke="none" stroke-width="1"><g fill="#000000" id="Group" transform="translate(-672.000000, -288.000000)"><path d="M679,293 L679,296 L677,296 L680,300 L683,296 L681,296 L681,293 Z M672,298 C672,296.651721 672.895887,295.507545 674.127761,295.131093 C674.500314,293.897932 675.645295,293 677,293 C677.174013,293 677.344566,293.014816 677.510466,293.043254 C678.195719,291.823839 679.50165,291 681,291 C683.209139,291 685,292.790861 685,295 C686.668415,295.005076 688,296.346276 688,298 C688,299.653483 686.652611,301 684.990522,301 L675.009478,301 C673.336631,301 672,299.656854 672,298 Z M672,298" id="Rectangle 169 copy 2"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 936 B |
@ -1 +0,0 @@
|
||||
<?xml version="1.0" ?><svg height="16px" version="1.1" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><defs/><g fill="none" fill-rule="evenodd" id="Icons with numbers" stroke="none" stroke-width="1"><g fill="#000000" id="Group" transform="translate(-576.000000, -288.000000)"><path d="M576,298 C576,296.651721 576.895887,295.507545 578.127761,295.131093 C578.500314,293.897932 579.645295,293 581,293 C581.174013,293 581.344566,293.014816 581.510466,293.043254 C582.195719,291.823839 583.50165,291 585,291 C587.209139,291 589,292.790861 589,295 C590.668415,295.005076 592,296.346276 592,298 C592,299.653483 590.652611,301 588.990522,301 L579.009478,301 C577.336631,301 576,299.656854 576,298 Z M576,298" id="Rectangle 169"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 864 B |
@ -1 +0,0 @@
|
||||
<?xml version="1.0" ?><svg height="16px" version="1.1" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><defs/><g fill="none" fill-rule="evenodd" id="Icons with numbers" stroke="none" stroke-width="1"><g fill="#000000" id="Group" transform="translate(-624.000000, -288.000000)"><path d="M631,297 L631,300 L633,300 L633,297 L635,297 L632,293 L629,297 Z M624,298 C624,296.651721 624.895887,295.507545 626.127761,295.131093 C626.500314,293.897932 627.645295,293 629,293 C629.174013,293 629.344566,293.014816 629.510466,293.043254 C630.195719,291.823839 631.50165,291 633,291 C635.209139,291 637,292.790861 637,295 C638.668415,295.005076 640,296.346276 640,298 C640,299.653483 638.652611,301 636.990522,301 L627.009478,301 C625.336631,301 624,299.656854 624,298 Z M624,298" id="Rectangle 169 copy"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 934 B |
@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
|
||||
<path style="fill:#bebebe" d="M 3,1 C 2,1 2,2 2,2 V 14 C 2,14 2,15 3,15 H 13 C 13,15 14,15 14,14 V 2 C 14,2 14,1 13,1 Z M 8,3 C 10.21,3 12,4.79 12,7 12,9.21 10.21,11 8,11 H 4 V 7 C 4,4.79 5.79,3 8,3 Z M 8,5 C 6.9,5 6,5.9 6,7 6,8.1 6.9,9 8,9 9.1,9 10,8.1 10,7 10,5.9 9.1,5 8,5 Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 367 B |
@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
|
||||
<path style="fill:#bebebe" d="M 15,1 C 16,1 16,2 16,2 V 12 C 16,12 16,13 15,13 H 1 C 1,13 0,13 0,12 V 2 C 0,2 0,1 1,1 Z M 14,3 H 2 V 11 H 14 Z M 11,14 V 15 H 5 V 14 C 5,13 6,13 6,13 H 10 C 10,13 11,13 11,14 Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 298 B |
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
enable-background="new -0.2 0 18 30"
|
||||
height="30"
|
||||
version="1.1"
|
||||
viewBox="-0.2 0 30 30"
|
||||
width="30"
|
||||
xml:space="preserve"
|
||||
id="svg6"
|
||||
sodipodi:docname="if_Vector-icons_49_1041647.svg"
|
||||
inkscape:version="0.92.3 (3ce5693, 2018-03-11)"><metadata
|
||||
id="metadata10"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1070"
|
||||
inkscape:window-height="638"
|
||||
id="namedview8"
|
||||
showgrid="false"
|
||||
inkscape:zoom="7.8666667"
|
||||
inkscape:cx="5.2520864"
|
||||
inkscape:cy="14.6"
|
||||
inkscape:window-x="330"
|
||||
inkscape:window-y="226"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg6" /><defs
|
||||
id="defs2" /><path
|
||||
d="M 14.6,29.8 C 9.8,29.8 6,25.9 6,21.2 6,18.1 7.6,15.4 10,13.9 V 4.5 C 10,2 12.1,0 14.5,0 16.9,0 19,2 19,4.5 v 9.2 c 2.5,1.5 4.2,4.3 4.2,7.4 0.1,4.8 -3.8,8.7 -8.6,8.7 z M 17.3,15.4 17.1,5 C 17.1,3.8 15.7,2.9 14.5,2.9 13.3,2.9 12,3.8 12,5 v 10.5 c -2.1,1 -3.6,3.2 -3.6,5.7 0,3.5 2.8,6.3 6.3,6.3 3.5,0 6.3,-2.8 6.3,-6.3 0,-2.6 -1.5,-4.8 -3.7,-5.8 z m -2.7,10.5 c -2.6,0 -4.7,-2.1 -4.7,-4.7 0,-2 1.3,-3.7 3.1,-4.4 V 8 h 3 v 8.8 c 1.9,0.6 3.3,2.3 3.3,4.4 0,2.6 -2.1,4.7 -4.7,4.7 z"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0"
|
||||
style="clip-rule:evenodd;fill:#0d0d0d;fill-rule:evenodd" /></svg>
|
||||
|
Before Width: | Height: | Size: 2.1 KiB |
@ -1,125 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="svg7384"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
height="16"
|
||||
sodipodi:docname="voltage.svg"
|
||||
width="16">
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
inkscape:object-paths="true"
|
||||
inkscape:cy="8.2822539"
|
||||
inkscape:current-layer="svg7384"
|
||||
inkscape:window-width="1680"
|
||||
pagecolor="#555753"
|
||||
showborder="false"
|
||||
showguides="true"
|
||||
inkscape:snap-nodes="false"
|
||||
objecttolerance="10"
|
||||
showgrid="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-x="0"
|
||||
inkscape:snap-bbox="true"
|
||||
bordercolor="#666666"
|
||||
id="namedview88"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:window-y="27"
|
||||
gridtolerance="10"
|
||||
inkscape:zoom="68.593502"
|
||||
inkscape:window-height="991"
|
||||
borderopacity="1"
|
||||
guidetolerance="10"
|
||||
inkscape:snap-bbox-midpoints="false"
|
||||
inkscape:cx="6.2925429"
|
||||
inkscape:bbox-paths="false"
|
||||
inkscape:snap-grids="true"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:snap-to-guides="true">
|
||||
<inkscape:grid
|
||||
visible="true"
|
||||
spacingx="1px"
|
||||
type="xygrid"
|
||||
spacingy="1px"
|
||||
id="grid4866"
|
||||
empspacing="2"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true" />
|
||||
</sodipodi:namedview>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer9"
|
||||
inkscape:label="status"
|
||||
style="display:inline" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer10"
|
||||
inkscape:label="devices" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer11"
|
||||
inkscape:label="apps" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer12"
|
||||
inkscape:label="actions" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer13"
|
||||
inkscape:label="places" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer14"
|
||||
inkscape:label="mimetypes" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer15"
|
||||
inkscape:label="emblems"
|
||||
style="display:inline" />
|
||||
<g
|
||||
transform="translate(-261,-277)"
|
||||
inkscape:groupmode="layer"
|
||||
id="g4953"
|
||||
inkscape:label="categories"
|
||||
style="display:inline" />
|
||||
<path
|
||||
style="fill:#bebebe;fill-opacity:1;stroke:none"
|
||||
d="m 11.40625,1 c -0.455108,0.038189 -0.61564,0.1791748 -1.25,0.625 L 2.84375,7.34375 C 1.9959525,8.0221961 2,8.0144269 2,9 l 0,1 4,0 -3.1875,3.1875 C 1.98932,14.004249 2.00091,13.998722 2,15 l 0,1 1,0.03125 c 0.986227,-0.01956 0.997937,-0.03056 1.84375,-0.625 L 12.15625,9.6875 C 13.004048,9.0090539 13,8.9855731 13,8 L 13,7 9,7 12.1875,3.8125 C 13.01068,2.9957516 12.99909,3.0012778 13,2 l 0,-1 -1,0 c -0.246557,0.00489 -0.442047,-0.0127296 -0.59375,0 z"
|
||||
id="path3898"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sccsccccccccsccccccs" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.8 KiB |
@ -1,77 +0,0 @@
|
||||
import Clutter from 'gi://Clutter';
|
||||
import GObject from 'gi://GObject';
|
||||
import St from 'gi://St'
|
||||
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
||||
|
||||
export const MenuItem = GObject.registerClass({
|
||||
|
||||
Signals: {
|
||||
'toggle': { param_types: [Clutter.Event.$gtype] },
|
||||
},
|
||||
|
||||
}, class MenuItem extends PopupMenu.PopupBaseMenuItem {
|
||||
|
||||
_init(icon, key, label, value, checked) {
|
||||
super._init({ reactive: true });
|
||||
|
||||
this._checked = checked;
|
||||
this._updateOrnament();
|
||||
|
||||
this._key = key;
|
||||
this._gIcon = icon;
|
||||
|
||||
// add icon
|
||||
this.add_child(new St.Icon({ style_class: 'popup-menu-icon', gicon : this._gIcon }));
|
||||
|
||||
// add label
|
||||
this._labelActor = new St.Label({ text: label });
|
||||
this.add_child(this._labelActor);
|
||||
|
||||
// add value
|
||||
this._valueLabel = new St.Label({ text: value });
|
||||
this._valueLabel.set_x_align(Clutter.ActorAlign.END);
|
||||
this._valueLabel.set_x_expand(true);
|
||||
this._valueLabel.set_y_expand(true);
|
||||
this.add_child(this._valueLabel);
|
||||
|
||||
this.actor._delegate = this;
|
||||
}
|
||||
|
||||
get checked() {
|
||||
return this._checked;
|
||||
}
|
||||
|
||||
get key() {
|
||||
return this._key;
|
||||
}
|
||||
|
||||
get gicon() {
|
||||
return this._gIcon;
|
||||
}
|
||||
|
||||
set value(value) {
|
||||
this._valueLabel.text = value;
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this._valueLabel.text;
|
||||
}
|
||||
|
||||
// prevents menu from being closed
|
||||
activate(event) {
|
||||
this._checked = !this._checked;
|
||||
this._updateOrnament();
|
||||
this.emit('toggle', event);
|
||||
}
|
||||
|
||||
_updateOrnament() {
|
||||
if (this._checked)
|
||||
this.setOrnament(PopupMenu.Ornament.CHECK);
|
||||
else
|
||||
this.setOrnament(PopupMenu.Ornament.NONE);
|
||||
}
|
||||
|
||||
get label() {
|
||||
return this._labelActor.text;
|
||||
}
|
||||
});
|
||||
@ -1,20 +0,0 @@
|
||||
{
|
||||
"_generated": "Generated by SweetTooth, do not edit",
|
||||
"description": "A glimpse into your computer's temperature, voltage, fan speed, memory usage, processor load, system resources, network speed and storage stats. This is a one stop shop to monitor all of your vital sensors. Uses asynchronous polling to provide a smooth user experience. Feature requests or bugs? Please use GitHub.",
|
||||
"donations": {
|
||||
"paypal": "corecoding"
|
||||
},
|
||||
"gettext-domain": "vitals",
|
||||
"name": "Vitals",
|
||||
"settings-schema": "org.gnome.shell.extensions.vitals",
|
||||
"shell-version": [
|
||||
"45",
|
||||
"46",
|
||||
"47",
|
||||
"48",
|
||||
"49"
|
||||
],
|
||||
"url": "https://github.com/corecoding/Vitals",
|
||||
"uuid": "Vitals@CoreCoding.com",
|
||||
"version": 73
|
||||
}
|
||||
@ -1,138 +0,0 @@
|
||||
import Adw from 'gi://Adw';
|
||||
import Gio from 'gi://Gio';
|
||||
import GObject from 'gi://GObject';
|
||||
import Gtk from 'gi://Gtk';
|
||||
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
|
||||
/*
|
||||
if (sensor == 'show-storage' && this._settings.get_boolean(sensor)) {
|
||||
|
||||
let val = true;
|
||||
|
||||
try {
|
||||
let GTop = imports.gi.GTop;
|
||||
} catch (e) {
|
||||
val = false;
|
||||
}
|
||||
|
||||
let now = new Date().getTime();
|
||||
this._notify("Vitals", "Please run sudo apt install gir1.2-gtop-2.0", 'folder-symbolic');
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
const Settings = new GObject.Class({
|
||||
Name: 'Vitals.Settings',
|
||||
|
||||
_init: function(extensionObject, params) {
|
||||
this._extensionObject = extensionObject
|
||||
this.parent(params);
|
||||
|
||||
this._settings = extensionObject.getSettings();
|
||||
|
||||
this.builder = new Gtk.Builder();
|
||||
this.builder.set_translation_domain(this._extensionObject.metadata['gettext-domain']);
|
||||
this.builder.add_from_file(this._extensionObject.path + '/prefs.ui');
|
||||
this.widget = this.builder.get_object('prefs-container');
|
||||
|
||||
this._bind_settings();
|
||||
},
|
||||
|
||||
// Bind the gtk window to the schema settings
|
||||
_bind_settings: function() {
|
||||
let widget;
|
||||
|
||||
// process sensor toggles
|
||||
let sensors = [ 'show-temperature', 'show-voltage', 'show-fan',
|
||||
'show-memory', 'show-processor', 'show-system',
|
||||
'show-network', 'show-storage', 'use-higher-precision',
|
||||
'alphabetize', 'hide-zeros', 'include-public-ip',
|
||||
'show-battery', 'fixed-widths', 'hide-icons',
|
||||
'menu-centered', 'include-static-info',
|
||||
'show-gpu', 'include-static-gpu-info' ];
|
||||
|
||||
for (let key in sensors) {
|
||||
let sensor = sensors[key];
|
||||
|
||||
widget = this.builder.get_object(sensor);
|
||||
widget.set_active(this._settings.get_boolean(sensor));
|
||||
widget.connect('state-set', (_, val) => {
|
||||
this._settings.set_boolean(sensor, val);
|
||||
});
|
||||
}
|
||||
|
||||
// process individual drop down sensor preferences
|
||||
sensors = [ 'position-in-panel', 'unit', 'network-speed-format', 'memory-measurement', 'storage-measurement', 'battery-slot', 'icon-style' ];
|
||||
for (let key in sensors) {
|
||||
let sensor = sensors[key];
|
||||
|
||||
widget = this.builder.get_object(sensor);
|
||||
widget.set_active(this._settings.get_int(sensor));
|
||||
widget.connect('changed', (widget) => {
|
||||
this._settings.set_int(sensor, widget.get_active());
|
||||
});
|
||||
}
|
||||
|
||||
this._settings.bind('update-time', this.builder.get_object('update-time'), 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
// process individual text entry sensor preferences
|
||||
sensors = [ 'storage-path', 'monitor-cmd' ];
|
||||
for (let key in sensors) {
|
||||
let sensor = sensors[key];
|
||||
|
||||
widget = this.builder.get_object(sensor);
|
||||
widget.set_text(this._settings.get_string(sensor));
|
||||
|
||||
widget.connect('changed', (widget) => {
|
||||
let text = widget.get_text();
|
||||
if (!text) text = widget.get_placeholder_text();
|
||||
this._settings.set_string(sensor, text);
|
||||
});
|
||||
}
|
||||
|
||||
// makes individual sensor preference boxes appear
|
||||
sensors = [ 'temperature', 'network', 'storage', 'memory', 'battery', 'system', 'processor', 'gpu' ];
|
||||
for (let key in sensors) {
|
||||
let sensor = sensors[key];
|
||||
|
||||
// create dialog for intelligent autohide advanced settings
|
||||
this.builder.get_object(sensor + '-prefs').connect('clicked', () => {
|
||||
let transientObj = this.widget.get_root();
|
||||
let title = sensor.charAt(0).toUpperCase() + sensor.slice(1);
|
||||
let dialog = new Gtk.Dialog({ title: _(title) + ' ' + _('Preferences'),
|
||||
transient_for: transientObj,
|
||||
use_header_bar: false,
|
||||
modal: true });
|
||||
|
||||
let box = this.builder.get_object(sensor + '_prefs');
|
||||
dialog.get_content_area().append(box);
|
||||
dialog.connect('response', (dialog, id) => {
|
||||
// remove the settings box so it doesn't get destroyed;
|
||||
dialog.get_content_area().remove(box);
|
||||
dialog.destroy();
|
||||
return;
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
export default class VitalsPrefs extends ExtensionPreferences {
|
||||
fillPreferencesWindow(window) {
|
||||
window._settings = this.getSettings();
|
||||
|
||||
let settings = new Settings(this);
|
||||
let widget = settings.widget;
|
||||
|
||||
const page = new Adw.PreferencesPage();
|
||||
const group = new Adw.PreferencesGroup({});
|
||||
group.add(widget);
|
||||
page.add(group);
|
||||
window.add(page);
|
||||
window.set_default_size(widget.width, widget.height);
|
||||
widget.show();
|
||||
}
|
||||
}
|
||||
@ -1,155 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist gettext-domain="gnome-shell-extensions">
|
||||
<schema id="org.gnome.shell.extensions.vitals" path="/org/gnome/shell/extensions/vitals/">
|
||||
<key name="hot-sensors" type="as">
|
||||
<default>['_memory_usage_', '_system_load_1m_', '__network-rx_max__']</default>
|
||||
<summary>Sensors to show in panel</summary>
|
||||
<description>List of sensors to be shown in the panel</description>
|
||||
</key>
|
||||
<key type="i" name="update-time">
|
||||
<default>5</default>
|
||||
<summary>Seconds between updates</summary>
|
||||
<description>Delay between sensor polling</description>
|
||||
</key>
|
||||
<key type="i" name="position-in-panel">
|
||||
<default>2</default>
|
||||
<summary>Position in panel</summary>
|
||||
<description>Position in Panel ('left', 'center', 'right')</description>
|
||||
</key>
|
||||
<key type="b" name="use-higher-precision">
|
||||
<default>false</default>
|
||||
<summary>Use higher precision</summary>
|
||||
<description>Show one extra digit after decimal</description>
|
||||
</key>
|
||||
<key type="b" name="alphabetize">
|
||||
<default>true</default>
|
||||
<summary>Alphabetize sensors</summary>
|
||||
<description>Display sensors in alphabetical order</description>
|
||||
</key>
|
||||
<key type="b" name="hide-zeros">
|
||||
<default>false</default>
|
||||
<summary>Hide zero values</summary>
|
||||
<description>Hide data from sensors that are invalid</description>
|
||||
</key>
|
||||
<key type="b" name="show-temperature">
|
||||
<default>true</default>
|
||||
<summary>Monitor temperature</summary>
|
||||
<description>Display temperature of various components</description>
|
||||
</key>
|
||||
<key type="i" name="unit">
|
||||
<default>0</default>
|
||||
<summary>Temperature unit</summary>
|
||||
<description>The unit ('centigrade' or 'fahrenheit') the extension should display the temperature in</description>
|
||||
</key>
|
||||
<key type="b" name="show-voltage">
|
||||
<default>true</default>
|
||||
<summary>Monitor voltage</summary>
|
||||
<description>Display voltage of various components</description>
|
||||
</key>
|
||||
<key type="b" name="show-fan">
|
||||
<default>true</default>
|
||||
<summary>Monitor fan</summary>
|
||||
<description>Display fan rotation per minute</description>
|
||||
</key>
|
||||
<key type="b" name="show-memory">
|
||||
<default>true</default>
|
||||
<summary>Monitor memory</summary>
|
||||
<description>Display memory information</description>
|
||||
</key>
|
||||
<key type="b" name="show-processor">
|
||||
<default>true</default>
|
||||
<summary>Monitor processor</summary>
|
||||
<description>Display processor information</description>
|
||||
</key>
|
||||
<key type="b" name="show-system">
|
||||
<default>true</default>
|
||||
<summary>Monitor system</summary>
|
||||
<description>Display system information</description>
|
||||
</key>
|
||||
<key type="b" name="show-storage">
|
||||
<default>true</default>
|
||||
<summary>Monitor storage</summary>
|
||||
<description>Display storage information</description>
|
||||
</key>
|
||||
<key type="b" name="show-network">
|
||||
<default>true</default>
|
||||
<summary>Monitor network</summary>
|
||||
<description>Display network information</description>
|
||||
</key>
|
||||
<key type="b" name="include-public-ip">
|
||||
<default>true</default>
|
||||
<summary>Include public IP address</summary>
|
||||
<description>Display public IP address of internet connection</description>
|
||||
</key>
|
||||
<key type="i" name="network-speed-format">
|
||||
<default>0</default>
|
||||
<summary>Network speed format</summary>
|
||||
<description>Should speed display in bits or bytes?</description>
|
||||
</key>
|
||||
<key type="s" name="storage-path">
|
||||
<default>"/"</default>
|
||||
<summary>Storage path</summary>
|
||||
<description>Storage path for monitoring</description>
|
||||
</key>
|
||||
<key type="b" name="show-battery">
|
||||
<default>false</default>
|
||||
<summary>Monitor battery</summary>
|
||||
<description>Monitor battery health</description>
|
||||
</key>
|
||||
<key type="i" name="memory-measurement">
|
||||
<default>1</default>
|
||||
<summary>Memory measurement</summary>
|
||||
<description>Can use gigabyte or gibibyte for memory</description>
|
||||
</key>
|
||||
<key type="i" name="storage-measurement">
|
||||
<default>1</default>
|
||||
<summary>Storage measurement</summary>
|
||||
<description>Can use gigabyte or gibibyte for storage</description>
|
||||
</key>
|
||||
<key type="i" name="battery-slot">
|
||||
<default>0</default>
|
||||
<summary>Battery slot to monitor</summary>
|
||||
<description>Which numerical battery slot should vitals monitor</description>
|
||||
</key>
|
||||
<key type="b" name="fixed-widths">
|
||||
<default>true</default>
|
||||
<summary>Use fixed widths in top bar</summary>
|
||||
<description>Keep sensors in top bar from jumping around</description>
|
||||
</key>
|
||||
<key type="b" name="hide-icons">
|
||||
<default>false</default>
|
||||
<summary>Hide icons in top bar</summary>
|
||||
<description>Keep top bar clean by only showing sensor values</description>
|
||||
</key>
|
||||
<key type="b" name="menu-centered">
|
||||
<default>false</default>
|
||||
<summary>Make the menu centered</summary>
|
||||
<description>Center the menu to the icon regardless of the position in the panel</description>
|
||||
</key>
|
||||
<key type="s" name="monitor-cmd">
|
||||
<default>"gnome-system-monitor"</default>
|
||||
<summary>System Monitor command</summary>
|
||||
<description>The command run when system monitor button is clicked</description>
|
||||
</key>
|
||||
<key type="b" name="include-static-info">
|
||||
<default>false</default>
|
||||
<summary>Include processor static information</summary>
|
||||
<description>Display processor static information that doesn't change</description>
|
||||
</key>
|
||||
<key type="b" name="show-gpu">
|
||||
<default>false</default>
|
||||
<summary>Monitor GPU</summary>
|
||||
<description>Display GPU information (requires the nvidia-smi tool)</description>
|
||||
</key>
|
||||
<key type="b" name="include-static-gpu-info">
|
||||
<default>false</default>
|
||||
<summary>Include GPU static information</summary>
|
||||
<description>Display GPU static information that doesn't change</description>
|
||||
</key>
|
||||
<key type="i" name="icon-style">
|
||||
<default>0</default>
|
||||
<summary>Icon styles</summary>
|
||||
<description>Set the style for the displayed sensor icons ('original', 'updated')</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
@ -1,16 +0,0 @@
|
||||
.vitals-icon { icon-size: 16px; }
|
||||
.vitals-menu-button-container {}
|
||||
.vitals-panel-icon-temperature { margin: 0 1px 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-voltage { margin: 0 0 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-fan { margin: 0 4px 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-memory { margin: 0 2px 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-processor { margin: 0 3px 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-system { margin: 0 3px 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-network { margin: 0 3px 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-storage { margin: 0 2px 0 8px; padding: 0; }
|
||||
.vitals-panel-icon-battery { margin: 0 4px 0 8px; padding: 0; }
|
||||
.vitals-panel-label { margin: 0 3px 0 0; padding: 0; }
|
||||
.vitals-button-action { -st-icon-style: symbolic; border-radius: 32px; margin: 0px; min-height: 22px; min-width: 22px; padding: 10px; font-size: 100%; border: 1px solid transparent; }
|
||||
.vitals-button-action:hover, .vitals-button-action:focus { border-color: #777; }
|
||||
.vitals-button-action > StIcon { icon-size: 16px; }
|
||||
.vitals-button-box { padding: 0px; spacing: 22px; }
|
||||
@ -1,354 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2018, Chris Monahan <chris@corecoding.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the GNOME nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
const cbFun = (d, c) => {
|
||||
let bb = d[1] % c[0],
|
||||
aa = (d[1] - bb) / c[0];
|
||||
aa = aa > 0 ? aa + c[1] : '';
|
||||
|
||||
return [d[0] + aa, bb];
|
||||
};
|
||||
|
||||
export const Values = GObject.registerClass({
|
||||
GTypeName: 'Values',
|
||||
}, class Values extends GObject.Object {
|
||||
|
||||
_init(settings, sensorIcons) {
|
||||
this._settings = settings;
|
||||
this._sensorIcons = sensorIcons;
|
||||
|
||||
this._networkSpeedOffset = {};
|
||||
this._networkSpeeds = {};
|
||||
|
||||
this._history = {};
|
||||
//this._history2 = {};
|
||||
this.resetHistory();
|
||||
}
|
||||
|
||||
_legible(value, sensorClass) {
|
||||
let unit = 1000;
|
||||
if (value === null) return 'N/A';
|
||||
let use_higher_precision = this._settings.get_boolean('use-higher-precision');
|
||||
let memory_measurement = this._settings.get_int('memory-measurement')
|
||||
let storage_measurement = this._settings.get_int('storage-measurement')
|
||||
let use_bps = (this._settings.get_int('network-speed-format') == 1);
|
||||
|
||||
let format = '';
|
||||
let ending = '';
|
||||
let exp = 0;
|
||||
|
||||
var decimal = [ 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ];
|
||||
var binary = [ 'B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB' ];
|
||||
var hertz = [ 'Hz', 'KHz', 'MHz', 'GHz', 'THz', 'PHz', 'EHz', 'ZHz' ];
|
||||
|
||||
switch (sensorClass) {
|
||||
case 'percent':
|
||||
format = (use_higher_precision)?'%.1f%s':'%d%s';
|
||||
value = value * 100;
|
||||
if (value > 100) value = 100;
|
||||
ending = '%';
|
||||
break;
|
||||
case 'temp':
|
||||
value = value / 1000;
|
||||
ending = '°C';
|
||||
|
||||
// are we converting to fahrenheit?
|
||||
if (this._settings.get_int('unit') == 1) {
|
||||
value = ((9 / 5) * value + 32);
|
||||
ending = '°F';
|
||||
}
|
||||
|
||||
format = (use_higher_precision)?'%.1f%s':'%d%s';
|
||||
break;
|
||||
case 'fan':
|
||||
format = '%d %s';
|
||||
ending = 'RPM';
|
||||
break;
|
||||
case 'in': // voltage
|
||||
value = value / 1000;
|
||||
format = ((value >= 0) ? '+' : '-') + ((use_higher_precision)?'%.2f %s':'%.1f %s');
|
||||
ending = 'V';
|
||||
break;
|
||||
case 'hertz':
|
||||
if (value > 0) {
|
||||
exp = Math.floor(Math.log(value) / Math.log(unit));
|
||||
if (value >= Math.pow(unit, exp) * (unit - 0.05)) exp++;
|
||||
value = parseFloat((value / Math.pow(unit, exp)));
|
||||
}
|
||||
|
||||
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
|
||||
ending = hertz[exp];
|
||||
break;
|
||||
case 'memory':
|
||||
unit = (memory_measurement)?1000:1024;
|
||||
|
||||
if (value > 0) {
|
||||
value *= unit;
|
||||
exp = Math.floor(Math.log(value) / Math.log(unit));
|
||||
if (value >= Math.pow(unit, exp) * (unit - 0.05)) exp++;
|
||||
value = parseFloat((value / Math.pow(unit, exp)));
|
||||
}
|
||||
|
||||
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
|
||||
|
||||
if (memory_measurement)
|
||||
ending = decimal[exp];
|
||||
else
|
||||
ending = binary[exp];
|
||||
|
||||
break;
|
||||
case 'storage':
|
||||
unit = (storage_measurement)?1000:1024;
|
||||
|
||||
if (value > 0) {
|
||||
exp = Math.floor(Math.log(value) / Math.log(unit));
|
||||
if (value >= Math.pow(unit, exp) * (unit - 0.05)) exp++;
|
||||
value = parseFloat((value / Math.pow(unit, exp)));
|
||||
}
|
||||
|
||||
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
|
||||
|
||||
if (storage_measurement)
|
||||
ending = decimal[exp];
|
||||
else
|
||||
ending = binary[exp];
|
||||
|
||||
break;
|
||||
case 'speed':
|
||||
if (value > 0) {
|
||||
if (use_bps) value *= 8;
|
||||
exp = Math.floor(Math.log(value) / Math.log(unit));
|
||||
if (value >= Math.pow(unit, exp) * (unit - 0.05)) exp++;
|
||||
value = parseFloat((value / Math.pow(unit, exp)));
|
||||
}
|
||||
|
||||
format = (use_higher_precision)?'%.1f %s':'%.0f %s';
|
||||
|
||||
if (use_bps) {
|
||||
ending = decimal[exp].replace('B', 'bps');
|
||||
} else {
|
||||
ending = decimal[exp] + '/s';
|
||||
}
|
||||
|
||||
break;
|
||||
case 'runtime':
|
||||
case 'uptime':
|
||||
let scale = [24, 60, 60];
|
||||
let units = ['d ', 'h ', 'm '];
|
||||
|
||||
// show seconds on higher precision or if value under a minute
|
||||
if (sensorClass != 'runtime' && (use_higher_precision || value < 60)) {
|
||||
scale.push(1);
|
||||
units.push('s ');
|
||||
}
|
||||
|
||||
let rslt = scale.map((d, i, a) => a.slice(i).reduce((d, c) => d * c))
|
||||
.map((d, i) => ([d, units[i]]))
|
||||
.reduce(cbFun, ['', value]);
|
||||
|
||||
value = rslt[0].trim();
|
||||
|
||||
format = '%s';
|
||||
break;
|
||||
case 'milliamp':
|
||||
format = (use_higher_precision)?'%.1f %s':'%d %s';
|
||||
value = value / 1000;
|
||||
ending = 'mA';
|
||||
break;
|
||||
case 'milliamp-hour':
|
||||
format = (use_higher_precision)?'%.1f %s':'%d %s';
|
||||
value = value / 1000;
|
||||
ending = 'mAh';
|
||||
break;
|
||||
case 'watt':
|
||||
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
|
||||
value = value / 1000000;
|
||||
ending = 'W';
|
||||
break;
|
||||
case 'watt-gpu':
|
||||
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
|
||||
ending = 'W';
|
||||
break;
|
||||
case 'watt-hour':
|
||||
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
|
||||
value = value / 1000000;
|
||||
ending = 'Wh';
|
||||
break;
|
||||
case 'load':
|
||||
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
|
||||
break;
|
||||
case 'pcie':
|
||||
let split = value.split('x');
|
||||
value = 'PCIe ' + parseInt(split[0]) + (split.length > 1 ? ' x' + parseInt(split[1]) : '');
|
||||
format = '%s';
|
||||
break;
|
||||
default:
|
||||
format = '%s';
|
||||
break;
|
||||
}
|
||||
|
||||
return format.format(value, ending);
|
||||
}
|
||||
|
||||
returnIfDifferent(dwell, label, value, type, format, key) {
|
||||
let output = [];
|
||||
|
||||
// make sure the keys exist
|
||||
if (!(type in this._history)) this._history[type] = {};
|
||||
|
||||
// no sense in continuing when the raw value has not changed
|
||||
if (type != 'network-rx' && type != 'network-tx' &&
|
||||
key in this._history[type] && this._history[type][key][1] == value)
|
||||
return output;
|
||||
|
||||
// is the value different from last time?
|
||||
let legible = this._legible(value, format);
|
||||
|
||||
// don't return early when dealing with network traffic
|
||||
if (type != 'network-rx' && type != 'network-tx') {
|
||||
// only update when we are coming through for the first time, or if a value has changed
|
||||
if (key in this._history[type] && this._history[type][key][0] == legible)
|
||||
return output;
|
||||
|
||||
// add label as it was sent from sensors class
|
||||
output.push([label, legible, type, key]);
|
||||
}
|
||||
|
||||
// save previous values to update screen on changes only
|
||||
let previousValue = this._history[type][key];
|
||||
this._history[type][key] = [legible, value];
|
||||
|
||||
// process average, min and max values
|
||||
if (type == 'temperature' || type == 'voltage' || type == 'fan') {
|
||||
let vals = Object.values(this._history[type]).map(x => parseFloat(x[1]));
|
||||
|
||||
// show value in group even if there is one value present
|
||||
let sum = vals.reduce((a, b) => a + b);
|
||||
let avg = this._legible(sum / vals.length, format);
|
||||
output.push([type, avg, type + '-group', '']);
|
||||
|
||||
// If only one value is present, don't display avg, min and max
|
||||
if (vals.length > 1) {
|
||||
output.push(['Average', avg, type, '__' + type + '_avg__']);
|
||||
|
||||
// calculate Minimum value
|
||||
let min = Math.min(...vals);
|
||||
min = this._legible(min, format);
|
||||
output.push(['Minimum', min, type, '__' + type + '_min__']);
|
||||
|
||||
// calculate Maximum value
|
||||
let max = Math.max(...vals);
|
||||
max = this._legible(max, format);
|
||||
output.push(['Maximum', max, type, '__' + type + '_max__']);
|
||||
}
|
||||
} else if (type == 'network-rx' || type == 'network-tx') {
|
||||
let direction = type.split('-')[1];
|
||||
|
||||
// appends total upload and download for all interfaces for #216
|
||||
let vals = Object.values(this._history[type]).map(x => parseFloat(x[1]));
|
||||
let sum = vals.reduce((partialSum, a) => partialSum + a, 0);
|
||||
output.push(['Boot ' + direction, this._legible(sum, format), type, '__' + type + '_boot__']);
|
||||
|
||||
// keeps track of session start point
|
||||
if (!(key in this._networkSpeedOffset) || this._networkSpeedOffset[key] <= 0)
|
||||
this._networkSpeedOffset[key] = sum;
|
||||
|
||||
// outputs session upload and download for all interfaces for #234
|
||||
output.push(['Session ' + direction, this._legible(sum - this._networkSpeedOffset[key], format), type, '__' + type + '_ses__']);
|
||||
|
||||
// calculate speed for this interface
|
||||
let speed = (value - previousValue[1]) / dwell;
|
||||
output.push([label, this._legible(speed, 'speed'), type, key]);
|
||||
|
||||
// store speed for Device report
|
||||
if (!(direction in this._networkSpeeds)) this._networkSpeeds[direction] = {};
|
||||
if (!(label in this._networkSpeeds[direction])) this._networkSpeeds[direction][label] = 0;
|
||||
|
||||
// store value for next go around
|
||||
if (value > 0 || (value == 0 && !this._settings.get_boolean('hide-zeros')))
|
||||
this._networkSpeeds[direction][label] = speed;
|
||||
|
||||
// calculate total upload and download device speed
|
||||
for (let direction in this._networkSpeeds) {
|
||||
let sum = 0;
|
||||
for (let iface in this._networkSpeeds[direction])
|
||||
sum += parseFloat(this._networkSpeeds[direction][iface]);
|
||||
|
||||
sum = this._legible(sum, 'speed');
|
||||
output.push(['Device ' + direction, sum, 'network-' + direction, '__network-' + direction + '_max__']);
|
||||
// append download speed to group itself
|
||||
if (direction == 'rx') output.push([type, sum, type + '-group', '']);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
global.log('before', JSON.stringify(output));
|
||||
for (let i = output.length - 1; i >= 0; i--) {
|
||||
let sensor = output[i];
|
||||
// sensor[0]=label, sensor[1]=value, sensor[2]=type, sensor[3]=key)
|
||||
|
||||
//["CPU Core 5","46°C","temperature","_temperature_hwmon8temp7_"]
|
||||
|
||||
// make sure the keys exist
|
||||
if (!(sensor[2] in this._history2)) this._history2[sensor[2]] = {};
|
||||
|
||||
if (sensor[3] in this._history2[sensor[2]]) {
|
||||
if (this._history2[sensor[2]][sensor[3]] == sensor[1]) {
|
||||
output.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
this._history2[sensor[2]][sensor[3]] = sensor[1];
|
||||
}
|
||||
|
||||
global.log(' after', JSON.stringify(output));
|
||||
global.log('***************************');
|
||||
*/
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
resetHistory(numGpus) {
|
||||
// don't call this._history = {}, as we want to keep network-rx and network-tx
|
||||
// otherwise network history statistics will start over
|
||||
for (let sensor in this._sensorIcons) {
|
||||
//each gpu has it's own sensor name and thus must be handled separately
|
||||
if(sensor === 'gpu') continue;
|
||||
|
||||
this._history[sensor] = {};
|
||||
this._history[sensor + '-group'] = {};
|
||||
//this._history2[sensor] = {};
|
||||
//this._history2[sensor + '-group'] = {};
|
||||
}
|
||||
|
||||
for(let i = 1; i <= numGpus; i++){
|
||||
this._history['gpu#' + i] = {};
|
||||
this._history['gpu#' + i + '-group'] = {};
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -24,6 +24,7 @@ import St from 'gi://St';
|
||||
import * as Params from 'resource:///org/gnome/shell/misc/params.js';
|
||||
import * as Signals from 'resource:///org/gnome/shell/misc/signals.js';
|
||||
|
||||
import * as DBusUtils from './dbusUtils.js';
|
||||
import * as IconCache from './iconCache.js';
|
||||
import * as Util from './util.js';
|
||||
import * as Interfaces from './interfaces.js';
|
||||
@ -218,6 +219,8 @@ class AppIndicatorProxy extends DBusProxy {
|
||||
return;
|
||||
}
|
||||
|
||||
const cancellable = this._cancellable;
|
||||
|
||||
if (!params.get_type().equal(AppIndicatorProxy.TUPLE_TYPE)) {
|
||||
// If the property includes arguments, we can just queue the signal emission
|
||||
const [value] = params.unpack();
|
||||
@ -238,7 +241,7 @@ class AppIndicatorProxy extends DBusProxy {
|
||||
return;
|
||||
|
||||
this._signalsAccumulator = new PromiseUtils.TimeoutPromise(
|
||||
MAX_UPDATE_FREQUENCY, GLib.PRIORITY_DEFAULT_IDLE, this._cancellable);
|
||||
MAX_UPDATE_FREQUENCY, GLib.PRIORITY_DEFAULT_IDLE, cancellable);
|
||||
try {
|
||||
await this._signalsAccumulator;
|
||||
const refreshPropertiesPromises =
|
||||
@ -460,7 +463,7 @@ export class AppIndicator extends Signals.EventEmitter {
|
||||
}
|
||||
|
||||
try {
|
||||
this._commandLine = await Util.getProcessName(this.busName,
|
||||
this._commandLine = await DBusUtils.getProcessName(this.busName,
|
||||
cancellable, GLib.PRIORITY_LOW);
|
||||
} catch (e) {
|
||||
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||
|
||||
@ -196,7 +196,7 @@ export class DbusMenuItem extends Signals.EventEmitter {
|
||||
if (!data)
|
||||
data = GLib.Variant.new_int32(0);
|
||||
|
||||
this._client.sendEvent(this._id, event, data, timestamp);
|
||||
return this._client.sendEvent(this._id, event, data, timestamp);
|
||||
}
|
||||
|
||||
getId() {
|
||||
@ -533,14 +533,18 @@ export const DBusClient = GObject.registerClass({
|
||||
}
|
||||
}
|
||||
|
||||
sendEvent(id, event, params, timestamp) {
|
||||
async sendEvent(id, event, params, timestamp) {
|
||||
if (!this.gNameOwner)
|
||||
return;
|
||||
|
||||
this.EventAsync(id, event, params, timestamp, this._cancellable).catch(e => {
|
||||
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||
logError(e);
|
||||
});
|
||||
try {
|
||||
await this.EventAsync(id, event, params, timestamp, this._cancellable);
|
||||
} catch (e) {
|
||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||
return;
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
_onPropertiesUpdated([changed, removed]) {
|
||||
@ -628,6 +632,8 @@ const MenuItemFactory = {
|
||||
shellItem, MenuItemFactory._onActivate);
|
||||
|
||||
shellItem.connect('destroy', () => {
|
||||
shellItem._dbusItemCancellable?.cancel();
|
||||
shellItem._dbusItemCancellable = null;
|
||||
shellItem._dbusItem = null;
|
||||
shellItem._dbusClient = null;
|
||||
shellItem._icon = null;
|
||||
@ -655,7 +661,7 @@ const MenuItemFactory = {
|
||||
menu._parent._openedSubMenu = menu;
|
||||
}
|
||||
|
||||
this._dbusItem.handleEvent('opened', null, 0);
|
||||
this._dbusItem.handleEvent('opened', null, 0).catch(logError);
|
||||
this._dbusItem.sendAboutToShow();
|
||||
} else {
|
||||
if (NEED_NESTED_SUBMENU_FIX) {
|
||||
@ -664,7 +670,7 @@ const MenuItemFactory = {
|
||||
menu._openedSubMenu.close(false);
|
||||
}
|
||||
|
||||
this._dbusItem.handleEvent('closed', null, 0);
|
||||
this._dbusItem.handleEvent('closed', null, 0).catch(logError);
|
||||
}
|
||||
},
|
||||
|
||||
@ -674,7 +680,7 @@ const MenuItemFactory = {
|
||||
this._dbusClient.indicator.provideActivationToken(timestamp);
|
||||
|
||||
this._dbusItem.handleEvent('clicked', GLib.Variant.new('i', 0),
|
||||
timestamp);
|
||||
timestamp).catch(logError);
|
||||
},
|
||||
|
||||
_onPropertyChanged(dbusItem, prop, _value) {
|
||||
@ -756,10 +762,15 @@ const MenuItemFactory = {
|
||||
this._icon.icon_name = iconName;
|
||||
} else if (iconData) {
|
||||
try {
|
||||
if (!this._dbusItemCancellable) {
|
||||
this._dbusItemCancellable = new Util.CancellableChild(
|
||||
this._dbusClient.cancellable);
|
||||
}
|
||||
|
||||
const inputStream = Gio.MemoryInputStream.new_from_bytes(
|
||||
iconData.get_data_as_bytes());
|
||||
this._icon.gicon = await GdkPixbuf.Pixbuf.new_from_stream_async(
|
||||
inputStream, this._dbusClient.cancellable);
|
||||
inputStream, this._dbusItemCancellable);
|
||||
} catch (e) {
|
||||
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||
logError(e);
|
||||
@ -872,7 +883,7 @@ export class Client extends Signals.EventEmitter {
|
||||
menu._setOpenedSubMenu = this._setOpenedSubmenu.bind(this);
|
||||
|
||||
// connect handlers
|
||||
Util.connectSmart(menu, 'open-state-changed', this, this._onMenuOpened);
|
||||
Util.connectSmart(menu, 'open-state-changed', this, this._onMenuOpenStateChanged);
|
||||
Util.connectSmart(menu, 'destroy', this, this.destroy);
|
||||
|
||||
Util.connectSmart(this._rootItem, 'child-added', this, this._onRootChildAdded);
|
||||
@ -939,7 +950,7 @@ export class Client extends Signals.EventEmitter {
|
||||
MenuUtils.moveItemInMenu(this._rootMenu, dbusItem, newpos);
|
||||
}
|
||||
|
||||
_onMenuOpened(menu, state) {
|
||||
_onMenuOpenStateChanged(menu, state) {
|
||||
if (!this._rootItem)
|
||||
return;
|
||||
|
||||
@ -949,10 +960,18 @@ export class Client extends Signals.EventEmitter {
|
||||
if (this._openedSubMenu && this._openedSubMenu.isOpen)
|
||||
this._openedSubMenu.close();
|
||||
|
||||
this._rootItem.handleEvent('opened', null, 0);
|
||||
this._rootItem.handleEvent('opened', null, 0).catch(logError);
|
||||
this._rootItem.sendAboutToShow();
|
||||
} else {
|
||||
this._rootItem.handleEvent('closed', null, 0);
|
||||
this._rootItem.handleEvent('closed', null, 0).catch(e => {
|
||||
if (e.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_OBJECT)) {
|
||||
// The menu hay have been removed at this point, thus do not
|
||||
// spam the users about this if it happens.
|
||||
return;
|
||||
}
|
||||
|
||||
logError(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,8 +40,13 @@ export const DBusProxy = GObject.registerClass({
|
||||
(_proxy, ...args) => this._onSignal(...args)));
|
||||
}
|
||||
|
||||
this._signalIds.push(this.connect('notify::g-name-owner', () =>
|
||||
this._onNameOwnerChanged()));
|
||||
this._signalIds.push(this.connect('notify::g-name-owner', () => {
|
||||
if (!this.gNameOwner) {
|
||||
this._cancellable.cancel();
|
||||
this._cancellable = new Gio.Cancellable();
|
||||
}
|
||||
this._onNameOwnerChanged();
|
||||
}));
|
||||
}
|
||||
|
||||
async initAsync(cancellable) {
|
||||
|
||||
@ -0,0 +1,121 @@
|
||||
// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
|
||||
import {Logger} from './logger.js';
|
||||
|
||||
export const BUS_ADDRESS_REGEX = /([a-zA-Z0-9._-]+\.[a-zA-Z0-9.-]+)|(:[0-9]+\.[0-9]+)$/;
|
||||
|
||||
Gio._promisify(Gio.DBusConnection.prototype, 'call');
|
||||
|
||||
export async function getUniqueBusName(bus, name, cancellable) {
|
||||
if (name[0] === ':')
|
||||
return name;
|
||||
|
||||
if (!bus)
|
||||
bus = Gio.DBus.session;
|
||||
|
||||
const variantName = new GLib.Variant('(s)', [name]);
|
||||
const [unique] = (await bus.call('org.freedesktop.DBus', '/', 'org.freedesktop.DBus',
|
||||
'GetNameOwner', variantName, new GLib.VariantType('(s)'),
|
||||
Gio.DBusCallFlags.NONE, -1, cancellable)).deep_unpack();
|
||||
|
||||
return unique;
|
||||
}
|
||||
|
||||
export async function getBusNames(bus, cancellable) {
|
||||
if (!bus)
|
||||
bus = Gio.DBus.session;
|
||||
|
||||
const [names] = (await bus.call('org.freedesktop.DBus', '/', 'org.freedesktop.DBus',
|
||||
'ListNames', null, new GLib.VariantType('(as)'), Gio.DBusCallFlags.NONE,
|
||||
-1, cancellable)).deep_unpack();
|
||||
|
||||
const uniqueNames = new Map();
|
||||
const requests = names.map(name => getUniqueBusName(bus, name, cancellable));
|
||||
const results = await Promise.allSettled(requests);
|
||||
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const result = results[i];
|
||||
if (result.status === 'fulfilled') {
|
||||
let namesForBus = uniqueNames.get(result.value);
|
||||
if (!namesForBus) {
|
||||
namesForBus = new Set();
|
||||
uniqueNames.set(result.value, namesForBus);
|
||||
}
|
||||
if (result.value !== names[i])
|
||||
namesForBus.add(names[i]);
|
||||
} else if (!result.reason.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||
Logger.debug(`Impossible to get the unique name of ${names[i]}: ${result.reason}`);
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueNames;
|
||||
}
|
||||
|
||||
async function getProcessId(connectionName, cancellable = null, bus = Gio.DBus.session) {
|
||||
const res = await bus.call('org.freedesktop.DBus', '/',
|
||||
'org.freedesktop.DBus', 'GetConnectionUnixProcessID',
|
||||
new GLib.Variant('(s)', [connectionName]),
|
||||
new GLib.VariantType('(u)'),
|
||||
Gio.DBusCallFlags.NONE,
|
||||
-1,
|
||||
cancellable);
|
||||
const [pid] = res.deepUnpack();
|
||||
return pid;
|
||||
}
|
||||
|
||||
export async function getProcessName(connectionName, cancellable = null,
|
||||
priority = GLib.PRIORITY_DEFAULT, bus = Gio.DBus.session) {
|
||||
const pid = await getProcessId(connectionName, cancellable, bus);
|
||||
const cmdFile = Gio.File.new_for_path(`/proc/${pid}/cmdline`);
|
||||
const inputStream = await cmdFile.read_async(priority, cancellable);
|
||||
const bytes = await inputStream.read_bytes_async(2048, priority, cancellable);
|
||||
const textDecoder = new TextDecoder();
|
||||
return textDecoder.decode(bytes.toArray().map(v => !v ? 0x20 : v));
|
||||
}
|
||||
|
||||
export async function* introspectBusObject(bus, name, cancellable,
|
||||
interfaces = undefined, path = undefined) {
|
||||
if (!path)
|
||||
path = '/';
|
||||
|
||||
const [introspection] = (await bus.call(name, path, 'org.freedesktop.DBus.Introspectable',
|
||||
'Introspect', null, new GLib.VariantType('(s)'), Gio.DBusCallFlags.NONE,
|
||||
5000, cancellable)).deep_unpack();
|
||||
|
||||
const nodeInfo = Gio.DBusNodeInfo.new_for_xml(introspection);
|
||||
|
||||
if (!interfaces || dbusNodeImplementsInterfaces(nodeInfo, interfaces))
|
||||
yield {nodeInfo, path};
|
||||
|
||||
if (path === '/')
|
||||
path = '';
|
||||
|
||||
for (const subNodeInfo of nodeInfo.nodes) {
|
||||
const subPath = `${path}/${subNodeInfo.path}`;
|
||||
yield* introspectBusObject(bus, name, cancellable, interfaces, subPath);
|
||||
}
|
||||
}
|
||||
|
||||
function dbusNodeImplementsInterfaces(nodeInfo, interfaces) {
|
||||
if (!(nodeInfo instanceof Gio.DBusNodeInfo) || !Array.isArray(interfaces))
|
||||
return false;
|
||||
|
||||
return interfaces.some(iface => nodeInfo.lookup_interface(iface));
|
||||
}
|
||||
@ -20,13 +20,14 @@ import * as StatusNotifierWatcher from './statusNotifierWatcher.js';
|
||||
import * as Interfaces from './interfaces.js';
|
||||
import * as TrayIconsManager from './trayIconsManager.js';
|
||||
import * as Util from './util.js';
|
||||
import {Logger} from './logger.js';
|
||||
import {SettingsManager} from './settingsManager.js';
|
||||
|
||||
export default class AppIndicatorExtension extends Extension.Extension {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
||||
Util.Logger.init(this);
|
||||
Logger.init(this);
|
||||
Interfaces.initialize(this);
|
||||
|
||||
this._isEnabled = false;
|
||||
@ -42,7 +43,7 @@ export default class AppIndicatorExtension extends Extension.Extension {
|
||||
global['--appindicator-extension-on-reload']();
|
||||
|
||||
global['--appindicator-extension-on-reload'] = () => {
|
||||
Util.Logger.debug('Reload detected, destroying old watchdog');
|
||||
Logger.debug('Reload detected, destroying old watchdog');
|
||||
this._watchDog.destroy();
|
||||
this._watchDog = null;
|
||||
};
|
||||
@ -84,6 +85,6 @@ export default class AppIndicatorExtension extends Extension.Extension {
|
||||
return;
|
||||
|
||||
this._statusNotifierWatcher = new StatusNotifierWatcher.StatusNotifierWatcher(
|
||||
this._watchDog);
|
||||
this, this._watchDog);
|
||||
}
|
||||
}
|
||||
|
||||