Because the update will overwrite them with ‘normal’ versions - referencing ugly icons and skipping the scaling etc.
Or you could:
sudo chattr +i some.desktop
Those .desktop files may have useful modifications on updates. But in that case they may not be easy to change, and would require manual intervention.
Very true - but I assume (!) I would hear about it if something world-shaking was added. (or I would live without it). Life - and Linux - is tradeoffs
No update should touch your home directory. The user space should not be affected by the package management.
If you make copies of the .desktop files to ~/.local/share/applications
they should remain unaffected by updates. Settings in your home directory take precedence for your user’s account over any other settings system-wide.
Here a guide to the “proper” method for changing icons for applications:
I tried that a couple of times (would be ideal, as I could check out the new ones and decide, like a .pacnew) - but for some reason it didn’t work… and I never re-checked or figured out why! Thanks for the reminder, I’ll retry on another build that hasn’t been ‘hooked’ yet…
Looking into it further - it might be related to plank. Perhaps it doesn’t honour the primacy of .local/share/applications versions -as they ARE all there… but every update I see the icons change in plank.
Would be nice if it DID work, though…
It could be a bug in plank. Test it further and report it, if you can confirm it.
Extend the man
command with EOS apps and packages:
# add this line into your ~/.bashrc: man() { /usr/bin/man "$@" || eos-pkginfo "$@" ; }
Note that this is a quick and dirty trick, and some EOS stuff might not work with this yet.
Anyway, now you can do e.g.
man welcome man eos-pkginfo man akm # etc.
A couple of network IP scripts. Depending on the fonts installed on your system the icons may not display correct. They have - primarily - been created for use with polybar but they work with tint2 as well - they are a part of my running setup.
#!/bin/bash
# root.nix.dk
# polybar wan/vpn status script
#
broken=""
state1=""
state2=""
state3=""
connected=""
shield=""
wan=""
vpn=""
network=$(ip a | grep ' state UP' | cut -d' ' -f2 | cut -d':' -f1)
if [[ -z ${network} ]]; then
echo ${wan} ${broken} ${state1}; sleep 0.5
echo ${wan} ${broken} ${state2}; sleep 0.5
echo ${wan} ${broken} ${state3}; sleep 0.5
else
device=$(ip a | grep 'tun')
if [[ -z $device ]]; then
device=$(ip a | grep 'proton')
fi
if [[ ${device} == "" ]]; then
echo ${wan} $(curl -s https://get.geojs.io/v1/ip)
else
echo ${shield} $(curl -s https://get.geojs.io/v1/ip)
fi
fi
#!/usr/bin/env bash
#
# root.nix.dk
# polybar check-network script
#
broken=""
state0=""
state1=""
state2=""
state3=""
wlan=""
lan=""
lanip() {
echo $(ip a show $1 | grep 'inet ' | head -n 4 | awk '{print $2}' | cut -d'/' -f1)
}
network_down() {
echo ${lan} ${broken}; sleep 0.5
echo ${lan} ${state1}; sleep 0.5
echo ${lan} ${state2}; sleep 0.5
echo ${lan} ${state3}; sleep 0.5
echo ${lan} ${state0}; sleep 0.5
}
nic=$(ip a | grep ' state UP' | cut -d' ' -f2 | cut -d':' -f1)
if [[ ${nic} != "" ]]; then
if [[ ${nic} == e* ]]; then
echo ${lan} $(lanip ${nic})
else
echo ${wlan} $(lanip ${nic})
fi
else
network_down
fi
The scripts requires some truetype fonts with icons - I can’t really remember which one it is - but I have a package for it. It’s called ttf-shadow-fonts because it shadows a collection of fonts from different packages. The fonts has been renamed so they don’t collide - which may make the font show up twice - I don’t really know.
Well, this is neither handy nor utility, but more of a tool to include in your scripts. A nice, pacman-style progress bar:
#!/bin/bash
#Displays a progress bar like this:
#So progressive... 88% [################################### ]
trap 'printf "\x1B[?25h" ' EXIT # cursor on
printf "\x1B[?25l" # cursor off
function progress_bar() { #MESSAGE, PERCENT, BAR_LENGTH
printf "\r%s %3d%% [" "$1" $2
for ((c = 0; c < $3; c++)) do
if (( $c <= $2 * $3 / 100 )); then
echo -ne "#"
else
echo -ne " "
fi
done;
stdbuf -oL printf "]" #flush stdout
}
for i in {1..100}; do
progress_bar "Processing..." $i 40
sleep 0.03s
done;
printf "\nDone.\n"
It’s fairly elementary, but it has a few interesting details, like the \r
(carriage return) character, flushing the stdout, hiding and showing the cursor, and using trap
to handle interrupts.
Of course, instead of sleep
the real application would do something useful with it.
A challenge for those who feel up to it: modify the script above to turn the progress bar into ILoveCandy pacman bar.
Nice.
Sadly, the only place I would use it is for cp
command. And if I really need that I use rsync
.
Thx, you’ve read my mind actually, i was about to make something like that
I want to find a use for it now
Do you mind if I use it in the akm app?
No, I don’t mind at all, why would I post it and then tell you: “no, no, you can only look at it, and admire, but do not use it for something that is actually useful!”
Besides, it’s not an original idea by any means, it’s already seen in pacman and many other programs. And even if it were original, I don’t believe in copyright.
Thanks, I’ll mention you in the source code.
Just felt it is good to ask. And I don’t believe either in patenting simple designs like rounded corners on a cell phone…
By the way, the progress bar suits very well into akm when you start akm form the terminal.
Wait…what?!
I had no idea you can terminal akm
P.S. Oh, you mean just start, not use
Here is a digital clock I just made as an exercise in bash scripting:
#!/usr/bin/env bash
# A rather nice looking digital clock in the terminal.
function cleanup_() {
printf '\033[?25h' # unhide cursor
stty echo 2>/dev/null
}
trap cleanup_ EXIT
REFRESH_INTERVAL=0.2 # display the clock every 0.2 seconds, adjust if necessary
TIME_FORMAT="%H:%M:%S" # change to "%I:%M:%S" for 12-hour format
# Feel free to modify the FONT, the only restriction is that all characters are
# of equal height. There should be 11 characters, in this order: "0123456780:"
FONT=(
"█▀▀█ "
"█ █ "
"█ █ "
"▀▀▀▀ "
" █ "
" █ "
" █ "
" ▀ "
"▀▀▀█ "
"▄▄▄█ "
"█ "
"▀▀▀▀ "
"▀▀▀█ "
"▄▄▄█ "
" █ "
"▀▀▀▀ "
"█ █ "
"█▄▄█ "
" █ "
" ▀ "
"█▀▀▀ "
"█▄▄▄ "
" █ "
"▀▀▀▀ "
"█▀▀▀ "
"█▄▄▄ "
"█ █ "
"▀▀▀▀ "
"▀▀▀█ "
" █ "
" █ "
" ▀ "
"█▀▀█ "
"█▄▄█ "
"█ █ "
"▀▀▀▀ "
"█▀▀█ "
"█▄▄█ "
" █ "
"▀▀▀▀ "
" "
" ▀ "
" "
" ▀ "
)
FONT_HEIGHT=$(( ${#FONT[@]} / 11 )) # FONT height in characters
function figletise() {
read str;
for (( line = 0; line < FONT_HEIGHT; line++ )); do
printf " "
for (( c=0; c<${#str}; c++ )); do
local ch=$(LC_CTYPE=C printf '%d' "'${str:$c:1}") # get ascii value
ch=$((ch-48))
if (( ch >= 0 && ch <= 10 )); then
local i=$(( ch * FONT_HEIGHT + line )) # 2D -> 1D array conversion
printf '%s' "${FONT[$i]}"
fi
done
printf "\n"
done
}
stty -echo 2>/dev/null
printf '\033[?25l\n' # hide cursor
unset EXIT_
while true; do
date +"$TIME_FORMAT" | figletise
[[ -z $EXIT_ ]] || exit 0
read -t $REFRESH_INTERVAL -n 1 && EXIT_=1; # bloat for freebird
printf "\033[${FONT_HEIGHT}A\r" # move cursor to beginning,
# fixed for crappy terminals
done
Most of it is quite simple, but there are two interesting things about it (in my opinion):
- the escape sequence
\033[F
which works a bit like the carriage return\r
from the progress bar script above, but in addition, moves the cursor one line up - the way of obtaining ASCII code of a character, using
printf
function and a single quote character – a rather insane syntax which I haven’t seen before, but it works. Read about it here: http://mywiki.wooledge.org/BashFAQ/071
For those of us who do Web Development:
#!/bin/sh
# =================================================================================================================================================
# Backup script for LAMP servers
# ------------------------------
#
# Read the comments below to understand how to work with this script!
# All risks are yours. But it is a very safe script!
#
# by onyx
# =================================================================================================================================================
set -v
# Below this line are the system variables you need to set for each unique site
# THESERVER is the IP address of the server it needs to run on, usually 127.0.0.1
THESERVER="127.0.0.1"
# THESITE is the name of the website - whatever you want to call it, it names the backup file
THESITE="mysite"
# THEDB is the database name in the MySQL/ MariaDB databases list that relates to this website. Check in PHPMyadmin if unsure
THEDB="mysitedb"
# THEDBUSER is the name for the MySQL/ MariaDB user that can read this database. Best not to be "root" in a shared environment!
THEDBUSER="root"
# THEDBPW is the password for the above THEDBUSER
THEDBPW="rootpassword"
# THEDBPORT is the port that the MySQL/ MariaDB engine is running on; usually 3306
THEDBPORT="3306"
# The following settings control the paths to the website files and the backup files
# every path needs to end with /
# NOTE: the Linux system user that is running this script MUST have permissions to read from the THESITEPATH and write to THEBACKUPPATH !!
# THESITEPATH is where the website files are
THESITEPATH="/path/to/the/site/"
# THEBACKUPPATH is where the backups will go
THEBACKUPPATH="/path/to/the/backups/"
# THEDATE should be left alone unless you know what you are doing - it dates the backup files correctly
THEDATE=`date +%d%m%y%H%M`
# THEDAYSTOKEEP is how many backups to keep before removing the old ones - this does assume a daily Cron job!
THEDAYSTOKEEP="30"
# =================================================================================================================================================
# Below this line the work is done!
# =================================================================================================================================================
mysqldump --host ${THESERVER} -P${THEDBPORT} -u ${THEDBUSER} -p${THEDBPW} ${THEDB} | gzip >${THEBACKUPPATH}dbbackup_${THEDB}_${THEDB}_${THEDATE}.gz
tar czf ${THEBACKUPPATH}sitebackup_${THESITE}_${THEDATE}.tar -C / ${THESITEPATH}${THESITE}
gzip ${THEBACKUPPATH}sitebackup_${THESITE}_${THEDATE}.tar
find ${THEBACKUPPATH}site* -mtime +${THEDAYSTOKEEP} -exec rm {} \;
find ${THEBACKUPPATH}db* -mtime +${THEDAYSTOKEEP} -exec rm {} \;
# =================================================================================================================================================
# Finished the work!
# =================================================================================================================================================
# =================================================================================================================================================
# Now save this file where your Cron can get to it, and make sure that it is executable
# Example: chmod +x backupscript1.sh
# Then add the file to your Cron jobs
# Example: crontab -e
#
# * 0 * * * /home/username/path/to/backupscript1.sh
#
# And save that. The above example runs at midnight every day.
#
# =================================================================================================================================================