2
0
Fork 0
This commit is contained in:
0x736561 2024-03-18 11:04:23 -03:00
parent e20955cac2
commit bf3337d6fa
25 changed files with 307 additions and 82 deletions

View file

@ -0,0 +1,79 @@
#version 330
in vec2 fragCoord;
out vec4 fragColor;
// bar values. defaults to left channels first (low to high), then right (high to low).
uniform float bars[512];
uniform int bars_count; // number of bars (left + right) (configurable)
uniform int bar_width; // bar width (configurable), not used here
uniform int bar_spacing; // space bewteen bars (configurable)
uniform vec3 u_resolution; // window resolution
//colors, configurable in cava config file (r,g,b) (0.0 - 1.0)
uniform vec3 bg_color; // background color
uniform vec3 fg_color; // foreground color
uniform int gradient_count;
uniform vec3 gradient_colors[8]; // gradient colors
vec3 normalize_C(float y,vec3 col_1, vec3 col_2, float y_min, float y_max)
{
//create color based on fraction of this color and next color
float yr = (y - y_min) / (y_max - y_min);
return col_1 * (1.0 - yr) + col_2 * yr;
}
void main()
{
// find which bar to use based on where we are on the x axis
float x = u_resolution.x * fragCoord.x;
int bar = int(bars_count * fragCoord.x);
//calculate a bar size
float bar_size = u_resolution.x / bars_count;
//the y coordinate and bar values are the same
float y = bars[bar];
// make sure there is a thin line at bottom
if (y * u_resolution.y < 1.0)
{
y = 1.0 / u_resolution.y;
}
//draw the bar up to current height
if (y > fragCoord.y)
{
//make some space between bars basen on settings
if (x > (bar + 1) * (bar_size) - bar_spacing)
{
fragColor = vec4(bg_color,1.0);
}
else
{
if (gradient_count == 0)
{
fragColor = vec4(fg_color,1.0);
}
else
{
//find which color in the configured gradient we are at
int color = int((gradient_count - 1) * fragCoord.y);
//find where on y this and next color is supposed to be
float y_min = color / (gradient_count - 1.0);
float y_max = (color + 1.0) / (gradient_count - 1.0);
//make color
fragColor = vec4(normalize_C(fragCoord.y, gradient_colors[color], gradient_colors[color + 1], y_min, y_max), 1.0);
}
}
}
else
{
fragColor = vec4(bg_color,1.0);
}
}

View file

@ -0,0 +1,34 @@
#version 330
in vec2 fragCoord;
out vec4 fragColor;
// bar values. defaults to left channels first (low to high), then right (high to low).
uniform float bars[512];
uniform int bars_count; // number of bars (left + right) (configurable)
uniform vec3 u_resolution; // window resolution, not used here
//colors, configurable in cava config file
uniform vec3 bg_color; // background color(r,g,b) (0.0 - 1.0), not used here
uniform vec3 fg_color; // foreground color, not used here
void main()
{
// find which bar to use based on where we are on the x axis
int bar = int(bars_count * fragCoord.x);
float bar_y = 1.0 - abs((fragCoord.y - 0.5)) * 2.0;
float y = (bars[bar]) * bar_y;
float bar_x = (fragCoord.x - float(bar) / float(bars_count)) * bars_count;
float bar_r = 1.0 - abs((bar_x - 0.5)) * 2;
bar_r = bar_r * bar_r * 2;
// set color
fragColor.r = fg_color.x * y * bar_r;
fragColor.g = fg_color.y * y * bar_r;
fragColor.b = fg_color.z * y * bar_r;
}

View file

@ -0,0 +1,14 @@
#version 330
// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;
// Output data ; will be interpolated for each fragment.
out vec2 fragCoord;
void main()
{
gl_Position = vec4(vertexPosition_modelspace,1);
fragCoord = (vertexPosition_modelspace.xy+vec2(1,1))/2.0;
}

View file

@ -1,17 +1,18 @@
include ~/.config/sway/temas/gruvbox
### Configurações gerais ###
font pango:JetBrainsMono 8
default_floating_border none
default_border pixel 2
smart_borders on
smart_gaps on
gaps inner 10
xwayland disable
### Inicialização ###
exec_always {
swaymsg seat seat0 hide_cursor 5000
swaymsg seat seat0 hide_cursor when-typing enable
swaymsg default_border pixel 2
}
exec {
@ -19,6 +20,7 @@ exec {
gsettings set org.gnome.desktop.interface icon-theme Gruvbox-Material-Dark
gsettings set org.gnome.desktop.interface font-name "JetBrains Mono"
gsettings set org.gnome.desktop.interface cursor-theme macOS-Monterey
swayidle -C ~/.config/sway/idle
wlsunset -t 3500 -s 18:00 -S 5:30
export MOZ_ENABLE_WAYLAND=1
mako
@ -26,9 +28,14 @@ exec {
}
### Configuração da paleta de cores ###
client.focused $1 $1 $0 $1 $1
client.focused_inactive $0 $0 $2 $0 $0
client.unfocused $0 $0 $2 $0 $0
set $0 #282828
set $1 #98971a
set $2 #ebdbb2
client.focused $1 $1 $0 $1 $1
client.focused_inactive $0 $0 $2 $0 $0
client.unfocused $0 $0 $2 $0 $0
bar {
position top
@ -42,36 +49,20 @@ bar {
}
### Wallpaper ###
output * background ~/.config/sway/wp fill
output * background ~/.config/sway/wp fill
### Output ###
### swaymsg -t get_outputs ###
set $display1 "eDP-1"
set $display2 "HDMI-A-1"
set $display1 "eDP-1"
set $display2 "HDMI-A-1"
workspace 1 output $display1
workspace 2 output $display1
workspace 3 output $display1
workspace 4 output $display1
workspace 5 output $display1
workspace 6 output $display2 $display1
workspace 7 output $display2 $display1
workspace 8 output $display2 $display1
workspace 9 output $display2 $display1
workspace 10 output $display2 $display1
### Teclado ###
# output HDMI-A-1 resolution 1920x1080 position 1920,0
# You can get the names of your outputs by running: swaymsg -t get_outputs
input 1:1:AT_Translated_Set_2_keyboard xkb_layout "br"
### Teclas de atalho ###
set $mod Mod4
set $term foot -c ~/.config/sway/etc/foot.ini
set $web qutebrowser
set $files $term lf -config ~/.config/sway/etc/lf/lfrc
set $scripts ~/.config/sway/scripts
### Touchpad
### Touchpad ###
input "1267:12734:MSFT0001:01_04F3:31BE_Touchpad" {
dwt enabled
@ -80,7 +71,7 @@ set $scripts ~/.config/sway/scripts
middle_emulation disabled
}
### Gestos
### Gestos ###
bindgesture swipe:left workspace prev
bindgesture swipe:right workspace next
@ -89,11 +80,19 @@ set $scripts ~/.config/sway/scripts
bindgesture pinch:inward+left move left
bindgesture pinch:inward+right move right
### Teclado
input 1:1:AT_Translated_Set_2_keyboard xkb_layout "br"
### Switch ###
set $lock swaylock -e -i ~/.config/sway/wp
bindswitch lid:on exec $lock
### Teclas de atalho ###
set $mod Mod4
set $term foot
set $web qutebrowser
set $files $term lf
### Teclas de atalho
# Desligar tela do notebook
bindsym $mod+o output "eDP-1" toggle
@ -117,32 +116,32 @@ set $scripts ~/.config/sway/scripts
bindsym XF86MonBrightnessDown exec brightnessctl s 3%-
# Menu
bindsym $mod+p exec rofi -config ~/.config/sway/etc/rofi/config.rasi -show run
bindsym $mod+d exec rofi -config ~/.config/sway/etc/rofi/config.rasi -show drun -show-icons
bindsym $mod+p exec rofi -show run
bindsym $mod+d exec rofi -show drun -show-icons
# Seletor de emoji
bindsym $mod+semicolon exec rofi -config ~/.config/sway/etc/rofi/config.rasi -show emoji
bindsym $mod+semicolon exec rofi -show emoji
# Explorador de arquivos
bindsym $mod+e exec $files
# Menu de energia
bindsym $mod+delete exec $scripts/power_menu
bindsym $mod+delete exec power_menu
# Explorador de senhas
bindsym $mod+s exec $scripts/pass_menu
bindsym $mod+s exec pass_menu
# Gerenciador de afazeres
bindsym $mod+g exec $scripts/todo
bindsym $mod+g exec todo
# Menu wifi
bindsym $mod+y exec $scripts/wifi_menu
bindsym $mod+y exec wifi_menu
# Trocar de wallpaper
bindsym $mod+i exec $scripts/walls
bindsym $mod+i exec walls
# rofi-mpd
bindsym $mod+c exec $scripts/rofi-mpd -a
bindsym $mod+c exec rofi-mpd -a
# Abrir terminal
bindsym $mod+Return exec $term
@ -164,7 +163,7 @@ set $scripts ~/.config/sway/scripts
bindsym Ctrl+Print exec foot wf-recorder -a -x yuv420p -c libx264 -f rec.mp4
# cava
bindsym $mod+v exec cava -p ~/.config/sway/etc/cava
bindsym $mod+v exec cava
# Newsboat
bindsym $mod+n exec foot newsboat
@ -172,9 +171,8 @@ set $scripts ~/.config/sway/scripts
# Neomutt
bindsym $mod+m exec foot neomutt
### Movimentação
# teclas Vim-like
### Movimentação ###
set $left h
set $down j
set $up k
@ -201,7 +199,17 @@ set $scripts ~/.config/sway/scripts
bindsym $mod+Alt+$up move up
bindsym $mod+Alt+$right move right
### Workspaces:
### Workspaces ###
workspace 1 output $display1
workspace 2 output $display1
workspace 3 output $display1
workspace 4 output $display1
workspace 5 output $display1
workspace 6 output $display2 $display1
workspace 7 output $display2 $display1
workspace 8 output $display2 $display1
workspace 9 output $display2 $display1
workspace 10 output $display2 $display1
# Switch to workspace
bindsym $mod+1 workspace number 1
@ -215,6 +223,11 @@ set $scripts ~/.config/sway/scripts
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
bindsym $mod+shift+$right workspace next
bindsym $mod+shift+$left workspace prev
bindsym $mod+shift+$up workspace next
bindsym $mod+shift+$down workspace prev
# Move focused container to workspace
bindsym $mod+Alt+1 move container to workspace number 1
bindsym $mod+Alt+2 move container to workspace number 2
@ -227,7 +240,7 @@ set $scripts ~/.config/sway/scripts
bindsym $mod+Alt+9 move container to workspace number 9
bindsym $mod+Alt+0 move container to workspace number 10
### Layout stuff:
### Layout ###
bindsym $mod+x layout tabbed
bindsym $mod+z layout toggle split
@ -237,7 +250,7 @@ set $scripts ~/.config/sway/scripts
bindsym $mod+Tab floating toggle
bindsym Alt+Tab focus mode_toggle
### Scratchpad:
### Scratchpad ###
bindsym $mod+Alt+minus move scratchpad
bindsym $mod+minus scratchpad show

2
.config/sway/idle Normal file
View file

@ -0,0 +1,2 @@
timeout 300 'swaylock -e -i ~/.config/sway/wp'
before-sleep 'swaylock -e -i ~/.config/sway/wp'

View file

@ -1,8 +0,0 @@
#!/bin/env bash
CONFIRMACAO="$(printf "Sim\nNão" | rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i -p "Você tem certeza?")"
case "$CONFIRMACAO" in
Sim) echo 0;;
*) exit;;
esac

View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
ESCOLHA=$(ls ~/.config/sway/wallpapers/ | rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i -p "Escolha o wallpaper")
cp ~/.config/sway/wallpapers/$ESCOLHA ~/.config/sway/wp
swaymsg reload &

View file

@ -1,3 +0,0 @@
set $0 #282828
set $1 #98971a
set $2 #ebdbb2

82
.local/bin/cvrt Executable file
View file

@ -0,0 +1,82 @@
#!/bin/bash
print_help() {
cat << EOF
Usage: cvrt [infiles...] [FFMPEG options] [outfile/extension]
Options
-h Print this help screen
-e Edit the cvrt script (add defaults)
-d Delete infiles after processing (DANGEROUS!)
-* Other FFMPEG options (ie. -c:v libx264)
EOF
exit 0
}
# Universal FFMPEG options
OPT=" -hide_banner -loglevel error -stats"
declare -a FILES=()
[ -z $EDITOR ] && EDITOR=nano
# Find file list
i=1
while [ $i -le $# ]; do
case "${!i}" in
-e) $EDITOR `readlink -f "$0"`; exit 0 ;;
-d) DELETE=true ;;
-h) print_help ;;
-*) OPT="$OPT ${!i} ${@:$((i+1)):1}"; ((i++)) ;;
*) FILES+=( "${!i}" ) ;;
esac
((i++))
done
# Error check
[ -z "${FILES[1]}" ] && print_help
[ -n "$DELETE" ] && echo "WARNING: Your infiles will be DELETED!"
# Get outfile and extension
OUTFILE="${FILES[-1]}"
unset "FILES[-1]"
echo "$OUTFILE" | grep -q "." && EXT="${OUTFILE##*.}" || EXT="$OUTFILE"
# Custom defaults
case "$EXT" in
*flac) OPT="-vn $OPT" ;;
*mov) OPT="-c:v mpeg4 -q:v 0 -pix_fmt yuv420p -c:a pcm_s16le $OPT" ;;
*mp4) OPT="-c:v libx264 -crf 21 -c:a libopus -b:a 320k $OPT" ;;
esac
# Concatenate files
if ([ $EXT != $OUTFILE ] && [ -n "${FILES[1]}" ]); then
echo "Attempting to concatenate infiles into $OUTFILE"
echo "# Generated by cvrt" > mylist.txt
for i in "${FILES[@]}"; do
i="${i//\'/\'\\\'\'}"
echo "file '$i'" >> mylist.txt
done
ffmpeg -f concat -safe 0 -i mylist.txt $OPT $OUTFILE
if [ -n "$DELETE" ]; then
for i in "${FILES[@]}"; do
rm "$i"
done
fi
rm mylist.txt
exit 0
# Single infile --> outfile
elif ([ $EXT != $OUTFILE ] && [ -z "${FILES[2]}" ]); then
ffmpeg -i "${FILES[0]}" $OPT "$OUTFILE"
[ -n "$DELETE" ] && rm "${FILES[0]}"
exit 0
fi
# Multiple infiles ---> outfiles
for i in "${FILES[@]}"; do
ffmpeg -i "$i" $OPT "${i%.*}.$EXT"
[ -n "$DELETE" ] && rm "$i"
done
exit 0

BIN
.local/bin/gendoc Executable file

Binary file not shown.

8
.local/bin/nag Executable file
View file

@ -0,0 +1,8 @@
#!/bin/env bash
CONFIRMACAO="$(printf "Sim\nNão" | rofi -dmenu -i -p "Você tem certeza?")"
case "$CONFIRMACAO" in
Sim) echo 0;;
*) exit;;
esac

View file

@ -24,7 +24,7 @@ while [ "$DONE" -eq 0 ] ; do
if [ "$LEVEL" -ne 0 ] ; then
password_files=(".." "${password_files[@]}")
fi
entry=$(printf '%s\n' "${password_files[@]}" | rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu "$@" -i -p "Escolha a senha")
entry=$(printf '%s\n' "${password_files[@]}" | rofi -dmenu "$@" -i -p "Escolha a senha")
echo "entry: $entry"
if [ -z "$entry" ] ; then

View file

@ -1,29 +1,29 @@
#!/bin/env bash
sair(){
if [ $(~/.config/sway/scripts/nag) ]; then
if [ $(nag) ]; then
swaymsg exit
fi
}
suspender(){
if [ $(~/.config/sway/scripts/nag) ]; then
if [ $(nag) ]; then
systemctl suspend
fi
}
reiniciar(){
if [ $(~/.config/sway/scripts/nag) ]; then
if [ $(nag) ]; then
systemctl reboot
fi
}
desligar(){
if [ $(~/.config/sway/scripts/nag) ]; then
if [ $(nag) ]; then
systemctl poweroff
fi
}
ESCOLHA="$(printf "Sair\nSuspender\nReiniciar\nDesligar" | rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i -p "Escolha uma opção:")"
ESCOLHA="$(printf "Sair\nSuspender\nReiniciar\nDesligar" | rofi -dmenu -i -p "Escolha uma opção:")"
case "$ESCOLHA" in
Sair) sair;;

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh
m() { rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i "$@" ;}
mb() { rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i -kb-custom-1 "Alt+q" "$@" ;}
m() { rofi -dmenu -i "$@" ;}
mb() { rofi -dmenu -i -kb-custom-1 "Alt+q" "$@" ;}
artist() {
lines="$(mpc list artist | wc -l)"

View file

@ -11,7 +11,7 @@ touch "$file"
height=$(wc -l "$file" | awk '{print $1}')
prompt="Add/delete a task: "
cmd=$(rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i -l "$height" -p "$prompt" "$@" < "$file")
cmd=$(rofi -dmenu -i -l "$height" -p "$prompt" "$@" < "$file")
while [ -n "$cmd" ]; do
if grep -q "^$cmd\$" "$file"; then
grep -v "^$cmd\$" "$file" > "$file.$$"
@ -22,7 +22,7 @@ while [ -n "$cmd" ]; do
height=$(( height + 1 ))
fi
cmd=$(rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i -l "$height" -p "$prompt" "$@" < "$file")
cmd=$(rofi -dmenu -i -l "$height" -p "$prompt" "$@" < "$file")
done
exit 0

4
.local/bin/up Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
FILE=$1
curl -F"file=@$FILE" -Fsecret= https://0x0.st | qrencode -o ./url.png &&
imv url.png && rm url.png

4
.local/bin/walls Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
ESCOLHA=$(ls ~/.config/sway/wallpapers/ | rofi -dmenu -i -p "Escolha o wallpaper")
cp ~/.config/sway/wallpapers/$ESCOLHA ~/.config/sway/wp
swaymsg reload &

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
notify-send "Getting list of available Wi-Fi networks..."
notify-send "Buscando redes Wi-Fi..."
# Get a list of available wifi connections and morph it into a nice-looking list
wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d")
@ -12,7 +12,7 @@ elif [[ "$connected" =~ "disabled" ]]; then
fi
# Use rofi to select wifi network
chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " )
chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " )
# Get name of connection
read -r chosen_id <<< "${chosen_network:3}"
@ -24,15 +24,15 @@ elif [ "$chosen_network" = "󰖪 Disable Wi-Fi" ]; then
nmcli radio wifi off
else
# Message to show when connection is activated successfully
success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
success_message="Agora você conectado na rede Wi-Fi \"$chosen_id\"."
# Get saved connections
saved_connections=$(nmcli -g NAME connection)
if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
nmcli connection up id "$chosen_id" | grep "successfully" && notify-send "Connection Established" "$success_message"
nmcli connection up id "$chosen_id" | grep "successfully" && notify-send "Conexão estabelecida" "$success_message"
else
if [[ "$chosen_network" =~ "" ]]; then
wifi_password=$(rofi -config ~/.config/sway/etc/rofi/config.rasi -dmenu -password -p "Password: " )
wifi_password=$(rofi -dmenu -password -p "Password: " )
fi
nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && notify-send "Connection Established" "$success_message"
nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && notify-send "Conexão estabelecida" "$success_message"
fi
fi