superclick upd

This commit is contained in:
Daniel Napora 2024-08-25 01:58:41 +02:00
parent 95995abb14
commit 3cdb05019d
4 changed files with 41 additions and 25 deletions

View File

@ -198,12 +198,12 @@ 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><br /><br /><a href='run://jgdeskgrid -s'><button type='button'> Konfiguruj ...</button></a>"
MOUSE="przytrzymaj klawisz <kbd>super</kbd> i kliknij w wybrany obszar okna<br /><br /><em>...kolejne kliknięcia zmieniają rozmiar</em><br /><br /><a href='run://jgdeskgrid -s'><button type='button'> Konfiguruj ...</button></a><a href='run://viewnior /usr/share/mabox/img/superclick-keyboard.gif'><button type='button'> Demo (z klawiatury) </button></a>"
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><br /><br /><a href='run://jgdeskgrid -s'><button type='button'> Configure ...</button></a>"
MOUSE="hold <kbd>Super</kbd> key and click in appropriate area<br />of any window<br /><br /><em>...subsequent clicks change the size</em><br /><br /><a href='run://jgdeskgrid -s'><button type='button'> Config Menu ...</button></a><a href='run://viewnior /usr/share/mabox/img/superclick-keyboard.gif'><button type='button'> Keyboard Demo</button></a>"
KEYB="<em>with keyboard: Super + KP_1..9</em>"
;;
esac

39
bin/superclick-desktop Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
# superclick-desktop = actions for w-Leftmouseclick event on desktop
CONFIG_FILE="$HOME/.config/mabox/superclick-desktop.conf"
if [ ! -f ${CONFIG_FILE} ]; then
cat <<EOF > ${CONFIG_FILE}
# SuperClick on desktop config file
# Sidearea width in pixels
sidewidth=300
# Commands to run on super + clik on left, center or right desktop area
left_cmd="mb-jgtools places 2>/dev/null"
center_cmd="jgdesktops -s 2>/dev/null"
right_cmd="mb-jgtools right 2>/dev/null"
EOF
fi
# read config variables from file
source <(grep = $CONFIG_FILE)
SIDEWIDTH=${sidewidth:-0}
CENTER_CMD=${center_cmd:-"jgdesktops -s 2>/dev/null"}
LEFT_CMD=${left_cmd:-"mb-jgtools places 2>/dev/null"}
RIGHT_CMD=${right_cmd:-"mb-jgtools right 2>/dev/null"}
# TODO: Make it work on dual monitor setups - buy second monitor and look how it is implemented in superclick script ;)
MON_WIDTH=$(xrandr | grep " connected" |awk '{print $3}' |awk -F[x+] '{print $1}')
RIGHT=$((MON_WIDTH-sidewidth))
eval $(xdotool getmouselocation --shell)
if [ $X -lt ${sidewidth} ];then
bash <<< "$LEFT_CMD"
elif [ $X -gt ${RIGHT} ];then
bash <<< "$RIGHT_CMD"
else
bash <<< "$CENTER_CMD"
fi

View File

@ -1,23 +0,0 @@
<!DOCTYPE html><html><head><style>
body{padding:0;margin:0;}
.grid-container {display: grid;grid-template-columns: auto auto auto;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-weight:bold;line-height: 5vh;position:relative;}
.grid-container > div.item5 span {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="item2">&uarr;</div>
<div class="item3">&nearr;</div>
<div class="item4">&larr;</div>
<div class="item5"><span><br />hold <kbd>Super</kbd> key<br />and click<br />in appropriate area<br />of any window</span></div>
<div class="item6">&rarr;</div>
<div class="item7">&swarr;</div>
<div class="item8">&darr;</div>
<div class="item8">&searr;</div>
</div></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB