scripts: deleted 2 & added config-load & edited some
This commit is contained in:
@@ -120,9 +120,6 @@ layer-rule {
|
|||||||
// Switch configs
|
// Switch configs
|
||||||
spawn-sh-at-startup "config-switch niri"
|
spawn-sh-at-startup "config-switch niri"
|
||||||
|
|
||||||
// Idle
|
|
||||||
spawn-sh-at-startup "hypridle"
|
|
||||||
|
|
||||||
// Wallpaper
|
// Wallpaper
|
||||||
spawn-at-startup "wallpaper-daemon"
|
spawn-at-startup "wallpaper-daemon"
|
||||||
|
|
||||||
@@ -149,9 +146,10 @@ spawn-at-startup "sunshine"
|
|||||||
// spawn-at-startup "spotify"
|
// spawn-at-startup "spotify"
|
||||||
// spawn-at-startup "thunderbird"
|
// spawn-at-startup "thunderbird"
|
||||||
|
|
||||||
|
// Idle
|
||||||
|
spawn-at-startup "hypridle"
|
||||||
|
|
||||||
// Quickshell must start after hypridle,
|
// QuickShell
|
||||||
// otherwise Firefox cannot block idle when playing media
|
|
||||||
spawn-at-startup "quickshell"
|
spawn-at-startup "quickshell"
|
||||||
|
|
||||||
/************************Envs************************/
|
/************************Envs************************/
|
||||||
@@ -439,5 +437,5 @@ binds {
|
|||||||
|
|
||||||
Mod+M allow-inhibiting=false { quit; }
|
Mod+M allow-inhibiting=false { quit; }
|
||||||
|
|
||||||
Mod+Shift+P { power-off-monitors; }
|
Mod+Shift+P { spawn-sh "(hyprlock &) && niri msg action power-off-monitors"; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ Singleton {
|
|||||||
// Nerd fonts icons
|
// Nerd fonts icons
|
||||||
readonly property string distro: ""
|
readonly property string distro: ""
|
||||||
readonly property string tray: ""
|
readonly property string tray: ""
|
||||||
readonly property string idleInhibitorActivated: ""
|
readonly property string idleInhibitorActivated: ""
|
||||||
readonly property string idleInhibitorDeactivated: ""
|
readonly property string idleInhibitorDeactivated: ""
|
||||||
readonly property string powerMenu: ""
|
readonly property string powerMenu: ""
|
||||||
readonly property string volumeHigh: ""
|
readonly property string volumeHigh: ""
|
||||||
readonly property string volumeMedium: ""
|
readonly property string volumeMedium: ""
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ Item {
|
|||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
SymbolButton {
|
SymbolButton {
|
||||||
symbol: Icons.tray
|
symbol: Icons.tray
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ Singleton {
|
|||||||
Quickshell.execDetached(["ddcutil", "-b", busNum, "setvcp", "10", rounded])
|
Quickshell.execDetached(["ddcutil", "-b", busNum, "setvcp", "10", rounded])
|
||||||
} else {
|
} else {
|
||||||
monitor.ignoreNextChange = true
|
monitor.ignoreNextChange = true
|
||||||
Quickshell.execDetached(["set-brightness", rounded + "%"])
|
Quickshell.execDetached(["sh", "-c", "brightnessctl -d $BRIGHTNESSCTL_DEVICE set "+ rounded + "%"])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDdc) {
|
if (isDdc) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Singleton {
|
|||||||
Logger.log("LyricsService", "Starting lyrics syncing");
|
Logger.log("LyricsService", "Starting lyrics syncing");
|
||||||
// fill lyrics with empty lines
|
// fill lyrics with empty lines
|
||||||
lyrics = Array(linesCount).fill(" ");
|
lyrics = Array(linesCount).fill(" ");
|
||||||
listenProcess.exec(["sh", "-c", `sl-wrap listen -l ${linesCount} -a ${linesAhead} -f ${offsetFile}`]);
|
listenProcess.exec(["sh", "-c", `pkill -x spotify-lyrics -u $USER; spotify-lyrics listen -l ${linesCount} -a ${linesAhead} -f ${offsetFile}`]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,14 +35,13 @@ Singleton {
|
|||||||
Logger.log("LyricsService", "Reference count:", referenceCount);
|
Logger.log("LyricsService", "Reference count:", referenceCount);
|
||||||
if (referenceCount <= 0) {
|
if (referenceCount <= 0) {
|
||||||
Logger.log("LyricsService", "Stopping lyrics syncing");
|
Logger.log("LyricsService", "Stopping lyrics syncing");
|
||||||
// Execute again to stop
|
// kinda ugly but works, meanwhile:
|
||||||
// kinda ugly but works, but meanwhile:
|
|
||||||
// listenProcess.signal(9)
|
// listenProcess.signal(9)
|
||||||
// listenProcess.signal(15)
|
// listenProcess.signal(15)
|
||||||
// listenProcess.running = false
|
// listenProcess.running = false
|
||||||
// counts on exec() to terminate previous exec()
|
// counting on exec() to terminate previous exec()
|
||||||
// all don't work
|
// all don't work
|
||||||
listenProcess.exec(["sh", "-c", `sl-wrap trackid`]);
|
listenProcess.exec(["sh", "-c", `pkill -x spotify-lyrics -u $USER`]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,8 +136,8 @@
|
|||||||
"format-alt-click": "click-right",
|
"format-alt-click": "click-right",
|
||||||
//"format-icons": ["", ""],
|
//"format-icons": ["", ""],
|
||||||
"format-icons": [""],
|
"format-icons": [""],
|
||||||
"on-scroll-down": "brightnessctl --class=backlight set -5%",
|
"on-scroll-down": "brightnessctl -d $BRIGHTNESSCTL_DEVICE set -5%",
|
||||||
"on-scroll-up": "brightnessctl --class=backlight set +5%",
|
"on-scroll-up": "brightnessctl -d $BRIGHTNESSCTL_DEVICE set +5%",
|
||||||
"max-length": 6,
|
"max-length": 6,
|
||||||
"min-length": 6
|
"min-length": 6
|
||||||
},
|
},
|
||||||
|
|||||||
6
memo/powerprofile
Normal file
6
memo/powerprofile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
powerprofilectl:
|
||||||
|
systemctl start/enable --now power-profiles-daemon.service
|
||||||
|
powerprofilectl set performance/balanced/power-saver
|
||||||
|
|
||||||
|
cpupower:
|
||||||
|
cpupower frequency-set --governor performance
|
||||||
@@ -1,6 +1,28 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Select image file if none is provided
|
# Required tools:
|
||||||
|
# - zenity (for file selection dialog)
|
||||||
|
# - imagemagick (for image processing)
|
||||||
|
# - swww (wallpaper daemon)
|
||||||
|
# - notify-send (for notifications)
|
||||||
|
# - change-colortheme (from scripts/change-colortheme)
|
||||||
|
# - flock (usually part of util-linux)
|
||||||
|
|
||||||
|
# Lock
|
||||||
|
|
||||||
|
exec {LOCK_FD}>/tmp/"$(basename "$0")".lock || {
|
||||||
|
echo "Failed to open lock file"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
flock -n "$LOCK_FD" || {
|
||||||
|
echo "Another instance is running. Exiting."
|
||||||
|
notify-send -a "change-wallpaper" "Error" "Another instance is running. Exiting."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Open a file selection dialog if no argument is provided
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
image=$(zenity --file-selection --title="Open File" --file-filter="*.jpg *.jpeg *.png *.webp *.bmp *.jfif *.tiff *.avif *.heic *.heif")
|
image=$(zenity --file-selection --title="Open File" --file-filter="*.jpg *.jpeg *.png *.webp *.bmp *.jfif *.tiff *.avif *.heic *.heif")
|
||||||
else
|
else
|
||||||
|
|||||||
34
scripts/config-load
Executable file
34
scripts/config-load
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
path="$(dirname "$(readlink -f "$0")")"
|
||||||
|
backupDir="$HOME/.config/config-backup/$(date +%Y%m%d-%H%M%S)"
|
||||||
|
backupDirCreated=0
|
||||||
|
|
||||||
|
sources=""
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
sources=$(find "$path/../config/" -maxdepth 1 -not -path "$path/../config")
|
||||||
|
else
|
||||||
|
for arg in "$@"; do
|
||||||
|
src="$path/../config/$arg"
|
||||||
|
if [ ! -e "$src" ]; then
|
||||||
|
echo "Error: Config '$arg' does not exist." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sources="$sources $path/../config/$arg"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
for src in $sources; do
|
||||||
|
name="$(basename "$src")"
|
||||||
|
dest="$HOME/.config/$name"
|
||||||
|
|
||||||
|
if [ -e "$dest" ] || [ -L "$dest" ]; then
|
||||||
|
[ "$backupDirCreated" -eq 0 ] && {
|
||||||
|
mkdir -pv "$backupDir"
|
||||||
|
backupDirCreated=1
|
||||||
|
}
|
||||||
|
mv -vf "$dest" "$backupDir/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -sv "$(realpath --relative-to="$HOME/.config" "$src")" "$dest"
|
||||||
|
done
|
||||||
@@ -9,13 +9,18 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for item in "kitty" "ghostty" "wlogout"; do
|
for item in "kitty" "ghostty" "wlogout"; do
|
||||||
[ -L "$HOME/.config/$item" ] || exit 1
|
for target in "$item" "$item-niri"; do
|
||||||
|
if [ -L "$HOME/.config/$target" ]; then
|
||||||
rm "$HOME/.config/$item"
|
rm -v "$HOME/.config/$target"
|
||||||
|
elif [ -e "$HOME/.config/$target" ]; then
|
||||||
if [ "$desktop" = "niri" ]; then
|
echo "Error: $HOME/.config/$target is not a symlink." >&2
|
||||||
ln -s "$path/../config/$item-niri" "$HOME/.config/$item"
|
exit 1
|
||||||
else
|
fi
|
||||||
ln -s "$path/../config/$item" "$HOME/.config/$item"
|
done
|
||||||
|
|
||||||
|
if [ "$desktop" = "niri" ]; then
|
||||||
|
ln -sv "$path/../config/$item-niri" "$HOME/.config/$item"
|
||||||
|
else
|
||||||
|
ln -sv "$path/../config/$item" "$HOME/.config/$item"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -42,7 +42,9 @@ def take_screenshot(filepath: Path, typeStr: str):
|
|||||||
ScreenshotType.AREA: f"hyprshot -z -m region -o {SCREENSHOT_DIR} -f ",
|
ScreenshotType.AREA: f"hyprshot -z -m region -o {SCREENSHOT_DIR} -f ",
|
||||||
ScreenshotType.WINDOW: f"hyprshot -z -m window -o {SCREENSHOT_DIR} -f ",
|
ScreenshotType.WINDOW: f"hyprshot -z -m window -o {SCREENSHOT_DIR} -f ",
|
||||||
}
|
}
|
||||||
os.system(f"{cmd[type]}{filepath.name}")
|
if os.system(f"{cmd[type]}{filepath.name}"):
|
||||||
|
print("Failed to take screenshot.")
|
||||||
|
exit(1)
|
||||||
wait_until_file_exists(filepath)
|
wait_until_file_exists(filepath)
|
||||||
elif "niri" in currentDesktop:
|
elif "niri" in currentDesktop:
|
||||||
cmd = {
|
cmd = {
|
||||||
@@ -53,10 +55,15 @@ def take_screenshot(filepath: Path, typeStr: str):
|
|||||||
niriScreenshotPath = SCREENSHOT_DIR / ".niri_screenshot.png"
|
niriScreenshotPath = SCREENSHOT_DIR / ".niri_screenshot.png"
|
||||||
if niriScreenshotPath.exists():
|
if niriScreenshotPath.exists():
|
||||||
niriScreenshotPath.unlink()
|
niriScreenshotPath.unlink()
|
||||||
os.system(cmd[type])
|
if os.system(cmd[type]):
|
||||||
|
print("Failed to take screenshot.")
|
||||||
|
exit(1)
|
||||||
wait_until_file_exists(niriScreenshotPath)
|
wait_until_file_exists(niriScreenshotPath)
|
||||||
if niriScreenshotPath.exists():
|
if niriScreenshotPath.exists():
|
||||||
niriScreenshotPath.rename(filepath)
|
niriScreenshotPath.rename(filepath)
|
||||||
|
else:
|
||||||
|
print("Failed to take screenshot.")
|
||||||
|
exit(1)
|
||||||
wait_until_file_exists(filepath)
|
wait_until_file_exists(filepath)
|
||||||
else:
|
else:
|
||||||
print("Unsupported desktop environment.")
|
print("Unsupported desktop environment.")
|
||||||
@@ -120,7 +127,7 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
n.add_action(
|
n.add_action(
|
||||||
"default",
|
"default",
|
||||||
"Default",
|
"Open in Editor",
|
||||||
edit_callback,
|
edit_callback,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
[ -z "$1" ] && exit 1
|
|
||||||
[ -z "$BRIGHTNESSCTL_DEVICE" ] && BRIGHTNESSCTL_DEVICE="auto"
|
|
||||||
|
|
||||||
brightnessctl -d "$BRIGHTNESSCTL_DEVICE" set "$1"
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
pgrep -f spotify-lyrics -u "$USER" && (killall spotify-lyrics -u "$USER" || exit 1)
|
|
||||||
spotify-lyrics "$@"
|
|
||||||
Reference in New Issue
Block a user