nvidia😡
This commit is contained in:
@@ -40,6 +40,7 @@ import shutil
|
|||||||
import argparse
|
import argparse
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
|
||||||
FLAVOR_NAME_PLACEHOLDER = "<FLAVOR_NAME>"
|
FLAVOR_NAME_PLACEHOLDER = "<FLAVOR_NAME>"
|
||||||
FLAVOR_HEX_PLACEHOLDER = "<FLAVOR_HEX>"
|
FLAVOR_HEX_PLACEHOLDER = "<FLAVOR_HEX>"
|
||||||
|
|
||||||
@@ -105,6 +106,10 @@ def copy_template(src: Path, dist_dir: Path | None) -> Path:
|
|||||||
return dist
|
return dist
|
||||||
|
|
||||||
|
|
||||||
|
def hex2rgb(hex_color: str) -> tuple[int, int, int]:
|
||||||
|
return tuple(int(hex_color[i:i + 2], 16) for i in (0, 2, 4)) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def _change_kvantum(_, flavor):
|
def _change_kvantum(_, flavor):
|
||||||
os.system(f'kvantummanager --set catppuccin-mocha-{flavor}')
|
os.system(f'kvantummanager --set catppuccin-mocha-{flavor}')
|
||||||
# execute twice to ensure the theme is installed AND applied
|
# execute twice to ensure the theme is installed AND applied
|
||||||
@@ -208,7 +213,7 @@ apply_theme_funcs: dict[str, Callable[[dict[str, str], str], None]] = {
|
|||||||
'hypr': _change_hypr,
|
'hypr': _change_hypr,
|
||||||
'rofi': _change_rofi,
|
'rofi': _change_rofi,
|
||||||
'waybar': _change_waybar,
|
'waybar': _change_waybar,
|
||||||
'oh-myposh': _change_ohmyposh,
|
'oh-my-posh': _change_ohmyposh,
|
||||||
'fastfetch': _change_fastfetch,
|
'fastfetch': _change_fastfetch,
|
||||||
'mako': _change_mako,
|
'mako': _change_mako,
|
||||||
'yazi': _change_yazi,
|
'yazi': _change_yazi,
|
||||||
@@ -229,9 +234,6 @@ def match_color(color: str, palette: dict[str, str]) -> str:
|
|||||||
|
|
||||||
color = color.lower().strip().removeprefix('#')
|
color = color.lower().strip().removeprefix('#')
|
||||||
|
|
||||||
def hex2rgb(hex_color: str) -> tuple[int, int, int]:
|
|
||||||
return tuple(int(hex_color[i:i + 2], 16) for i in (0, 2, 4)) # type: ignore
|
|
||||||
|
|
||||||
# weigh by CCIR 601 luminosity
|
# weigh by CCIR 601 luminosity
|
||||||
fr, fg, fb = 0.299 / 255 / 255, 0.587 / 255 / 255, 0.114 / 255 / 255
|
fr, fg, fb = 0.299 / 255 / 255, 0.587 / 255 / 255, 0.114 / 255 / 255
|
||||||
lfr, lfg, lfb = 0.299 / 255, 0.587 / 255, 0.114 / 255
|
lfr, lfg, lfb = 0.299 / 255, 0.587 / 255, 0.114 / 255
|
||||||
@@ -282,6 +284,39 @@ def match_color(color: str, palette: dict[str, str]) -> str:
|
|||||||
return closest_color
|
return closest_color
|
||||||
|
|
||||||
|
|
||||||
|
def pick_flavor(palette: dict[str, str]) -> str:
|
||||||
|
def is_interactive() -> bool:
|
||||||
|
return sys.stdin.isatty() and sys.stdout.isatty()
|
||||||
|
|
||||||
|
def is_truecolor() -> bool:
|
||||||
|
colorterm = os.environ.get('COLORTERM', '')
|
||||||
|
term = os.environ.get('TERM', '')
|
||||||
|
|
||||||
|
return (
|
||||||
|
'truecolor' in colorterm or
|
||||||
|
'24bit' in colorterm or
|
||||||
|
term.endswith('-256color')
|
||||||
|
)
|
||||||
|
|
||||||
|
if is_interactive():
|
||||||
|
isTruecolor = is_truecolor()
|
||||||
|
print("Available flavors:")
|
||||||
|
for i, flavor in enumerate(palette.keys(), 1):
|
||||||
|
r, g, b = hex2rgb(palette[flavor])
|
||||||
|
if isTruecolor:
|
||||||
|
print(f"\033[38;2;{r};{g};{b}m█ {i}. {flavor}: #{palette[flavor]}\033[0m")
|
||||||
|
else:
|
||||||
|
print(f"{i}. {flavor}")
|
||||||
|
while True:
|
||||||
|
choice = input("Pick a flavor by number: ")
|
||||||
|
if choice.isdigit() and 1 <= int(choice) <= len(palette):
|
||||||
|
return list(palette.keys())[int(choice) - 1]
|
||||||
|
print("Invalid choice. Try again.")
|
||||||
|
else:
|
||||||
|
print("No flavor specified.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Change color theme for various applications.")
|
parser = argparse.ArgumentParser(description="Change color theme for various applications.")
|
||||||
parser.add_argument('-i', '--image', type=str, help="Path to the image")
|
parser.add_argument('-i', '--image', type=str, help="Path to the image")
|
||||||
@@ -313,8 +348,7 @@ def main():
|
|||||||
flavor = match_color(color, palette)
|
flavor = match_color(color, palette)
|
||||||
print(f"Extracted color: {flavor}")
|
print(f"Extracted color: {flavor}")
|
||||||
else:
|
else:
|
||||||
import random
|
flavor = pick_flavor(palette)
|
||||||
flavor = random.choice(list(palette.keys()))
|
|
||||||
return flavor
|
return flavor
|
||||||
|
|
||||||
def parse_apps() -> list[str]:
|
def parse_apps() -> list[str]:
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/bin/fish
|
|
||||||
|
|
||||||
# if the path is given as an argument, use that
|
|
||||||
if test (count $argv) -eq 1
|
|
||||||
set image $argv[1]
|
|
||||||
else
|
|
||||||
set image (zenity --file-selection --title="Open File" --file-filter="*.jpg *.jpeg *.png")
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -z "$image"
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
if not test -f "$image"
|
|
||||||
notify-send "Error" "Selected file does not exist."
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
if string match -q "* *" "$image"
|
|
||||||
notify-send "Error" "The path of selected file contains white spaces, please select a file without white spaces."
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
|
|
||||||
hyprctl hyprpaper reload ,"$image"
|
|
||||||
echo "preload = $image" > ~/.config/hypr/hyprpaper.conf
|
|
||||||
echo "wallpaper = , $image" >> ~/.config/hypr/hyprpaper.conf
|
|
||||||
|
|
||||||
notify-send "Wallpaper Changed" "$image"
|
|
||||||
|
|
||||||
notify-send "Extracting colors from wallpaper" "This may take a few seconds..."
|
|
||||||
change-colortheme.py -i "$image"
|
|
||||||
23
.scripts/change-wallpaper.sh
Executable file
23
.scripts/change-wallpaper.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/env bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
image=$(zenity --file-selection --title="Open File" --file-filter="*.jpg *.jpeg *.png *.webp *.bmp *.jfif *.tiff *.avif *.heic *.heif")
|
||||||
|
else
|
||||||
|
image="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$image" ] && exit 1
|
||||||
|
|
||||||
|
ext=${image##*.}
|
||||||
|
image_copied="$HOME/.config/hypr/wallpaper.$ext"
|
||||||
|
|
||||||
|
cp -f "$image" "$image_copied" || exit 1
|
||||||
|
|
||||||
|
hyprctl hyprpaper reload ,"$image_copied" || exit 1
|
||||||
|
echo "preload = $image_copied" >"$HOME/.config/hypr/hyprpaper.conf"
|
||||||
|
echo "wallpaper = , $image_copied" >>"$HOME/.config/hypr/hyprpaper.conf"
|
||||||
|
|
||||||
|
notify-send "Wallpaper Changed" "$image"
|
||||||
|
|
||||||
|
notify-send "Extracting colors from wallpaper" "This may take a few seconds..."
|
||||||
|
change-colortheme.py -i "$image_copied" || exit 1
|
||||||
27
.utils/set_display
Normal file
27
.utils/set_display
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
Intel_ID="$(lspci -d ::03xx | grep Intel | cut -f 1 -d ' ')"
|
||||||
|
NVIDIA_ID="$(lspci -d ::03xx | grep NVIDIA | cut -f 1 -d ' ')"
|
||||||
|
|
||||||
|
for file in /dev/dri/by-path/*card; do
|
||||||
|
real_target=$(readlink -f "$file")
|
||||||
|
if [[ "$file" == *"$Intel_ID"* ]]; then
|
||||||
|
Intel_DRI_PATH="$real_target"
|
||||||
|
elif [[ "$file" == *"$NVIDIA_ID"* ]]; then
|
||||||
|
NVIDIA_DRI_PATH="$real_target"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$Intel_DRI_PATH" ]; then
|
||||||
|
export HYPR_DISPLAY_DEVICE=intel_backlight
|
||||||
|
# if [ -n "$NVIDIA_DRI_PATH" ]; then
|
||||||
|
# export HYPR_AQ_DRM_DEVICES="$NVIDIA_DRI_PATH:$Intel_DRI_PATH"
|
||||||
|
# else
|
||||||
|
# export HYPR_AQ_DRM_DEVICES="$Intel_DRI_PATH"
|
||||||
|
# fi
|
||||||
|
elif [ -n "$NVIDIA_DRI_PATH" ]; then
|
||||||
|
export HYPR_DISPLAY_DEVICE=nvidia_0
|
||||||
|
# export HYPR_AQ_DRM_DEVICES="$NVIDIA_DRI_PATH"
|
||||||
|
else
|
||||||
|
export HYPR_DISPLAY_DEVICE
|
||||||
|
# export HYPR_AQ_DRM_DEVICES=/dev/dri/card0
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
.offset-minus,
|
.offset-minus,
|
||||||
.offset-minus-single {
|
.offset-minus-single {
|
||||||
color: $border;
|
color: $blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
.offset-plus,
|
.offset-plus,
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
'''
|
|
||||||
Author: Uyanide pywang0608@foxmail.com
|
|
||||||
Date: 2025-06-14 20:23:25
|
|
||||||
LastEditTime: 2025-08-03 01:15:54
|
|
||||||
Description:
|
|
||||||
'''
|
|
||||||
"""
|
|
||||||
To be used with a companion fish function like this:
|
|
||||||
|
|
||||||
function refish
|
|
||||||
set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x
|
|
||||||
end
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@@ -31,9 +16,10 @@ FISH_READONLY = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
IGNORED = [
|
IGNORED = [
|
||||||
'PS1', 'XPC_SERVICE_NAME'
|
'PS1', 'XPC_SERVICE_NAME'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def ignored(name):
|
def ignored(name):
|
||||||
if name == 'PWD': # this is read only, but has special handling
|
if name == 'PWD': # this is read only, but has special handling
|
||||||
return False
|
return False
|
||||||
@@ -46,16 +32,20 @@ def ignored(name):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def escape(string):
|
def escape(string):
|
||||||
# use json.dumps to reliably escape quotes and backslashes
|
# use json.dumps to reliably escape quotes and backslashes
|
||||||
return json.dumps(string).replace(r'$', r'\$')
|
return json.dumps(string).replace(r'$', r'\$')
|
||||||
|
|
||||||
|
|
||||||
def escape_identifier(word):
|
def escape_identifier(word):
|
||||||
return escape(word.replace('?', '\\?'))
|
return escape(word.replace('?', '\\?'))
|
||||||
|
|
||||||
|
|
||||||
def comment(string):
|
def comment(string):
|
||||||
return '\n'.join(['# ' + line for line in string.split('\n')])
|
return '\n'.join(['# ' + line for line in string.split('\n')])
|
||||||
|
|
||||||
|
|
||||||
def gen_script():
|
def gen_script():
|
||||||
# Use the following instead of /usr/bin/env to read environment so we can
|
# Use the following instead of /usr/bin/env to read environment so we can
|
||||||
# deal with multi-line environment variables (and other odd cases).
|
# deal with multi-line environment variables (and other odd cases).
|
||||||
@@ -66,7 +56,7 @@ def gen_script():
|
|||||||
|
|
||||||
pipe_r, pipe_w = os.pipe()
|
pipe_r, pipe_w = os.pipe()
|
||||||
if sys.version_info >= (3, 4):
|
if sys.version_info >= (3, 4):
|
||||||
os.set_inheritable(pipe_w, True)
|
os.set_inheritable(pipe_w, True)
|
||||||
command = 'eval $1 && ({}; alias) >&{}'.format(
|
command = 'eval $1 && ({}; alias) >&{}'.format(
|
||||||
env_reader,
|
env_reader,
|
||||||
pipe_w
|
pipe_w
|
||||||
@@ -126,6 +116,7 @@ def gen_script():
|
|||||||
|
|
||||||
return script + '\n' + alias
|
return script + '\n' + alias
|
||||||
|
|
||||||
|
|
||||||
script_file = os.fdopen(3, 'w')
|
script_file = os.fdopen(3, 'w')
|
||||||
|
|
||||||
if not sys.argv[1:]:
|
if not sys.argv[1:]:
|
||||||
@@ -138,7 +129,7 @@ except subprocess.CalledProcessError as e:
|
|||||||
sys.exit(e.returncode)
|
sys.exit(e.returncode)
|
||||||
except Exception:
|
except Exception:
|
||||||
print('Bass internal error!', file=sys.stderr)
|
print('Bass internal error!', file=sys.stderr)
|
||||||
raise # traceback will output to stderr
|
raise # traceback will output to stderr
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
os.kill(os.getpid(), signal.SIGINT)
|
os.kill(os.getpid(), signal.SIGINT)
|
||||||
|
|||||||
1
hypr/.gitignore
vendored
1
hypr/.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
shaders
|
shaders
|
||||||
|
wallpaper*
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
# This file sources other files in `hyprland` and `custom` folders
|
|
||||||
# You wanna add your stuff in file in `custom`
|
|
||||||
|
|
||||||
# Defaults
|
|
||||||
source=~/.config/hypr/hyprland/env.conf
|
source=~/.config/hypr/hyprland/env.conf
|
||||||
source=~/.config/hypr/hyprland/execs.conf
|
source=~/.config/hypr/hyprland/execs.conf
|
||||||
source=~/.config/hypr/hyprland/general.conf
|
source=~/.config/hypr/hyprland/general.conf
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ env = QT_STYLE_OVERRIDE, kvantum
|
|||||||
|
|
||||||
# ############ nvidia #############
|
# ############ nvidia #############
|
||||||
env = LIBVA_DRIVER_NAME,nvidia
|
env = LIBVA_DRIVER_NAME,nvidia
|
||||||
|
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
|
||||||
env = NVD_BACKEND,direct
|
env = NVD_BACKEND,direct
|
||||||
|
# env = AQ_DRM_DEVICES,$HYPR_AQ_DRM_DEVICES
|
||||||
|
|
||||||
# ############ others #############
|
# ############ others #############
|
||||||
env = XCURSOR_SIZE,24
|
env = XCURSOR_SIZE,24
|
||||||
env = HYPRCURSOR_SIZE,24
|
env = HYPRCURSOR_SIZE,24
|
||||||
env = ELECTRON_OZONE_PLATFORM_HINT,auto
|
env = ELECTRON_OZONE_PLATFORM_HINT,auto
|
||||||
env = DISPLAY_DEVICE,intel_backlight # or nvidia_0
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# MONITOR CONFIG
|
# MONITOR CONFIG
|
||||||
monitor=,preferred,auto,1
|
monitor=,preferred,auto,1
|
||||||
monitor=eDP-1,2560x1600@240,auto,1.25 # dGPU only
|
monitor=eDP-1,2560x1600@240,auto,1.25,bitdepth,10
|
||||||
monitor=eDP-2,2560x1600@240,auto,1.25,bitdepth,10 # iGPU & dGPU hybrid
|
monitor=eDP-2,2560x1600@240,auto,1.25,bitdepth,10
|
||||||
# monitor=,addreserved, 0, 0, 0, 0 # Custom reserved area
|
# monitor=,addreserved, 0, 0, 0, 0 # Custom reserved area
|
||||||
|
|
||||||
# HDMI port: mirror display. To see device name, use `hyprctl monitors`
|
# HDMI port: mirror display. To see device name, use `hyprctl monitors`
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
preload = /home/kolkas/.config/backgrounds/nanami.png
|
preload = /home/kolkas/.config/hypr/wallpaper.png
|
||||||
wallpaper = , /home/kolkas/.config/backgrounds/nanami.png
|
wallpaper = , /home/kolkas/.config/hypr/wallpaper.png
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
"min-length": 20
|
"min-length": 20
|
||||||
},
|
},
|
||||||
"custom/publicip": {
|
"custom/publicip": {
|
||||||
"interval": 60,
|
"interval": 30,
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"format": " {text}",
|
"format": " {text}",
|
||||||
"tooltip-format": "{alt}",
|
"tooltip-format": "{alt}",
|
||||||
@@ -131,8 +131,8 @@
|
|||||||
"format-alt-click": "click-right",
|
"format-alt-click": "click-right",
|
||||||
//"format-icons": ["", ""],
|
//"format-icons": ["", ""],
|
||||||
"format-icons": [""],
|
"format-icons": [""],
|
||||||
"on-scroll-down": "brightnessctl -d $DISPLAY_DEVICE set 5%-",
|
"on-scroll-down": "brightnessctl -d $HYPR_DISPLAY_DEVICE set 5%-",
|
||||||
"on-scroll-up": "brightnessctl -d $DISPLAY_DEVICE set +5%",
|
"on-scroll-up": "brightnessctl -d $HYPR_DISPLAY_DEVICE set +5%",
|
||||||
"max-length": 6,
|
"max-length": 6,
|
||||||
"min-length": 6
|
"min-length": 6
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,6 +25,19 @@ time_log="$path/publicip.log"
|
|||||||
[ "$1" == "force" ] && rm -f "$cache_file"
|
[ "$1" == "force" ] && rm -f "$cache_file"
|
||||||
[ -f "$cache_file" ] && . "$cache_file"
|
[ -f "$cache_file" ] && . "$cache_file"
|
||||||
|
|
||||||
|
# Try to check network connectivity before querying
|
||||||
|
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then
|
||||||
|
# No network, return cached values if available
|
||||||
|
[ -z "$CACHED_IP" ] && CACHED_IP="N/A"
|
||||||
|
[ -z "$CACHED_CODE" ] && CACHED_CODE="N/A"
|
||||||
|
|
||||||
|
jq -n --unbuffered --compact-output \
|
||||||
|
--arg ip "$CACHED_IP" \
|
||||||
|
--arg country "$CACHED_CODE" \
|
||||||
|
'{alt: $ip, text: $country}'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
ip_current=$(curl -s -L -4 "$IP_QUERY_URL" | jq -r '.ip')
|
ip_current=$(curl -s -L -4 "$IP_QUERY_URL" | jq -r '.ip')
|
||||||
[ -z "$ip_current" ] && exit 1
|
[ -z "$ip_current" ] && exit 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user