Compare commits

..

No commits in common. "698c94bbbe218f74de23aedf3af44dbb3a92fc63" and "1e1c2bbe640d897a092b211f15f583de57728e3c" have entirely different histories.

13 changed files with 33 additions and 287 deletions

24
.bashrc
View File

@ -14,7 +14,12 @@ alias grep='grep --color=auto'
alias ll='ls -l --color=auto'
alias l='ls -lta --color=auto'
alias nv='vim'
alias ncmpcpp='ncmpcpp -b ~/.config/ncmpcpp/bindings'
alias nv='nvim'
alias lv='lvim'
alias nnn='nnn -de'
alias lg='lazygit'
@ -31,29 +36,36 @@ export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
export HISTFILE=~/.history
export HISTSIZE=5000
export VISUAL=vim
export VISUAL=nvim
export EDITOR="$VISUAL"
# nnn
export NNN_TRASH=1
export NNN_OPTS="" # 'H' shows the hidden files. Same as option -H (so 'nnn -deH')
# export NNN_OPTS="deH" # if you prefer to have all the options at the same place
export LC_COLLATE="C" # hidden files on top
export NNN_FIFO="/tmp/nnn.fifo" # temporary buffer for the previews
export NNN_FCOLORS="AAAAE631BBBBCCCCDDDD9999" # feel free to change the colors
export NNN_PLUG='p:preview-tui' # many other plugins are available here: https://github.com/jarun/nnn/tree/master/plugins
export SPLIT='v' # to split Kitty vertically
# -------- #
# keybinds #
# -------- #
# remove entire words with control+(backspace/delete)
bind '"\C-H": backward-kill-word'
bind '"\e[3;5~": kill-word'
# fzf shortcuts
source ~/.config/fzf/key-bindings.bash
source ~/.config/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash
source /usr/share/fzf/completion.bash
# ------- #
# startup #
# ------- #
# display system info on startup
# pfetch
pfetch
# initialize starship prompt
eval "$(starship init bash)"

View File

@ -2,11 +2,8 @@
pgrep -x sxhkd > /dev/null || sxhkd &
# use DP-0 on desktop
bspc monitor eDP-1 -d 1 2 3 4 5
# enable on desktop
#bspc monitor HDMI-0 -d 6 7 8 9 0
bspc monitor DP-0 -d 1 2 3 4 5
bspc monitor HDMI-0 -d 6 7 8 9 0
bspc config remove_disabled_monitors false
bspc config remove_unplugged_monitors false
@ -67,9 +64,6 @@ pgrep -x caffeine > /dev/null || caffeine &
# polkit authentication agent
pgrep -x lxsession > /dev/null || lxsession &
# wallpaper
xwallpaper --zoom /home/april/wall/art/police.jpg
# compositor
killall picom
picom --no-fading-openclose &

View File

@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/bash
killall -q polybar
polybar primary 2>&1 | tee -a /tmp/polybar.log & disown
# polybar secondary 2>&1 | tee -a /tmp/polybar.log & disown
polybar secondary 2>&1 | tee -a /tmp/polybar.log & disown

View File

@ -30,7 +30,7 @@ width = 100%
height = 24pt
radius = 0
monitor = eDP-1
monitor = DP-0
; dpi = 96
@ -55,7 +55,7 @@ font-0 = "JetBrainsMonoNL Nerd Font Mono:pixelsize=12;2"
modules-left = bspwm xwindow
modules-center = date
modules-right = music memory cpu wlan pipewire backlight battery powermenu
modules-right = music systray filesystem memory cpu bluetooth wlan powermenu
cursor-click = pointer
; cursor-scroll = ns-resize
@ -164,12 +164,16 @@ label-empty-padding = 1
[module/xwindow]
type = internal/xwindow
label = %title:0:40:...%
label = %title:0:60:...%
[module/music]
type = custom/script
exec = ~/.config/polybar/scripts/player-mpris-tail.py -f '%{F#A7C080}{icon}%{F-} {artist} - %{F#8ABEB7}{title}' --icon-playing 󰎈 --icon-paused  --icon-none 󰎊 --icon-stopped 
tail = true
exec = ~/.config/polybar/scripts/now-playing.sh primary
click-middle = ~/.config/polybar/scripts/player-mpris-tail.py previous &
click-right = ~/.config/polybar/scripts/player-mpris-tail.py next &
click-left = ~/.config/polybar/scripts/player-mpris-tail.py play-pause &
icon-playing =
[module/filesystem]
type = internal/fs
@ -191,17 +195,6 @@ scroll-up = source ~/.config/polybar/scripts/env.sh && ~/.config/polybar/scripts
scroll-down = source ~/.config/polybar/scripts/env.sh && ~/.config/polybar/scripts/redshift.sh decrease
interval=0.5
[module/pipewire]
type = custom/script
label = %{F#A7C080}vol%{F-} %output%
# interval = 3
tail = true
exec = ~/.config/polybar/scripts/pipewire-simple.sh
click-right = exec pavucontrol &
click-left = ~/.config/polybar/scripts/pipewire-simple.sh --mute &
scroll-up = ~/.config/polybar/scripts/pipewire-simple.sh --up &
scroll-down = ~/.config/polybar/scripts/pipewire-simple.sh --down &
[module/pulseaudio]
type = internal/pulseaudio
@ -259,23 +252,13 @@ label-disconnected = %{F#A7C080}%ifname%%{F#707880} disconnected
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %{F#A7C080}%ifname%%{F-} %essid%
label-connected = %{F#A7C080}%ifname%%{F-} %essid% %local_ip%
[module/eth]
inherit = network-base
interface-type = wired
label-connected = %{F#A7C080}%ifname%%{F-} %local_ip%
[module/backlight]
type = internal/backlight
format = %{F#A7C080}bl%{F-} <label>
[module/battery]
type = internal/battery
battery = BAT0
label-discharging = %{F#A7C080}bat%{F-} %percentage%%
label-charging = %{F#A7C080}plg%{F-} %percentage%%
[module/date]
type = internal/date
interval = 1

View File

@ -1,146 +0,0 @@
#!/bin/sh
# Get config values for script
source "${0%/*}/now-playing-options.cfg"
# The name of polybar bar which houses the main spotify module and the control modules.
PARENT_BAR="${1:-music}"
PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1)
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
send_hook() {
[ -z "$1" ] && echo "send_hook: missing arg" && exit 1
polybar-msg -p "$PARENT_BAR_PID" hook mpris-play-pause "$1" 1>/dev/null 2>&1
}
extract_meta() {
grep "$1\W" <<< "$meta" | awk '{$1=$2=""; print $0}' | sed 's/^ *//; s/; */;/g' | paste -s -d/ -
}
# Truncate strings to passed maximum lengths (arg 1 is relevant string from get_info)
# If the remaining string still has "(" or "[", put the closing parenthesis or bracket after the ...
truncate() {
tr_result=$(echo "$1" | sed "s/\(.\{$2\}\).*/\1.../")
if [[ $tr_result == *"("* && $tr_result != *")"* ]]; then
tr_result="$tr_result)"
echo "$tr_result"
return 0
elif [[ $tr_result == *"["* && $tr_result != *"]"* ]]; then
tr_result="$tr_result]"
echo "$tr_result"
return 0
#If there are multiple sets of parentheses and the final one is interrupted, make sure the closing parenthesis is still added
elif [[ $tr_result == *"("*")"*"("* && $tr_result != *"("*")"*"("*")"* ]]; then
tr_result="$tr_result)"
echo "$tr_result"
return 0
#Should basically never happen, but same thing with brackets
elif [[ $tr_result == *"["*"]"*"["* && $tr_result != *"["*"]"*"["*"]"* ]]; then
tr_result="$tr_result]"
echo "$tr_result"
return 0
else
echo "$tr_result"
return 0
fi
}
# if "icon" given, determine icon. otherwise, print metadata
get_info() {
#if no arguments passed, print correct syntax
if [ -z "$1" ]; then
echo "Usage: get_info PLAYER [icon]"
exit 1
fi
meta=$(playerctl -p "$1" metadata)
# get title
title=$(extract_meta title)
# if no title, try url e.g. vlc
if [ -z "$title" ]; then
title=$(extract_meta url)
title=$(urldecode "${title##*/}")
fi
title=$(truncate "$title" "$title_maxlen")
# if not "icon", display information and return
if [ "$2" != "icon" ]; then
artist=$(extract_meta artist)
[ -z "$artist" ] && artist=$(extract_meta albumArtist)
if [ -n "$artist" ]; then
#truncates artist length to $artist_maxlen in config.cfg
artist=$(truncate "$artist" "$artist_maxlen")
# only checks album metadata and truncates if $show_album is enabled in config.cfg
if [ "$show_album" = "true" ]; then
album=$(extract_meta album)
# If there is an album, truncate it and append icon only if $show_aa_icons is enabled in config .cfg
[ -n "$album" ] && album=$(truncate "$album" "$album_maxlen") && if [ "$show_aa_icons" = "true" ]; then
echo -n "$album $separator "
else
echo -n "$album $separator "
fi
fi
if [ "$show_aa_icons" = "true" ]; then
echo -n "$artist $separator "
else
echo -n "$artist $separator "
fi
fi
echo "$title"
return 0
fi
# determine icon:
# if player name is recognised, use it
case "$1" in
spotify* | vlc | mpv | rhythmbox) echo "$1";;
kdeconnect*) echo "kdeconnect";;
chromium*|firefox*|chrome*)
# if a browser, search window titles:
# this tries to avoid title messing up the regex
regex_title=$(echo "$title" | tr "[:punct:]" ".")
windowname=$(xdotool search --name --class --classname "$regex_title" getwindowname 2>/dev/null)
case $windowname in
"") ;; # ignore if empty
*Netflix*) echo "netflix";;
*YouTube*) echo "youtube";;
*"Prime Video"*) echo "prime";;
*"Corridor Digital"*) echo "corridor";;
*) echo "browser";;
esac;;
*) echo "none";;
esac
}
# manually go through players (this is where $1 and $2 are defined for get_info)
read -d'\n' -ra PLAYERS <<<"$(playerctl -l -i "$ignored_players" 2>/dev/null)" # -i ignores players defined in options.cfg
declare -a PAUSED
for player in "${PLAYERS[@]}"; do
[ "$player" = "playerctld" ] && continue;
p_status=$(playerctl -p "$player" status 2>/dev/null)
# if we have one playing, we'll use it and EXIT
if [ "$p_status" = "Playing" ]; then
send_hook 1
get_info "$player" "$2"
exit 0;
fi
[ "$p_status" = "Paused" ] && PAUSED+=("$player")
done
# if we have a paused, show it otherwise assume there are no players or have all stopped
if [ -n "${PAUSED[0]}" ]; then
send_hook 2
get_info "${PAUSED[0]}" "$2"
else
[ "$2" = icon ] && echo "none" || echo "" #" 󰒲 Not playing "
fi

View File

@ -1,29 +0,0 @@
#!/bin/sh
#
# Set necessary values for script here
#
# Set the maximum length of song title
title_maxlen=25
# Set the maximum length of artist
artist_maxlen=20
# Include album in output or just artist and title? (valid options: true/false)
show_album=false
# Set the maximum length of album title (if enabled, otherwise this does nothing)
album_maxlen=25
# Show icons denoting the start of the album and artist strings? (valid options: true/false)
show_aa_icons=false
# What to use as the separator between strings (ex: ALBUM ARTIST TITLE)
separator=""
# How long to wait in seconds before getting the status again (can help avoid rate limiting)
wait_time=1
# A comma-separated list of players to ignore (if they are being problematic)
ignored_players=""

View File

@ -1,34 +0,0 @@
#!/bin/sh
[ -z $1 ] && echo "Error: BAR_NAME is not supplied." && exit 1
#Get config values for script
source "${0%/*}/now-playing-options.cfg"
#Call the get_status script with the supplied BAR_NAME in polybar's config.ini (therefore, running get_status icon supplies icon as arg 2)
get_status() {
${0%/*}/now-playing-get.sh $1 $2
}
prepend() {
echo "$1$(get_status $1)"
if [ -n $wait_time ]; then
sleep $wait_time
fi
}
case "$(get_status $1 icon)" in
"none"|"") prepend '';;
"browser") prepend '󰇧 ';;
"netflix") prepend '󰝆 ';;
"youtube") prepend '󰗃 ';;
"prime") prepend ' ';;
"spotify") prepend '󰓇 ';;
"vlc") prepend '󰕼 ';;
"mpv") prepend '󱖏 ';;
"kdeconnect") prepend ' ';;
"corridor") prepend '󰎁 ';;
"rhythmbox") prepend '󰓃 ';;
esac

0
.config/polybar/scripts/pipewire-microphone.sh Executable file → Normal file
View File

3
.config/polybar/scripts/pipewire-simple.sh Executable file → Normal file
View File

@ -27,6 +27,5 @@ case $1 in
pamixer --toggle-mute
;;
*)
echo ${VOLUME}
# echo "Source: ${SOURCE} | Sink: ${VOLUME} ${SINK}"
echo "Source: ${SOURCE} | Sink: ${VOLUME} ${SINK}"
esac

View File

@ -1,23 +0,0 @@
#!/bin/sh
function main() {
DEFAULT_SOURCE=$(pw-record --list-targets | sed -n 's/^*[[:space:]]*[[:digit:]]\+: source description="\(.*\)" prio=[[:digit:]]\+$/\1/p')
DEFAULT_SINK=$(pw-play --list-targets | sed -n 's/^*[[:space:]]*[[:digit:]]\+: sink description="\(.*\)" prio=[[:digit:]]\+$/\1/p')
VOLUME=$(pamixer --get-volume-human)
case $1 in
"up")
pamixer --increase 10
;;
"down")
pamixer --decrease 10
;;
"mute")
pamixer --toggle-mute
;;
*)
echo "Source: ${DEFAULT_SOURCE} | Sink: ${VOLUME} ${DEFAULT_SINK}"
esac
}
main "$@"

View File

@ -1,5 +1,4 @@
format = """
$nix_shell\
$username\
$hostname\
$directory\

View File

@ -171,12 +171,3 @@ super + period
super + comma
playerctl --player=Supersonic previous
XF86AudioRaiseVolume
pactl set-sink-volume @DEFAULT_SINK@ +5%
XF86AudioLowerVolume
pactl set-sink-volume @DEFAULT_SINK@ -5%
XF86AudioMute
pactl set-sink-mute @DEFAULT_SINK@ toggle

View File

@ -4,7 +4,7 @@
xsetroot -cursor_name left_ptr
# set wallpaper
xwallpaper --zoom /home/april/wall/art/police.jpg
xwallpaper --zoom ~/wall/everforest/flowers.png
# start window manager
exec bspwm