Skip to content

Instantly share code, notes, and snippets.

@joaosousa1
Created August 1, 2022 18:16
Show Gist options
  • Save joaosousa1/c2be53c609e846b9c6aad752ff999c20 to your computer and use it in GitHub Desktop.
Save joaosousa1/c2be53c609e846b9c6aad752ff999c20 to your computer and use it in GitHub Desktop.
Script para redimensionar a área do wacom stylus na tela do Linux
#!/bin/bash
# Script muda área de atuação da stylus wacom
# O script utiliza o conky para visualizar os limites
# Utilize o script um primeira vez para utilizar a área pequena
# Na segunda vez ele usa a área inteira
# Funciona como um "toggle"
# cria conky config files
if [ -f /home/${USER}/conky-wacom-area-top ]; then
echo "ok ja existe o conky-wacom-area-top"
else
cat > /home/${USER}/conky-wacom-area-top << EOF
conky.config = {
double_buffer = true,
alignment = 'top_left',
gap_x = 300,
gap_y = 280,
minimum_width = 800,
minimum_height = 1,
default_color = 'green',
font = 'Roboto:size=10',
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'normal',
own_window_hints = 'above,undecorated,skip_taskbar,skip_pager',
own_window_argb_visual = true,
own_window_argb_value = 255,
update_interval = 3,
background = true,
}
conky.text = [[
area da pen
]]
EOF
cat > /home/${USER}/conky-wacom-area-bottom << EOF
conky.config = {
double_buffer = true,
alignment = 'top_left',
gap_x = 300,
gap_y = 807,
minimum_width = 800,
minimum_height = 1,
default_color = 'green',
font = 'Roboto:size=10',
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'normal',
own_window_hints = 'above,undecorated,skip_taskbar,skip_pager',
own_window_argb_visual = true,
own_window_argb_value = 255,
update_interval = 1.0,
background = true,
}
conky.text = [[
]]
EOF
fi
if [ `ps -ef | grep "krita" | grep -v "grep" | wc -l` -eq "0" ];then
echo "krita não está aberto"
else
if [ -f /tmp/wacomscript-memory-tokken ]; then
# Here Precision mode; full tablet area in cm are 1:1 on a portion of the screen.
echo "Precision mode"
xsetwacom --set "Wacom One by Wacom M Pen stylus" MapToOutput 800x500+300+300
#notify-send -i /usr/share/icons/gnome/22x22/devices/input-tablet.png "Precision mode" "$XtabletactiveareaPIX x $YtabletactiveareaPIX part-of-screen"
rm /tmp/wacomscript-memory-tokken
conky -c conky-wacom-area-top &
conky -c conky-wacom-area-bottom &
else
# Here normal mode; tablet map to Fullscreen with ratio correction
Xscreenpix=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)
Yscreenpix=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)
echo "Full-screen mode with ratio correction"
xsetwacom --set "Wacom One by Wacom M Pen stylus" MapToOutput ${Xscreenpix}x${Yscreenpix}+0+0
#notify-send -i /usr/share/icons/gnome/22x22/devices/input-tablet.png "Normal mode" "full-screen"
touch /tmp/wacomscript-memory-tokken
killall conky
fi
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment