We are still actively working on the spam issue.

Ricing-Code-Snippets-Anon-No-76935693

From InstallGentoo Wiki
Jump to: navigation, search
Imbox deletion.png
Imbox deletion.png
DELETION CANDIDATE
Relevant discussion may be found on the talk page. Reason: This entire article is someone's custom rice, orphaned from any other article. It would better be put into a main article, or an individual user page. The article title is also a bizzare title unbefitting a wiki

1595751212859.png

Music Player

dzen popup config:

#!/bin/bash
 
YPOS="16"
FONT="lemon:size=8:antialias=false"
TIMING="15"
BG="#f1f1f4"
FG1="#94949e"
FG2="#70708f"
INPUT_BG="#1f1f47"
INPUT_FG="#dadada"
red="#db758b"
redb="#f0a3a3"
blue="#7c96c9"
blueb="#96b6d8"
green="#7cc988"
greenb="#b0deb7"
cyan="#63918b"
cyanb="#92b5b0"
magenta="#e18bbd"
purple="#a96fcd"
white0="#626e74"
bar_bg="#cbdbcd"
bar_fg="#383847"
notify="#F39D21"
warning="#D23D3D"
highlight="#b4b4b4"
alert="#be698b"
 

dzen mpd popup:

#!/bin/bash
 
# define variables
source $(dirname $0)/d-conf
#XPOS=1387
XPOS=845
HEIGHT="12"
WIDTH="242"
LINES="8"
ALIGN="left"
THUMBSDIR="$HOME/mu/thumbs"
 
cover="$(dirname $0)/d-cover"
buttons="^fg($blue)   ^ca(1, mpc prev)⮳  ^ca()  ^ca(1, mpc pause)⮔  ^ca() ^ca(1, $cover)↓  ^ca() ^ca(1, mpc play)⮓ ^ca()  ^ca(1, mpc next)⮲  ^ca() "
 
if [ "`mpc 2>&1 | wc -l`" -gt "1" ]; then
 
  # loop for continuous updates
  while true;do
 
    # format track information
    track_unformatted=`mpc current -f %title%`
    artist_unformatted=`mpc current -f %artist%`
    album_unformatted=`mpc current -f %album%`
    artist_search=`mpc current -f %artist% | sed -e 's/\//-/g'| sed -e 's/|/-/g' | sed -e 's/\://g' | sed -e 's/(//g' | sed -e 's/)//g' | sed -e 's/\[//g' | sed -e 's/\]//g'`
    album_search=`mpc current -f %album% | sed -e 's/\//-/g'| sed -e 's/|/-/g' | sed -e 's/\://g' | sed -e 's/(//g' | sed -e 's/)//g' | sed -e 's/\[//g' | sed -e 's/\]//g'`
 
    # replace overflow with ellipses
    len_artist=`echo ${#artist_unformatted}`
    if [ "$len_artist" -gt 17 ]; then
      artist_formatted=`echo ${artist_unformatted:0:16}…`
    else
      artist_formatted=$artist_unformatted
    fi
 
    len_album=`echo ${#album_unformatted}`
    if [ "$len_album" -gt 17 ]; then
      album_formatted=`echo ${album_unformatted:0:16}…`
    else
      album_formatted=$album_unformatted
    fi
 
    len_track=`echo ${#track_unformatted}`
    if [ "$len_track" -gt 24 ]; then
      trim=`echo $track_unformatted | cut -c1-23`
      track_formatted=`echo $trim…`
    else
      trailing=`expr 24 - $len_track`
      to_add=`expr $trailing / 2`
      whitespace=`printf '%*s' "$to_add" | tr  ' ' " "`
      track_formatted=$whitespace$track_unformatted
    fi
 
    # return formatted track information
    artist="^fg($FG1)by     ^fg($FG2)$artist_formatted"
    album="^fg($FG1)from   ^fg($FG2)$album_formatted"
    track="^fg($FG1)track  ^fg($FG2)$(mpc -f %track% | sed -n "1p")"
    time="^fg($FG1)time   ^fg($FG2)$(mpc | sed -n "2p" | awk -F " " '{print $3}')"
 
    # progress bar
    perc=`mpc | awk 'NR == 2 {gsub(/[()%]/,""); print $4}'`
    percwidth=$(( $WIDTH - 128 ))
    percbar=`echo -e "$perc" | gdbar -bg $bar_bg -fg $bar_fg -h 1 -w $percwidth`
 
    # album art
    album_art="$THUMBSDIR/$(ls ~/mu/thumbs | grep "$artist_search - $album_search.xpm")"
    if [ -f "$album_art" ]; then
      img="^i($album_art)"
    else
      img="^i($THUMBSDIR/placeholder.xpm)"
    fi
 
    # spawn the popup
    echo "^ib(1) \
   ^pa(0;4)$img \
   ^pa(106;4)^fg($FG2) $track_formatted \
   ^pa(106;16) $artist \
   ^pa(106;28) $album \
   ^pa(106;40) $track \
   ^pa(106;52) $time \
   ^pa(110;78) $percbar \
   ^pa(106;88) $buttons"
  done | dzen2 -p $TIMING -bg $BG -fn $FONT -x $XPOS -y $YPOS -w $WIDTH -h 112 -e 'onstart=uncollapse;button1=exit;button2=exit;button3=exit;button4=exit;button5=exit;onexit=exec:pkill d-music'
else
  (echo "^fg($FG2)MPD is not playing."; sleep 1) | dzen2 -bg $BG -fn $FONT -x 1540 -y $YPOS -w 95 -h $HEIGHT -l 0 -ta "center" -sa $ALIGN -e 'onstart=uncollapse;button1=exit;button2=exit;button3=exit;button4=exit;button5=exit'
fi

Cover Art fetcher

!/bin/zsh
 
artist="$(mpc current -f %artist%)"
album="$(mpc current -f %album%)"
file=$(mpc current -f %file%)
 
album_dir="$HOME/mu/music/${file%/*}"
thumbs_dir="$HOME/mu/music/thumbs"
 
cd ~/mu/thumbs
 
data=$(curl \
    --data-urlencode method=album.getinfo \
    --data-urlencode api_key=2f63459bcb2578a277c5cf5ec4ca62f7 \
    --data-urlencode artist=$artist \
    --data-urlencode album=$album \
    -G -s http://ws.audioscrobbler.com/2.0/)
 
[[ $? > 0 ]] && echo 'Error: Unable to fetch album data!' && return 3
 
setopt rematchpcre
[[ $data =~ '<image size="large">([^<]+)</image>' ]] || { echo 'No cover art found.' && return 4 }
 
artist_formatted="$(mpc current -f %artist% | sed -e 's/\//-/g' | sed -e 's/|/-/g' | sed -e 's/\://g' | sed -e 's/\*//g' | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/(//g' | sed -e 's/)//g')"
album_formatted="$(mpc current -f %album% | sed -e 's/\//-/g' | sed -e 's/|/-/g' | sed -e 's/\://g' | sed -e 's/\;//g' |  sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/(//g' | sed -e 's/)//g')"
 
1=${1:gs/\//_}
2=${2:gs/\//_}
 
echo 'Downloading…'
curl -o /tmp/album.png -s $match
echo 'Converting to .xpm…'
convert -resize 104x104 /tmp/album.png "$artist_formatted - $album_formatted.xpm"
echo 'Moving .png…'
convert -resize 300x300 /tmp/album.png "$album_dir/album.png"
 
[[ $? == 0 ]] && echo 'All done!' && cd ~ || { echo 'Error fetching or converting..' && return 5 && cd ~ }

UserChrome.css


/* things to hide {{{
---------------------
*/
 
scrollbar,
scrollbar scrollbarbutton,
scrollbar gripper,
scrollbar thumb,
liberator-commandline-command,
.webextension-browser-action,
.findbar-button,
.searchbar-textbox,
#urlbar-wrapper,
#social-share-button,
#webide-button,
#downloads-button,
#sidebar-button,
#home-button,
#browser-bottombox,
.tab-icon-image,
.tabs-closebutton-box,
.tab-close-button,
#main-menubar,
#urlbar dropmarker,
#identity-box,
#star-button,
#go-button,
#PanelUI-button,
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tab-throbber,
.tabbrowser-arrowscrollbox > .scrollbutton-down,
.notificationbox-stack,
#TabsToolbar::after,
.notificationbox-stack {
  display: none !important;
}
 
.tab-label-container[textoverflow]:not([pinned]) {
  mask-image: unset !important;
}
 
/* }}} */
 
/* nav bar {{{ */
 
#navigator-toolbox {
  background: #404059 !important;
  padding-top; 1px !important;
  padding-bottom: 1px !important;
  border-top: 1px solid #404059 !important;
}
 
#nav-bar {
  background: #404059 !important;
  margin-top: -18px !important;
  height: 18px !important;
  padding: 0px !important;
  margin-bottom: -2px !important;
  -moz-appearance: none !important;
}
 
#back-button,
#forward-button {
  display: block !important;
  width: 10px !important;
  padding-right: 8px !important;
}
 
#back-button > .toolbarbutton-icon,
#forward-button > .toolbarbutton-icon {
  list-style-image: none !important;
  border: none !important;
  border-radius: 0 0 0 0 !important;
  background-image: none !important;
  background: inherit !important;
  display: inline !important;
}
 
#back-button:before,
#forward-button:before {
  display: block !important;
  background: #f1f1f4 !important;
  color: #414143 !important;
  font-size: 9px !important;
  font-family: lemon !important;
  text-align: center !important;
  margin-top: 3px !important;
  max-height: 12px !important;
  min-width: 18px !important;
  padding: 0px 4px 4px 3px !important;
  /*border-right: 0px solid #f1f1f4 !important;*/
  border-right: none !important;
}
 
#back-button:before {
  content: " <  > " !important;
  margin-left: -3px !important;
  margin-right: 1px !important;
  padding-bottom: 2px !important;
}
 
#back-button:hover:before {
  background: #595961 !important;
  color: #eee !important;
}
 
/* }}} */
 
/* tabs {{{
--------------
*/
 
#TabsToolbar{
  margin-left: 38px !important;
}
 
.tabbrowser-tab::before, .tabbrowser-tab::after {
  background: none !important;
  display: none !important;
  opacity: 1 !important;
}
 
.tab-background-start,
.tab-background-end {
  visibility: hidden !important;
  box-shadow: none !important;
  background: none !important;
}
 
.tab-background-middle {
  background: none !important;
}
 
tabs#tabbrowser-tabs, tabs#tabbrowser-tabs * {
  -moz-appearance: none !important;
  border: none !important;
  border-radius: 0px !important;
  background-image: none !important;
  margin-top: 0px !important;
  box-shadow: none !important;
  max-height: 13px !important;
  min-height: 10px !important;
  padding-left: 0px !important;
}
 
tabs#tabbrowser-tabs {
  background: #404059 !important;
  padding: 1px !important;
  padding-top: 0px !important;
  border: 0px none !important;
  box-shadow: none !important;
  margin-left: -15px !important;
  margin-right: -15px !important;
  z-index: 2000 !important;
}
 
.tabbrowser-tab {
  margin-left: 0px !important;
  margin-right: 0px !important;
  padding-top: 0px !important;
  border: 0px none !important;
  color: #6d6d78 !important;
  background: #f1f1f4 !important;
  min-width:initial!important;
}
 
.tabbrowser-tab:hover, .tabbrowser-tab:active {
  background: #e6e6ea !important;
  box-shadow: none !important;
}
 
.tabbrowser-tab[selected=true], .tabbrowser-tab[selected=true]:hover {
  color: #eee !important;
  background: #404059 !important;
}
 
.tabbrowser-tab .tab-text {
  margin-left: 8px !important;
  margin-top: 0px !important;
  font-size: 8pt !important;
  font-family: lemon !important;
  text-align: center !important;
  -moz-box-flex: 1 !important;
}
 
.titlebar-placeholder[type="caption-buttons"] {
  margin-left: 10px !important;
}
 
.tabbrowser-tabs:not([drag=detach]) > .tabbrowser-tab:not([pinned])[fadein] {
  min-width: 10px !important;
  max-width: 100% !important;
}
 
.tab-background {
  opacity: 0 !important;
}
/* }}} */