Notification, use of mpris and pulseaudio

This commit is contained in:
Neptune 2021-01-31 22:18:35 +01:00
parent 889708051b
commit 97aea8ccf0
26 changed files with 16334 additions and 141 deletions

View file

@ -3,7 +3,7 @@
## BSPWM config
bspc config focus_follows_pointer true
bspc config border_width 0
bspc config border_width 1
bspc config window_gap 6
bspc config top_padding 28
bspc config left_padding 0
@ -15,15 +15,61 @@ bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config pointer_modifier mod1
bspc monitor -f primary
## BSPWM Rules
bspc rule -a Wine monitor=HDMI-A-1
## Swallow
pgrep -fl 'pidswallow -gl' || pidswallow -gl &
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_PLATFORM_PLUGIN="qt5ct"
export KRITA_NO_STYLE_OVERRIDE=1
export GTK_CSD=0
export GTK_USE_PORTAL=1
export LD_PRELOAD="/usr/lib/libgtk3-nocsd.so.0"
export GO111MODULE=on
## Screens
xrandr --output HDMI-A-1 --auto --primary
xrandr --output DisplayPort-1 --auto --right-of HDMI-A-1
bspc monitor -f primary
## Keyboard and shortcuts
setxkbmap -layout "dvorak" -option "caps:backspace,lv3:ralt_switch,compose:sclk" && sxhkd &
## Cursor
xsetroot -cursor_name left_ptr &
xbanish &
## Colors / Wallpaper
xrdb -merge -q ~/.Xresources && ~/.fehbg && wal -Rnq
## Music
start-pulseaudio-x11 &
sshfs -o uid=1000 -o gid=1000 kemurikusa:/data/Music ~/Music &
sshfs -o uid=1000 -o gid=1000 neptune-01:/home/deploy/Movies ~/Movies &
mpd &
mpDris2 &
transmission-daemon --port 9091 --allowed "127.0.0.1"
transmission-rss
## No screensaver
xset s off &
xset -dpms &
## No time to waste
xset r rate 300 50 &
## Compositor
picom --experimental-backends --backend glx -b &
redshift -l 44.481:0.3545 &
## Peripherals
xsetwacom set "$(xsetwacom --list devices | awk '/Pen stylus/ { if ($7 == "id:") { print $8 } }')" MapToOutput HDMI-A-1 &
## Manage desktops
btops &
## Swallow
#export PIDSWALLOW_SWALLOW_COMMAND='bspc node $pwid --flag hidden=on'
#export PIDSWALLOW_VOMIT_COMMAND='bspc node $pwid --flag hidden=off'
pgrep -fl 'pidswallow -gl' || pidswallow -gl
## Bar
"${HOME}/.config/polybar/launch.sh"
xfce4-panel -d > /dev/null 2>&1

View file

@ -24,13 +24,13 @@ constant = " "
"" = ["Steam","steam"]
" " = ["keepassxc","KeePassXC"]
" " = ["krita"]
" " = ["Cemu.exe", "antimicro", "Wine", "Lutris"]
" " = ["Cemu.exe", "antimicro", "Wine", "Lutris", "Com.github.tkashkin.gamehub"]
" " = ["TelegramDesktop"]
" " = ["Spectral","nheko"]
" " = ["nvim"]
" " = ["Termite", "Alacritty", "konsole", "terminator", "URxvt", "xst-256color", "st-256color", "kitty"]
" " = ["calibre"]
" " = ["dolphin"]
" " = ["dolphin", "pcmanfm-qt"]
" " = ["okular", "llpp", "Zathura", "mupdf", "Evince", "MuPDF"]
" " = ["cantata", "elisa"]
" " = ["mpv"]

View file

@ -1,3 +1,15 @@
#################################
# Animations #
#################################
# requires https://github.com/jonaburg/picom
# (These are also the default values)
transition-length = 300
transition-pow-x = 0.1
transition-pow-y = 0.1
transition-pow-w = 0.1
transition-pow-h = 0.1
size-transition = true
#################################
# Corners #
#################################
@ -5,11 +17,12 @@
corner-radius = 10;
rounded-corners-exclude = [
#"window_type = 'normal'",
"window_type = 'popup_menu'",
# "window_type = 'popup_menu'",
"class_g = 'awesome'",
"class_g = 'Xfce4-panel'",
#"class_g = 'Xfce4-panel'",
#"class_g = 'Polybar'",
];
round-borders = 1;
#################################
# Shadows #
@ -68,6 +81,7 @@ shadow-exclude = [
"class_g = 'Cairo-clock'",
"class_g = 'slop'",
"class_g = 'Polybar'",
"window_type = 'popup_menu'",
"_GTK_FRAME_EXTENTS@:c"
];
@ -171,6 +185,8 @@ opacity-rule = [
"100:class_g = 'Alacritty'",
"100:class_g = 'Polybar'",
"100:class_g = 'Thunderbird'",
"80:class_g = 'Thunar'",
"80:class_g = 'Lutris'",
];
@ -212,13 +228,9 @@ opacity-rule = [
blur: {
# requires: https://github.com/ibhagwan/picom
method = "dual_kawase";
size = 20;
method = "kawase";
deviation = 10.0;
#method = "kernel";
strength = 7.0;
# deviation = 1.0;
# kernel = "11x11gaussian";
background = false;
background-frame = false;
background-fixed = false;
@ -237,7 +249,7 @@ blur-background-exclude = [
"window_type = 'desktop'",
#"window_type = 'dock'",
"window_type = 'utility'",
"window_type = 'notification'",
#"window_type = 'notification'",
"class_g = 'slop'",
"class_g = 'Firefox' && argb",
"class_g = 'Xfce4-panel'",
@ -407,7 +419,7 @@ no-use-damage = true
# Make transparent windows clip other windows like non-transparent windows do,
# instead of blending on top of them.
#
# transparent-clipping = false
transparent-clipping = false
# Set the log level. Possible values are:
# "trace", "debug", "info", "warn", "error"

View file

@ -52,14 +52,14 @@ inherit = bar/default
monitor = ${env:MONITOR:HDMI-A-1}
modules-left = bspwm
modules-center =
modules-right = xwindow mpd mutt-wizard temp volume date
modules-right = xwindow mpd mixer date
[bar/DisplayPort-1]
inherit = bar/default
monitor = ${env:MONITOR:DisplayPort-1}
modules-left = bspwm
modules-center = xwindow
modules-right = mpd mutt-wizard temp volume date
modules-right = mpd mixer date
[module/xwindow]
type = internal/xwindow
@ -70,6 +70,15 @@ label-foreground = ${colors.foreground-focus}
label-background = ${colors.primary}
label-underline= ${colors.primary}
[module/mixer]
type = custom/script
exec = mixer listen --color=color2 --volume-icons="奄,奔,墳,"
tail = true
format-prefix = " "
# click-left = kitty -e cmixer &
# click-right = mixer next
format-prefix-foreground = ${xrdb:color2}
[module/mutt-wizard]
type = custom/script
exec = mailbox
@ -389,7 +398,181 @@ menu-2-1-exec = menu-open-0
[module/vpn-nordvpn-status]
type = custom/script
exec = ~/polybar-scripts/polybar-scripts/vpn-nordvpn-status/vpn-nordvpn-status.sh
exec = ~/bin/src/polybar-scripts/polybar-scripts/vpn-nordvpn-status/vpn-nordvpn-status.sh
interval = 5
[module/mixer-mpris]
format-prefix = " "
format-prefix-foreground = ${xrdb:color2}
type = custom/script
exec = mixer mpris
tail = true
;; Custom Modules For MPRIS D-Bus Interface
;; Use custom/ipc, custom/script
; https://en.wikipedia.org/wiki/Media_control_symbols
; 'primary_mpris' is bar name of mrpis controller defined in file '/PATH/polybar/bars'
[module/mpris]
type = custom/script
; Default: 5 (0 if `tail = true`)
interval = 6
format-foreground = ${colors.nord-purple}
format-padding = 1
; unicode uf885  , uf883 
exec = echo %{T4}%{T-}
exec-if = mpris_player_control -l -b 'primary_mpris'
;exec-if = [[ -n $(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames 2> /dev/null | sed -r -n '/org.mpris.MediaPlayer2/{s@.*org.mpris.MediaPlayer2.([^"]+).*@\1@g;p}') ]]
click-left = polybar-msg cmd toggle 'primary_mpris' &> /dev/null
click-right = polybar-msg cmd restart 'primary_mpris' &> /dev/null
double-click-left = mpris_player_control
[module/mpris-track]
type = custom/script
; Default: 5 (0 if `tail = true`)
interval = 6
; Available tokens:
; %output%
; Default: %output%
label = %output:0:60:...%
; unicode uf1bc  , ufa7b 嗢 , uf001 
format-prefix = %{T4} %{T-}
format-prefix-padding-right = 1
;format = <label>
format-foreground = ${colors.nord-yellow}
; bar name must be defined in config file like '[bar/primary_mpris]'
exec = mpris_player_control -q -b 'primary_mpris'
; Conditional command that, if defined, needs to exit successfully before the main exec command is invoked. Default: ""
;exec-if = pgrep -x polybar
click-left = mpris_player_control
[module/mpris-app-name]
type = custom/script
interval = 6
label = %output:0:28%
; unicode uf885 
format-prefix = %{T4}%{T-}
format-prefix-padding-right = 1
;format = <label>
format-foreground = ${colors.nord-purple}
exec = mpris_player_control -c | tail -n 1
# click-right = mpris_player_control -k
[module/mpris-reset]
type = custom/script
interval = 86400
; unicode uf021 
exec = echo %{T4}%{T-}
;format = <label>
format-padding = 1
format-foreground = ${colors.nord-red}
click-left = mpris_player_control -r
[module/mpris-next]
type = custom/script
interval = 86400
; unicode uf9ac 怜 , uf9ab 嶺
exec = echo %{T4}嶺%{T-}
;format = <label>
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -a next
[module/mpris-previous]
type = custom/script
interval = 86400
; unicode uf9ad 玲 , uf9aa 寧
exec = echo %{T4}寧%{T-}
;format = <label>
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -a previous
[module/mpris-forward]
type = custom/script
interval = 86400
; unicode uf710  , uf04e  , uf9d6 淪
exec = echo %{T4}淪%{T-}
;format = <label>
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -s 5
[module/mpris-backward]
type = custom/script
interval = 86400
; unicode uf04a  , uf9d4 倫
exec = echo %{T4}倫%{T-}
;format = <label>
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -s '-5'
[module/mpris-stop]
type = custom/script
interval = 86400
; unicode uf9da 栗
exec = echo %{T4}栗%{T-}
; format = <label>
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -a stop
[module/mpris-vol-up]
type = custom/script
interval = 86400
; unicode fc5b ﱛ
exec = echo %{T4}ﱛ%{T-}
;format = <label>
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -V '+15'
[module/mpris-vol-down]
type = custom/script
interval = 86400
; unicode fc5c ﱜ
exec = echo %{T4}ﱜ%{T-}
;format = <label>
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -V '-5'
[module/mpris-toggle-mute]
type = custom/ipc
; Define the command to be executed when the hook is triggered
; unicode uf466  , uf485 
; Playing index 1
hook-0 = echo %{T4} %{T-}
; Paused index 2
hook-1 = echo %{T4} %{T-}
; Hook to execute on launch. The index is 1-based, default: 0
initial = 1
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -m
; scroll is used to control sink volume up/down, for touchpad just two fingers up/down
scroll-up = mpris_player_control -V '+40'
scroll-down = mpris_player_control -V '-25'
[module/mpris-playpause]
type = custom/ipc
; Define the command to be executed when the hook is triggered
; unicode uf909 契, uf90c 奈 , uf01d  , uf8e3  , uf8e5  , uf28c 
; Playing index 1
hook-0 = echo %{T4}%{T-}
; Paused index 2
hook-1 = echo %{T4}%{T-}
; Hook to execute on launch. The index is 1-based, default: 0
initial = 1
format-padding = 1
format-foreground = ${colors.nord-blue}
click-left = mpris_player_control -a playpause
; scroll is used to control sink volume up/down, for touchpad just two fingers up/down
scroll-up = mpris_player_control -V '+10'
scroll-down = mpris_player_control -V '-5'
;; End
; vim:ft=dosini

View file

@ -165,39 +165,46 @@ super + shift + Print
# Audio
#@XF86Audio{Raise,Lower}Volume
# amixer -q set Master 1%{+,-}
Pause
mixer switch
@XF86Audio{Raise,Lower}Volume
amixer -q set Master 1%{+,-}
mixer update 2%{+,-}
@XF86AudioMute
amixer -q set Master toggle
# mpris_player_control -m
amixer -q set Master toggle
## Music control
@XF86AudioPrev
mpc prev
mixer prev
@XF86AudioNext
mpc next
mixer next
@XF86AudioPlay
mpc toggle
mixer toggle
@XF86AudioStop
mpc stop
mixer stop
## Music control on keyboards with no music keys
super + @XF86Audio{Raise,Lower}Volume
mpc {next,prev}
mixer {next,prev}
super + @XF86AudioMute
mpc toggle
mixer toggle
@XF86ScreenSaver
slock
slock
super + v
bspc query --nodes --node focused | pidswallow -t
bspc query --nodes --node focused | pidswallow -t
super + ctrl + {Left,Down,Up,Right}
bspwm_resize {west,south,north,east}
bspwm_resize {west,south,north,east}

189
mixer Executable file
View file

@ -0,0 +1,189 @@
#!/usr/bin/env sh
###########################################
# Displays audio sinks and control volume #
###########################################
sink="$HOME/.cache/mixer/sink"
save="$HOME/.cache/mixer/save"
# list options
help() {
echo "Usage:
 listen [monitor events and display current sink volume]
 update {+,-}1% [update current sink volume]
 switch [switch to the next sink]
 restore [restore saved configuration]
 help, --help [this help page]
懶 toggle [toggle between play and pause]
玲 prev [play previous song]
怜 next [play next song]
栗 stop [stop playing]
"
}
# return selected color generated by pywal
get_color() {
grep -o "$1.*" "$HOME/.cache/wal/colors.sh" | sed "s/$1='\(.*\)'.*/\1/"
}
# display volume icon
# @param: volume between 1 and 100, normalized_volume otherwise
volume_icon() {
volume=${1:-$(normalized_volume)}
len_icons=$(echo "$volume_icons" | wc -l)
for i in $(seq 1 "$len_icons"); do
if [ "$(echo "$i * (100/$len_icons) + 1" | bc -l | xargs printf "%0.f\n" )" -ge "${volume}" ]; then
echo "$volume_icons" | sed "$i!d"
break
fi
done
}
# return current volume associated with current sink
current_volume() {
sndioctl "$(current_sink).level" | sed '/device/d' | cut -f 2 -d '='
}
# print current sink
current_sink() {
cat "$sink"
}
# return volume between 0 and 100%
# @param: volume between 0 and 1.0, current_volume otherwise
normalized_volume() {
volume=${1:-$(current_volume)}
echo "${volume} * 100" | bc | xargs printf "%0.f\n"
}
# save sinks with volumes
save() {
aucatctl | tr '\n' ' ' > "$save"
}
# update volume with increment of value
# value between 0..100
# increment +n or -n
update() {
operand=$(echo "$1" | grep -o '+\|-')
value=$(echo "$1" | grep -o '[[:digit:]]*')
volume=$(normalized_volume)
{ [ "$volume" -eq 0 ] && [ "$operand" = "-" ]; } || { [ "$volume" -eq 100 ] && [ "$operand" = "+" ]; } && return
sndioctl "$(current_sink).level=$operand$(echo "scale=2;$value/100" | bc -l)"
save
}
# automatically set current sink to last modified
auto_switch_sink() {
new_sink="$(echo "$1" | sed '/device/d' | cut -f 1 -d '.')"
[ "$new_sink" = '' ] && return
[ "$new_sink" = "$(current_sink)" ] || echo "$new_sink" > "$sink"
}
mpris() {
while true; do
player_status=$(playerctl status 2> /dev/null)
if [ "$player_status" = "Playing" ]; then
volume=$(playerctl status --format '{{volume}}')
player=$(playerctl status --format '{{playerName}}')
normalized_volume=$(normalized_volume "$volume")
echo "$player %{F$color}$(volume_icon "$normalized_volume")%{F-} ${normalized_volume}%"
sleep 1
fi
done
}
# listen on sndiod new events and sink change
listen() {
# on separated thread listen to sndiod events
{
sndioctl -m | while read -r MSG; do
auto_switch_sink "$MSG"
display
save
done
} &
# watch for current sink value stored in file change
while inotifywait -q -q -e close_write "$sink"; do
display
done
}
# display sink and associated volume in polybar
display() {
echo "$(current_sink) %{F$color}$(volume_icon)%{F-} $(normalized_volume)%"
}
# switch to the next available sink
switch() {
sinks=$(sndioctl | sed '/device/d')
max_index=$(echo "$sinks" | wc -l)
current_index=$(echo "$sinks" | grep -n "$(current_sink)" | cut -f 1 -d ':')
next_index=$(echo "$current_index%$max_index + 1" | bc)
echo "$sinks" | sed "$next_index!d" | cut -f 1 -d '=' | sed 's/.level//' > "$sink"
}
# restore last saved volume per sink
restore() {
[ -f "$save" ] && aucatctl "$(cat "$save")"
}
is_mpd_sink() {
[ "$(current_sink | grep -o 'mpd')" = "mpd" ] && echo "true" || echo "false"
}
toggle() {
[ "$(is_mpd_sink)" = "true" ] && mpc toggle || playerctl play-pause
}
prev() {
[ "$(is_mpd_sink)" = "true" ] && mpc prev || playerctl previous
}
next() {
[ "$(is_mpd_sink)" = "true" ] && mpc next || playerctl next
}
stop() {
[ "$(is_mpd_sink)" = "true" ] && mpc stop || playerctl stop
}
main() {
[ ! -f "$sink" ] && mkdir -p "$HOME/.cache/mixer" && echo "output" > "$sink"
color=$(get_color 'color2')
volume_icons="奄\n奔\n墳\n"
case "$1" in
listen)
case "$2" in
--color=?*)
case "$3" in
--volume-icons=?*)
volume_icons=$(echo "${3#*=}" | tr ',' '\n')
esac
color=$(get_color "${2#*=}");;
esac
listen;;
mpris)
mpris;;
update)
shift;
update "$@";;
switch)
switch;;
restore)
restore;;
prev)
prev;;
next)
next;;
toggle)
toggle;;
stop)
stop;;
--help|-h|*)
help;;
esac
}
main "$@"

View file

@ -5,23 +5,28 @@
############################################################################
## start processing `01_output-audio-alsa.conf'
audio_output {
type "sndio"
name "audio"
mixer_type "software"
type "pulse"
name "pulse audio"
}
audio_output {
type "alsa"
name "alsa"
enabled "no"
}
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
#audio_output {
# type "sndio"
# name "audio"
# mixer_type "software"
#}
#
#audio_output {
# type "alsa"
# name "alsa"
# enabled "no"
#}
#
#audio_output {
# type "fifo"
# name "my_fifo"
# path "/tmp/mpd.fifo"
# format "44100:16:2"
#}
replaygain "off"
## done processing
@ -35,7 +40,7 @@ filesystem_charset "UTF-8"
id3v1_encoding "UTF-8"
log_level "default"
auto_update "yes"
auto_update_depth "4096"
# auto_update_depth "4096"
## done processing
## start processing `04_client-limits.conf'

View file

@ -5,7 +5,7 @@
#########
# Specify default audio driver (see --ao=help for a list).
ao=sndio
ao=pulse
#########
# video #
@ -33,8 +33,6 @@ tscale-window=quadric
tscale-clamp=0.0
tscale-radius=1.1
# Disable the On Screen Controller (OSC).
osc=no
osd-bar=no

View file

@ -6,9 +6,10 @@
#-------------------------------#
# Path to music directory
MUSIC_DIR="$HOME/Music"
# MUSIC_DIR="$HOME/Music"
# Path to output cover
COVER="/tmp/cover.png"
COVER_NOTIFICATION="/tmp/cover_notification.png"
# Size of cover
COVER_SIZE=297
# Size in pixel of borders to crop out
@ -29,19 +30,33 @@ rounded_cover() {
\) -alpha off -compose CopyOpacity -composite "$COVER"
}
fallback_find_cover() {
album=$(dirname "$file")
album_cover="$(find "$album" -type d -exec find {} -maxdepth 1 -type f -iregex ".*\(covers?\|folders?\|artworks?\|fronts?\|scans?\).*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
[ -z "$album_cover" ] && album_cover="$(find "$album" -type d -exec find {} -maxdepth 1 -type f -iregex ".*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
[ -z "$album_cover" ] && album_cover="$(find "${album%/*}" -type d -exec find {} -maxdepth 1 -type f -iregex ".*\(covers?\|folders?\|artworks?\|fronts?\|scans?\|booklets?\).*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
album_cover="$(echo -n "$album_cover" | grep -iv '\(back\|cd\)\.' | head -n1)"
#fallback_find_cover() {
# album=$(dirname "$file")
# album_cover="$(find "$album" -type d -exec find {} -maxdepth 1 -type f -iregex ".*\(covers?\|folders?\|artworks?\|fronts?\|scans?\).*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
# [ -z "$album_cover" ] && album_cover="$(find "$album" -type d -exec find {} -maxdepth 1 -type f -iregex ".*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
# [ -z "$album_cover" ] && album_cover="$(find "${album%/*}" -type d -exec find {} -maxdepth 1 -type f -iregex ".*\(covers?\|folders?\|artworks?\|fronts?\|scans?\|booklets?\).*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
# album_cover="$(echo "$album_cover" | grep -iv '\(back\|cd\)\.' | head -n1)"
#}
mpris_album_art() {
playerctl metadata mpris:artUrl | sed 's#file://##'
# mpris_player_control -t | grep 'artUrl' | cut -f 3 -d '|' | sed 's#file://##'
}
notification() {
convert "$COVER" -resize 144x144 "$COVER_NOTIFICATION"
notify-send -i "$COVER_NOTIFICATION" "$(playerctl metadata --format '{{title}} {{album}}')"
}
main() {
file="$MUSIC_DIR/$(mpc --format %file% current)"
# file="$MUSIC_DIR/$(mpc --format %file% current)"
[ -n "$file" ] && ffmpeg_cover "$file" && rounded_cover ||
fallback_find_cover && ffmpeg_cover "$album_cover" && rounded_cover
# [ -n "$file" ] && ffmpeg_cover "$file" && rounded_cover ||
# fallback_find_cover && ffmpeg_cover "$album_cover" && rounded_cover
[ ! -x "$(which playerctl)" ] && echo "Install playerctl and mpDris2 for this script to work."
ffmpeg_cover "$(mpris_album_art)" && rounded_cover
notification
}
main

View file

@ -105,8 +105,11 @@ music:
- fuse-sshfs
- mpc
- mpd
- mpDris2
- mpv
- mpv-mpris
- ncmpcpp
- playerctl
- sndio
- sox
- youtube-dl
@ -148,6 +151,9 @@ qtapps:
- xfce4-panel
- xfce4-panel-appmenu
- xsettingsd
- plasma-integration
- ffmpegthumbs
- kio-extras
#------------------------------------------------#
# Videocard Ati #
@ -175,6 +181,7 @@ devops:
- python3-netaddr
- python3-pip
- python3-virtualenv
- shellcheck
- speedtest-cli
#------------------------------------------------#

View file

@ -24,32 +24,31 @@ pprint() {
service() {
pprint "Activating service $1..."
[ ! -L /var/service/$1 ] && sudo ln -s /etc/sv/$1/ /var/service/
[ ! -L "/var/service/$1" ] && sudo ln -s "/etc/sv/$1/" /var/service/
}
pull() {
cd "$1"
cd "$1" || return
pprint "Updating ${1##*/}"
git pull
}
pkgs() {
pprint "Installing packages from group $1..."
list=$(yq -r .$1'| join(" ")' packages.yaml)
sudo xbps-install -S $list
list=$(yq -r ."$1| join(' ')" packages.yaml)
sudo xbps-install -S "$list"
}
_pkgs() {
pprint "Installing custom packages from group $1..."
node=$1
packagedir=$2
packagelnk=$3
[ ! -d "$packagedir" ] && mkdir -p "$packagedir"
list=$(yq -cr .$1'[]' packages.yaml)
list=$(yq -cr ."$1[]" packages.yaml)
for row in $list; do
_jq() {
echo ${row} | jq -r ${1}
echo "${row}" | jq -r "${1}"
}
packagename=$(_jq '.name'); packageurl=$(_jq '.url'); packagebin=$(_jq '.bin')
[ ! -d "$packagedir/$packagename" ] && git clone "$packageurl" "$packagedir/$packagename" || pull "$packagedir/$packagename"
@ -59,7 +58,7 @@ _pkgs() {
vimplug() {
[ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/nvim/site/autoload/plug.vim" ] &&
echo "${CYAN}Installing vim plug..." &&
echo "${cyan}Installing vim plug..." &&
curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}/nvim/site/autoload/plug.vim" --create-dirs "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
}
@ -124,7 +123,7 @@ devops() {
}
voidrepo() {
[ ! -f "/etc/xbps.d/my-local-repo.conf" ] && [ -d "$HOME/.void-packages"] &&
[ ! -f "/etc/xbps.d/my-local-repo.conf" ] && [ -d "$HOME/.void-packages" ] &&
pprint "Add local repository to list of xbps remote hosts..." &&
echo "repository=$HOME/.void-packages/hostdir/binpkgs/neptune" | sudo tee "/etc/xbps.d/my-local-repo.conf" ||
pprint "Cloning custom void-packages repository..." &&
@ -178,5 +177,5 @@ main() {
esac
}
main ${1:-"--list"}
main "${1:-'--list'}"

View file

@ -9,7 +9,7 @@ case $session in
bspwm )
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile
exec bspwm
exec dbus-run-session -- bspwm
;;
sway ) exec sway;;
wayfire ) exec wayfire;;

View file

@ -1,44 +1,2 @@
#!/usr/bin/env sh
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_PLATFORM_PLUGIN="qt5ct"
export KRITA_NO_STYLE_OVERRIDE=1
export GO111MODULE=on
## Screens
xrandr --output HDMI-A-1 --auto --primary
xrandr --output DisplayPort-1 --auto --right-of HDMI-A-1
## Keyboard and shortcuts
setxkbmap -layout "dvorak" -option "caps:backspace,lv3:ralt_switch,compose:sclk" && sxhkd &
## Cursor
xsetroot -cursor_name left_ptr &
xbanish &
## Colors / Wallpaper
xrdb -merge -q ~/.Xresources && wal -Rq
## Bar
"${HOME}/.config/polybar/launch.sh"
xfce4-panel -d &>/dev/null
## Music
sshfs -o uid=1000 -o gid=1000 kemurikusa:/data/Music ~/Music &
sshfs -o uid=1000 -o gid=1000 neptune-01:/home/deploy/Movies ~/Movies &
mpd &
## No screensaver
xset s off &
xset -dpms &
## No time to waste
xset r rate 300 50 &
## Compositor
picom --experimental-backends --backend glx -b &
redshift -l 44.481:0.3545 &
## Peripherals
xsetwacom set $(xsetwacom --list devices | awk '/Pen stylus/ { if ($7 == "id:") { print $8 } }') MapToOutput HDMI-A-1 &
xow &

View file

@ -58,6 +58,10 @@ set -x SDL_AUDIODRIVER alsa
## Aliases
alias imv 'imv -c "exec _wid=\$(xdo id);xprop -f WM_CLIENT_MACHINE 8s -set WM_CLIENT_MACHINE \$(hostname) -id \$_wid;xprop -f _NET_WM_PID 32c -set _NET_WM_PID \$imv_pid -id \$_wid;pidswallow -gt \$_wid"'
alias wal 'wal -o bspwmrc'
alias powa 'sudo poweroff'
alias play 'env SOX_OPTS="--buffer 20000 --play-rate-arg -hs" play'
abbr - 'ssh'
## Utilities
abbr icat 'kitty +kitten icat'
@ -73,7 +77,7 @@ abbr nico 'youtube-dl'
abbr yt 'youtube-dl -f bestvideo+bestaudio' # Youtube videos
## Torrent
abbr seed 'aria2c --check-integrity=true --seed-ratio=0.0'
abbr seed 'aria2c --check-integrity=true --seed-ratio=0.0 --bt-save-metadata=true'
abbr seed_today "aria2c --check-integrity=true --seed-ratio=0.0 (find . -maxdepth 1 -name '*.torrent' -mtime -1)"
abbr torrent 'aria2c --bt-metadata-only=true --bt-save-metadata=true'

View file

@ -24,7 +24,7 @@ initial_pan = 0 0
[binds]
# Define some key bindings
q = quit
y = exec echo working!
#y = exec echo working!
# Image navigation
gg = goto 0
@ -56,7 +56,7 @@ s = scaling next
<Shift+S> = upscaling next
a = zoom actual
r = reset
w = exec wal -i "$imv_current_file"
w = exec wal -i "$imv_current_file" -o "bspwmrc"
# Rotate the currently open image by 90 degrees by pressing 'R'
<Shift+R> = exec mogrify -rotate 90 "$imv_current_file"

View file

@ -28,7 +28,7 @@ archive() {
}
draw() {
kitty +kitten icat --transfer-mode=file --silent --align=left --place=${WIDTH}x${HEIGHT}@${X}x${Y} --z-index=-1 "$1"
kitty +kitten icat --transfer-mode=file --silent --align=left --place="${WIDTH}x${HEIGHT}@${X}x${Y}" --z-index=-1 "$1"
}
image() {
@ -60,6 +60,7 @@ main() {
[ "$1" = "clear" ] && previewclear
maketemp
mimetype=$(file -b --mime-type "$1")
extension="$(printf "%s" "${1##*.}" | tr '[:upper:]' '[:lower:]')"
case $mimetype in
application/epub*)
@ -68,8 +69,6 @@ main() {
pdf "$1";;
application/x-bittorrent)
torrent "$1";;
application/zip | application/x-tar | *rar | application/gzip )
archive "$1";;
audio/*)
audio "$1";;
image/*)
@ -79,9 +78,21 @@ main() {
video/*)
video "$1";;
inode/directory)
[ -z "${1##*/..*}" ] && echo || exa -Fa --color always "$1";;
[ -z "${1##*/..*}" ] && echo || exa -Fa --sort oldest --color always "$1";;
*)
text "$1";;
case $extension in
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
archive "$1";;
rar)
unrar lt -p- -- "$1";;
7z)
7z l -p -- "$1";;
kra)
[ ! -f "$CACHEFILE" ] && unzip -p "$1" preview.png > "$CACHEFILE"
draw "$CACHEFILE";;
*)
text "$1";;
esac
esac
}

View file

@ -247,6 +247,14 @@ nnoremap w :!wal -i %f -q &<cr>
nnoremap mkd :mkdir<space>
"}}}
" Hold shift to jump five files
nnoremap J 5j
nnoremap K 5k
" Just type - or _ to resize the panels
nnoremap - <C-w>5<
nnoremap _ <C-w>5>
"{{{ Icons
" Ranger devicons for ViFM
@ -352,3 +360,7 @@ set iec
" autocmd DirEnter ~/Videos/*,~/Pictures/manga/**,~/Books/** setlocal sort=+name,+mtime,-dir
autocmd DirEnter ~/Videos/* filter .ass|.srt
" drag and drop
command! dragon dragon-drag-and-drop -a -x %f
nmap <C-d> :dragon<CR>

View file

@ -4,37 +4,37 @@
[global]
monitor = 0
follow = mouse
geometry = "500x5-30+30"
geometry = "512x5-6+34"
indicate_hidden = yes
shrink = yes
transparency = 20
separator_height = 2
padding = 8
horizontal_padding = 13
frame_width = 2
separator_height = 1
padding = 15
horizontal_padding = 15
frame_width = 1
frame_color = "{color2}"
separator_color = "{color8}"
separator_color = "{color2}"
sort = no
idle_threshold = 120
font = iosevka nerd font mono 10
line_height = 0
markup = full
format = "<b>%s</b>\n<i>%b</i>"
alignment = left
alignment = center
show_age_threshold = 60
word_wrap = yes
ignore_newline = no
stack_duplicates = false
hide_duplicate_count = yes
show_indicators = yes
icon_position = left
icon_position = right
sticky_history = no
history_length = 20
browser = qutebrowser
always_run_script = true
title = Dunst
class = Dunst
corner_radius = 0
corner_radius = 10
icon_path = /usr/share/icons/Papirus-Dark/48x48/actions/:/usr/share/icons/Papirus-Dark/48x48/apps/:/usr/share/icons/Papirus-Dark/48x48/devices/:/usr/share/icons/Papirus-Dark/48x48/emblems/:/usr/share/icons/Papirus-Dark/48x48/emotes/:/usr/share/icons/Papirus-Dark/48x48/mimetypes/:/usr/share/icons/Papirus-Dark/48x48/places/:/usr/share/icons/Papirus-Dark/48x48/status/
mouse_left_click = close_current
mouse_middle_click = do_action

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,7 @@ c.aliases = {'mpv': 'spawn --userscript view_in_mpv', 'q': 'quit', 'w': 'session
# default, Qt determines the platform theme based on the desktop
# environment.
# Type: String
c.qt.force_platformtheme = 'qt5ctl'
c.qt.force_platformtheme = 'kde'
# Time interval (in milliseconds) between auto-saves of
# config/cookies/etc.
@ -80,6 +80,8 @@ config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}) AppleWebKit/53
# Type: FormatString
config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}; rv:71.0) Gecko/20100101 Firefox/71.0', 'https://docs.google.com/*')
c.spellcheck.languages = ["en-US"]
# Enable host blocking.
# Type: Bool
c.content.host_blocking.enabled = False
@ -586,6 +588,15 @@ c.colors.tabs.pinned.selected.even.bg = '#EEFFFF'
c.colors.webpage.darkmode.enabled = True
## Which algorithm to use for modifying how colors are rendered with
## darkmode.
## Type: String
## Valid values:
## - lightness-cielab: Modify colors by converting them to CIELAB color space and inverting the L value.
## - lightness-hsl: Modify colors by converting them to the HSL color space and inverting the lightness (i.e. the "L" in HSL).
## - brightness-rgb: Modify colors by subtracting each of r, g, and b from their maximum value.
c.colors.webpage.darkmode.algorithm = 'lightness-cielab'
# Default font families to use. Whenever "default_family" is used in a
# font setting, it's replaced with the fonts listed here. If set to an
# empty value, a system-specific monospace default is used.
@ -636,4 +647,4 @@ sys.path.append(os.path.join(sys.path[0], 'jmatrix'))
config.source("jmatrix/jmatrix/integrations/qutebrowser.py")
sys.path.append(os.path.join(sys.path[0], 'jblock'))
config.source("jblock/jblock/integrations/qutebrowser.py")
os.environ['QT_QPA_PLATFORMTHEME'] = 'kde'
#os.environ['QT_QPA_PLATFORMTHEME'] = 'kde'

View file

@ -27,6 +27,15 @@ boards.4channel.org nstepien.github.io xhr allow
boards.4channel.org files.catbox.moe media allow
boards.4channel.org desuarchive.org xhr allow
boards.4channel.org noembed.com xhr allow
boards.4channel.org soundcloud.com xhr allow
boards.4channel.org a.pomf.cat media allow
boards.4channel.org a.pomf.cat xhr allow
boards.4channel.org api.streamable.com xhr allow
boards.4channel.org z.zz.ht media allow
boards.4channel.org de.catbox.moe media allow
boards.4channel.org fles.catbox.moe media allow
boards.4channel.org file.catbox.moe media allow
boards.4channel.org is2.4chan.org media allow
gitlab.com assets.gitlab-static.net other allow
gitlab.com assets.gitlab-static.net script allow
old.reddit.com www.redditstatic.com script allow

View file

@ -3,9 +3,7 @@ scantrad.net###selectPg
mangadex.org##.social-media-btns
||www.cmso.com/banque/assurance/credit-mutuel/pro/$image
www.cmso.com###entete-wrapper
||mon.cmso.com/novatio-modules/ux-library/6f106deecbf1333e89355b33b376bb69/assets/images/authent.jpg$image
mon.cmso.com##.c-nav--noborderbottom.c-nav--sociaux.c-nav > .c-nav__list
mon.cmso.com##.is-desktop
@ -18,8 +16,6 @@ www.wikiart.org##li.root.selected:nth-of-type(4) > [href="javascript:;"] > h4
www.wikiart.org##[href="/en/female-artists"]
www.wikiart.org##.court-metrage.wiki-footer-column-links > li > [href="/en/app/court-metrage"]
www.wikiart.org##.ng-valid-pattern.ng-valid.ng-pristine.form-subscribe
||uploads.wikiart.org/Content/wiki/img/fb.png$image
||uploads.wikiart.org/Content/wiki/img/twitter.png$image
www.wikiart.org##.shop.wiki-footer-column-links > li > .hidden-blank
www.wikiart.org##.court-metrage.wiki-footer-column-links
www.wikiart.org##.shop.wiki-footer-column-links
@ -30,3 +26,8 @@ www.wikiart.org##li.root:nth-of-type(5) > [href="javascript:;"] > h4
www.wikiart.org##.movie-section.main-info > aside
www.wikiart.org##.movie-section
www.wikiart.org##.short-of-the-month-section > header
wordgrammar.net##.code-block-2.code-block > p
wordgrammar.net##.code-block-1.code-block > p
wordgrammar.net##.entry-content > .code-block-3.code-block > p
wordgrammar.net###ai_widget-4 > .code-block-3.code-block > p

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@
// ==/UserScript==
const exceptions = {};
const hits = {"scantrad.net":["#selectPg",".asqx"],"mangadex.org":[".social-media-btns"],"www.cmso.com":["#entete-wrapper"],"mon.cmso.com":[".is-desktop",".c-nav--noborderbottom.c-nav--sociaux.c-nav > .c-nav__list"],"nyaa.si":["[href=\"https:\/\/twitter.com\/NyaaV2\"]","[href=\"\/\/sukebei.Nyaa.si\"]"],"www.wikiart.org":[".short-of-the-month-section > header",".movie-section",".movie-section.main-info > aside","li.root:nth-of-type(5) > [href=\"javascript:;\"] > h4","li.root:nth-of-type(4) > [href=\"javascript:;\"] > h4","[href=\"\/en\/artists-by-century\/21\"]",".artists.wiki-footer-column-links > li:nth-of-type(11)",".shop.wiki-footer-column-links",".court-metrage.wiki-footer-column-links",".shop.wiki-footer-column-links > li > .hidden-blank",".ng-valid-pattern.ng-valid.ng-pristine.form-subscribe",".court-metrage.wiki-footer-column-links > li > [href=\"\/en\/app\/court-metrage\"]","[href=\"\/en\/female-artists\"]","li.root.selected:nth-of-type(4) > [href=\"javascript:;\"] > h4","[href=\"\/en\/app\/court-metrage\"] > h5",".view-painting-section.short-of-the-month-section"]};
const hits = {"scantrad.net":["#selectPg",".asqx"],"mangadex.org":[".social-media-btns"],"www.cmso.com":["#entete-wrapper"],"mon.cmso.com":[".is-desktop",".c-nav--noborderbottom.c-nav--sociaux.c-nav > .c-nav__list"],"nyaa.si":["[href=\"https:\/\/twitter.com\/NyaaV2\"]","[href=\"\/\/sukebei.Nyaa.si\"]"],"www.wikiart.org":[".short-of-the-month-section > header",".movie-section",".movie-section.main-info > aside","li.root:nth-of-type(5) > [href=\"javascript:;\"] > h4","li.root:nth-of-type(4) > [href=\"javascript:;\"] > h4","[href=\"\/en\/artists-by-century\/21\"]",".artists.wiki-footer-column-links > li:nth-of-type(11)",".shop.wiki-footer-column-links",".court-metrage.wiki-footer-column-links",".shop.wiki-footer-column-links > li > .hidden-blank",".ng-valid-pattern.ng-valid.ng-pristine.form-subscribe",".court-metrage.wiki-footer-column-links > li > [href=\"\/en\/app\/court-metrage\"]","[href=\"\/en\/female-artists\"]","li.root.selected:nth-of-type(4) > [href=\"javascript:;\"] > h4","[href=\"\/en\/app\/court-metrage\"] > h5",".view-painting-section.short-of-the-month-section"],"wordgrammar.net":["#ai_widget-4 > .code-block-3.code-block > p",".entry-content > .code-block-3.code-block > p",".code-block-1.code-block > p",".code-block-2.code-block > p"]};
const fallback = null;
const whitelist = {"null":true};
/** Set union of A and B. Destroys set A. */