diff --git a/rockethype/local/bin/loopback_toggle b/rockethype/local/bin/loopback_toggle new file mode 100755 index 0000000..330c96a --- /dev/null +++ b/rockethype/local/bin/loopback_toggle @@ -0,0 +1,11 @@ +#!/bin/bash + +LB=$(pidof pw-loopback) + +if [[ $LB > 0 ]]; then + killall pw-loopback +else + pw-loopback --capture "alsa_input.usb-AVerMedia_Technologies__Inc._Live_Gamer_MINI_5203206100308-03.pro-input-0" & +fi + +exit 0 diff --git a/rockethype/local/bin/menudrun b/rockethype/local/bin/menudrun new file mode 100755 index 0000000..36acc16 --- /dev/null +++ b/rockethype/local/bin/menudrun @@ -0,0 +1,5 @@ +#!/bin/bash + +wofi || exit 0 + +exit 0 diff --git a/rockethype/local/bin/menugames b/rockethype/local/bin/menugames new file mode 100755 index 0000000..d4ce398 --- /dev/null +++ b/rockethype/local/bin/menugames @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import json +import os +import subprocess + +tmp = os.popen("lutris -ojl").read() +games = json.loads(tmp) + +gameslist = "" +concat = "" +for item in games: + gameslist = gameslist + concat + item["name"] + concat = "\n" + +tmp = subprocess.getoutput("echo \"" + gameslist + "\" | wofi -n -d -p \"Select Game:\"") + +for item in games: + if item["name"] == tmp: + subprocess.Popen(["lutris","lutris:rungameid/" + str(item["id"])]) + break diff --git a/rockethype/local/bin/menupass b/rockethype/local/bin/menupass new file mode 100755 index 0000000..ecb284e --- /dev/null +++ b/rockethype/local/bin/menupass @@ -0,0 +1,176 @@ +#!/bin/sh + +set -eu + +autotype=0 +copyisset=0 +fileisuser=0 +help=0 +onlypassword=0 +squash=0 +typeisset=0 + +COPY_CMD="wl-copy" +TYPE_CMD="wtype -" + +_trim() { + var="$*" + # remove leading whitespace characters + var="${var#"${var%%[![:space:]]*}"}" + # remove trailing whitespace characters + var="${var%"${var##*[![:space:]]}"}" + printf '%s' "$var" +} + +# the explicit newlines here are funky, but needed due to command substitution +# stripping trailing newlines so `printf '%s\n' "$line"` cannot be used +_parse_fields() { + has_username=0 + fields="$(pass show "$password" | tail -n +2 | cut -d: -f1 -s)" + field_list="password +" + if [ "$fileisuser" -eq 1 ]; then + has_username=1 + line="username" + field_list="$field_list$line +" + fi + for line in $fields; do + if [ "$line" = "username" ]; then + has_username=1 + field_list="$field_list$line +" + elif [ "$line" = "otpauth" ]; then + field_list="${field_list}OTP +" + elif [ "$line" = autotype_always ]; then + autotype=1 + else + field_list="$field_list$line +" + fi + done + if [ "$typeisset" -eq 1 ] && [ "$has_username" -eq 1 ]; then + printf "autotype +" + fi + printf '%s' "$field_list" +} + +_pass_field() { + _trim "$(pass show "$password" | tail -n+2 | grep "^${*}:.*$" | cut -d: -f1 -s --complement)" +} + +_pass_get() { + if [ "$1" = "password" ]; then + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } + elif [ "$1" = "OTP" ]; then + pass otp "$password" | tail -n1 | { IFS= read -r pass; printf %s "$pass"; } + elif [ "$fileisuser" -eq 1 ] && [ "$1" = "username" ]; then + printf %s "$passname" + else + _pass_field "$@" + fi +} + +_usage() { + printf "Usage: wofi-pass [options]\n" + printf " -a, --autotype autotype whatever entry is chosen\n" + printf " -c, --copy=[cmd] copy to clipboard. Defaults to wl-copy if no cmd is given.\n" + printf " -f, --fileisuser use the name of the password file as username\n" + printf " -h, --help show this help message\n" + printf " -s, --squash don't show field choice if password file only contains password\n" + printf " -t, --type=[cmd] type the selection instead of copying to clipboard.\n" + printf " Defaults to wtype if no cmd is given.\n" +} + +OPTS="$(getopt --options ac::fhst:: --longoptions autotype,copy::,fileisuser,help,squash,type:: -n 'wofi-pass' -- "$@")" +eval set -- "$OPTS" +while true; do + case "$1" in + -a | --autotype ) autotype=1; shift ;; + -c ) copyisset=1; copy_cmd="$COPY_CMD"; shift ;; + --copy ) + copyisset=1 + if [ -n "$2" ]; then + copy_cmd="$2" + shift 2 + else + copy_cmd="$COPY_CMD" + shift + fi ;; + -f | --fileisuser ) fileisuser=1; shift;; + -h | --help ) help=1; shift ;; + -s | --squash ) squash=1; shift ;; + -t ) typeisset=1; type_cmd="$TYPE_CMD"; shift ;; + --type ) + typeisset=1 + if [ -n "$2" ]; then + type_cmd="$2" + shift 2 + else + type_cmd="$TYPE_CMD" + shift + fi ;; + -- ) shift; break;; + * ) break;; + esac +done + +if [ "$help" -eq 1 ]; then + _usage >&2 + exit 0 +fi + +if [ "$typeisset" -eq 1 ] && [ "$copyisset" -eq 1 ]; then + printf "copy and type cannot be used at same time. Please pass only one.\n" + exit 1 +elif [ "$typeisset" -eq 0 ] && [ "$copyisset" -eq 0 ]; then + printf "neither -c/--copy or -t/--type passed. Defaulting to copying with wl-copy." + copy_cmd="$COPY_CMD" +fi + +cd "${PASSWORD_STORE_DIR:-$HOME/.password-store}" +password_files="$(find . -name "*.gpg" | sed "s/^\.\/\(.*\)\.gpg$/\1/")" + +password=$(printf '%s\n' "$password_files" | wofi --dmenu) +[ -n "$password" ] || exit + +if [ "$fileisuser" -eq 1 ]; then + passname=$(printf '%s' "$password" | sed "s,.*/\(\),\1,") +fi + +field_list="$(_parse_fields)" +field_count="$(printf '%s' "$field_list" | wc -l)" +if [ "$squash" -eq 1 ] && [ "$field_count" -eq 0 ]; then + field="password" + onlypassword=1 +elif [ "$autotype" -ne 1 ]; then + field=$(printf '%s\n' "$field_list" | wofi --dmenu) +fi + +# get the command to output to +if [ "$typeisset" -eq 1 ]; then + output_cmd=$type_cmd +else + output_cmd=$copy_cmd +fi + +if [ "$autotype" -eq 1 ] || [ "$field" = "autotype" ]; then + if [ "$fileisuser" -eq 1 ]; then + username="$passname" + else + username=$(_pass_get "username") + fi + password=$(_pass_get "password") + + # check if we are autotyping a password-only file + if [ "$onlypassword" -eq 1 ]; then + printf '%s\n' "$password" | $output_cmd + else + printf '%s\t%s\n' "$username" "$password" | $output_cmd + fi + +else + _pass_get "$field" | $output_cmd +fi diff --git a/rockethype/local/bin/menupower b/rockethype/local/bin/menupower new file mode 100755 index 0000000..4905d31 --- /dev/null +++ b/rockethype/local/bin/menupower @@ -0,0 +1,44 @@ +#!/bin/bash + +option0=" Lock" +option1=" Poweroff" +option2=" Reboot" +option3=" Exit" + +option4=" Monitor toggle" +option5=" VPN Toggle" + +options="$option0\n$option1\n$option2\n$option3\n$option4\n$option5" + +selected="$(echo -e "$options" | wofi --show dmenu --location top_right --xoffset -32 --yoffset 14 --width 256 --height 228 -p "Powermenu:" || exit 0)" + +case $selected in + $option0) + swaylock \ + --screenshots \ + --clock \ + --indicator \ + --indicator-radius 100 \ + --indicator-thickness 7 \ + --effect-blur 6x5 \ + --effect-vignette 0.5:0.5 \ + --ring-color 1f2227 \ + --key-hl-color e06c75 \ + --line-color 00000000 \ + --inside-color 00000088 \ + --separator-color 00000000 \ + --grace 2 \ + --fade-in 0.2;; + $option1) + systemctl poweroff;; + $option2) + systemctl reboot;; + $option3) + exec exit;; + $option4) + monitor-toggle;; + $option5) + exec $HOME/.config/waybar/scripts/wgstatus -toggle;; +esac + +exit 0 diff --git a/rockethype/local/bin/menurun b/rockethype/local/bin/menurun new file mode 100755 index 0000000..93dc1e6 --- /dev/null +++ b/rockethype/local/bin/menurun @@ -0,0 +1,9 @@ +#!/bin/bash +exec wofi \ + --show drun \ + --location top_left \ + --xoffset 14 \ + --yoffset 14 \ + --width 384 \ + --height 512 \ + -p Application: diff --git a/rockethype/local/bin/menuwallpapers b/rockethype/local/bin/menuwallpapers new file mode 100755 index 0000000..e304a35 --- /dev/null +++ b/rockethype/local/bin/menuwallpapers @@ -0,0 +1,8 @@ +#!/bin/bash + +WALLPATH="$HOME/.local/share/backgrounds/" +WALLFILE="$(ls $WALLPATH | wofi --show dmenu -p Wallpapers:)" + +swww img $WALLPATH$WALLFILE --transition-type wipe --transition-step 30 --transition-fps 165 > /dev/null + +exit 0 diff --git a/rockethype/local/bin/monitor-toggle b/rockethype/local/bin/monitor-toggle new file mode 100755 index 0000000..622bfff --- /dev/null +++ b/rockethype/local/bin/monitor-toggle @@ -0,0 +1,19 @@ +#!/bin/bash + +MONON(){ +hyprctl keyword monitor DP-2,2560x1440@165,0x0,1 +} + +MONOFF(){ +hyprctl keyword monitor DP-2,disable +} + +MONTEMP=$(hyprctl monitors | grep "(ID 1)") + +if [[ $MONTEMP = "Monitor DP-2 (ID 1):" ]]; then + MONOFF +else + MONON +fi + +exit 0 diff --git a/rockethype/local/bin/night-mode b/rockethype/local/bin/night-mode new file mode 100755 index 0000000..d4505c5 --- /dev/null +++ b/rockethype/local/bin/night-mode @@ -0,0 +1,11 @@ +#!/bin/bash + +NM=$(pidof gammastep) + +if [[ $NM > 0 ]]; then + killall gammastep +else + gammastep -b 1:0.9 -l 56.01:92.86 -t 5600:4500 & +fi + +exit 0 diff --git a/rockethype/local/bin/perf b/rockethype/local/bin/perf new file mode 100755 index 0000000..bc25b8d --- /dev/null +++ b/rockethype/local/bin/perf @@ -0,0 +1,29 @@ +#!/bin/bash + +SPACEPORT(){ +notify-send -e -i "$ICONPATH/space-base.png" "$HNOTIFY" "Низкая производительность" +corectrl -m Spaceport +} + +COSMIC(){ +notify-send -e -i "$ICONPATH/spaceship.png" "$HNOTIFY" "Средняя производительность" +corectrl -m Cosmic +} + +ROCKET(){ +notify-send -e -i "$ICONPATH/rocket.png" "$HNOTIFY" "Высокая производительность" +corectrl -m Rocket +} + +ICONPATH="/home/mat/.config/streamdeck/sources/Keys/applications" +HNOTIFY="Центр Управления Полетами" + +if [[ $1 = 'spaceport' ]]; then + SPACEPORT +elif [[ $1 = 'cosmic' ]]; then + COSMIC +elif [[ $1 = 'rocket' ]]; then + ROCKET +fi + +exit 0 diff --git a/rockethype/local/bin/screenshot b/rockethype/local/bin/screenshot new file mode 100755 index 0000000..ff9dac1 --- /dev/null +++ b/rockethype/local/bin/screenshot @@ -0,0 +1,23 @@ +#!/bin/bash + +SCREENFILE=$HOME/Documents/Images/Screenshots/$(date +'screenshot_%Y-%m-%d-%H%M%S.png') +ICONPATH="/home/mat/.config/streamdeck/sources/Keys/applications" +HNOTIFY="Центр Управления Полетами" + +SCREENZONE(){ +grim -g "$(slurp -d)" - | wl-copy && wl-paste > $SCREENFILE +notify-send -e -i "$ICONPATH/screenshots.png" "$HNOTIFY" "Скриншот скопирован и сохранен" +} + +SCREENFULL(){ +grim - | wl-copy && wl-paste > $SCREENFILE +notify-send -e -i "$ICONPATH/screenshots.png" "$HNOTIFY" "Скриншот скопирован и сохранен" +} + +if [[ $1 = 'full' ]]; then + SCREENFULL +else + SCREENZONE +fi + +exit 0 diff --git a/rockethype/local/bin/thunar b/rockethype/local/bin/thunar new file mode 100755 index 0000000..e28e7cb --- /dev/null +++ b/rockethype/local/bin/thunar @@ -0,0 +1,9 @@ +#!/bin/bash +if [[ $1 == --daemon ]]; then + until pgrep gvfs >/dev/null; do + sleep 1 + done + exec /usr/bin/Thunar "$@" +else + exec /usr/bin/Thunar "$@" +fi