From f58c88726ec16c97f1eaa6645780f4832905100e Mon Sep 17 00:00:00 2001 From: Mubashshir Date: Tue, 3 Jan 2023 23:42:47 +0600 Subject: xfce: Implement refresh context menu Signed-off-by: Mubashshir --- bin/simulate-refresh | 17 +++++++++++++++++ patch/thunar-refresh | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 bin/simulate-refresh create mode 100755 patch/thunar-refresh diff --git a/bin/simulate-refresh b/bin/simulate-refresh new file mode 100755 index 0000000..064fade --- /dev/null +++ b/bin/simulate-refresh @@ -0,0 +1,17 @@ +#!/bin/sh +AW=$( ( + xdotool getactivewindow + printf : + xdotool getactivewindow getwindowpid +) | tr -d '[:space:]') +PROC=$(realpath "/proc/${AW#*:}/exe" | xargs basename) + +unset REFOCUS +if ! echo "$PROC" | grep -qlE '(thunar|xfdesktop)'; then + REFOCUS=true + xdotool search --onlyvisible --classname Xfdesktop windowfocus +fi + +xdotool key F5 + +"${REFOCUS:-false}" && xdotool windowfocus "${AW%:*}" diff --git a/patch/thunar-refresh b/patch/thunar-refresh new file mode 100755 index 0000000..b48723f --- /dev/null +++ b/patch/thunar-refresh @@ -0,0 +1,22 @@ +#!/bin/sh + +# +# view-refresh +# * +# +# Refresh +# simulate-refresh +# Refresh current content +# +# + +xml ed -L \ + -i '/actions/action[1]' -t elem -n action \ + -s '/actions/action[1]' -t elem -n icon -v view-refresh \ + -s '/actions/action[1]' -t elem -n patterns -v '*' \ + -s '/actions/action[1]' -t elem -n range \ + -s '/actions/action[1]' -t elem -n name -v Refresh \ + -s '/actions/action[1]' -t elem -n command -v simulate-refresh \ + -s '/actions/action[1]' -t elem -n description -v 'Refresh current content' \ + -s '/actions/action[1]' -t elem -n directories \ + /etc/xdg/Thunar/uca.xml -- cgit v1.2.3