diff --git a/home.nix b/home.nix index dc7cfeb..0b34faf 100644 --- a/home.nix +++ b/home.nix @@ -42,6 +42,7 @@ ".config/satty".source = ./dotfiles/satty; ".config/waybar".source = ./dotfiles/waybar; ".config/hypr".source = ./dotfiles/hypr; + ".local/bin".source = ./scripts; }; home.sessionVariables = { diff --git a/scripts/check-do-not-disturb.sh b/scripts/check-do-not-disturb.sh new file mode 100755 index 0000000..6b6b60c --- /dev/null +++ b/scripts/check-do-not-disturb.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +disturbed=$(makoctl mode | grep -i do-not-disturb) > /dev/null +mute_icon="" +unmute_icon="🕭" + +case $1 in + "show") + if [[ $disturbed == "" ]]; then + echo "$unmute_icon" + else + echo "$mute_icon" + fi + ;; + "change") + if [[ $disturbed == "" ]]; then + makoctl mode -a do-not-disturb > /dev/null + echo "$unmute_icon" + else + makoctl mode -r do-not-disturb > /dev/null + echo "$mute_icon" + fi + pkill -SIGRTMIN+2 waybar + ;; + *) + echo "Arguments are: show, change" + ;; +esac diff --git a/scripts/check-if-muted.sh b/scripts/check-if-muted.sh new file mode 100755 index 0000000..5d4849f --- /dev/null +++ b/scripts/check-if-muted.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +MUTED=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -iq muted; echo $?) + +if [[ $MUTED -eq 0 ]]; then + notify-send "Audio muted" -a 'wp-vol' -t 1000 +else + notify-send "Audio unmuted" -a 'wp-vol' -t 1000 +fi diff --git a/scripts/home_backup.sh b/scripts/home_backup.sh new file mode 100755 index 0000000..bdb812e --- /dev/null +++ b/scripts/home_backup.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +rsync -avh --no-links --delete --exclude=.* --exclude=dyski /home/szymon/ /mnt/backup/home/szymon/ +rsync -avh --no-links --delete --exclude=.* --exclude=dyski /home/szymon/ /mnt/backup_wd/home/szymon/ diff --git a/scripts/old/brightness.sh b/scripts/old/brightness.sh new file mode 100755 index 0000000..2b78a41 --- /dev/null +++ b/scripts/old/brightness.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +if [[ $1 == "up" ]]; then + ddcutil -d 1 setvcp 10 100 && ddcutil -d 2 setvcp 10 100 +elif [[ $1 == "down" ]]; then + ddcutil -d 1 setvcp 10 30 && ddcutil -d 2 setvcp 10 0 +else + echo "Usage: brightness.sh [up/down]" +fi diff --git a/scripts/old/change_colors.sh b/scripts/old/change_colors.sh new file mode 100755 index 0000000..88890f8 --- /dev/null +++ b/scripts/old/change_colors.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +declare -A blue +blue[background]="rgba(36, 158, 202, 0.20)" +blue[foreground]="rgba(36, 158, 202, 0.30)" +blue[font-color]="#499DA9" +blue[wallpaper]="~/Obrazy/tapety/niebieski.jpg" + +declare -A red +red[background]="rgba(202, 36, 36, 0.20)" +red[foreground]="rgba(202, 36, 36, 0.30)" +red[font-color]="#A94949" +red[wallpaper]="~/Obrazy/tapety/czerwony.jpg" + +declare -A gray +gray[background]="rgba(169, 169, 169, 0.20)" +gray[foreground]="rgba(169, 169, 169, 0.30)" +gray[font-color]="#A9A9A9" +gray[wallpaper]="~/Obrazy/tapety/szary.jpg" + +choosen_color=$1 +if [[ -z $choosen_color ]]; then + choosen_color=$(echo -e "blue\nred\ngray\n" | wofi --show dmenu --prompt "Choose your theme") +fi + +echo "You choose: $(choosen_color)" + +if [[ $choosen_color == "blue" ]]; then + waybar_colors="@define-color background ${blue[background]};\n@define-color foreground ${blue[foreground]};\n@define-color font-color ${blue[font-color]};" + mako_colors="blue" + wofi_colors="#249ECA\n#499DA9" + rivalcfg --strip-top-color "#249ECA" --strip-middle-color "#249ECA" --strip-bottom-color "#249ECA" -c "#249ECA" + hyprctl hyprpaper reload ,${blue[wallpaper]} + echo -e "preload = ${blue[wallpaper]}\nwallpaper = ,${blue[wallpaper]}\nsplash = off\nipc = on" > ~/.config/hypr/hyprpaper.conf +elif [[ $choosen_color == "red" ]]; then + waybar_colors="@define-color background ${red[background]};\n@define-color foreground ${red[foreground]};\n@define-color font-color ${red[font-color]};" + mako_colors="red" + wofi_colors="#CA2424\n#A94949" + rivalcfg --strip-top-color "#CA2424" --strip-middle-color "#CA2424" --strip-bottom-color "#CA2424" -c "#CA2424" + hyprctl hyprpaper reload ,${red[wallpaper]} + echo -e "preload = ${red[wallpaper]}\nwallpaper = ,${red[wallpaper]}\nsplash = off\nipc = on" > ~/.config/hypr/hyprpaper.conf +elif [[ $choosen_color == "gray" ]]; then + waybar_colors="@define-color background ${gray[background]};\n@define-color foreground ${gray[foreground]};\n@define-color font-color ${gray[font-color]};" + mako_colors="gray" + wofi_colors="#A9A9A9\n#A9A9A9" + rivalcfg --strip-top-color "#A9A9A9" --strip-middle-color "#A9A9A9" --strip-bottom-color "#A9A9A9" -c "#A9A9A9" + hyprctl hyprpaper reload ,${gray[wallpaper]} + echo -e "preload = ${gray[wallpaper]}\nwallpaper = ,${gray[wallpaper]}\nsplash = off\nipc = on" > ~/.config/hypr/hyprpaper.conf +fi + + +echo -e "$waybar_colors" > ~/.config/waybar/colors.css +~/.local/bin/restart_waybar.sh & + +# killall mako +cat ~/.config/mako/$mako_colors > ~/.config/mako/config +makoctl reload +# mako --config ~/.config/mako/$mako_colors & + +echo -e $wofi_colors > ~/.config/wofi/colors + diff --git a/scripts/old/change_wallpaper.sh b/scripts/old/change_wallpaper.sh new file mode 100755 index 0000000..6ef38ed --- /dev/null +++ b/scripts/old/change_wallpaper.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +case $1 in + "sfw") + wallpaper=$(find ~/Obrazy/tapety/sfw/ -type f | wofi --dmenu) + ;; + "nsfw") + wallpaper=$(find ~/Obrazy/tapety/nsfw/ -type f | wofi --dmenu) + ;; + *) + echo "Please choose nsfw or sfw" + exit 1 + ;; +esac + +if [[ -n $wallpaper ]];then + hyprctl hyprpaper reload ,$wallpaper +fi diff --git a/scripts/old/random_wallpaper.sh b/scripts/old/random_wallpaper.sh new file mode 100755 index 0000000..395f25f --- /dev/null +++ b/scripts/old/random_wallpaper.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +case $1 in + "nsfw") + WALLPAPER_DIR="$HOME/Obrazy/tapety/nsfw/" + ;; + "sfw") + WALLPAPER_DIR="$HOME/Obrazy/tapety/sfw/" + ;; + *) + echo "Please choose nsfw or sfw" + exit 1 +esac +CURRENT_WALL=$(hyprctl hyprpaper listloaded) + +# Get a random wallpaper that is not the current one +WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1) + +# Apply the selected wallpaper +hyprctl hyprpaper reload ,"$WALLPAPER" diff --git a/scripts/old/screenshots_overcomplified.sh b/scripts/old/screenshots_overcomplified.sh new file mode 100755 index 0000000..60ac390 --- /dev/null +++ b/scripts/old/screenshots_overcomplified.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +### DEPENDENCIES: +## libnotify +## feh +## grim +## slurp +## satty +## wl-clipboard + +dir_target="$HOME/Obrazy/zrzuty" # where your screenshots are stored +file_name="zrzut_$(date +'%H-%M-%S_%d-%m-%Y').png" # name of your screenshot +file_path="$dir_target/$file_name" # full path combined of the above +tmp_path="/tmp/$file_name" # path of temporary file + +# flags +edit=false # edit after screenshotting +save=false # save to the disk +copy=false # copy to clipboard + +# messages + +error_message="No argument provided. Use -h or --help for help message." +help_message="\nUsage: screenShot [flags] [type-of-screen-shot / color (for color picker)\n\nFlags:\n\t-c | --copy \t Copies to clipboard\n\t-s | --save \t Saves to $dir_target\n\t-e | --edit \t Edit screenshot with swappy\n\nTypes:\n\tfullscreen\n\twindow\n\tregion\n" + +# don't go crazy when directory doesn't exist + +if [[ ! -d $dir_target ]]; then + echo "Target directory does not exist. Creating..." + notify-send "Screenshot" "Target directory does not exist. Creating..." + mkdir -p $dir_target +fi + +# handle flags +while [[ $# -gt 0 ]]; do + case "$1" in + -c | --copy) + copy=true + ;; + -s | --save) + save=true + ;; + -e | --edit) + edit=true + ;; + -h | --help) + echo -e "$help_message" + exit 0 + ;; + fullscreen | window | region | color) + type_of_screenshot="$1" + ;; + *) + echo "$error_message" + exit 1 + ;; + esac + shift +done + +# actually screenshot +case "$type_of_screenshot" in +fullscreen) + grim -o $(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name') "$tmp_path" + ;; +window) + active_window_position="$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 0) | .at')" + active_window_size="$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 0) | .size')" + + x=$(echo "$active_window_position" | jq '.[0]') + y=$(echo "$active_window_position" | jq '.[1]') + width=$(echo "$active_window_size" | jq '.[0]') + height=$(echo "$active_window_size" | jq '.[1]') + + grim -g "${x},${y} ${width}x${height}" "$tmp_path" + ;; +region) + grim -o $(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name') "$tmp_path" && feh --title screenshot --fullscreen "$tmp_path" & + sleep 0.5 + feh_pid=$(pgrep feh) + grim -g "$(slurp)" "$tmp_path" + echo "Killing feh…" + kill -9 "$feh_pid" + ;; +color) + grim -o $(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name') "$tmp_path" && feh --title screenshot --fullscreen "$tmp_path" & + sleep 0.5 + feh_pid=$(pgrep feh) + position=$(slurp -p) + sleep 1.0 + color_hex=$(grim -g "$position" -t ppm - | magick convert - -format '%[pixel:p{0,0}]' txt:- | sed -n '2p' | awk '{print $3}') + wl-copy $color_hex + notify-send "Color picker" "Copied $color_hex to clipboard" + kill -9 "$feh_pid" + exit 0 + ;; + +esac + +case "$copy-$save" in +"true-true") + cp "$tmp_path" "$file_path" + wl-copy <"$tmp_path" + notify-send -i "$tmp_path" "Screenshot" "Copied and saved to $file_path" + ;; +"false-true") + cp "$tmp_path" "$file_path" + notify-send -i "$tmp_path" "Screenshot" "Saved screenshot to $file_path" + ;; +"true-false") + wl-copy <"$tmp_path" + notify-send -i "$tmp_path" "Screenshot" "Copied screenshot" + ;; +"false-false") + if [ "$edit" = "true" ]; then + satty -f "$tmp_path" + fi + ;; +esac + +rm $tmp_path + +exit 0 diff --git a/scripts/old/start_coding.sh b/scripts/old/start_coding.sh new file mode 100755 index 0000000..3c2d53b --- /dev/null +++ b/scripts/old/start_coding.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +dir=$(find ~/Dokumenty/kodowanie/ -maxdepth 2 -type d ! -name '.*' | fzf) +export EDITOR="nvim" + +if [[ -n $dir ]]; then + echo "You choose $dir" + hyprctl dispatch exec [workspace 5] kitty $dir + hyprctl dispatch exec [workspace 5] kitty yazi $dir + hyprctl dispatch exec [workspace 5] kitty $dir +else + echo "No reasonable directory selected, bye bye :P" +fi diff --git a/scripts/restart_waybar.sh b/scripts/restart_waybar.sh new file mode 100755 index 0000000..53d84ec --- /dev/null +++ b/scripts/restart_waybar.sh @@ -0,0 +1,5 @@ +killall -q waybar + +while pgrep -x waybar >/dev/null; do sleep 1; done + +uwsm app waybar diff --git a/scripts/screenshot.sh b/scripts/screenshot.sh new file mode 100755 index 0000000..56fb96e --- /dev/null +++ b/scripts/screenshot.sh @@ -0,0 +1,50 @@ +#!/bin/env bash + +# variables +## path vars +date="$(date +'%d-%m-%Y_%H:%M:%S')" +fname="$date.png" +target_path="$HOME/Obrazy/zrzuty/$fname" +## stdout +error_wrong_type="The first argument needs to be \"fullscreen\", \"window\" or \"region\". Exiting..." +notification_succes="$target_path saved and copied" + + +# validate input +case "$1" in + "fullscreen" | "window" | "region") + type=$1 + ;; + *) + echo "$error_wrong_type" + exit + ;; +esac + +notification() { + notify-send -i "$target_path" -u low -a "Screenshot" "Screenshot $type" "$notification_succes" +} + +case $type in + "fullscreen") + grim -o $(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name') "$target_path" + wl-copy < "$target_path" + notification + ;; + "window") + active_window_position="$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 0) | .at')" + active_window_size="$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 0) | .size')" + + x=$(echo "$active_window_position" | jq '.[0]') + y=$(echo "$active_window_position" | jq '.[1]') + width=$(echo "$active_window_size" | jq '.[0]') + height=$(echo "$active_window_size" | jq '.[1]') + + grim -g "${x},${y} ${width}x${height}" "$target_path" + wl-copy < "$target_path" + notification + ;; + "region") + grim -o $(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name') - | satty -f - + ;; +esac diff --git a/scripts/sekirofpsunlock b/scripts/sekirofpsunlock new file mode 100755 index 0000000..6499d99 Binary files /dev/null and b/scripts/sekirofpsunlock differ diff --git a/scripts/sherlock b/scripts/sherlock new file mode 120000 index 0000000..b0dcbab --- /dev/null +++ b/scripts/sherlock @@ -0,0 +1 @@ +/home/szymon/.local/share/pipx/venvs/sherlock-project/bin/sherlock \ No newline at end of file diff --git a/scripts/steamtinkerlaunch b/scripts/steamtinkerlaunch new file mode 120000 index 0000000..2558098 --- /dev/null +++ b/scripts/steamtinkerlaunch @@ -0,0 +1 @@ +/home/szymon/.local/share/steamtinkerlaunch/steamtinkerlaunch \ No newline at end of file diff --git a/scripts/system_setup.sh b/scripts/system_setup.sh new file mode 100755 index 0000000..2300980 --- /dev/null +++ b/scripts/system_setup.sh @@ -0,0 +1,319 @@ +#!/bin/bash + +# colors +RED='\033[0;31m' +GREEN='\033[0;32m' +BOLD='\033[1m' +RESET='\033[0m' + +# functions +function install_yay() { + echo "Checking if yay is installed..." + if ! command -v yay &> /dev/null; then + echo "Yay is not installed, installing..." + sudo pacman -S --needed git base-devel + tmpdir="$(mktemp -d)" + git clone https://aur.archlinux.org/yay.git "$tmpdir" + cd "$tmpdir" + makepkg -si || { echo "Yay installation failed!"; exit 1; } + cd - + rm -rf "$tmpdir" + fi + echo "Yay is installed!" +} + +function show_help() { + echo -e "$help_message" + exit 0 +} + +function list_presets() { + echo -e "Existing presets:\n\tmiminal - a minimal preset with not a lot of stuff\n\tnormal - preset with everything you could possibly need" + exit 0 +} + +function list_preset_packages() { + echo "Preset $preset contains:" + echo "${presets[$preset]}" + exit 0 +} + +function install_preset() { + install_yay + echo "Downloading preset: $preset" + yay -Syu ${presets[$preset]} --needed +} + +function uninstall_preset() { + reassurance="" + read -p "Are you sure you want to do this very stupid thing? Type I AM VERY DUM to continue..." reassurance + if [[ $reassurance = "I AM VERY DUM" ]]; then + echo "Uninstalling preset: $preset" + yay -Rns ${presets[$preset]} + else + echo "Canceled uninstall" + fi + exit 0 +} + +function enable_services() { + sudo systemctl enable sddm bluetooth NetworkManager cups + systemctl --user enable pipewire wireplumber +} + +# pkgs lists +HYPRLAND_UI=" +hyprland +hyprland-protocols +hyprlauncher +hypridle +hyprlock +hyprpaper +hyprpolkitagent +hyprpwcenter +hyprsunset +hyprwire +waybar +grim +slurp +swww +wl-clipboard +nwg-displays +nwg-look +waypaper +xdg-desktop-portal-gtk +xdg-desktop-portal-hyprland +mako +notification-daemon +libnotify +sddm +" + +THEME=" +adw-gtk-theme +catppuccin-gtk-theme-latte +papirus-icon-theme +rose-pine-cursor +rose-pine-hyprcursor +" + +AUDIO=" +pipewire +pipewire-alsa +pipewire-pulse +wireplumber +pavucontrol +cava +" + +NETWORK=" +networkmanager +network-manager-applet +blueman +bluez +bluez-utils +bluez-cups +openssh +sshfs +aria2 +wget +rclone +" + +PRINTERS=" +cups +cups-browsed +cups-pdf +system-config-printer +sane +sane-airscan +" + +FILESYSTEM=" +btrfs-progs +btrfs-assistant +snapper +ntfs-3g +dosfstools +zip +7zip +rsync +trash-cli +" + +TERMINAL_TOOLS=" +fish +yazi +playerctl +atuin +zoxide +eza +fd +ripgrep +fzf +duf +gdu +fastfetch +tealdeer +man-db +bc +mediainfo +" + +DEV=" +cmake +go +rust +rust-analyzer +python-pip +prettier +npm +pandoc-cli +tectonic +chezmoi +neovim +lazygit +github-cli +" + +GAMES=" +steam +heroic-games-launcher-bin +lutris +wine +winetricks +protontricks +prismlauncher +gamemode +gamescope +mangohud +lact +goverlay +" + +MULTIMEDIA=" +mpv +satty +gimp +kdenlive +imagemagick +feh +" + +DOCUMENTS=" +zathura +zathura-pdf-poppler +" + +USERSPACE=" +gurk +vesktop +openrgb +homebank +winboat +freetube +zen-browser-bin +" + +declare -A presets +presets[minimal]="$HYPRLAND_UI $AUDIO $TERMINAL_TOOLS" +presets[normal]="$HYPRLAND_UI $AUDIO $TERMINAL_TOOLS $THEME $NETWORK $FILESYSTEM $USERSPACE $DOCUMENTS $MULTIMEDIA $PRINTERS $DEV $GAMES" + +wants_help=false +list=false +list_presets=false +install=false +uninstall=false +services=false +preset="" + +help_message="Super cool system setup utility that downloads all the packages you could possibly need!\n +How to use this bad boy:\n\n +\t--help - show this help message and leave\n +\t--list - list what is in given preset and leave. You can only use this option with --preset!\n +\t--preset - choose a preset you want to use\n +\t--services - enable all services after installing packages\n +\t--install - installs given preset to your system\n +\t--uninstall - uninstall given preset from your system. Possibly very stupid, because presets contain important system packages, like your window manager!\n\n +Thanks for using my super cool script :D +" + +# check root +if [ "$EUID" -eq 0 ]; then + echo -e "${RED}Please do not run this script as root.${RESET}" + exit 1 +fi + +# check args +if [[ -z "$1" ]]; then + echo "You need to give me some arguments...\nTry --help if you don't know what you're doing" + exit 1 +fi + +# parse args +while [ -n "$1" ]; do + case $1 in + --list-presets) + list_presets=true + shift + ;; + --list) + list=true + shift + ;; + --preset) + if [ -n "$2" ]; then + preset="$2" + shift 2 + else + echo "Error: --preset requires one argument" + exit 1 + fi + ;; + --help) + wants_help=true + shift 1 + ;; + --install) + install=true + shift + ;; + --uninstall) + uninstall=true + shift + ;; + --services) + services=true + shift + ;; + *) + echo "$1 is not a valid option! What are you even doing?!" + shift + ;; + esac +done + +if [[ "$wants_help" = true ]]; then + show_help +fi + +if [[ "$list_presets" = true ]]; then + list_presets +fi + +if [[ -v presets[$preset] ]]; then + if [[ "$list" = true ]]; then + list_preset_packages + fi + if [[ "$install" = true ]]; then + install_preset + if [[ "$services" = true ]]; then + enable_services + fi + fi + if [[ "$uninstall" = true ]]; then + uninstall_preset + fi +else + echo "Given preset does not exists..." +fi diff --git a/scripts/wp-vol.sh b/scripts/wp-vol.sh new file mode 100755 index 0000000..3ab9b80 --- /dev/null +++ b/scripts/wp-vol.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Get the volume level and convert it to a percentage +volume=$(wpctl get-volume @DEFAULT_SINK@) +volume=$(echo "$volume" | awk '{print $2}') +volume=$(echo "( $volume * 100 ) / 1" | bc) + +notify-send -t 1000 -a 'wp-vol' -h int:value:$volume "Volume: ${volume}%"