Merge branch 'dev' into logos

update statusbar
add $MUSIC_PLAYER
This commit is contained in:
David JULIEN 2021-09-25 00:07:21 +02:00
commit 73cb8fdf1b
9 changed files with 287 additions and 162 deletions

View File

@ -2,6 +2,8 @@
# sourced at launch
alias cp='cp -v'
alias mv='mv -v'
alias rm='rm -v'
alias grep='grep --color=auto'
alias ls='ls --color=auto'
alias ll='ls -lh'
@ -10,12 +12,11 @@ alias bulkrename='\ls | $EDITOR - -c ":%s/.*/mv -i & &/g"'
alias backup='rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /'
alias printenv='printenv | sort'
alias gu='git fetch upstream && git merge upstream/master'
alias unimatrix='unimatrix -a -f -c=cyan -s=95'
alias unimatrix='unimatrix -a -f -s=95'
alias untar='tar -zxvf'
alias root@site='ssh root@davidjulien.xyz'
alias swytch@site='ssh swytch@davidjulien.xyz'
alias @webapps='ssh p1926178@192.168.75.57'
alias @projet='ssh p1926178@192.168.74.198'
alias dotfiles='/usr/bin/git --git-dir=$DOTFILES --work-tree=$HOME'
alias abcde='abcde -c $XDG_CONFIG_HOME/abcde/config'
alias abook='abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook'
alias pip-upgrade="pip freeze --user | cut -d'=' -f1 | xargs -n1 pip install -U"

View File

@ -1,29 +1,29 @@
# Recommended location for database
db_file "~/.config/mpd/database"
db_file "~/.config/mpd/database"
# Logs to systemd journal
log_file "syslog"
log_file "syslog"
# The music directory is by default the XDG directory, uncomment to amend and choose a different directory
music_directory "~/music"
music_directory "~/music"
# Uncomment to refresh the database whenever files in the music_directory are changed
auto_update "yes"
auto_update "yes"
# Uncomment to enable the functionalities
playlist_directory "~/.config/mpd/playlists"
pid_file "~/.config/mpd/pid"
#state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql"
playlist_directory "~/.config/mpd/playlists"
pid_file "~/.config/mpd/pid"
#state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql"
audio_output {
type "pulse"
name "pulse audio"
type "pulse"
name "pulse audio"
}
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}

View File

@ -1,7 +1,8 @@
##########################################################
## this is example bindings configuration file, copy it ##
## to ~/.ncmpcpp/bindings and set up your preferences ##
##########################################################
##############################################################
## This is the example bindings file. Copy it to ##
## $XDG_CONFIG_HOME/ncmpcpp/bindings or ~/.ncmpcpp/bindings ##
## and set up your preferences. ##
##############################################################
##
##### General rules #####
##
@ -51,8 +52,11 @@
## picked by ncmpcpp upon next call to readKey function.
## Accepted values: mouse, up, down, page_up, page_down,
## home, end, space, enter, insert, delete, left, right,
## tab, shift_tab, ctrl_a, ctrl_b, ..., ctrl_z, f1, f2,
## ..., f12, backspace, backspace_2.
## tab, ctrl-a, ctrl-b, ..., ctrl-z, ctrl-[, ctrl-\\,
## ctrl-], ctrl-^, ctrl-_, f1, f2, ..., f12, backspace.
## In addition, most of these names can be prefixed with
## alt-/ctrl-/shift- to be recognized with the appropriate
## modifier key(s).
##
## - push_characters "string" - pushes given string into
## input queue.
@ -93,6 +97,10 @@
## - run_external_command "command" - runs given command using
## system() function.
##
## - run_external_console_command "command" - runs given console
## command using system() function.
##
##
## 5) In addition to binding to a key, you can also bind actions
## or chains of actions to a command. If it comes to commands,
## syntax is very similar to defining keys. Here goes example
@ -111,11 +119,12 @@
## could be used. Then ncmpcpp will not wait for confirmation
## (enter) and will execute the command the moment it sees it.
##
## Note: Both 'backspace' and 'backspace_2' are used because some
## terminals interpret backspace using keycode of 'backspace'
## and some the one of 'backspace_2'. You can get away with
## binding once if all your terminal emulators use the same
## value.
## Note: while command chains are executed, internal environment
## update (which includes current window refresh and mpd status
## update) is not performed for performance reasons. However, it
## may be desirable to do so in some situration. Therefore it's
## possible to invoke by hand by performing 'update enviroment'
## action.
##
## Note: There is a difference between:
##
@ -142,7 +151,7 @@
## The following actions are not bound to any key/command:
##
## - set_volume
## - filter_playlist_on_priorities
## - load
##
#
#def_key "mouse"
@ -150,10 +159,18 @@
#
def_key "k"
scroll_up
#
#def_key "shift-up"
# select_item
# scroll_up
#
def_key "j"
scroll_down
#
#def_key "shift-down"
# select_item
# scroll_down
#
#def_key "["
# scroll_up_album
#
@ -166,32 +183,62 @@ def_key "j"
#def_key "}"
# scroll_down_artist
#
#def_key "page_up"
# page_up
#
def_key "g"
page_up
#
def_key "G"
page_down
#
#def_key "page_down"
# page_down
#
#def_key "home"
# move_home
#
#def_key "end"
# move_end
#
#def_key "space"
# press_space
#def_key "insert"
# select_item
#
def_key "l"
enter_directory
#
#def_key "enter"
# press_enter
# enter_directory
#
#def_key "enter"
# toggle_output
#
#def_key "enter"
# run_action
#
#def_key "enter"
# play_item
#
#def_key "space"
# add_item_to_playlist
#
#def_key "space"
# toggle_lyrics_update_on_song_change
#
#def_key "space"
# toggle_visualization_type
#
#def_key "delete"
# delete_playlist_items
#
#def_key "delete"
# delete_browser_items
#
def_key "d"
delete_playlist_items
#def_key "delete"
# delete_stored_playlist
#
def_key "l"
next_column
#def_key "right"
# next_column
#
#def_key "right"
# slave_screen
@ -199,11 +246,11 @@ def_key "l"
#def_key "right"
# volume_up
#
def_key "="
volume_up
def_key "h"
previous_column
#def_key "+"
# volume_up
#
#def_key "left"
# previous_column
#
#def_key "left"
# master_screen
@ -211,8 +258,8 @@ def_key "h"
#def_key "left"
# volume_down
#
def_key "-"
volume_down
#def_key "-"
# volume_down
#
#def_key ":"
# execute_command
@ -220,45 +267,45 @@ def_key "-"
#def_key "tab"
# next_screen
#
#def_key "shift_tab"
#def_key "shift-tab"
# previous_screen
#
def_key "1"
show_help
def_key "2"
show_playlist
def_key "3"
show_browser
def_key "3"
change_browse_mode
def_key "4"
show_search_engine
def_key "4"
reset_search_engine
def_key "5"
show_media_library
def_key "5"
toggle_media_library_columns_mode
def_key "6"
show_playlist_editor
def_key "7"
show_tag_editor
def_key "8"
show_outputs
def_key "9"
show_visualizer
#def_key "f1"
# show_help
#
#def_key "1"
# show_playlist
#
#def_key "2"
# show_browser
#
#def_key "2"
# change_browse_mode
#
#def_key "3"
# show_search_engine
#
#def_key "3"
# reset_search_engine
#
#def_key "4"
# show_media_library
#
#def_key "4"
# toggle_media_library_columns_mode
#
#def_key "5"
# show_playlist_editor
#
#def_key "6"
# show_tag_editor
#
#def_key "7"
# show_outputs
#
#def_key "8"
# show_visualizer
#
#def_key "="
# show_clock
#
@ -277,23 +324,23 @@ def_key "9"
#def_key "<"
# previous
#
#def_key "ctrl_h"
#def_key "ctrl-h"
# jump_to_parent_directory
#
#def_key "ctrl_h"
#def_key "ctrl-h"
# replay_song
#
def_key "h"
jump_to_parent_directory
#
#def_key "backspace"
# jump_to_parent_directory
#
#def_key "backspace"
# replay_song
#
#def_key "backspace_2"
# jump_to_parent_directory
#
#def_key "backspace_2"
# replay_song
#def_key "backspace"
# play
#
#def_key "f"
# seek_forward
@ -322,9 +369,6 @@ def_key "9"
#def_key "Y"
# toggle_replay_gain_mode
#
#def_key "t"
# toggle_space_mode
#
#def_key "T"
# toggle_add_mode
#
@ -346,15 +390,24 @@ def_key "9"
#def_key "u"
# update_database
#
#def_key "ctrl_v"
#def_key "ctrl-s"
# sort_playlist
#
#def_key "ctrl_r"
#def_key "ctrl-s"
# toggle_browser_sort_mode
#
#def_key "ctrl-s"
# toggle_media_library_sort_mode
#
#def_key "ctrl-r"
# reverse_playlist
#
#def_key "ctrl_f"
#def_key "ctrl-f"
# apply_filter
#
#def_key "ctrl-_"
# select_found_items
#
#def_key "/"
# find
#
@ -403,9 +456,12 @@ def_key "9"
#def_key "g"
# jump_to_position_in_song
#
def_key "l"
show_lyrics
#def_key "l"
# show_lyrics
#
#def_key "ctrl-v"
# select_range
#
#def_key "v"
# reverse_selection
#
@ -436,12 +492,6 @@ def_key "l"
#def_key "m"
# move_selected_items_up
#
#def_key "m"
# toggle_media_library_sort_mode
#
#def_key "m"
# set_visualizer_sample_multiplier
#
#def_key "n"
# move_sort_order_down
#
@ -488,15 +538,15 @@ def_key "l"
# toggle_lyrics_fetcher
#
#def_key "F"
# fetch_lyrics_in_background
#
#def_key "alt-l"
# toggle_fetching_lyrics_in_background
#
#def_key "ctrl_l"
#def_key "ctrl-l"
# toggle_screen_lock
#
#def_key "`"
# toggle_browser_sort_mode
#
#def_key "`"
# toggle_library_tag_type
#
#def_key "`"
@ -505,9 +555,9 @@ def_key "l"
#def_key "`"
# add_random_items
#
#def_key "ctrl_p"
#def_key "ctrl-p"
# set_selected_items_priority
#
def_key "q"
quit
#def_key "q"
# quit
#

View File

@ -1,7 +1,8 @@
##############################################################################
## This is the example configuration file. Copy it to $HOME/.ncmpcpp/config ##
## or $XDG_CONFIG_HOME/ncmpcpp/config and set up your preferences. ##
##############################################################################
##############################################################
## This is an example configuration file. Copy it to ##
## $XDG_CONFIG_HOME/ncmpcpp/config or $HOME/.ncmpcpp/config ##
## and set up your preferences. ##
##############################################################
#
##### directories ######
##
@ -11,7 +12,7 @@
## ncmpcpp.
##
#
ncmpcpp_directory = ~/.config/ncmpcpp
#ncmpcpp_directory = ~/.config/ncmpcpp
#
##
## Directory for storing downloaded lyrics. It defaults to ~/.lyrics since other
@ -32,14 +33,18 @@ mpd_connection_timeout = 5
##
mpd_music_dir = ~/music
#
mpd_crossfade_time = 5
#mpd_crossfade_time = 5
#
# Exclude pattern for random song action
# http://www.boost.org/doc/libs/1_46_1/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html
#random_exclude_pattern = "^(temp|midi_songs).*"
#
##### music visualizer #####
##
## Note: In order to make music visualizer work you'll need to use mpd fifo
## output, whose format parameter has to be set to 44100:16:1 for mono
## visualization or 44100:16:2 for stereo visualization. Example configuration
## (it has to be put into mpd.conf):
## In order to make music visualizer work with MPD you need to use the fifo
## output. Its format parameter has to be set to 44100:16:1 for mono
## visualization or 44100:16:2 for stereo visualization. As an example here is
## the relevant section for mpd.conf:
##
## audio_output {
## type "fifo"
@ -48,21 +53,43 @@ mpd_crossfade_time = 5
## format "44100:16:2"
## }
##
## If the visualization on occasion diverges from the audio output, please set
## 'buffer_time' parameter of your audio output in mpd.conf to '100000' (100ms)
## or less to prevent that from happening.
##
## Note: If you're using Mopidy, an address of a udpsink gstreamer's output is
## also accepted. For example, the following section in mopidy.conf:
##
## [audio]
## output = tee name=t ! queue ! autoaudiosink t.
## ! queue ! audio/x-raw,rate=44100,channels=2,format=S16LE
## ! udpsink host=localhost port=5555
##
## will make localhost:5555 available as a source of data for the stereo
## visualizer.
##
#
visualizer_data_source = /tmp/mpd.fifo
#visualizer_data_source = /tmp/mpd.fifo
#
##
## Note: Below parameter is needed for ncmpcpp to determine which output
## provides data for visualizer and thus allow syncing between visualization and
## sound as currently there are some problems with it.
## provides data for visualizer and reset it at the beginning of visualization
## to synchronize with audio.
##
#
visualizer_output_name = Visualizer feed
#visualizer_output_name = Visualizer feed
#
##
## If you set format to 44100:16:2, make it 'yes'.
##
visualizer_in_stereo = yes
#visualizer_in_stereo = yes
#
##
## Note: set below to >=10 only if you have synchronization issues with
## visualization and audio.
##
#
#visualizer_sync_interval = 0
#
##
## Note: To enable spectrum frequency visualization you need to compile ncmpcpp
@ -71,15 +98,46 @@ visualizer_in_stereo = yes
#
## Available values: spectrum, wave, wave_filled, ellipse.
##
visualizer_type = spectrum
#visualizer_type = spectrum
#
visualizer_look = ●▮
#visualizer_fps = 60
#
visualizer_color = blue, cyan, green, yellow, magenta, red
#visualizer_autoscale = no
#
#visualizer_look = ●▮
#
#visualizer_color = blue, cyan, green, yellow, magenta, red
#
## Alternative subset of 256 colors for terminals that support it.
##
#visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161
#visualizer_color = 47, 83, 119, 155, 191, 227, 221, 215, 209, 203, 197, 161
#
##
## Note: The next few visualization options apply to the spectrum visualizer.
##
#
## Use unicode block characters for a smoother, more continuous look.
## This will override the visualizer_look option. With transparent terminals
## and visualizer_in_stereo set, artifacts may be visible on the bottom half of
## the visualization.
#
#visualizer_spectrum_smooth_look = yes
#
## A value between 1 and 5 inclusive. Specifying a larger value makes the
## visualizer look at a larger slice of time, which results in less jumpy
## visualizer output.
#
#visualizer_spectrum_dft_size = 2
#
#visualizer_spectrum_gain = 10
#
## Left-most frequency of visualizer in Hz, must be less than HZ MAX
#
#visualizer_spectrum_hz_min = 20
#
## Right-most frequency of visualizer in Hz, must be greater than HZ MIN
#
#visualizer_spectrum_hz_max = 20000
#
##### system encoding #####
##
@ -172,9 +230,12 @@ visualizer_color = blue, cyan, green, yellow, magenta, red
##
## Note: colors can be nested.
##
#
song_list_format = "{$3[%l]$9} {$6%t$9}|{$6%30f$9} %n"
#song_list_format = {%a - }{%t}|{$8%f$9}$R{$3%l$9}
#
song_status_format = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
#song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
#
#song_library_format = {%n - }{%t}|{%f}
#
@ -210,12 +271,12 @@ song_status_format = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
## Note: Below variables are used for sorting songs in browser. The sort mode
## determines how songs are sorted, and can be used in combination with a sort
## format to specify a custom sorting format. Available values for
## browser_sort_mode are "name", "mtime", "format" and "noop".
## browser_sort_mode are "type", "name", "mtime", "format" and "none".
##
#
#browser_sort_mode = name
#browser_sort_mode = type
#
#browser_sort_format = {%a - }{%t}|{%f} {(%l)}
#browser_sort_format = {%a - }{%t}|{%f} {%l}
#
##### columns settings #####
##
@ -252,7 +313,8 @@ song_status_format = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
## available.
##
#
song_columns_list_format = (6f)[green]{NE} (30)[white]{30t|30f:Title} (7f)[green]{l} (30)[]{a} (30)[]{b}
song_columns_list_format = (6f)[green]{NE} (30)[white]{t|f:Title} (7f)[green]{l} (30)[]{a} (30)[]{b}
#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}
#
##### various settings #####
#
@ -325,6 +387,8 @@ song_columns_list_format = (6f)[green]{NE} (30)[white]{30t|30f:Title} (7f)[green
#
#media_library_albums_split_by_date = yes
#
#media_library_hide_album_dates = no
#
## Available values: wrapped, normal.
##
#default_find_mode = wrapped
@ -335,15 +399,16 @@ song_columns_list_format = (6f)[green]{NE} (30)[white]{30t|30f:Title} (7f)[green
#
#statusbar_visibility = yes
#
## Show the "Connected to ..." message on startup
#connected_message_on_startup = yes
#
#titles_visibility = yes
#
#header_text_scrolling = yes
#
#cyclic_scrolling = no
#
#lines_scrolled = 2
#
#lyrics_fetchers = lyricwiki, azlyrics, genius, sing365, lyricsmania, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, internet
#lyrics_fetchers = azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet
#
#follow_now_playing_lyrics = no
#
@ -378,7 +443,7 @@ song_columns_list_format = (6f)[green]{NE} (30)[white]{30t|30f:Title} (7f)[green
## media_library, playlist_editor, tag_editor, outputs, visualizer, clock,
## lyrics, last_fm.
##
screen_switcher_mode = playlist, browser
#screen_switcher_mode = playlist, browser
#
##
## Note: You can define startup screen by choosing screen from the list above.
@ -434,7 +499,9 @@ startup_screen = browser
#
#mouse_support = yes
#
#mouse_list_scroll_whole_page = yes
#mouse_list_scroll_whole_page = no
#
#lines_scrolled = 5
#
#empty_tag_marker = <empty>
#

View File

@ -49,7 +49,7 @@ super + shift + {h,j,k,l}
player {prev,stop,toggle,next}
super + shift + m
$TERMINAL -g 128x32 -c "floating" -e ncmpc
$TERMINAL -g 128x32 -c "floating" -e $MUSIC_PLAYER
super + shift + n
$TERMINAL -g 128x32 -c "floating" -e neomutt

View File

@ -28,3 +28,4 @@ export EDITOR="nvim"
export TERMINAL="st"
export READER="zathura"
export BROWSER="firefox"
export MUSIC_PLAYER="ncmpcpp"

View File

@ -26,8 +26,8 @@ notify() { \
[ 300 -gt $delta ] && return;
echo $now > $XDG_CONFIG_HOME/batteryupdate
case "$capacity" in
1[0-9]) notify-send -u "normal" "Battery is running low ($capacity%)" "Please plug your computer to a power source" ;;
[0-9]) notify-send -u "critical" "Battery is dangerously low ($capacity%)" "Please plug your computer to a power source - <b>NOW!</b>" ;;
2[0-9]) notify-send -u "normal" "Battery is running low ($capacity%)" "Please plug your computer to a power source" ;;
*) notify-send -u "critical" "Battery is dangerously low ($capacity%)" "Please plug your computer to a power source - <b>NOW!</b>" ;;
esac
}
@ -35,19 +35,24 @@ for bat in /sys/class/power_supply/BAT?/
do
status="$(cat "$bat/status")"
capacity="$(cat "$bat/capacity")"
if [ "$status" = "Full" ]; then
total="$(expr $total + $capacity)"
slot="$(basename $bat)"
if [ "Full" = "$status" ]; then
status=" " && capacity="FULL"
printf " %s %s " "$status" "$capacity" && exit
elif [ "$status" = "Charging" ]; then
status=""
else
case "$capacity" in
100|[8-9][0-9]) status="" ;;
[6-7][0-9]) status="" ;;
[4-5][0-9]) status="" ;;
[2-3][0-9]) status="" ;;
*) status="" ; notify;;
esac
fi
printf " %s %3d%% " "$status" "$capacity";
printf " %s:%s(%s) " "$slot" "$status" "$capacity"
else
if [ "$status" = "Charging" ]; then
status=""
else
case "$capacity" in
100|[8-9][0-9]) status="" ;;
[6-7][0-9]) status="" ;;
[4-5][0-9]) status="" ;;
[2-3][0-9]) status="" ;;
*) status="" ;;
esac
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify;
fi
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
fi
done

View File

@ -11,9 +11,10 @@
# Wifi quality percentage and  icon if ethernet is connected.
wifi="$(grep "^\s*w" /proc/net/wireless | awk '{ printf int($3 * 100 / 70) }')"
[ -n "$wifi" ] && str="$(printf "直 %3d%%" $wifi)" || str="$(printf "睊")"
eth="$(cat /sys/class/net/eno1/operstate)"
ssid="$(wpa_cli status | grep -i ^ssid | sed -e 's/.*=//')"
state="$(wpa_cli status | grep -i ^wpa_state | sed -e 's/.*=//')"
[ "COMPLETED" = $state ] && str="$(printf " %s" $ssid)" || str="$(printf " ---")"
if [ "up" = "$eth" ]; then
str="$(printf "%s /  " "$str")"
fi

View File

@ -13,7 +13,7 @@
unicode() { sed "s/[]/'/g;s/[“”]/\"/g"; }
format() { sed "s/^volume:n\/a.*//g;/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g"; }
mpc="$(mpc --format "%albumartist% - %title%")"
mpc="$(mpc --format "%artist% - %title%")"
title="$(echo "$mpc" | head -n1 | cut -d'-' -f2 | unicode)"
[ "$(echo "$title" | wc -c)" -gt 18 ] && title="$(printf "%.15s..." "$title")"
artist="$(echo "$mpc" | head -n1 | cut -d'-' -f1 | unicode)"