superclick changes

This commit is contained in:
Daniel Napora 2024-02-25 23:08:18 +01:00
parent a2ccf6354c
commit df83a48318
4 changed files with 58 additions and 51 deletions

View File

@ -7,7 +7,6 @@
CONFIG_FILE="$HOME/.config/superclick.cfg" CONFIG_FILE="$HOME/.config/superclick.cfg"
mkdir -p $CONFIG_DIR
if [ ! -f $CONFIG_FILE ]; then if [ ! -f $CONFIG_FILE ]; then
cat <<EOF > ${CONFIG_FILE} cat <<EOF > ${CONFIG_FILE}
# Gap between windows in pixels (reasonable values: 0 8 16 24) # Gap between windows in pixels (reasonable values: 0 8 16 24)

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright (C) Daniel Napora 2021-22 <napcok@gmail.com> # Copyright (C) Daniel Napora 2021-24 <napcok@gmail.com>
# https://maboxlinux.org # https://maboxlinux.org
#: deskmngr - save all programs (windows) running on current desktop in session file. #: deskmngr - save all programs (windows) running on current desktop in session file.
#: With windows positions and state (decorated or not) #: With windows positions and state (decorated or not)

View File

@ -142,7 +142,7 @@ clicksnap() {
Win_height="$HEIGHT" Win_height="$HEIGHT"
if [[ $Mouse_x -gt $Win_x && $Mouse_x -lt $((Win_x+WIDTH)) && $Mouse_y -gt $Win_y && $Mouse_y -lt $((Win_y+HEIGHT)) ]];then if [[ $Mouse_x -gt $Win_x && $Mouse_x -lt $((Win_x+WIDTH)) && $Mouse_y -gt $Win_y && $Mouse_y -lt $((Win_y+HEIGHT)) ]];then
pos_x="$(((Mouse_x-Win_x)/(Win_width/3)))" pos_x="$(((Mouse_x-Win_x)/(Win_width/3)))"
pos_y="$(((Mouse_y-Win_y)/(Win_height/3)))" pos_y="$(((Mouse_y-Win_y)/(Win_height/3)))"
POS_CODE="$pos_x$pos_y" POS_CODE="$pos_x$pos_y"
else else
@ -164,6 +164,49 @@ moveto() {
POS_CODE="$1" POS_CODE="$1"
_getwin _getwin
}
trainer(){
case "$LANG" in
pl*)
TITLE="Trener Superclick"
MOUSE="przytrzymaj klawisz <kbd>super</kbd> i kliknij w wybrany obszar okna<br /><br /><em>...kolejne kliknięcia zmieniają rozmiar</em>"
KEYB="<em>z klawiatury: Super + KP_1..9</em>"
;;
*)
TITLE="SuperClick trainer"
MOUSE="hold <kbd>Super</kbd> key and click in appropriate area<br />of any window<br /><br /><em>...subsequent clicks change the size</em>"
KEYB="<em>with keyboard: Super + KP_1..9</em>"
;;
esac
HTML_FILE=$(mktemp /tmp/superclickXXXXX)
cat <<EOF > ${HTML_FILE}
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
body{padding:0;margin:0;}
#grid {display: grid;grid-template-columns: auto auto auto;gap: 1px;background-color: #113344;padding: 1px;height:100vh;}
#grid > div {background-color: rgba(255, 255, 255, 0.8);color: #113344;text-align: center;font-size: 20vh;line-height: 33vh;transition:0.3s;}
#grid > div.txt {text-align: center;position:relative;}
#grid > div.txt p {position:absolute;top:0;left:0;font-size: 2.8vh;line-height: 3.2vh;width:100%;color: #222222;}
#grid > div.txt:hover p {color: #EEEEEE;}
#grid > div:hover {background-color: #113344;color: yellow;}
</style></head>
<body><div id="grid">
<div>&nwarr;</div>
<div>&uarr;</div>
<div>&nearr;</div>
<div>&larr;</div>
<div class="txt"><p>${MOUSE}</p></div>
<div>&rarr;</div>
<div>&swarr;</div>
<div class="txt"><p>${KEYB}</p>&darr;</div>
<div>&searr;</div>
</div></body></html>
EOF
yhtml "${HTML_FILE}" "${TITLE}"
} }
usage() { usage() {
grep "^#:" $0 | while read DOC; do printf '%s\n' "${DOC###:}"; done grep "^#:" $0 | while read DOC; do printf '%s\n' "${DOC###:}"; done
@ -171,7 +214,8 @@ usage() {
} }
case "$1" in case "$1" in
"") clicksnap ;; "") clicksnap ;;
topleft|top|topright|left|center|right|bottomleft|bottom|bottomright) moveto "$1" ;; topleft|top|topright|left|center|right|bottomleft|bottom|bottomright) moveto "$1" ;;
-h|--help) usage ;; trainer) trainer;;
-h|--help) usage ;;
esac esac

View File

@ -1,48 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html><html><head><style>
<html>
<head>
<style>
body{padding:0;margin:0;} body{padding:0;margin:0;}
.grid-container { .grid-container {display: grid;grid-template-columns: auto auto auto;gap: 1px;background-color: #113344;padding: 1px;height:100vh;}
display: grid; .grid-container > div {background-color: rgba(255, 255, 255, 0.8);color: #113344;text-align: center;font-size: 20vh;line-height: 33vh;}
grid-template-columns: auto auto auto; .grid-container > div.item5 {background-color: rgba(255, 255, 255, 0.8);color: #222222;text-align: center;
gap: 1px;
background-color: #113344;
padding: 1px;
height:100vh;
}
.grid-container > div {
background-color: rgba(255, 255, 255, 0.8);
color: #113344;
text-align: center;
font-size: 20vh;
line-height: 33vh;
}
.grid-container > div.item5 {
background-color: rgba(255, 255, 255, 0.8);
color: #222222;
text-align: center;
font-size: 16px; font-size: 16px;
font-weight:bold; font-weight:bold;line-height: 5vh;position:relative;}
line-height: 5vh; .grid-container > div.item5 span {position:absolute;left: 50%;transform: translate(-50%, 0);width:100%;}
position:relative; .grid-container > div:hover {background-color: #113344;color: yellow;}
} </style></head>
.grid-container > div.item5 span { <body><div class="grid-container">
position:absolute;
left: 50%;
transform: translate(-50%, 0);
width:100%;
}
.grid-container > div:hover {
background-color: #113344;
color: yellow;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="item1">&nwarr;</div> <div class="item1">&nwarr;</div>
<div class="item2">&uarr;</div> <div class="item2">&uarr;</div>
<div class="item3">&nearr;</div> <div class="item3">&nearr;</div>
@ -52,8 +18,6 @@ left: 50%;
<div class="item7">&swarr;</div> <div class="item7">&swarr;</div>
<div class="item8">&darr;</div> <div class="item8">&darr;</div>
<div class="item8">&searr;</div> <div class="item8">&searr;</div>
</div> </div></body></html>
</body>
</html>