#1 Le 27/03/2016, à 15:54
- rabillou
Modifier Icone en ligne de commande (Résolu)
Bonjour,
Voilà tout est dit dans le titre, comment peut on changer l’icône d'un fichier en ligne de commande
En gros comment faire pour remplacer:
- clic droit
- propriété
- changer d’icône
C'est pour pouvoir l'intégré à un script, car je synchronise certain fichier avec mon serveur et j'aimerais pouvoir modifier l’icône du fichier (comme dropbox) pour que cela soit "parlant" pour tous ceux qui utilise le pc, pour évité d'effacer un fichier non synchronisé
J'ai chercher sur le forum et sur le net mais j'ai pas trouvé mon bonheur, il ne parle que de changé l’icône suivant le type mime, la sa peut etre des photos, vidéos, document, sons, etc...
Si quelqu'un sait comment faire....
Dernière modification par rabillou (Le 09/04/2016, à 10:20)
Hors ligne
#2 Le 28/03/2016, à 18:36
- rabillou
Re : Modifier Icone en ligne de commande (Résolu)
Personne ne sait ?
Hors ligne
#3 Le 28/03/2016, à 18:52
- MicP
Re : Modifier Icone en ligne de commande (Résolu)
C'est pas aussi facile que ça de proposer une solution qui fonctionnera pour tous les environnements de bureaux et dans toutes les résolutions d'affichage pour toutes les applications.
Par exemple, j'utilise XFce et certaines icônes sont dans le répertoire /usr/share/icons
mais il n'y a pas qu'une icône, il y en a une pour chaque (par groupe) ensemble de résolutions possibles.
Hors ligne
#4 Le 29/03/2016, à 09:43
- Compte anonymisé
Re : Modifier Icone en ligne de commande (Résolu)
C'est assez simple , pour tout les D.esktop E.nvironnement :
L'icone d'1 app dépend du theme d'icone utilisé .
A moins de modifier manuellement l'icone de l'app dans : "/usr/share/applications" ou "~/local/share/applications"
( Exception pour les logiciels optionels : /opt )
------------------------------------------------------------------------
L'icone d'un fichier dépend du Gestionnaire de fichier .
Cherche le repertoire d'icone de celui-ci .
Dernière modification par Compte anonymisé (Le 29/03/2016, à 09:49)
#5 Le 29/03/2016, à 12:22
- LeoMajor
Re : Modifier Icone en ligne de commande (Résolu)
bonjour,
sous unity, cela fonctionne très bien
gvfs-set-attribute -t string /tmp/test.txt metadata::custom-icon file:///usr/share/vlc/vlc.ico
sinon passer par les types mimes, avec une nouvelle extension du genre *.syn
Hors ligne
#6 Le 29/03/2016, à 23:55
- sergeG75018
Re : Modifier Icone en ligne de commande (Résolu)
Bonjour.
perso J'utilise la commande donnée par LeoMajor
mais si tu veux avoir la même icones pour tous les themes alors il faut la créer.
j'ai 2 méthodes
Le svg car les images svg ne sont que de simple fichiers texte XML
Exemple a coller dans un terminal
#tu crais ton dossier avec l'icone standard (ou le fichier)
mkdir "$HOME/test icone dossier"
#tu crais ton icone et tu l'enregistre dans le dossier systeme perso $HOME/.local/share/icons/un nom de ton choix
#pour l'exemple $HOME/.local/share/icons/testdossier
mkdir $HOME/.local/share/icons/testdossier
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0"
width="22"
height="22"
id="svg2449">
<defs
id="defs2451">
<linearGradient
id="linearGradient3827">
<stop
id="stop3835"
style="stop-color:#6396cd;stop-opacity:1"
offset="0" />
<stop
id="stop3831"
style="stop-color:#7ba7d5;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3803">
<stop
id="stop3805"
style="stop-color:#538ec6;stop-opacity:1"
offset="0" />
<stop
id="stop3807"
style="stop-color:#538ec6;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3533">
<stop
id="stop3535"
style="stop-color:#93b9dd;stop-opacity:1"
offset="0" />
<stop
id="stop3545"
style="stop-color:#6396cd;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="108.97875"
y1="185.10141"
x2="111.16116"
y2="193.85185"
id="linearGradient5584"
xlink:href="#linearGradient5578"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0000213,0,0,0.99999945,-103.00376,-175.00295)" />
<linearGradient
id="linearGradient5578">
<stop
id="stop5580"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop5582"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="113.66741"
y1="189.97391"
x2="112.51836"
y2="187"
id="linearGradient5554"
xlink:href="#linearGradient5548"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0000213,0,0,0.99999945,-103.00376,-175.00295)" />
<linearGradient
id="linearGradient5548">
<stop
id="stop5550"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop5552"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="116.4927"
y1="198.96754"
x2="110.65003"
y2="177.1624"
id="linearGradient5374"
xlink:href="#linearGradient4022-6-5-6"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4022-6-5-6">
<stop
id="stop4024-1-5-3"
style="stop-color:#555753;stop-opacity:1"
offset="0" />
<stop
id="stop4026-2-3-1"
style="stop-color:#babdb6;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="114.86526"
y1="192.53191"
x2="119.53192"
y2="187.86525"
id="linearGradient3809"
xlink:href="#linearGradient3803"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="109.00001"
y1="177"
x2="113.00001"
y2="196"
id="linearGradient3817"
xlink:href="#linearGradient3533"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="113.93192"
y1="192.53191"
x2="120.46526"
y2="189.73192"
id="linearGradient3833"
xlink:href="#linearGradient3827"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="109.00001"
y1="177"
x2="112.11741"
y2="188.79379"
id="linearGradient3883"
xlink:href="#linearGradient3533"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="109.00001"
y1="177"
x2="113.00001"
y2="196"
id="linearGradient3885"
xlink:href="#linearGradient3533"
gradientUnits="userSpaceOnUse" />
</defs>
<g
transform="matrix(1.0000213,0,0,0.99999945,-103.00376,-175.00295)"
id="g5364"
style="stroke:url(#linearGradient5374);display:inline;enable-background:new">
<path
d="m 112.44761,192.97817 a 7,7 0 1 1 5.7872,-11.6254"
transform="matrix(1.0714286,0,0,1.0714286,-7.0699096,-12.284198)"
id="path3159-8"
style="color:#000000;fill:none;stroke:#538ec6;stroke-width:4.66666651;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 121,179 0,0 0,5 -5,0"
id="path3957-8"
style="fill:none;stroke:#538ec6;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline;enable-background:new" />
<path
d="m 119.19847,189.25253 a 7,7 0 0 1 -9.49902,2.92051"
transform="matrix(1.0714286,0,0,1.0714286,-7.0699096,-12.284198)"
id="path3801"
style="color:#000000;fill:none;stroke:url(#linearGradient3809);stroke-width:4.66666651;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
<g
transform="matrix(1.0000213,0,0,0.99999945,-103.00376,-175.00295)"
id="g5315"
style="fill-opacity:1;stroke:url(#linearGradient3817);stroke-opacity:1;display:inline;enable-background:new">
<path
d="m 112.17502,192.95122 a 7,7 0 1 1 6.05979,-11.59845"
transform="matrix(1.0714286,0,0,1.0714286,-7.0699104,-12.284198)"
id="path3159"
style="color:#000000;fill:none;stroke:url(#linearGradient3883);stroke-width:2.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 121,179 0,0 0,5 -5,0"
id="path3957-7-3"
style="fill:none;stroke:url(#linearGradient3885);stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline;enable-background:new" />
<path
d="m 119.19728,189.25479 a 7,7 0 0 1 -10.70311,2.10222"
transform="matrix(1.0714286,0,0,1.0714286,-7.0699104,-12.284198)"
id="path3823"
style="color:#000000;fill:none;stroke:url(#linearGradient3833);stroke-width:2.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
<path
d="m 16.748792,14.996954 c -0.340462,0.647683 -0.77176,1.215015 -1.270184,1.6936 -1.954963,1.877154 -4.939072,2.390862 -7.4800025,1.056399 C 4.8098576,16.072264 3.5738312,12.185636 5.2485469,8.9969583 6.9232726,5.8082797 10.809995,4.5722804 13.998734,6.2469594 c 0.614773,0.3228699 1.174775,0.7544396 1.656285,1.2499994 m 0.843768,-1.968749 C 16.023097,5.1240301 15.492676,4.7579403 14.936254,4.4657104 13.899832,3.9213907 12.817699,3.6191709 11.717435,3.5282109 c -0.206294,-0.0171 -0.415259,-0.0323 -0.625013,-0.0312 -0.209756,0.001 -0.42031,0.0182 -0.625014,0.0312 C 7.601587,3.7101908 4.8961094,5.3389099 3.467259,8.0594585 1.2899527,12.205056 2.9153881,17.350941 7.0610855,19.528202 c 3.2323445,1.697581 7.0727905,1.083478 9.6400985,-1.234453 0.725431,-0.654965 1.348937,-1.446112 1.828896,-2.359295"
id="path3159-1"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:0.15;color:#000000;fill:none;stroke:#ffffff;stroke-width:1.00001037;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
<path
d="m 15.498766,8.4969582 -2.500054,0 c -0.264165,-0.004 -0.50713,0.2358199 -0.50713,0.5000001 m 5.413485,-5.4999974 c -0.229205,0.0437 -0.410369,0.2666999 -0.406259,0.4999998 l 0,2.4999986"
id="path3957-7-5-1"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:0.3;color:#000000;fill:none;stroke:#ffffff;stroke-width:1.00001037;stroke-linecap:round;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
<path
d="M 14.07866,17.713355 C 12.251948,18.70353 9.98927,18.792424 7.9986055,17.746955 4.8098576,16.072266 3.5738312,12.185638 5.2485469,8.9969603 6.9232726,5.8082817 10.809995,4.5722824 13.998734,6.2469614 c 0.614773,0.3228699 1.174775,0.7544396 1.656285,1.2499994"
id="path3159-1-7"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:0.23999999;color:#000000;fill:none;stroke:url(#linearGradient5554);stroke-width:1.00001037;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
<path
d="M 16.498787,5.5282098 C 16.023097,5.1240301 15.492676,4.7579403 14.936254,4.4657104 13.899832,3.9213907 12.817699,3.6191709 11.717435,3.5282109 c -0.206294,-0.0171 -0.415259,-0.0323 -0.625013,-0.0312 -0.209756,0.001 -0.42031,0.0182 -0.625014,0.0312 C 7.601587,3.7101908 4.8961094,5.3389099 3.467259,8.0594585 1.2899527,12.205056 2.9153872,17.350943 7.0610855,19.528202"
id="path3159-1-9"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:0.23999999;color:#000000;fill:none;stroke:url(#linearGradient5584);stroke-width:1.00001037;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
</svg>' > $HOME/.local/share/icons/testdossier/monicone.svg
#puis tu change l'icone du dossier
gvfs-set-attribute -t string "$HOME/test icone dossier" metadata::custom-icon "file:///$HOME/.local/share/icons/testdossier/monicone.svg"
ou avec imagemagick (mais il faut l'installer)
#on garde le même dossier
#on crait l'icone
convert -size 50x50 xc: +noise Random -virtual-pixel Tile -blur 0x5 \
-auto-level -separate -background white \
-compose ModulusAdd -flatten -channel R -combine +channel \
-set colorspace HSB -colorspace RGB /tmp/tile_diag_source.jpg
convert /tmp/tile_diag_source.jpg \( +clone -transpose \) \
\( +clone -sparse-color voronoi '%w,0 white 0,%h black' \) \
-composite \
\( +clone -flop -chop 1x0 \) +append \
\( +clone -flip -chop 0x1 \) -append \
/tmp/tile_diag_mirror.jpg
convert /tmp/tile_diag_mirror.jpg -thumbnail 120x120 -font Candice -pointsize 40 \
-bordercolor Snow -background black -fill dodgerblue -stroke navy \
-gravity center -set caption "[A-Z]" -polaroid 10 \
/tmp/poloroid_controls.png
convert -resize x48 /tmp/poloroid_controls.png $HOME/.local/share/icons/testdossier/monicone.png
xdg-open $HOME/.local/share/icons/testdossier/monicone.png
#puis tu change l'icone du dossier
gvfs-set-attribute -t string "$HOME/test icone dossier" metadata::custom-icon "file:///$HOME/.local/share/icons/testdossier/monicone.png"
voilà comment je fais, si ça peux t'aider.
N'oublies pas de recharger ton dossier personnel pour voir le résultat.
Ironie, sarcasme ou cynisme? Je ne sais plus
Hors ligne
#7 Le 30/03/2016, à 08:23
- rabillou
Re : Modifier Icone en ligne de commande (Résolu)
bonjour,
sous unity, cela fonctionne très biengvfs-set-attribute -t string /tmp/test.txt metadata::custom-icon file:///usr/share/vlc/vlc.ico
sinon passer par les types mimes, avec une nouvelle extension du genre *.syn
J'ai essayé, sa marche impeccable! c'est exactement ce que je cherchais!!!
MERCI BEAUCOUP.....
Hors ligne
#8 Le 30/03/2016, à 23:26
- MicP
Re : Modifier Icone en ligne de commande (Résolu)
Nickel : j'aurai appris un truc de plus
Merci.
Hors ligne
#9 Le 31/03/2016, à 08:59
- Arbiel
Re : Modifier Icone en ligne de commande (Résolu)
Bonjour
Bien, maintenant que tu peux marquer les fichiers qui ont été synchronisés, comment fais-tu pour enlever la marque lorsque le fichier en question n'est plus synchronisé suite à une quelconque modification ?
Arbiel
Arbiel Perlacremaz
LDLC Aurore NK3S-8-S4 Ubuntu 20.04, GNOME 3.36.8
24.04 en cours de tests
Abandon d'azerty au profit de bépo, de google au profit de Lilo et de la messagerie électronique violable au profit de Protonmail, une messagerie chiffrée de poste de travail à poste de travail.
Hors ligne
#10 Le 09/04/2016, à 10:19
- rabillou
Re : Modifier Icone en ligne de commande (Résolu)
Bonjour
Bien, maintenant que tu peux marquer les fichiers qui ont été synchronisés, comment fais-tu pour enlever la marque lorsque le fichier en question n'est plus synchronisé suite à une quelconque modification ?
Arbiel
Désolé de ne répondre que maintenant!
Je ne me suis pas posé la question car je ne classe mes fichiers dans les dossiers que quand ils sont "fini" donc je n'en est pas besoin mais c'est vrai qu'un retour à l’icône normal peut être intéressant, de toute façons Rsync le synchronisera de toutes façons si il a été modifier.
Hors ligne