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 # sourced at launch
alias cp='cp -v' alias cp='cp -v'
alias mv='mv -v'
alias rm='rm -v'
alias grep='grep --color=auto' alias grep='grep --color=auto'
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias ll='ls -lh' 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 backup='rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /'
alias printenv='printenv | sort' alias printenv='printenv | sort'
alias gu='git fetch upstream && git merge upstream/master' 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 untar='tar -zxvf'
alias root@site='ssh root@davidjulien.xyz' alias root@site='ssh root@davidjulien.xyz'
alias swytch@site='ssh swytch@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 dotfiles='/usr/bin/git --git-dir=$DOTFILES --work-tree=$HOME'
alias abcde='abcde -c $XDG_CONFIG_HOME/abcde/config' 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 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 # Recommended location for database
db_file "~/.config/mpd/database" db_file "~/.config/mpd/database"
# Logs to systemd journal # 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 # 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 # Uncomment to refresh the database whenever files in the music_directory are changed
auto_update "yes" auto_update "yes"
# Uncomment to enable the functionalities # Uncomment to enable the functionalities
playlist_directory "~/.config/mpd/playlists" playlist_directory "~/.config/mpd/playlists"
pid_file "~/.config/mpd/pid" pid_file "~/.config/mpd/pid"
#state_file "~/.config/mpd/state" #state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql" sticker_file "~/.config/mpd/sticker.sql"
audio_output { audio_output {
type "pulse" type "pulse"
name "pulse audio" name "pulse audio"
} }
audio_output { audio_output {
type "fifo" type "fifo"
name "my_fifo" name "my_fifo"
path "/tmp/mpd.fifo" path "/tmp/mpd.fifo"
format "44100:16:2" format "44100:16:2"
} }

View File

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

View File

@ -1,7 +1,8 @@
############################################################################## ##############################################################
## This is the example configuration file. Copy it to $HOME/.ncmpcpp/config ## ## This is an example configuration file. Copy it to ##
## or $XDG_CONFIG_HOME/ncmpcpp/config and set up your preferences. ## ## $XDG_CONFIG_HOME/ncmpcpp/config or $HOME/.ncmpcpp/config ##
############################################################################## ## and set up your preferences. ##
##############################################################
# #
##### directories ###### ##### directories ######
## ##
@ -11,7 +12,7 @@
## ncmpcpp. ## ncmpcpp.
## ##
# #
ncmpcpp_directory = ~/.config/ncmpcpp #ncmpcpp_directory = ~/.config/ncmpcpp
# #
## ##
## Directory for storing downloaded lyrics. It defaults to ~/.lyrics since other ## Directory for storing downloaded lyrics. It defaults to ~/.lyrics since other
@ -32,14 +33,18 @@ mpd_connection_timeout = 5
## ##
mpd_music_dir = ~/music 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 ##### ##### music visualizer #####
## ##
## Note: In order to make music visualizer work you'll need to use mpd fifo ## In order to make music visualizer work with MPD you need to use the fifo
## output, whose format parameter has to be set to 44100:16:1 for mono ## output. Its format parameter has to be set to 44100:16:1 for mono
## visualization or 44100:16:2 for stereo visualization. Example configuration ## visualization or 44100:16:2 for stereo visualization. As an example here is
## (it has to be put into mpd.conf): ## the relevant section for mpd.conf:
## ##
## audio_output { ## audio_output {
## type "fifo" ## type "fifo"
@ -48,21 +53,43 @@ mpd_crossfade_time = 5
## format "44100:16:2" ## 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 ## Note: Below parameter is needed for ncmpcpp to determine which output
## provides data for visualizer and thus allow syncing between visualization and ## provides data for visualizer and reset it at the beginning of visualization
## sound as currently there are some problems with it. ## 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'. ## 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 ## 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. ## 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. ## 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 ##### ##### system encoding #####
## ##
@ -172,9 +230,12 @@ visualizer_color = blue, cyan, green, yellow, magenta, red
## ##
## Note: colors can be nested. ## Note: colors can be nested.
## ##
#
song_list_format = "{$3[%l]$9} {$6%t$9}|{$6%30f$9} %n" 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 = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
#song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
# #
#song_library_format = {%n - }{%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 ## 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 ## determines how songs are sorted, and can be used in combination with a sort
## format to specify a custom sorting format. Available values for ## 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 ##### ##### columns settings #####
## ##
@ -252,7 +313,8 @@ song_status_format = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
## available. ## 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 ##### ##### 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_albums_split_by_date = yes
# #
#media_library_hide_album_dates = no
#
## Available values: wrapped, normal. ## Available values: wrapped, normal.
## ##
#default_find_mode = wrapped #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 #statusbar_visibility = yes
# #
## Show the "Connected to ..." message on startup
#connected_message_on_startup = yes
#
#titles_visibility = yes #titles_visibility = yes
# #
#header_text_scrolling = yes #header_text_scrolling = yes
# #
#cyclic_scrolling = no #cyclic_scrolling = no
# #
#lines_scrolled = 2 #lyrics_fetchers = azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet
#
#lyrics_fetchers = lyricwiki, azlyrics, genius, sing365, lyricsmania, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, internet
# #
#follow_now_playing_lyrics = no #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, ## media_library, playlist_editor, tag_editor, outputs, visualizer, clock,
## lyrics, last_fm. ## 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. ## Note: You can define startup screen by choosing screen from the list above.
@ -434,7 +499,9 @@ startup_screen = browser
# #
#mouse_support = yes #mouse_support = yes
# #
#mouse_list_scroll_whole_page = yes #mouse_list_scroll_whole_page = no
#
#lines_scrolled = 5
# #
#empty_tag_marker = <empty> #empty_tag_marker = <empty>
# #

View File

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

View File

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

View File

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

View File

@ -11,9 +11,10 @@
# Wifi quality percentage and  icon if ethernet is connected. # 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)" 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 if [ "up" = "$eth" ]; then
str="$(printf "%s /  " "$str")" str="$(printf "%s /  " "$str")"
fi fi

View File

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