Huge Update
This commit is contained in:
1 parent
b3f41b52b1
commit
0867aa7fca
26 files changed
+1182
-124
No files matched your search
@@ -21,7 +21,7 @@ exec-once = $scriptsDir/Polkit.sh
|
||||
# Battery Notification
|
||||
exec-once = $scriptsDir/BatteryNotify.sh
|
||||
|
||||
# Welcome Notification
|
||||
# Welcome Message
|
||||
exec-once = $RunCMD welcome
|
||||
|
||||
# starup apps
|
||||
@@ -30,7 +30,8 @@ exec-once = swaync &
|
||||
exec-once = blueman-applet &
|
||||
exec-once = nm-applet --indicator &
|
||||
exec-once = udiskie &
|
||||
exec-once = blueman-applet &
|
||||
#exec-once = blueman-applet &
|
||||
exec-once = bluetoothctl power off &
|
||||
|
||||
#clipboard manager
|
||||
exec-once = wl-paste --type text --watch cliphist store
|
||||
|
||||
@@ -33,7 +33,7 @@ bind = $mainMod_SHIFT, Slash, exec, codium --disable-gpu
|
||||
bind = SHIFT_ALT, R, exec, $RunCMD reload
|
||||
bind = $mainMod, X, exec, $RunCMD powermenu
|
||||
bind = $mainMod_SHIFT, A, exec, $RunCMD gamemode
|
||||
bind = ALT, slash, exec, $scriptsDir/Emoji.sh
|
||||
bind = ALT, slash, exec, $RunCMD emoji
|
||||
bind = ALT, F1, exec, $RunCMD kb
|
||||
bind = $mainMod_SHIFT, Q, exec, $RunCMD blur
|
||||
bind = $mainMod, space, exec, $RunCMD layout
|
||||
|
||||
File renamed without changes.
Executable → Regular
-8
@@ -1,11 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed '1,/^### DATA ###$/d' $0 |
|
||||
rofi -dmenu -config ~/.config/rofi/config-long.rasi|
|
||||
cut -d ' ' -f 1 | tr -d '\n' | wl-copy
|
||||
|
||||
exit
|
||||
### DATA ###
|
||||
😀 grinning face, grin
|
||||
😃 grinning face with big eyes, mouth open smile
|
||||
😄 grinning face with smiling eyes eye, mouth open smile
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
batterynotify_conf=$HOME/.config/hypr/scripts/batterynotify.conf
|
||||
batterynotify_conf=$HOME/.config/hypr/configs/batterynotify.conf
|
||||
config_info() {
|
||||
cat << EOF
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ case "$1" in
|
||||
get_backlight
|
||||
;;
|
||||
"--inc")
|
||||
change_backlight "+10%"
|
||||
change_backlight "+5%"
|
||||
;;
|
||||
"--dec")
|
||||
change_backlight "10%-"
|
||||
change_backlight "5%-"
|
||||
;;
|
||||
"--get-kbd")
|
||||
get_kbd_backlight
|
||||
|
||||
@@ -25,16 +25,26 @@ touchpad() {
|
||||
|
||||
# Toggle Wifi
|
||||
wifi() {
|
||||
wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')"
|
||||
if [ -n "$wifi" ]; then
|
||||
rfkill block all &
|
||||
wifi_status=$(nmcli radio wifi)
|
||||
if [ "$wifi_status" == "enabled" ]; then
|
||||
nmcli radio wifi off
|
||||
notify-send -u low -i "$notif" 'Airplane mode: OFF'
|
||||
else
|
||||
rfkill unblock all &
|
||||
nmcli radio wifi on
|
||||
notify-send -u low -i "$notif" 'Airplane mode: ON'
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggle Bluetooth
|
||||
bluetooth() {
|
||||
if [ "$bluetooth_status" == "no" ]; then
|
||||
bluetoothctl power on
|
||||
notify-send -u low -i "$notif" 'Bluetooth ON'
|
||||
else
|
||||
bluetoothctl power off
|
||||
notify-send -u low -i "$notif" 'Bluetooth OFF'
|
||||
fi
|
||||
}
|
||||
|
||||
# Reload Waybar, Rofi, Swaync, and Rainbowborder.sh (SHIFT ALT R)
|
||||
reload() {
|
||||
@@ -109,3 +119,41 @@ disable_edp1() {
|
||||
enable_edp1() {
|
||||
hyprctl keyword monitor eDP-1,preferred,auto,1
|
||||
}
|
||||
|
||||
weather() {
|
||||
city=kohalpur
|
||||
cachedir=~/.cache/rbn
|
||||
cachefile=${0##*/}-$1
|
||||
|
||||
mkdir -p $cachedir
|
||||
touch $cachedir/$cachefile
|
||||
|
||||
SAVEIFS=$IFS;IFS=$'\n'
|
||||
cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
|
||||
[ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ] && {
|
||||
data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1))
|
||||
for i in {1..2}; do echo ${data[$i]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile; done
|
||||
}
|
||||
IFS=$SAVEIFS
|
||||
|
||||
weather=($(cat $cachedir/$cachefile))
|
||||
temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g')
|
||||
|
||||
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
|
||||
clear|sunny) condition="" ;;
|
||||
partly\ cloudy) condition="" ;;
|
||||
cloudy) condition="" ;;
|
||||
overcast) condition="" ;;
|
||||
fog|freezing\ fog) condition="" ;;
|
||||
patchy\ rain\ possible|patchy\ light\ drizzle|light\ drizzle|patchy\ light\ rain|light\ rain|light\ rain\ shower|mist|rain) condition="" ;;
|
||||
moderate\ rain\ at\ times|moderate\ rain|heavy\ rain\ at\ times|heavy\ rain|moderate\ or\ heavy\ rain\ shower|torrential\ rain\ shower|rain\ shower) condition="" ;;
|
||||
patchy\ snow\ possible|patchy\ sleet\ possible|patchy\ freezing\ drizzle\ possible|freezing\ drizzle|heavy\ freezing\ drizzle|light\ freezing\ rain|moderate\ or\ heavy\ freezing\ rain|light\ sleet|ice\ pellets|light\ sleet\ showers|moderate\ or\ heavy\ sleet\ showers) condition="" ;;
|
||||
blowing\ snow|moderate\ or\ heavy\ sleet|patchy\ light\ snow|light\ snow|light\ snow\ showers) condition="" ;;
|
||||
blizzard|patchy\ moderate\ snow|moderate\ snow|patchy\ heavy\ snow|heavy\ snow|moderate\ or\ heavy\ snow\ with\ thunder|moderate\ or\ heavy\ snow\ showers) condition="" ;;
|
||||
thundery\ outbreaks\ possible|patchy\ light\ rain\ with\ thunder|moderate\ or\ heavy\ rain\ with\ thunder|patchy\ light\ snow\ with\ thunder) condition="" ;;
|
||||
*) condition="" ;;
|
||||
esac
|
||||
|
||||
echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#####################################
|
||||
# #
|
||||
# @author : 00xZ4CKX #
|
||||
# GitHub : @S4NKALP #
|
||||
# Developer : Sankalp Tharu #
|
||||
# Copyright : Sankalp Tharu #
|
||||
# #
|
||||
#####################################
|
||||
|
||||
|
||||
# Select the right temperature file. #
|
||||
for temp_dir in /sys/class/hwmon/*; do
|
||||
[[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && {
|
||||
|
||||
temp_dirs=("$temp_dir"/temp*_input)
|
||||
temp_dir=${temp_dirs[0]}
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
done
|
||||
|
||||
|
||||
# Get CPU temp. #
|
||||
[[ -f "$temp_dir" ]] && deg="$(($(< "$temp_dir") * 100 / 10000))"
|
||||
|
||||
# Add CPU temp to the output. #
|
||||
if [[ "$cpu_temp" != "off" && "$deg" ]]; then
|
||||
deg="${deg//.}"
|
||||
|
||||
# Convert to Fahrenheit if enabled
|
||||
[[ "$cpu_temp" == "F" ]] && deg="$((deg * 90 / 50 + 320))"
|
||||
|
||||
deg_no_format="${deg/${deg: -1}}"
|
||||
|
||||
# Format the output
|
||||
deg="${deg/${deg: -1}}°${cpu_temp:-C}"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
# from 0°C to 40°C print ->
|
||||
if [[ "$deg_no_format" -le 40 ]]
|
||||
then
|
||||
echo -e " $deg"
|
||||
|
||||
# from 40°C to 60°C print ->
|
||||
elif [[ "$deg_no_format" -le 60 ]]
|
||||
then
|
||||
echo -e " $deg"
|
||||
|
||||
|
||||
# from 60°C to 85°C print ->
|
||||
elif [[ "$deg_no_format" -le 85 ]]
|
||||
then
|
||||
echo -e " $deg"
|
||||
|
||||
# from 85°C to +... print ->
|
||||
elif [[ "$deg_no_format" -gt 85 ]]
|
||||
then
|
||||
# the ' -n "%{F#FF0008}" ' -> red font as 85°C to +... is the default warn temperature
|
||||
echo -e "${BRed} $deg"
|
||||
fi
|
||||
@@ -67,3 +67,9 @@ NOTES_EDITOR="kitty nvim"
|
||||
# Misc
|
||||
lock="$SCRIPTSDIR/device_cmd.sh lockscreen"
|
||||
|
||||
# For panel
|
||||
theme="$HOME/.config/rofi/config-panel.rasi"
|
||||
|
||||
# For Bluetooth
|
||||
bluetooth_status=$(bluetoothctl show | grep "Powered" | awk '{print $2}')
|
||||
|
||||
@@ -209,4 +209,8 @@ CONFIG=$(rofi -show file-browser-extended -file-browser-stdout -file-browser-dir
|
||||
hyprctl dispatch exec "[float;size 45% 80%;center 1] kitty keyb -k '$CONFIG'"
|
||||
}
|
||||
|
||||
|
||||
# Emoji (ALT SLASH)
|
||||
emoji() {
|
||||
A="$(rofi -dmenu -l 10 -p "Emoji:" -config ~/.config/rofi/config-long.rasi < "$HOME/.config/hypr/configs/emojis" | cut -d' ' -f1 | tr -d '\n')"
|
||||
[[ -n "$A" ]] && wl-copy -- "$A"
|
||||
}
|
||||
@@ -4,6 +4,7 @@ source ~/.config/hypr/scripts/Ui_cmd.sh
|
||||
source ~/.config/hypr/scripts/Device_cmd.sh
|
||||
source ~/.config/hypr/scripts/Rofi_cmd.sh
|
||||
source ~/.config/hypr/scripts/Music_cmd.sh
|
||||
source ~/.config/hypr/scripts/Widget.sh
|
||||
|
||||
help() {
|
||||
declare -F
|
||||
|
||||
Executable
+141
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Source the configuration file.
|
||||
CONFIG_FILE=~/.config/hypr/scripts/Ref.sh
|
||||
source "$CONFIG_FILE"
|
||||
|
||||
panel(){
|
||||
# Theme Elements
|
||||
prompt='Panel'
|
||||
|
||||
list_col='2'
|
||||
list_row='2'
|
||||
win_width='450px'
|
||||
|
||||
# Options
|
||||
bluetooth_status=$(bluetoothctl show | awk '/Powered:/ {print $2}')
|
||||
bluetooth_icon=""
|
||||
[ "$bluetooth_status" = "yes" ] && bluetooth_icon=""
|
||||
|
||||
wifi_status=$(nmcli radio wifi)
|
||||
wifi_icon=""
|
||||
[ "$wifi_status" = "enabled" ] && wifi_icon=""
|
||||
|
||||
layout=$(grep 'USE_ICON' "$theme" | cut -d'=' -f2)
|
||||
if [[ "$layout" == 'NO' ]]; then
|
||||
option_1=""
|
||||
option_2=""
|
||||
option_3=""
|
||||
option_4=""
|
||||
else
|
||||
option_1=" ${wifi_icon}" # Wifi
|
||||
option_2=" ⏸" # Play pause
|
||||
option_3=" ${bluetooth_icon}" # Bluetooth
|
||||
option_4="" # Settings
|
||||
fi
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
rofi -theme-str "window {width: $win_width;}" \
|
||||
-theme-str "listview {columns: $list_col; lines: $list_row;}" \
|
||||
-theme-str 'textbox-prompt-colon {str: " ";}' \
|
||||
-dmenu -p "$prompt" -markup-rows -theme "$theme" -hover-select
|
||||
}
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$option_1\n$option_2\n$option_3\n$option_4" | rofi_cmd
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
case $1 in
|
||||
'--opt1') $SCRIPTSDIR/RunCMD.sh wifi ;;
|
||||
'--opt2') playerctl play-pause ;;
|
||||
'--opt3') $SCRIPTSDIR/RunCMD.sh bluetooth ;;
|
||||
'--opt4') $SCRIPTSDIR/RunCMD.sh panelsetting ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen=$(run_rofi)
|
||||
case $chosen in
|
||||
$option_1) run_cmd --opt1 ;;
|
||||
$option_2) run_cmd --opt2 ;;
|
||||
$option_3) run_cmd --opt3 ;;
|
||||
$option_4) run_cmd --opt4 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
panelsetting(){
|
||||
# Theme Elements
|
||||
prompt='Panel Settings'
|
||||
|
||||
|
||||
list_col='2'
|
||||
list_row='2'
|
||||
win_width='450px'
|
||||
|
||||
# Options
|
||||
|
||||
layout=`cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2`
|
||||
if [[ "$layout" == 'NO' ]]; then
|
||||
option_1=""
|
||||
option_2=""
|
||||
option_3=""
|
||||
option_4=""
|
||||
else
|
||||
option_1="" # Wifi
|
||||
option_2="" # Back
|
||||
option_3="" # Bluetooth
|
||||
option_4="" # Hyprconf
|
||||
fi
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
rofi \
|
||||
-theme-str "window {width: $win_width;}" \
|
||||
-theme-str "listview {columns: $list_col; lines: $list_row;}" \
|
||||
-theme-str 'textbox-prompt-colon {str: " ";}' \
|
||||
-dmenu \
|
||||
-p "$prompt" \
|
||||
-markup-rows \
|
||||
-theme ${theme} \
|
||||
-hover-select
|
||||
}
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$option_1\n$option_2\n$option_3\n$option_4" | rofi_cmd
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
if [[ "$1" == '--opt1' ]]; then
|
||||
kitty nmtui
|
||||
elif [[ "$1" == '--opt2' ]]; then
|
||||
$SCRIPTSDIR/RunCMD.sh panel
|
||||
elif [[ "$1" == '--opt3' ]]; then
|
||||
blueberry
|
||||
elif [[ "$1" == '--opt4' ]]; then
|
||||
$SCRIPTSDIR/RunCMD.sh edit
|
||||
fi
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen="$(run_rofi)"
|
||||
case ${chosen} in
|
||||
$option_1)
|
||||
run_cmd --opt1
|
||||
;;
|
||||
$option_2)
|
||||
run_cmd --opt2
|
||||
;;
|
||||
$option_3)
|
||||
run_cmd --opt3
|
||||
;;
|
||||
$option_4)
|
||||
run_cmd --opt4
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -32,7 +32,7 @@ declare -A menu_options=(
|
||||
["; Launcher"]="rofi -show drun -modi drun,filebrowser,run,window -theme $HOME/.config/rofi/launcher.rasi"
|
||||
["cb Clipboard"]="$RunCMD clip"
|
||||
["rm RunCMDMusic"]="$scriptsDir/Music_cmd.sh -m"
|
||||
["emj RunCMDEmoji"]="$scriptsDir/Emoji.sh"
|
||||
["emj RunCMDEmoji"]="$RunCMD emoji"
|
||||
["cc Calculator"]="$RunCMD calc"
|
||||
["td Todo"]="$RunCMD todo"
|
||||
["tx Tmux"]="$RunCMD tmux"
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
* {
|
||||
font: "JetBrains Mono Nerd Font 10";
|
||||
background: #1E1D2FFF;
|
||||
background-alt: #282839FF;
|
||||
foreground: #D9E0EEFF;
|
||||
selected: #7AA2F7FF;
|
||||
active: #ABE9B3FF;
|
||||
urgent: #F28FADFF;
|
||||
}
|
||||
|
||||
/*
|
||||
USE_BUTTONS=YES
|
||||
*/
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 115px;
|
||||
x-offset: -15px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 2px;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
cursor: "default";
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 15px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
children: [ "listview" ];
|
||||
background-image: url("~/.config/rofi/.current_wallpaper", width);
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
children: [ "textbox-prompt-colon", "prompt"];
|
||||
}
|
||||
|
||||
dummy {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "";
|
||||
padding: 12px 16px;
|
||||
border-radius: 10px;
|
||||
background-color: @urgent;
|
||||
text-color: @background;
|
||||
}
|
||||
prompt {
|
||||
enabled: true;
|
||||
padding: 12px;
|
||||
border-radius: 10px;
|
||||
background-color: @active;
|
||||
text-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
}
|
||||
textbox {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
placeholder-color: @foreground;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 5;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 20px 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: pointer;
|
||||
}
|
||||
element-text {
|
||||
font: "feather bold 24";
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected);
|
||||
text-color: var(background);
|
||||
}
|
||||
@@ -55,10 +55,10 @@
|
||||
"image-radius": 0
|
||||
},
|
||||
"volume": {
|
||||
"label": ""
|
||||
"label": "🔉"
|
||||
},
|
||||
"backlight": {
|
||||
"label": ""
|
||||
"label": "🔅"
|
||||
},
|
||||
"buttons-grid": {
|
||||
"actions": [
|
||||
@@ -72,7 +72,7 @@
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
"command": "~/.config/hypr/scripts/RunCMD.sh lockscreen"
|
||||
"command": "~/.config/hypr/scripts/RunCMD.sh lock"
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"modules-left": [
|
||||
"custom/menu",
|
||||
"cpu",
|
||||
"custom/CpuTemp",
|
||||
"temperature",
|
||||
"memory",
|
||||
"disk",
|
||||
],
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"modules-left": [
|
||||
"custom/menu",
|
||||
"cpu",
|
||||
"custom/CpuTemp",
|
||||
"temperature",
|
||||
"memory",
|
||||
"disk",
|
||||
],
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"custom/separator#dot-line",
|
||||
"cpu",
|
||||
"custom/separator#dot-line",
|
||||
"custom/CpuTemp",
|
||||
"temperature",
|
||||
"custom/separator#dot-line",
|
||||
"memory",
|
||||
"custom/separator#dot-line",
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
"backlight#gar": {
|
||||
"device": "intel_backlight",
|
||||
"format": "{icon}",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", ""],
|
||||
//"format-icons": ["", "", "", "", "", "", "", "", ""],
|
||||
"format-icons": ["🔅", "🔆", "☀️"],
|
||||
"tooltip-format": "{percent}%"
|
||||
},
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"custom/separator#blank",
|
||||
"pulseaudio",
|
||||
"custom/separator#blank",
|
||||
"custom/CpuTemp",
|
||||
"temperature",
|
||||
"custom/separator#blank",
|
||||
"network#peony",
|
||||
"custom/swaync"],
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
"modules-left": [
|
||||
"cpu",
|
||||
"custom/CpuTemp",
|
||||
"temperature",
|
||||
"memory",
|
||||
"disk",
|
||||
],
|
||||
|
||||
+52
-28
@@ -137,7 +137,7 @@
|
||||
"modules": [
|
||||
"cpu",
|
||||
"memory",
|
||||
"custom/CpuTemp",
|
||||
"temperature",
|
||||
"disk",
|
||||
]
|
||||
},
|
||||
@@ -164,8 +164,10 @@
|
||||
"rotate": 0,
|
||||
//"format": "{icon} {percent}%",
|
||||
//"format-icons": ["", "", ""],
|
||||
//"format-icons": ["", "", "", "", "", "", "", "", ""],
|
||||
// "format-icons": ["", "", "", "", "", "", "", "", ""],
|
||||
"format": "{icon}",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", ""],
|
||||
"format-icons": ["🔅", "🔆", "☀️"],
|
||||
"tooltip-format": "backlight {percent}%",
|
||||
"icon-size": 10,
|
||||
"on-click": "",
|
||||
@@ -216,9 +218,11 @@
|
||||
|
||||
"clock": {
|
||||
"interval": 1,
|
||||
"format": " {:%I:%M %p}",
|
||||
//"format": " {:%I:%M %p}",
|
||||
//"format": " {:%H:%M:%S}",
|
||||
"format-alt": " {:%H:%M %Y, %d %B, %A}",
|
||||
//"format-alt": " {:%I:%M %Y, %d %B, %A}",
|
||||
"format": "{:🕰️ %I:%M %p 📅 %d/%m}",
|
||||
"format-alt": "🕰️ {:%I:%M %B %d, %Y %A} 🗓️",
|
||||
"tooltip-format": "<tt><small>{calendar}</small></tt>",
|
||||
"calendar": {
|
||||
"mode" : "year",
|
||||
@@ -243,10 +247,11 @@
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
"format": " {usage}%",
|
||||
//"format": " {usage}%",
|
||||
"format": "📊 {usage}%",
|
||||
"interval": 1,
|
||||
"format-alt-click": "click",
|
||||
"format-alt": "{icon0}{icon1}{icon2}{icon3} {usage:>2}% ",
|
||||
"format-alt": "{icon0}{icon1}{icon2}{icon3} {usage:>2}% 📊",
|
||||
"format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"],
|
||||
"on-click-right": "gnome-system-monitor",
|
||||
},
|
||||
@@ -256,7 +261,7 @@
|
||||
//"format": "",
|
||||
"path": "/",
|
||||
//"format-alt-click": "click",
|
||||
"format": " {percentage_used}%",
|
||||
"format": " {percentage_used}%",
|
||||
//"tooltip": true,
|
||||
"tooltip-format": "{used} used out of {total} on {path} ({percentage_used}%)",
|
||||
},
|
||||
@@ -308,11 +313,12 @@
|
||||
|
||||
"memory": {
|
||||
"interval": 1,
|
||||
"format": " {used:0.1f}G",
|
||||
"format-alt": " {percentage}%",
|
||||
//"format": " {used:0.1f}G",
|
||||
//"format-alt": " {percentage}%",
|
||||
"format": "🧬 {used:0.1f}G/{total:0.1f}G",
|
||||
"format-alt": "🧬 {percentage}%",
|
||||
"format-alt-click": "click",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{used:0.1f}GB/{total:0.1f}G",
|
||||
"on-click-right": "kitty --title btop sh -c 'btop'"
|
||||
},
|
||||
|
||||
@@ -462,14 +468,23 @@
|
||||
"tooltip":true,
|
||||
"format": "{icon} {}",
|
||||
"format-icons": {
|
||||
"notification": "<span foreground='red'><sup></sup></span>",
|
||||
"none": "",
|
||||
"dnd-notification": "<span foreground='red'><sup></sup></span>",
|
||||
"dnd-none": "",
|
||||
"inhibited-notification": "<span foreground='red'><sup></sup></span>",
|
||||
"inhibited-none": "",
|
||||
"dnd-inhibited-notification": "<span foreground='red'><sup></sup></span>",
|
||||
"dnd-inhibited-none": ""
|
||||
"notification": "🔔<span foreground='red'><sup></sup></span>",
|
||||
"none": "🔔",
|
||||
"dnd-notification": "🔕<span foreground='red'><sup></sup></span>",
|
||||
"dnd-none": "🔕",
|
||||
"inhibited-notification": "🔔<span foreground='red'><sup></sup></span>",
|
||||
"inhibited-none": "🔔",
|
||||
"dnd-inhibited-notification": "🔕<span foreground='red'><sup></sup></span>",
|
||||
"dnd-inhibited-none": "🔕"
|
||||
|
||||
//"none": "",
|
||||
//"notification": "<span foreground='red'><sup></sup></span>",
|
||||
//"dnd-notification": "<span foreground='red'><sup></sup></span>",
|
||||
//"dnd-none": "",
|
||||
//"inhibited-notification": "<span foreground='red'><sup></sup></span>",
|
||||
//"inhibited-none": "",
|
||||
//"dnd-inhibited-notification": "<span foreground='red'><sup></sup></span>",
|
||||
//"dnd-inhibited-none": ""
|
||||
},
|
||||
"return-type": "json",
|
||||
"exec-if": "which swaync-client",
|
||||
@@ -545,11 +560,16 @@
|
||||
"tooltip": false,
|
||||
"interval": 900
|
||||
},
|
||||
"custom/CpuTemp":{
|
||||
"exec": "~/.config/hypr/scripts/HeatSensors.sh",
|
||||
"interval": 10,
|
||||
"format": "{} ",
|
||||
"tooltip": false,
|
||||
"temperature": {
|
||||
"interval": 10,
|
||||
"tooltip": true,
|
||||
"hwmon-path": ["/sys/class/hwmon/hwmon7/temp1_input"],
|
||||
//"thermal-zone": 0,
|
||||
"critical-threshold": 82,
|
||||
"format-critical": "{temperatureC}°C {icon}",
|
||||
"format": "{temperatureC}°C {icon}",
|
||||
"format-icons": ["🔥", "❤️🔥", "🌡️"],
|
||||
"on-click-right": "kitty --title nvtop sh -c 'nvtop'"
|
||||
},
|
||||
|
||||
// Separators
|
||||
@@ -596,7 +616,7 @@
|
||||
"align": 0.4,
|
||||
"rotate": 1,
|
||||
"format": "{icon}",
|
||||
"format-icons": ["", "", ""],
|
||||
"format-icons": ["🔅", "🔆", "☀️"],
|
||||
"on-click": "",
|
||||
"on-click-middle": "",
|
||||
"on-click-right": "",
|
||||
@@ -609,8 +629,9 @@
|
||||
|
||||
"clock#vertical": {
|
||||
//"format": "{:\n%H\n%M\n%S\n\n \n%d\n%m\n%y}",
|
||||
//"format": "{:\n%I\n%M\n%p\n\n \n%d\n%m\n%y}",
|
||||
"format": "{:🕰️\n%I\n%M\n%p\n\n🗓 \n%d\n%m\n%y}",
|
||||
"interval": 1,
|
||||
"format": "{:\n%I\n%M\n%p\n\n \n%d\n%m\n%y}",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{calendar}",
|
||||
"calendar": {
|
||||
@@ -622,15 +643,18 @@
|
||||
}
|
||||
},
|
||||
"cpu#vertical": {
|
||||
"format": "\n{usage}%",
|
||||
//"format": "\n{usage}%",
|
||||
"format": "📊\n{usage}%",
|
||||
"interval": 1,
|
||||
"on-click-right": "gnome-system-monitor",
|
||||
},
|
||||
|
||||
"memory#vertical": {
|
||||
"interval": 10,
|
||||
"format": "\n{percentage}%",
|
||||
"format-alt": "\n{used:0.1f}G",
|
||||
"format": "🧬\n{percentage}%",
|
||||
//"format": "\n{percentage}%",
|
||||
"format-alt": "🧬\n{used:0.1f}G",
|
||||
//"format-alt": "\n{used:0.1f}G",
|
||||
"format-alt-click": "click",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{used:0.1f}GB/{total:0.1f}G",
|
||||
|
||||
@@ -133,11 +133,11 @@ window#waybar.empty {
|
||||
#taskbar,
|
||||
#tray,
|
||||
#window,
|
||||
#temperature,
|
||||
#wireplumber,
|
||||
#workspaces,
|
||||
#custom-keybinds,
|
||||
#custom-keyboard,
|
||||
#custom-CpuTemp,
|
||||
#custom-cycle_wall,
|
||||
#custom-backlight,
|
||||
#custom-music,
|
||||
@@ -213,7 +213,7 @@ window#waybar.empty {
|
||||
color: @sapphire;
|
||||
}
|
||||
|
||||
#custom-CpuTemp {
|
||||
#temperature {
|
||||
color: @teal;
|
||||
}
|
||||
|
||||
|
||||
Executable
+385
@@ -0,0 +1,385 @@
|
||||
#!/usr/bin/env bash
|
||||
# pipes.sh: Animated pipes terminal screensaver.
|
||||
# https://github.com/pipeseroni/pipes.sh
|
||||
#
|
||||
# Copyright (c) 2015-2018 Pipeseroni/pipes.sh contributors
|
||||
# Copyright (c) 2013-2015 Yu-Jie Lin
|
||||
# Copyright (c) 2010 Matthew Simpson
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
|
||||
VERSION=1.3.0
|
||||
|
||||
M=32768 # Bash RANDOM maximum + 1
|
||||
p=1 # number of pipes
|
||||
f=75 # frame rate
|
||||
s=13 # probability of straight fitting
|
||||
r=2000 # characters limit
|
||||
t=0 # iteration counter for -r character limit
|
||||
w=80 # terminal size
|
||||
h=24
|
||||
|
||||
# ab -> sets[][idx] = a*4 + b
|
||||
# 0: up, 1: right, 2: down, 3: left
|
||||
# 00 means going up , then going up -> ┃
|
||||
# 12 means going right, then going down -> ┓
|
||||
sets=(
|
||||
"┃┏ ┓┛━┓ ┗┃┛┗ ┏━"
|
||||
"│╭ ╮╯─╮ ╰│╯╰ ╭─"
|
||||
"│┌ ┐┘─┐ └│┘└ ┌─"
|
||||
"║╔ ╗╝═╗ ╚║╝╚ ╔═"
|
||||
"|+ ++-+ +|++ +-"
|
||||
"|/ \/-\ \|/\ /-"
|
||||
".. .... .... .."
|
||||
".o oo.o o.oo o."
|
||||
"-\ /\|/ /-\/ \|" # railway
|
||||
"╿┍ ┑┚╼┒ ┕╽┙┖ ┎╾" # knobby pipe
|
||||
)
|
||||
SETS=() # rearranged all pipe chars into individul elements for easier access
|
||||
|
||||
# pipes'
|
||||
x=() # current position
|
||||
y=()
|
||||
l=() # current directions
|
||||
# 0: up, 1: right, 2: down, 3: left
|
||||
n=() # new directions
|
||||
v=() # current types
|
||||
c=() # current escape codes
|
||||
|
||||
# selected pipes'
|
||||
V=() # types (indexes to sets[])
|
||||
C=() # color indices for tput setaf
|
||||
VN=0 # number of selected types
|
||||
CN=0 # number of selected colors
|
||||
E=() # pre-generated escape codes from BOLD, NOCOLOR, and C
|
||||
|
||||
# switches
|
||||
RNDSTART=0 # randomize starting position and direction
|
||||
BOLD=1
|
||||
NOCOLOR=0
|
||||
KEEPCT=0 # keep pipe color and type
|
||||
|
||||
|
||||
# print help message in 72-char width
|
||||
print_help() {
|
||||
local cgap
|
||||
printf -v cgap '%*s' $((15 - ${#COLORS})) ''
|
||||
cat <<HELP
|
||||
Usage: $(basename $0) [OPTION]...
|
||||
Animated pipes terminal screensaver.
|
||||
|
||||
-p [1-] number of pipes (D=1)
|
||||
-t [0-$((${#sets[@]} - 1))] pipe type (D=0)
|
||||
-t c[16 chars] custom pipe type
|
||||
-c [0-$COLORS]${cgap}pipe color INDEX (TERM=$TERM), can be
|
||||
hexadecimal with '#' prefix
|
||||
(D=-c 1 -c 2 ... -c 7 -c 0)
|
||||
-f [20-100] framerate (D=75)
|
||||
-s [5-15] going straight probability, 1 in (D=13)
|
||||
-r [0-] reset after (D=2000) characters, 0 if no reset
|
||||
-R randomize starting position and direction
|
||||
-B no bold effect
|
||||
-C no color
|
||||
-K keep pipe color and type when crossing edges
|
||||
-h print this help message
|
||||
-v print version number
|
||||
|
||||
Note: -t and -c can be used more than once.
|
||||
HELP
|
||||
}
|
||||
|
||||
|
||||
# parse command-line options
|
||||
# It depends on a valid COLORS which is set by _CP_init_termcap_vars
|
||||
parse() {
|
||||
# test if $1 is a natural number in decimal, an integer >= 0
|
||||
is_N() {
|
||||
[[ -n $1 && -z ${1//[0-9]} ]]
|
||||
}
|
||||
|
||||
|
||||
# test if $1 is a hexadecimal string
|
||||
is_hex() {
|
||||
[[ -n $1 && -z ${1//[0-9A-Fa-f]} ]]
|
||||
}
|
||||
|
||||
|
||||
# print error message for invalid argument to standard error, this
|
||||
# - mimics getopts error message
|
||||
# - use all positional parameters as error message
|
||||
# - has a newline appended
|
||||
# $arg and $OPTARG are the option name and argument set by getopts.
|
||||
pearg() {
|
||||
printf "%s: -$arg invalid argument -- $OPTARG; %s\n" "$0" "$*" >&2
|
||||
}
|
||||
|
||||
|
||||
OPTIND=1
|
||||
while getopts "p:t:c:f:s:r:RBCKhv" arg; do
|
||||
case $arg in
|
||||
p)
|
||||
if is_N "$OPTARG" && ((OPTARG > 0)); then
|
||||
p=$OPTARG
|
||||
else
|
||||
pearg 'must be an integer and greater than 0'
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
t)
|
||||
if [[ "$OPTARG" = c???????????????? ]]; then
|
||||
V+=(${#sets[@]})
|
||||
sets+=("${OPTARG:1}")
|
||||
elif is_N "$OPTARG" && ((OPTARG < ${#sets[@]})); then
|
||||
V+=($OPTARG)
|
||||
else
|
||||
pearg 'must be an integer and from 0 to' \
|
||||
"$((${#sets[@]} - 1)); or a custom type"
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
c)
|
||||
if [[ $OPTARG == '#'* ]]; then
|
||||
if ! is_hex "${OPTARG:1}"; then
|
||||
pearg 'unrecognized hexadecimal string'
|
||||
return 1
|
||||
fi
|
||||
if ((16$OPTARG >= COLORS)); then
|
||||
pearg 'hexadecimal must be from #0 to' \
|
||||
"#$(printf '%X' $((COLORS - 1)))"
|
||||
return 1
|
||||
fi
|
||||
C+=($((16$OPTARG)))
|
||||
elif is_N "$OPTARG" && ((OPTARG < COLORS)); then
|
||||
C+=($OPTARG)
|
||||
else
|
||||
pearg "must be an integer and from 0 to $((COLORS - 1));" \
|
||||
'or a hexadecimal string with # prefix'
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
f)
|
||||
if is_N "$OPTARG" && ((OPTARG >= 20 && OPTARG <= 100)); then
|
||||
f=$OPTARG
|
||||
else
|
||||
pearg 'must be an integer and from 20 to 100'
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
s)
|
||||
if is_N "$OPTARG" && ((OPTARG >= 5 && OPTARG <= 15)); then
|
||||
s=$OPTARG
|
||||
else
|
||||
pearg 'must be an integer and from 5 to 15'
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
r)
|
||||
if is_N "$OPTARG"; then
|
||||
r=$OPTARG
|
||||
else
|
||||
pearg 'must be a non-negative integer'
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
R) RNDSTART=1;;
|
||||
B) BOLD=0;;
|
||||
C) NOCOLOR=1;;
|
||||
K) KEEPCT=1;;
|
||||
h)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
v) echo "$(basename -- "$0") $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
if (($#)); then
|
||||
printf "$0: illegal arguments -- $*; no arguments allowed\n" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
cleanup() {
|
||||
# clear out standard input
|
||||
read -t 0.001 && cat </dev/stdin>/dev/null
|
||||
|
||||
tput reset # fix for konsole, see pipeseroni/pipes.sh#43
|
||||
tput rmcup
|
||||
tput cnorm
|
||||
stty echo
|
||||
printf "$SGR0"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
resize() {
|
||||
w=$(tput cols) h=$(tput lines)
|
||||
}
|
||||
|
||||
|
||||
init_pipes() {
|
||||
# +_CP_init_pipes
|
||||
local i
|
||||
|
||||
ci=$((KEEPCT ? 0 : CN * RANDOM / M))
|
||||
vi=$((KEEPCT ? 0 : VN * RANDOM / M))
|
||||
for ((i = 0; i < p; i++)); do
|
||||
((
|
||||
n[i] = 0,
|
||||
l[i] = RNDSTART ? RANDOM % 4 : 0,
|
||||
x[i] = RNDSTART ? w * RANDOM / M : w / 2,
|
||||
y[i] = RNDSTART ? h * RANDOM / M : h / 2,
|
||||
v[i] = V[vi]
|
||||
))
|
||||
c[i]=${E[ci]}
|
||||
((ci = (ci + 1) % CN, vi = (vi + 1) % VN))
|
||||
done
|
||||
# -_CP_init_pipes
|
||||
}
|
||||
|
||||
|
||||
init_screen() {
|
||||
stty -echo
|
||||
tput smcup
|
||||
tput civis
|
||||
tput clear
|
||||
trap cleanup HUP TERM
|
||||
|
||||
resize
|
||||
trap resize SIGWINCH
|
||||
}
|
||||
|
||||
|
||||
main() {
|
||||
# simple pre-check of TERM, tput's error message should be enough
|
||||
tput -T "$TERM" sgr0 >/dev/null || return $?
|
||||
|
||||
# +_CP_init_termcap_vars
|
||||
COLORS=$(tput colors) # COLORS - 1 == maximum color index for -c argument
|
||||
SGR0=$(tput sgr0)
|
||||
SGR_BOLD=$(tput bold)
|
||||
# -_CP_init_termcap_vars
|
||||
|
||||
parse "$@" || return $?
|
||||
|
||||
# +_CP_init_VC
|
||||
# set default values if not by options
|
||||
((${#V[@]})) || V=(0)
|
||||
VN=${#V[@]}
|
||||
((${#C[@]})) || C=(1 2 3 4 5 6 7 0)
|
||||
CN=${#C[@]}
|
||||
# -_CP_init_VC
|
||||
|
||||
# +_CP_init_E
|
||||
# generate E[] based on BOLD (SGR_BOLD), NOCOLOR, and C for each element in
|
||||
# C, a corresponding element in E[] =
|
||||
# SGR0
|
||||
# + SGR_BOLD, if BOLD
|
||||
# + tput setaf C, if !NOCOLOR
|
||||
local i
|
||||
for ((i = 0; i < CN; i++)) {
|
||||
E[i]=$SGR0
|
||||
((BOLD)) && E[i]+=$SGR_BOLD
|
||||
((NOCOLOR)) || E[i]+=$(tput setaf ${C[i]})
|
||||
}
|
||||
# -_CP_init_E
|
||||
|
||||
# +_CP_init_SETS
|
||||
local i j
|
||||
for ((i = 0; i < ${#sets[@]}; i++)) {
|
||||
for ((j = 0; j < 16; j++)) {
|
||||
SETS+=("${sets[i]:j:1}")
|
||||
}
|
||||
}
|
||||
unset i j
|
||||
# -_CP_init_SETS
|
||||
|
||||
init_screen
|
||||
init_pipes
|
||||
|
||||
# any key press exits the loop and this script
|
||||
trap 'break 2' INT
|
||||
|
||||
local i
|
||||
while REPLY=; do
|
||||
read -t 0.0$((1000 / f)) -n 1 2>/dev/null
|
||||
case "$REPLY" in
|
||||
P) ((s = s < 15 ? s + 1 : s));;
|
||||
O) ((s = s > 3 ? s - 1 : s));;
|
||||
F) ((f = f < 100 ? f + 1 : f));;
|
||||
D) ((f = f > 20 ? f - 1 : f));;
|
||||
B) ((BOLD = (BOLD + 1) % 2));;
|
||||
C) ((NOCOLOR = (NOCOLOR + 1) % 2));;
|
||||
K) ((KEEPCT = (KEEPCT + 1) % 2));;
|
||||
?) break;;
|
||||
esac
|
||||
for ((i = 0; i < p; i++)); do
|
||||
# New position:
|
||||
# l[] direction = 0: up, 1: right, 2: down, 3: left
|
||||
# +_CP_newpos
|
||||
((l[i] % 2)) && ((x[i] += -l[i] + 2, 1)) || ((y[i] += l[i] - 1))
|
||||
# -_CP_newpos
|
||||
|
||||
# Loop on edges (change color on loop):
|
||||
# +_CP_warp
|
||||
((!KEEPCT && (x[i] >= w || x[i] < 0 || y[i] >= h || y[i] < 0))) \
|
||||
&& { c[i]=${E[CN * RANDOM / M]}; ((v[i] = V[VN * RANDOM / M])); }
|
||||
((x[i] = (x[i] + w) % w,
|
||||
y[i] = (y[i] + h) % h))
|
||||
# -_CP_warp
|
||||
|
||||
# new turning direction:
|
||||
# $((s - 1)) in $s, going straight, therefore n[i] == l[i];
|
||||
# and 1 in $s that pipe makes a right or left turn
|
||||
#
|
||||
# s * RANDOM / M - 1 == 0
|
||||
# n[i] == -1
|
||||
# => n[i] == l[i] + 1 or l[i] - 1
|
||||
# +_CP_newdir
|
||||
((
|
||||
n[i] = s * RANDOM / M - 1,
|
||||
n[i] = n[i] >= 0 ? l[i] : l[i] + (2 * (RANDOM % 2) - 1),
|
||||
n[i] = (n[i] + 4) % 4
|
||||
))
|
||||
# -_CP_newdir
|
||||
|
||||
# Print:
|
||||
# +_CP_print
|
||||
printf '\e[%d;%dH%s%s' \
|
||||
$((y[i] + 1)) $((x[i] + 1)) ${c[i]} \
|
||||
"${SETS[v[i] * 16 + l[i] * 4 + n[i]]}"
|
||||
# -_CP_print
|
||||
l[i]=${n[i]}
|
||||
done
|
||||
((r > 0 && t * p >= r)) && tput reset && tput civis && t=0 || ((t++))
|
||||
done
|
||||
|
||||
cleanup
|
||||
}
|
||||
|
||||
|
||||
# when being sourced, $0 == bash, only invoke main when they are the same
|
||||
[[ "$0" != "$BASH_SOURCE" ]] || main "$@"
|
||||
Executable
+128
@@ -0,0 +1,128 @@
|
||||
#!/bin/bash
|
||||
# Let it Rain!
|
||||
# Copyright (C) 2011, 2013 by Yu-Jie Lin
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Blog: https://yjlv.blogstpo.com/2013/07/let-it-rain.html
|
||||
# Gif : https://lh5.googleusercontent.com/-0WJ1vSZcFPs/UdadOwdPEXI/AAAAAAAAE-c/6kuH9hP3cUo/s800/rain.sh.gif
|
||||
# Clip: https://youtu.be/EssRgAh2w_c
|
||||
#
|
||||
# Modified from falling-<3s.sh:
|
||||
# https://yjlv.blogstpo.com/2011/02/time-to-have-falling-hearts-screensaver.html
|
||||
|
||||
RAINS=("|" "│" "┃" "┆" "┇" "┊" "┋" "╽" "╿")
|
||||
COLORS=("\e[37m" "\e[37;1m")
|
||||
# More from 256 color mode
|
||||
for i in {244..255}; do
|
||||
COLORS=("${COLORS[@]}" "\e[38;5;${i}m")
|
||||
done
|
||||
NRAINS=${#RAINS[@]}
|
||||
NCOLORS=${#COLORS[@]}
|
||||
NUM_RAIN_METADATA=5
|
||||
|
||||
|
||||
sigwinch() {
|
||||
TERM_WIDTH=$(tput cols)
|
||||
TERM_HEIGHT=$(tput lines)
|
||||
STEP_DURATION=0.025
|
||||
((MAX_RAINS = TERM_WIDTH * TERM_HEIGHT / 4))
|
||||
((MAX_RAIN_LENGTH = TERM_HEIGHT < 10 ? 1 : TERM_HEIGHT / 10))
|
||||
# In percentage
|
||||
((NEW_RAIN_ODD = TERM_HEIGHT > 50 ? 100 : TERM_HEIGHT * 2))
|
||||
((NEW_RAIN_ODD = NEW_RAIN_ODD * 75 / 100))
|
||||
((FALLING_ODD = TERM_HEIGHT > 25 ? 100 : TERM_HEIGHT * 4))
|
||||
((FALLING_ODD = FALLING_ODD * 90 / 100))
|
||||
}
|
||||
|
||||
do_exit() {
|
||||
echo -ne "\e[${TERM_HEIGHT};1H\e[0K"
|
||||
|
||||
# Show cursor and echo stdin
|
||||
echo -ne "\e[?25h"
|
||||
stty echo
|
||||
exit 0
|
||||
}
|
||||
|
||||
do_render() {
|
||||
# Clean screen first
|
||||
for ((idx = 0; idx < num_rains * NUM_RAIN_METADATA; idx += NUM_RAIN_METADATA)); do
|
||||
X=${rains[idx]}
|
||||
Y=${rains[idx + 1]}
|
||||
LENGTH=${rains[idx + 4]}
|
||||
for ((y = Y; y < Y + LENGTH; y++)); do
|
||||
(( y < 1 || y > TERM_HEIGHT )) && continue
|
||||
echo -ne "\e[${y};${X}H "
|
||||
done
|
||||
done
|
||||
|
||||
for ((idx = 0; idx < num_rains * NUM_RAIN_METADATA; idx += NUM_RAIN_METADATA)); do
|
||||
if ((100 * RANDOM / 32768 < FALLING_ODD)); then
|
||||
# Falling
|
||||
if ((++rains[idx + 1] > TERM_HEIGHT)); then
|
||||
# Out of screen, bye sweet <3
|
||||
rains=("${rains[@]:0:idx}"
|
||||
"${rains[@]:idx+NUM_RAIN_METADATA:num_rains*NUM_RAIN_METADATA}")
|
||||
((num_rains--))
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
X=${rains[idx]}
|
||||
Y=${rains[idx + 1]}
|
||||
RAIN=${rains[idx + 2]}
|
||||
COLOR=${rains[idx + 3]}
|
||||
LENGTH=${rains[idx + 4]}
|
||||
for ((y = Y; y < Y + LENGTH; y++)); do
|
||||
(( y < 1 || y > TERM_HEIGHT )) && continue
|
||||
echo -ne "\e[${y};${X}H${COLOR}${RAIN}"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
trap do_exit TERM INT
|
||||
trap sigwinch WINCH
|
||||
# No echo stdin and hide the cursor
|
||||
stty -echo
|
||||
echo -ne "\e[?25l"
|
||||
|
||||
echo -ne "\e[2J"
|
||||
rains=()
|
||||
sigwinch
|
||||
while :; do
|
||||
read -n 1 -t $STEP_DURATION ch
|
||||
case "$ch" in
|
||||
q|Q)
|
||||
do_exit
|
||||
;;
|
||||
esac
|
||||
|
||||
if ((num_rains < MAX_RAINS)) && ((100 * RANDOM / 32768 < NEW_RAIN_ODD)); then
|
||||
# Need new |, 1-based
|
||||
RAIN="${RAINS[NRAINS * RANDOM / 32768]}"
|
||||
COLOR="${COLORS[NCOLORS * RANDOM / 32768]}"
|
||||
LENGTH=$((MAX_RAIN_LENGTH * RANDOM / 32768 + 1))
|
||||
X=$((TERM_WIDTH * RANDOM / 32768 + 1))
|
||||
Y=$((1 - LENGTH))
|
||||
rains=("${rains[@]}" "$X" "$Y" "$RAIN" "$COLOR" "$LENGTH")
|
||||
((num_rains++))
|
||||
fi
|
||||
|
||||
# Let rain fall!
|
||||
do_render
|
||||
done
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
#!/bin/bash
|
||||
|
||||
# DISCLAIMER: this script has been started solely by me (sayan01)
|
||||
# and has had contributions from others like Nicholas-Baron and
|
||||
# juanCortelezzi (refer to contributors on github for details)
|
||||
# this script is not based off of any other work by anyone else,
|
||||
# nor is it made in association with anyone else, regardless of
|
||||
# their claims.
|
||||
|
||||
# Dependencies: mpv youtube-dl fzf rofi/dmenu gnu-grep
|
||||
|
||||
# NOTE: if you don't have gnu grep, you can replace grep with rg
|
||||
|
||||
# Explain usage
|
||||
function usage () {
|
||||
printf "usage: yt\n"
|
||||
printf " -h help\n"
|
||||
printf " -c channels/subscriptions\n"
|
||||
printf " -s query search\n"
|
||||
printf " -g / -r gui mode (rofi/dmenu)\n"
|
||||
printf " -m music mode (audio only) [dont use with -r]\n"
|
||||
printf " nothing use defaults (search from prompt)\n"
|
||||
printf "\n"
|
||||
printf "add channel names to the file %s to show them\n" "$sublistpath"
|
||||
printf "in yt -c option. First word should be channel url, optionally\n"
|
||||
printf "followed by tab and then anything else (channel name/description)\n"
|
||||
printf "channels not in sublist can be viewed by typing their url in the prompt\n"
|
||||
printf "\n"
|
||||
printf "example file format:\n"
|
||||
printf "markrober Mark Rober\n"
|
||||
printf "vsauce1 VSauce Michael Steven's Channel\n"
|
||||
printf "BlackGryph0n Black Gryph0n Gabriel Brown signs stuff\n"
|
||||
printf "TomScottGo Tom Scott\n"
|
||||
printf "danielthrasher Daniel Thrasher\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Use defaults if no arguments provided
|
||||
useDefaults="f"
|
||||
if [[ ${#} -eq 0 ]]; then
|
||||
useDefaults="t"
|
||||
fi
|
||||
|
||||
# Available flags
|
||||
optstring=":s:cgrhm"
|
||||
|
||||
defcmd="fzf"
|
||||
defaction="s"
|
||||
guicmd="rofi -dmenu -i" # uncomment next line for dmenu
|
||||
# guicmd="dmenu -i -l 15"
|
||||
|
||||
# Defaults
|
||||
promptcmd="$defcmd"
|
||||
action="$defaction"
|
||||
isGui="f"
|
||||
query=""
|
||||
mpv_options=""
|
||||
|
||||
max_resolution="480"
|
||||
max_fps="30"
|
||||
ignore_codec=""
|
||||
ytdlformats="bestvideo"
|
||||
|
||||
if [ -n "$max_resolution" ] ; then
|
||||
ytdlformats+="[height<=?$max_resolution]"
|
||||
fi
|
||||
if [ -n "$max_fps" ] ; then
|
||||
ytdlformats+="[fps<=?$max_fps]"
|
||||
fi
|
||||
if [ -n "$ignore_codec" ] ; then
|
||||
ytdlformats+="[vcodec!=$ignore_codec]"
|
||||
fi
|
||||
ytdlformats+="+bestaudio/best"
|
||||
|
||||
# Subscription list
|
||||
mkdir -p "${HOME:-}/.config/yt"
|
||||
sublistpath="${HOME:-}/.config/yt/sublist"
|
||||
sublist=""
|
||||
[ -f "$sublistpath" ] && sublist=$(cat "$sublistpath")
|
||||
|
||||
# If not using defaults, search for flags
|
||||
if [[ $useDefaults = "f" ]]; then
|
||||
while getopts ${optstring} arg; do
|
||||
case "${arg}" in
|
||||
s)
|
||||
# Search in YouTube for a query
|
||||
action="s"
|
||||
query="${OPTARG}" ;;
|
||||
c)
|
||||
# Search in subscriptions for a specific channel
|
||||
action="c"
|
||||
query="${OPTARG}" ;;
|
||||
g|r)
|
||||
# Set gui mode to true and change the prompt to gui prompt
|
||||
isGui="t"
|
||||
promptcmd="$guicmd" ;;
|
||||
m)
|
||||
# Make the mpv headless
|
||||
mpv_options+="--no-video" ;;
|
||||
h)
|
||||
# Display help / usage
|
||||
usage ;;
|
||||
\?|:)
|
||||
# Wrong args -> exit with explanation of usage
|
||||
echo "invalid option: -${OPTARG}"
|
||||
echo
|
||||
usage
|
||||
exit 1 ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
# If no query is set with flags, then ask for one
|
||||
if [ -z "$query" ]; then
|
||||
# Ask for a channel
|
||||
if [[ $action = "c" ]]; then
|
||||
# If in gui mode, use gui prompt
|
||||
if [[ $isGui = "t" ]]; then
|
||||
query=$($promptcmd -p "Channel: " <<< "$sublist")
|
||||
promptcmd="$promptcmd -p Video:"
|
||||
else
|
||||
query=$($promptcmd --print-query <<< "$sublist" | tail -n1)
|
||||
fi
|
||||
query=$(echo "$query" | awk '{print $1}')
|
||||
else
|
||||
# Ask for a query
|
||||
# If in gui mode, use gui prompt
|
||||
if [[ $isGui = "t" ]]; then
|
||||
query=$(echo | $promptcmd -p "Search: ")
|
||||
promptcmd="$promptcmd -p Video:"
|
||||
else
|
||||
echo -n "Search: "
|
||||
read -r query
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Program cancelled -> exit
|
||||
if [ -z "$query" ]; then exit; fi
|
||||
|
||||
# Clean query / channel
|
||||
query=$(sed \
|
||||
-e 's|+|%2B|g'\
|
||||
-e 's|#|%23|g'\
|
||||
-e 's|&|%26|g'\
|
||||
-e 's| |+|g' <<< "$query")
|
||||
|
||||
# If channel, look for channel vids
|
||||
if [[ $action = "c" ]]; then
|
||||
response=$(curl -s "https://www.youtube.com/c/$query/videos" |\
|
||||
sed "s/{\"gridVideoRenderer/\n\n&/g" |\
|
||||
sed "s/}]}}}]}}/&\n\n/g" |\
|
||||
awk -v ORS="\n\n" '/gridVideoRenderer/')
|
||||
|
||||
# If unable to fetch the YouTube results page, inform and exit
|
||||
if ! grep -q "gridVideoRenderer" <<< "$response"; then echo "unable to fetch yt"; exit 1; fi
|
||||
|
||||
# Regex expression to match video entries from YouTube channel page
|
||||
# Get the list of videos and their ids to ids
|
||||
ids=$(awk -F '[""]' '{print $6 "\t" $50;}' <<< "$response" | grep "^\S")
|
||||
|
||||
# URL prefix for videos
|
||||
videolink="https://youtu.be/"
|
||||
|
||||
# Prompt the results to user infinitely until they exit (escape)
|
||||
while true; do
|
||||
choice=$(echo -e "$ids" | cut -d' ' -f2 | $promptcmd) # Don't show id
|
||||
if [ -z "$choice" ]; then exit; fi # If esc-ed then exit
|
||||
id=$(echo -e "$ids" | grep -Fwm1 "$choice" | cut -d' ' -f1) # Get id of choice
|
||||
echo -e "$choice\t($id)"
|
||||
case $id in
|
||||
???????????) mpv "$videolink$id" "$mpv_options" --ytdl-format="$ytdlformats";;
|
||||
*) exit ;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
# If in search, show query result vids
|
||||
response="$(curl -s "https://www.youtube.com/results?search_query=$query" |\
|
||||
sed 's|\\.||g')"
|
||||
# If unable to fetch the YouTube results page, inform and exit
|
||||
if ! grep -q "script" <<< "$response"; then echo "unable to fetch yt"; exit 1; fi
|
||||
# Regex expression to match video and playlist entries from YouTube result page
|
||||
vgrep='"videoRenderer":{"videoId":"\K.{11}".+?"text":".+?[^\\](?=")'
|
||||
pgrep='"playlistRenderer":{"playlistId":"\K.{34}?","title":{"simpleText":".+?[^\"](?=")'
|
||||
# Grep the id and title
|
||||
# Return them in format id (type) title
|
||||
getresults() {
|
||||
grep -oP "$1" <<< "$response" |\
|
||||
awk -F\" -v p="$2" '{ print $1 "\t" p " " $NF}'
|
||||
}
|
||||
# Get the list of videos/playlists and their ids in videoids and playlistids
|
||||
videoids=$(getresults "$vgrep")
|
||||
playlistids=$(getresults "$pgrep" "(playlist)")
|
||||
# If there are playlists or videos, append them to list
|
||||
[ -n "$playlistids" ] && ids="$playlistids\n"
|
||||
[ -n "$videoids" ] && ids="$ids$videoids"
|
||||
# URL prefix for videos and playlists
|
||||
videolink="https://youtu.be/"
|
||||
playlink="https://youtube.com/playlist?list="
|
||||
# Prompt the results to user infinitely until they exit (escape)
|
||||
while true; do
|
||||
choice=$(echo -e "$ids" | cut -d' ' -f2 | $promptcmd) # Don't show id
|
||||
if [ -z "$choice" ]; then exit; fi # If esc-ed then exit
|
||||
id=$(echo -e "$ids" | grep -Fwm1 "$choice" | cut -d' ' -f1) # Get id of choice
|
||||
echo -e "$choice\t($id)"
|
||||
case $id in
|
||||
# 11 digit id = video
|
||||
???????????) mpv "$videolink$id" $mpv_options --ytdl-format="$ytdlformats";;
|
||||
# 34 digit id = playlist
|
||||
??????????????????????????????????) mpv "$playlink$id" $mpv_options --ytdl-format="$ytdlformats";;
|
||||
*) exit ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
Reference in new issue
Block a user