various tablet-setup tweaks

This commit is contained in:
rhiannon morris 2023-11-10 02:26:21 +01:00
parent 4adf34027f
commit ae7e6c796d

View file

@ -4,6 +4,8 @@
unit sub MAIN( unit sub MAIN(
#| Don't run the commands, just print them (implies -v) #| Don't run the commands, just print them (implies -v)
Bool :n(:$dry-run), Bool :n(:$dry-run),
#| Don't turn on the screens
Bool :S(:$no-screens),
#| Print each command before running it #| Print each command before running it
Bool :v(:$verbose) is copy, Bool :v(:$verbose) is copy,
#| Print the output of queries too (implies -v) #| Print the output of queries too (implies -v)
@ -113,7 +115,7 @@ my $did-something = False;
my $external = external-connected; my $external = external-connected;
with $external { say-prefix "using display '$_'" } with $external { say-v "using display '$_'" }
with Tablet.find: 'Intuos4' { with Tablet.find: 'Intuos4' {
say-v "Setting up \"$_\""; say-v "Setting up \"$_\"";
@ -129,7 +131,7 @@ with Tablet.find: 'Intuos4' {
for .stylus, .eraser, .cursor { for .stylus, .eraser, .cursor {
.set: :Rotate<half> :Area<0 0 65024 36576>; # full 65024x40640 .set: :Rotate<half> :Area<0 0 65024 36576>; # full 65024x40640
with $external -> $ { .set: :MapToOutput($external); } if defined $external { .set: :MapToOutput($external); }
} }
for .stylus, .eraser { for .stylus, .eraser {
@ -141,20 +143,20 @@ with Tablet.find: 'Intuos4' {
# circle # circle
1 => {map => key('tab')}, 1 => {map => key('tab')},
# upper four, top to bottom # upper four, top to bottom
13 => {map => key('shift'), screen => 7, label => 'Sh/Rotate'}, 13 => {map => key('shift'), screen => 7, label => "🠙 \xF0E2"}, # rotate
12 => {map => key('ctrl'), screen => 6, label => 'Ctrl/Zoom'}, 12 => {map => key('ctrl'), screen => 6, label => "⌃ \xF002"}, # magnifying glass
11 => {map => key('m'), screen => 5, label => 'Mirror'}, 11 => {map => key('m'), screen => 5, label => '⌽'},
10 => {map => key('5'), screen => 4, label => 'Rotate 0°'}, 10 => {map => key('5'), screen => 4, label => '⦜'},
# lower four # lower four
9 => {map => key('.'), screen => 3, label => 'Brush +'}, 9 => {map => key('.'), screen => 3, label => '●'},
8 => {map => key(','), screen => 2, label => 'Brush '}, 8 => {map => key(','), screen => 2, label => '⋅'},
3 => {map => key('insert'), screen => 1, label => 'Layer +'}, 3 => {map => key('insert'), screen => 1, label => '⏥'},
2 => {map => key('XF86AudioPlay'), screen => 0, label => 'Pause'}, 2 => {map => key(:ctrl, <'>), screen => 0, label => '𝞪'},
); );
update <sudo i4oled-chgrp>, $screen-dir; update <sudo i4oled-chgrp>, $screen-dir;
spurt "$screen-dir/buttons_luminance", 15; spurt "$screen-dir/buttons_luminance", ($no-screens ?? 0 !! 8);
given .pad { given .pad {
.set: :AbsWheelDown(key('shift')) :AbsWheelUp(key('shift')); .set: :AbsWheelDown(key('shift')) :AbsWheelUp(key('shift'));
@ -162,11 +164,10 @@ with Tablet.find: 'Intuos4' {
for %buttons.kv -> $button, % (:$map, :$screen, :$label) { for %buttons.kv -> $button, % (:$map, :$screen, :$label) {
.set: :Button($button, $map); .set: :Button($button, $map);
next without $label & $screen; next if $no-screens or not defined $label & $screen;
my $path = "$screen-dir/button{$screen}_rawimg"; my $path = "$screen-dir/button{$screen}_rawimg";
fail "!!! no such device $path" unless $path.IO.f; fail "!!! no such device $path" unless $path.IO.f;
update <i4oled -l -t>, $label, '-d', $path; update <i4oled -l -t>, $label, '-d', $path;
} }
} }
@ -183,7 +184,7 @@ with Tablet.find: 'H420' {
# FIXME do this properly # FIXME do this properly
.set: :MapToOutput<960x540+480+270>; .set: :MapToOutput<960x540+480+270>;
with $external -> $ { .set: :MapToOutput($external); } if defined $external { .set: :MapToOutput($external); }
} }
my %buttons = ( my %buttons = (