Deprecated.

This commit is contained in:
Ryan Thomas 2022-02-08 18:38:48 -05:00
parent 3dfa968e81
commit 2e602549d7
2 changed files with 6 additions and 124 deletions

87
exec.sh
View File

@ -1,87 +1,4 @@
#!/usr/bin/env bash
#rts/oarion7
#rts/oarion7 - ryanthomas.org
# See "README" ! Tested with awesome v4.3
script_path="$(dirname "$(realpath "$BASH_SOURCE")")"
rofi_theme="${script_path}/invisible.rasi" #key grabber only
exit_key='s' # See "README" !
hover_time='3' #time to hover in seconds if Ctrl+O
hide=true #for hidden systray environment, rehide when escaping/canceling
deps=( awesome-client iocane rofi xdotool )
for i in "${deps[@]}"; do command -v "$i" >/dev/null ||
errors=$(printf '%s %s\n' "$errors" "$i" | sed -e 's/^ //'); done
[[ "$errors" ]] && { notify-send -u critical \
"Veuillez corriger ces dépendances non satisfaites:" "$errors"; exit 1; }
parse_string() { printf '%s\n' "$1" | awk '{$1=""}1' | sed 's|[ "]||g' ; }
# 'string "X"' --> 'X'
awesome-exec() {
local file
file="${script_path}/${1}"
[ -f "$file" ] && awesome-client 'dofile("'"$file"'")' ||
{ echo "Could not find ${1}."; exit 1; }
}
mouse_location() {
[[ "$1" == "save" ]] &&
{ awesome-client 'sys_hints_saved_coords = mouse.coords({x = x, y = y})'; return; }
[[ "$1" == "restore" ]] &&
awesome-client 'mouse.coords({x = sys_hints_saved_coords.x, y = sys_hints_saved_coords.y}, true)'
}
hide_systray_hints() { awesome-client 'hide_systray_hints()' >/dev/null ; }
hide_systray() { awesome-client 'sys_hints_hide_systray()' >/dev/null ; }
seq_with_exit_key() { (printf '%s\n%s\n' "$exit_key" "$(seq $1)") ; }
mouse_to_icon() {
[[ "$1" == "1" ]] && factor='0' || factor=$(("$1" - 1))
target_position_x=$(( $first_icon_x + ( "$icon_width" * "$factor" ) ))
iocane -c "${target_position_x},${icons_y}"
}
get_choice() {
choice=$(seq_with_exit_key "$icon_count" | rofi \
-kb-custom-1 "Ctrl+l" -kb-custom-2 "Ctrl+o" -dmenu -i -theme "$rofi_theme" \
-no-custom -auto-select 2>/dev/null )
code="$?"
}
awesome-exec "core.lua"
data=$(awesome-client "return found_widget_geometry")
[[ -z "$data" ]] && { echo "Geometery data not found."; exit 1; }
IFS=',' read -r -a array <<< "$(parse_string "$data")"
[[ -n "${array[4]}" ]] || [[ -z "${array[3]}" ]] && { echo "Invalid data: $data"; exit 1; }
x="${array[0]}" ; y="${array[1]}" ; w="${array[2]}" ; h="${array[3]}"
icon_count=$((( $w - ( $w % $h )) / $h + 1 ))
icon_width=$(( $w / $icon_count ))
half_icon=$(( $icon_width / 2 ))
first_icon_x=$(( $x + $half_icon ))
icons_y=$(( $y + $half_icon ))
awesome-client 'systray_show_hints('"${x}, ${y}, ${icon_width}, ${icon_count}"')'
mouse_location save
mouse_button='3' #default to right click
get_choice; [[ "$code" == "10" ]] && { mouse_button='1'; get_choice; }
[[ "$code" == "11" ]] && { unset mouse_button; get_choice; }
hide_systray_hints
[[ "$choice" == "$exit_key" ]] && unset choice
[[ -z "$choice" ]] && { [[ "$hide" == "true" ]] && hide_systray; exit 0; }
mouse_to_icon "$choice" &&
[[ -n "$mouse_button" ]] && xdotool click "$mouse_button"
[[ -z "$mouse_button" ]] && sleep "$hover_time" #hover only (not so reliable)
mouse_location restore
# Shell layer deprecated

View File

@ -1,40 +1,5 @@
/**
* Invisible theme to use ROFI as a key grabber
* Based on a theme by Dave Davenport
*
* Deprecated.
*
*/
* {
background-color: rgba ( 255, 255, 255, 0 % );
border-color: rgba ( 255, 255, 255, 0 % );
text-color: rgba ( 255, 255, 255, 0 % );
}
#window {
anchor: north;
location: north;
width: 0;
padding: 4px;
children: [ horibox ];
}
#horibox {
orientation: horizontal;
children: [ prompt, entry, listview ];
}
#listview {
layout: horizontal;
spacing: 5px;
lines: 100;
}
#entry {
expand: false;
width: 10em;
}
#element {
padding: 0px 2px;
}
#element selected {
background-color: rgba ( 255, 255, 255, 0 % );
}