From 4ed9147ca53fbaadb4975ffa02aea477197bdec0 Mon Sep 17 00:00:00 2001 From: Breizh Date: Sat, 31 Jul 2021 20:51:55 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20Conky=20et=20fonds=20d?= =?UTF-8?q?=E2=80=99=C3=A9cran?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/conky/conkyrc1 | 12 +- .config/conky/conkyrc2 | 17 +- .config/variety/scripts/set_wallpaper | 252 ++++++++++++++++++++++++++ 3 files changed, 266 insertions(+), 15 deletions(-) create mode 100755 .config/variety/scripts/set_wallpaper diff --git a/.config/conky/conkyrc1 b/.config/conky/conkyrc1 index c0fabfe..4b85e42 100644 --- a/.config/conky/conkyrc1 +++ b/.config/conky/conkyrc1 @@ -8,15 +8,15 @@ conky.config = { draw_outline = true, minimum_width = 260, maximum_width = 260, - minimum_height = 0, + minimum_height = 1080, gap_x = 5, gap_y = 5, no_buffers = true, own_window = true, own_window_class = Conky, own_window_type = 'override', - own_window_transparent = true, - own_window_colour = '#000000', + own_window_transparent = false, + own_window_colour = '#2D2D2D', update_interval = 1.0, use_xft = true, default_color = 'A09F93', @@ -82,9 +82,9 @@ ${template2 5} ${color2}${font2}Carte graphique $hr${font}${color} ${voffset 2}Usage${goto 140}${texeci 3 conky_radeon}% VRAM: ${texeci 3 conky_radeon vram mb}M${goto 140}${texeci 3 conky_radeon vram}% -Temp${goto 140}${if_match ${execi 5 sensors -j | jq '."amdgpu-pci-0900"."edge"."temp1_input"'}>70}${color F2777A}$endif${execi 5 sensors -j | jq '."amdgpu-pci-0900"."edge"."temp1_input"' | cut -d. -f1}°C${color} -Conso${goto 140}${if_match ${execi 5 sensors -j | jq '."amdgpu-pci-0900"."power1"."power1_average"'}>180}${color F2777A}$endif${execi 5 sensors -j | jq '."amdgpu-pci-0900"."power1"."power1_average"' | cut -d. -f1} W${color} -Ventilo${goto 140}${if_match ${execi 5 sensors -j | jq '."amdgpu-pci-0900"."fan1"."fan1_input"'}>3000}${color F2777A}$endif${execi 5 sensors -j | jq '."amdgpu-pci-0900"."fan1"."fan1_input"' | cut -d. -f1} RPM${color} +Temp${goto 140}${if_match ${execi 5 sensors -j | jq '."amdgpu-pci-2700"."edge"."temp1_input"'}>70}${color F2777A}$endif${execi 5 sensors -j | jq '."amdgpu-pci-2700"."edge"."temp1_input"' | cut -d. -f1}°C${color} +Conso${goto 140}${if_match ${execi 5 sensors -j | jq '."amdgpu-pci-2700"."power1"."power1_average"'}>180}${color F2777A}$endif${execi 5 sensors -j | jq '."amdgpu-pci-2700"."power1"."power1_average"' | cut -d. -f1} W${color} +Ventilo${goto 140}${if_match ${execi 5 sensors -j | jq '."amdgpu-pci-2700"."fan1"."fan1_input"'}>3000}${color F2777A}$endif${execi 5 sensors -j | jq '."amdgpu-pci-2700"."fan1"."fan1_input"' | cut -d. -f1} RPM${color} ${color2}${font2}Système $hr$font$color${voffset 2} Kernel${goto 140}$kernel diff --git a/.config/conky/conkyrc2 b/.config/conky/conkyrc2 index 1190935..461743c 100644 --- a/.config/conky/conkyrc2 +++ b/.config/conky/conkyrc2 @@ -9,15 +9,15 @@ conky.config = { draw_outline = true, minimum_width = 260, maximum_width = 260, - minimum_height = 0, + minimum_height = 1080, gap_x = 5, gap_y = 5, no_buffers = true, own_window = true, own_window_class = Conky, own_window_type = 'override', - own_window_transparent = true, - own_window_colour = '#000000', + own_window_transparent = false, + own_window_colour = '#2D2D2D', update_interval = 1.0, use_xft = true, default_color = 'A09F93', @@ -59,12 +59,12 @@ ${template0 5} #${template0 10} ${color2}${font2}Réseau $hr$font$color -${voffset 2}Téléchargement ${downspeed enp6s0}${goto 140}Téléversement ${upspeed enp6s0} -${downspeedgraph enp6s0 25,125}${alignr}${upspeedgraph enp6s0 25,125} -Téléchargé ${totaldown enp6s0}${goto 140}Téléversé ${totalup enp6s0} +${voffset 2}Téléchargement ${downspeed enp34s0}${goto 140}Téléversement ${upspeed enp34s0} +${downspeedgraph enp34s0 25,125}${alignr}${upspeedgraph enp34s0 25,125} +Téléchargé ${totaldown enp34s0}${goto 140}Téléversé ${totalup enp34s0} -$alignc${addrs enp6s0} -$alignc${scroll left 39 2 1 ${v6addrs enp6s0 -n -s}} +$alignc${addrs enp34s0} +$alignc${scroll left 39 2 1 ${v6addrs enp34s0 -n -s}} $alignc${curl ifconfig.co/ip}${if_up tun0} ${color2}${font2}VPN $hr$font$color ${voffset 2}Téléchargement ${downspeed tun0}${goto 140}Téléversement ${upspeed tun0} @@ -76,7 +76,6 @@ $alignc${scroll left 39 2 1 ${v6addrs tun0 -n -s}} ${endif} ${color2}${font2}Capteurs $hr$font$color${voffset 2} CPU${goto 140}${if_match ${execi 5 sensors -j | jq '."zenpower-pci-00c3"."Tdie"."temp1_input"'}>70}${color F2777A}$endif${execi 5 sensors -j | jq '."zenpower-pci-00c3"."Tdie"."temp1_input"' | cut -d. -f1}°C${color} -Pièce${goto 140}${if_match ${execi 5 sensors -j | jq '."it8686-isa-0a60"."room"."temp2_input"'}>=25}${color F2777A}$endif${execi 5 sensors -j | jq '."it8686-isa-0a60"."room"."temp2_input"' | cut -d. -f1}°C${color} ${color2}${font2}Sylvexplorer $hr$font$color${voffset 2} ${texeci 3600 /home/breizh/.config/conky/sylv.sh} diff --git a/.config/variety/scripts/set_wallpaper b/.config/variety/scripts/set_wallpaper new file mode 100755 index 0000000..e4290d4 --- /dev/null +++ b/.config/variety/scripts/set_wallpaper @@ -0,0 +1,252 @@ +#!/bin/bash +# +# This script is run by Variety when a new wallpaper is set. +# You can use bash, python or whatever suits you for the script. +# Here you can put custom commands for setting the wallpaper on your specific desktop environment +# or run commands like notify-send to notify you of the change, or you can +# run commands that would theme your browser, login screen or whatever you desire. +# +# PARAMETERS: +# $1: The first passed parameter is the absolute path to the wallpaper image to be set as wallpaper +# (after effects, clock, etc. are applied). +# +# $2: The second passed parameter is "auto" when the wallpaper is changed automatically (i.e. regular change), "manual" +# when the user has triggered the change or "refresh" when the change is triggered by a change in quotes, clock, etc. +# +# $3: The third passed parameter is the absolute path to the original wallpaper image (before effects, clock, etc.) +# +# EXAMPLE: +# echo "$1" # /home/username/.config/variety/wallpaper/wallpaper-clock-fac0eef772f9b03bd9c0f82a79d72506.jpg +# echo "$2" # auto +# echo "$3" # /home/username/Pictures/Wallpapers/Nature/green-tunnel-1920x1080-wallpaper-861.jpg + + +# Here you may apply some additional custom operations on the wallpaper before it is applied. +# In the end put the path to the actual final wallpaper image file in the WP variable. +# The default is to simply set WP=$1. + +WP="${HOME}/.config/variety/wallpaper/edited.png" + +# Décalage Conky +convert "$3" -geometry 1380x1058 -background "#2d2d2d" -compose Copy -gravity Center -extent 1380x1058 "$WP" +convert "$WP" -geometry 1920x1080 -background "#2d2d2d" -compose Copy -gravity Center -extent 1920x1080+0+22 "$WP" + +# Météo +#touch -t $(date +%Y%m%d%H%M -d "now-1hour") /dev/shm/meteo.png.timestamp +#if [[ ! -f "/dev/shm/meteo.png" ]] || [[ "/dev/shm/meteo.png" -ot "/dev/shm/meteo.png.timestamp" ]] +#then +# convert <(curl fr.wttr.in/Rennes_0q.png) -fill "#2d2d2d" -opaque "#000000" /dev/shm/meteo.png +#fi +#convert "$WP" /dev/shm/meteo.png -gravity SouthEast -geometry +7+22 -composite "$WP" + +# Enlightenment +# Needs Modules/System/DBus Extension loaded to work +if [[ "$DESKTOP" == *"Enlightenment"* ]] || [[ "$DESKTOP" == *"Moksha"* ]]; then + + OUTPUT_DIR="$HOME/.e/e/backgrounds" + + TEMPLATE=' + images { image: "@IMAGE@" USER; } + collections { + group { + name: "e/desktop/background"; + data { item: "style" "4"; item: "noanimation" "1"; } + max: @WIDTH@ @HEIGHT@; + parts { + part { + name: "bg"; + mouse_events: 0; + description { + state: "default" 0.0; + aspect: @ASPECT@ @ASPECT@; + aspect_preference: NONE; + image { normal: "@IMAGE@"; scale_hint: STATIC; } + } + } + } + } + } + ' + + OFILE="$OUTPUT_DIR/variety_wallpaper_$RANDOM" + + DIMENSION="$(identify -format "%w/%h" "$WP")" + + if [ ! -z "$DIMENSION" ]; then + WIDTH="$(echo "$DIMENSION" | cut -d/ -f1)" + HEIGHT="$(echo "$DIMENSION" | cut -d/ -f2)" + IMAGE="$(echo "$WP" | sed 's/[^[:alnum:]_-]/\\&/g')" + + if [ -z "$HEIGHT" ] || [ "$HEIGHT" = "0" ]; then + ASPECT="0.0" + else + ASPECT="$(echo "scale=9; $DIMENSION" | bc)" + fi + fi + + printf "%s" "$TEMPLATE" | \ + sed "s/@ASPECT@/$ASPECT/g; s/@WIDTH@/$WIDTH/g; s/@HEIGHT@/$HEIGHT/g; s|@IMAGE@|$IMAGE|g" > "$OFILE.edc" + edje_cc "$OFILE.edc" "$OFILE.edj" 2>/dev/null + rm "$OFILE.edc" + + ## Get the current number of virtual desktops + desk_x_count=$(enlightenment_remote -desktops-get | awk '{print $1}') + desk_y_count=$(enlightenment_remote -desktops-get | awk '{print $2}') + + ## Get the current number of screens + screen_count=1 + # If xrandr is available use it to get screen desk_x_count + if command -v xrandr >/dev/null 2>&1; then + screen_count=$(xrandr -q | grep -c ' connected') + fi + + ## Set the wallpaper for each virtual desktop + for ((x=0; x "$LAST_WALLPAPER_FILE" + exit 0 +fi + +# KDE: Users on KDE 4 or Plasma < 5.7 will have to manually choose ~/Pictures/variety-wallpaper/ as a slideshow folder with a short interval. +# Afterwards, with the command below, Variety will just overwrite the single file there when changing the wallpaper +# and KDE will refresh it +# On Plasma 5.7 and above, the wallpaper choosing is automatic. +if [ "${KDE_FULL_SESSION}" == "true" ]; then + # Plasma 5.7 introduced a new feature to set the wallpaper via a qdbus script: + # https://github.com/KDE/plasma-workspace/commit/903cbfd7e267a4812a6ec222eb7e1b5dd775686f + if [[ -n "${KDE_SESSION_VERSION}" && "${KDE_SESSION_VERSION}" == '5' ]]; then + qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript " + var allDesktops = desktops(); + for (i=0; i < allDesktops.length; i++) { + d = allDesktops[i]; + d.wallpaperPlugin = 'org.kde.image'; + d.currentConfigGroup = Array('Wallpaper', 'org.kde.image', 'General'); + d.writeConfig('Image', 'file://""$WP""') + } + " + # Reuse the exit code from qdbus + exit "$?" + else + WALLDIR="$(xdg-user-dir PICTURES)/variety-wallpaper" + mkdir -p "$WALLDIR" + # Remove all old wallpapers + rm -fv "${WALLDIR}"/* + + NEWWP="${WALLDIR}/wallpaper-kde-$RANDOM.jpg" + cp "$WP" "$NEWWP" + touch "$NEWWP" + fi +fi + +# Cinnamon, for cases when it is detectable +if [ "$XDG_CURRENT_DESKTOP" == "X-Cinnamon" ]; then + gsettings set org.cinnamon.background picture-uri "file://$WP" 2> /dev/null + if [ "$(gsettings get org.cinnamon.background picture-options)" == "'none'" ]; then + gsettings set org.cinnamon.background picture-options 'zoom' + fi + + gsettings set org.cinnamon.desktop.background picture-uri "file://$WP" 2> /dev/null + if [ "$(gsettings get org.cinnamon.desktop.background picture-options)" == "'none'" ]; then + gsettings set org.cinnamon.desktop.background picture-options 'zoom' + fi + exit 0 +fi + +# Gnome 3, Unity +gsettings set org.gnome.desktop.background picture-uri "file://$WP" 2> /dev/null +if [ "$(gsettings get org.gnome.desktop.background picture-options)" == "'none'" ]; then + gsettings set org.gnome.desktop.background picture-options 'zoom' +fi + +# Deepin +if [ "$(gsettings list-schemas | grep -c com.deepin.wrap.gnome.desktop.background)" -ge 1 ]; then + gsettings set com.deepin.wrap.gnome.desktop.background picture-uri "file://$WP" + if [ "$(gsettings get com.deepin.wrap.gnome.desktop.background picture-options)" == "'none'" ]; then + gsettings set com.deepin.wrap.gnome.desktop.background picture-options 'zoom' + fi +fi + +# XFCE +command -v xfconf-query >/dev/null 2>&1 +rc=$? +if [[ $rc = 0 ]] ; then + for i in $(xfconf-query -c xfce4-desktop -p /backdrop -l | grep -E -e "screen.*/monitor.*image-path$" -e "screen.*/monitor.*/last-image$"); do + xfconf-query -c xfce4-desktop -p "$i" -n -t string -s "" 2> /dev/null + xfconf-query -c xfce4-desktop -p "$i" -s "" 2> /dev/null + xfconf-query -c xfce4-desktop -p "$i" -s "$WP" 2> /dev/null + done +fi + +# LXDE/PCmanFM +if [ "$XDG_CURRENT_DESKTOP" == "LXDE" ]; then + pcmanfm --set-wallpaper "$WP" 2> /dev/null +fi + +# LXQt/PCmanFM-qt +if [ "$XDG_CURRENT_DESKTOP" == "LXQt" ]; then + pcmanfm-qt --set-wallpaper "$WP" 2> /dev/null +fi + +# i3, openbox, dwm: use either feh or nitrogen +if [[ "$XDG_CURRENT_DESKTOP" == "i3"* ]] || [[ "$XDG_SESSION_DESKTOP" == "i3"* ]] || + [[ "$DESKTOP_SESSION" == "openbox" ]] || [[ "$XDG_SESSION_DESKTOP" == *"dwm"* ]] || + [[ "$XDG_CURRENT_DESKTOP" == *"dwm"* ]]; then + if command -v "feh" >/dev/null 2>&1; then + feh --bg-max --xinerama-index 0 "$WP" 2> /dev/null + elif command -v "nitrogen" >/dev/null 2>&1; then + nitrogen --set-zoom-fill --save "$WP" 2> /dev/null + fi +fi + +# trinity +if [ "$XDG_CURRENT_DESKTOP" == "Trinity" ]; then + dcop kdesktop KBackgroundIface setWallpaper "$WP" 4 2> /dev/null +fi + +# MATE after 1.6 +gsettings set org.mate.background picture-filename "$WP" 2> /dev/null + +# MATE before 1.6 +mateconftool-2 -t string -s /desktop/mate/background/picture_filename "$WP" 2> /dev/null + +# Cinnamon after 1.8, before 2.0 +gsettings set org.cinnamon.background picture-uri "file://$WP" 2> /dev/null + +# Cinnamon after 2.0 +gsettings set org.cinnamon.desktop.background picture-uri "file://$WP" 2> /dev/null + +# Gnome 2 +gconftool-2 -t string -s /desktop/gnome/background/picture_filename "$WP" 2> /dev/null + +# Awesome Window Manager + +# Set the path to the wallpaper using awesome-client, which communicates with awesome using D-Bus. +# Be sure to start variety when you start awesome, such as by adding it to ~/.xinitrc in Arch Linux. + +# echo "local gears = require(\"gears\") gears.wallpaper.maximized(\"$1\", s, true)" | awesome-client + +# NOTE: This config will change the wallpaper after your current awesome theme sets it. +# As such, the theme's wallpaper will briefly appear before being replaced with variety's wallpaper. + + +# Show a notification on wallpaper change (only when the change is automatic). Display the original filename, but the post-effects image. +# name=$(echo "$3" | sed 's/\//\n/g'| tail -n 1) +# if [ "$2" == "auto" ]; then notify-send --icon "$WP" "Wallpaper changed" "$name" ; fi