xdotool and keyboard layout - bash

Problem
I am trying to do:
xdotool type 'date;'
but instead of the expected
date;
I get:
dateq
I have a greek keyboard, but when I issue the command the language is set to US. A note: when greek language is used, the key 'q' of the keyboard is used for the semicolon ';' (this is the default behavior/mapping)
Question
What can I do to get a semicolon with xdotool's type?
Some info
I am on Xfce 4.8 on XUbuntu
$ xfce4-terminal -V
xfce4-terminal 0.4.8 (Xfce 4.8)
$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Applied rules from evdev:
rules: evdev
model: pc105
layout: us,gr
variant: ,
options: grp:caps_toggle
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+us+gr:2+inet(evdev)+capslock(grouplock)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+gr:2+inet(evdev)+capslock(grouplock)" };
xkb_geometry { include "pc(pc105)" };
};
$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise

try
setxkbmap <yourlocale>
before calling xdotool

This is a known bug. One thing you can try is upgrading to the newest version of xdotool. If that doesn't work, then check out this page, especially answer #29:
http://code.google.com/p/semicomplete/issues/detail?id=13
The issue was resolved by this pull request on 2014-04-07 (which is more than 3 years ago now). If anybody is still having this issue today, I think your best bet is upgrading xdotool.

These work for me:
echo "date;" | xvkbd -xsendevent -file -
xvkbd -xsendevent -text 'date;'
(remove the -xsendevent option and you get the same problem as with xdotool)

extending fazae's answer:
I have the latest version of xdotool, it seems. But the bug is still there:
$ xdotool --version
xdotool version 2.20110530.1
$ xdotool type ';'
$
'$' is typed instead of ';'.
$ xdotool type ':'
^
'^' is typed instead of ':'
FIX (example for the us and ru locales, alt+shift for toggling layouts): set locale to us, enable layout toggling with alt+shift:
$ setxkbmap us && xdotool type ':' && setxkbmap -option grp:alt_shift_toggle us,ru
:

Related

how to fix featureCounts in miniconda (Linux) with error "featureCounts: invalid option -- 'r'"

featureCounts was called under minconda in Linux subsystem on a Windows 10 computer.
featureCounts -a /mnt/d/.../__.txt -F SAF -readExtensions3 200 -o ___.tsv -O file1.bam file2.bam file3p.bam file4.bam file5.bam file6.bam file7.bam file8.bam
This always results in an error message
featureCounts: invalid option -- 'r'
Version 2.0.1
Usage: featureCounts [options] -a <annotation_file> -o <output_file> input_file1 [input_file2] ...
## Mandatory arguments:
-a <string> Name of an annotation file. GTF/GFF format by default. See...
And then reprinting the required and optional arguments for featureCounts function.
Does anyone know what does the error message "invalid option --'r'" mean? And how can I fix it?
Is there any difference between calling featureCounts in command prompt (or Terminal on Mac) and calling it in Linux/miniconda3?
It seems that you mistyped option name, it should be --readExtension3 with two dashes in front of it and without 's' in the end. I had a similar problem with --fraction which led me here!

Turn off perl-debug-m ansi escape sequences on Windows 7

On Windows 7 cmd.exe, the perl6-debug-m script outputs ansi escape sequences to set the colors, I suppose. How do I suppress these codes or at least make them functional? I'm just getting started with Perl 6 after working with Perl 4 and Perl 5 for over 20 years. I need this to work on Windows because of a program I'm trying to port from Perl 5.
C:\rakudo\bin\lib>perl6 -v
This is Rakudo Star version 2018.04.1 built on MoarVM version 2018.04.1
implementing Perl 6.c.
C:\rakudo\bin\lib>perl6-debug-m
←[35m>>> LOADING ←[0m<REPL 1>
←[34m+ <REPL 1> (1 - 1)←[0m
←[34m| ←[0m←[1;33mREPL←[0m
←[34m> ←[0mquit
←[34m- ←[0mRun END blocks (y/N)?
C:\rakudo\bin\lib>perl6 -V |grep -v "moar:"
distro::auth=unknown
distro::desc=2018-05-20T09:17:12.587605-04:00
distro::is-win=True
distro::name=mswin32
distro::path-sep=;
distro::release=unknown
distro::signature=
distro::version=6.3
kernel::arch=unknown
kernel::archname=unknown-win32
kernel::auth=unknown
kernel::bits=64
kernel::desc=
kernel::hardware=unknown
kernel::name=win32
kernel::release=unknown
kernel::signature=
kernel::version=unknown
perl6::build-date=2018-05-07T10:08:20Z
perl6::codename=
perl6::implementation=Rakudo Star
perl6::language_version=6.c
perl6::libdir=C:\rakudo\share
perl6::prefix=C:\rakudo
perl6::release-number=
perl6::source-digest=688d0872d150048d083b7a499e9fc7a9e8b6ab5b
perl6::version=2018.04.1
repo::chain=inst#C:\Users\danhale\.perl6 inst#C:\rakudo\share\perl6\site inst#C:\rakudo\share\perl6\vendor inst#C:\rakudo\share\perl6 ap# nqp# perl5#
There's currently no way to disable them (I just checked the debugger interface's source to verify that). I've previously used ANSICON on Windows in order to work with applications that produce ANSI color codes, including the Perl 6 debugger, and recall that it rendered them fine.

OS X Yosemite - Adding a Printer - UI Vs lpadmin

My problem is that when I add a printer using the Printers and Scanners UI printing works, when I add the same printer using lpadmin it doesn't.
To Add it through the UI I did the following:
From Printers and Scanners I selected the IP tab.
Address: 10.20.30.40, Protocol HP Jetdirect - Socket, Queue left blank, Name: TEST_01, Location "Top Floor", Use -> Select software -> HP LaserJet P3010 Series
After doing this, the Printer works as expected.
This is a (segment from a) script containing my lpadmin command that doesn't work
SUBNET=socket://10.20.30.
TEST_01=40
PPD_DIR=/Library/Printers/PPDs/Contents/Resources
TEST_01_PPD="hp LaserJet P3010 Series.gz"
lpadmin -E -p TEST_01 -v $SUBNET$TEST_01 -P "$PPD_DIR/$TEST_01_PPD" -D "TEST_01" -L "Top Floor"
The printer appears correctly in the UI but shows as paused.
I did find a message in system.log that may or may not be relevant - I was using Notes to test the printer:
Notes[502]: Failed to connect (_delegate) outlet from (com_hp_psdriver_19_11_0_PDEView) to (com_hp_psdriver_19_11_0_PDEAccountingController): missing setter or instance variable
Notes[2198]: Printing failed because PMSessionEndDocumentNoDialog() returned -30871.
The reason I want to use a script is that there are 20 printers to add on each of 30 new Macs. The actual script uses a series of arrays with lpadmin in a for loop. Everything I have read says it should work. What am I missing?
I think -E specified before the printer name enables encryption, whereas specified after it Enables the printer - effectively "unpausing" it. Madness- I know!
Mad Apple Documentation - see second sentence
I think you want:
lpadmin -p TEST_01 -v $SUBNET$TEST_01 -P "$PPD_DIR/$TEST_01_PPD" -D "TEST_01" -L "Top Floor" -E
I don't have a direct answer, but I can suggest an alternate approach: set up all 20 printers by hand on one computer, then copy the /etc/cups directory from that one to the other 29.

Colors with git-bash on windows

I didn't know where to post it.
I just have installed git-bash and arcanist project (http://www.phabricator.com/docs/phabricator/article/Arcanist_User_Guide.html).
Now when I type "arc help" on command prompt I get the following message :
bcohen#BCOHEN-L ~
$ arc help
←[1mNAME←[m
←[1marc←[m - arcanist, a code review and revision management utility
←[1mSYNOPSIS←[m
←[1marc←[m ←[4mcommand←[m [←[4moptions←[m] [←[4margs←[m]
This help file provides a detailed command reference.
←[1mCOMMAND REFERENCE←[m
←[1malias←[m
←[1malias←[m ←[4mcommand←[m
←[1malias←[m ←[4mcommand←[m ←[4mtarget←[m -- [←[4moptions←[m]
←[1mamend←[m [--revision ←[4mrevision_id←[m] [--show]
←[1manoid←[m
←[1mbackout←[m
←[1mbookmark←[m [←[4moptions←[m]
←[1mbookmark←[m ←[4mname←[m [←[4mstart←[m]
←[1mbranch←[m [←[4moptions←[m]
←[1mbranch←[m ←[4mname←[m [←[4mstart←[m]
←[1mbrowse←[m [←[4moptions←[m] ←[4mpath←[m ...
←[1mcall-conduit←[m ←[4mmethod←[m
←[1mclose←[m ←[4mtask_id←[m [←[4moptions←[m]
←[1mclose-revision←[m [←[4moptions←[m] ←[4mrevision←[m
←[1mcommit←[m [--revision ←[4mrevision_id←[m] [--show]
←[1mcover←[m [--rev ←[4mrevision←[m] [←[4mpath←[m ...]
←[1mdiff←[m [←[4mpaths←[m] (svn)
←[1mdiff←[m [←[4mcommit←[m] (git, hg)
For having colors, I must replace with sed the ← by \033 as following :
bcohen#BCOHEN-L ~
$ arc help |sed "s/?/\033/m"
NAME
arc - arcanist, a code review and revision management utility
SYNOPSIS
arc command [options] [args]
This help file provides a detailed command reference.
COMMAND REFERENCE
alias
alias command
alias command target -- [options]
amend [--revision revision_id] [--show]
anoid
backout
bookmark [options]
bookmark name [start]
branch [options]
branch name [start]
browse [options] path ...
call-conduit method
close task_id [options]
close-revision [options] revision
commit [--revision revision_id] [--show]
Do you have an idea ?
Maybe with an alias ?
Maybe by changing the encoding ?
Just a clue :
bcohen#BCOHEN-L ~
$ echo -e "\033[,4mtoto"
toto
This wode work whereas :
bcohen#BCOHEN-L ~
$ php -r 'echo "\033[1mtoto", PHP_EOL;'
←[1mtoto
doesn't work :(

Setting proxy on .Rprofile on OSX fails

In order to access CRAN packages from within R on OSX I've been using
Sys.setenv(http_proxy="http://blah_blah:1234/")
as the first command in the R GUI for a while, but would really like to set this proxy automatically.
I've tried unsuccessfully to get the same command to work in a .Rprofile file in ~/
I've also tried http_proxy="http://blah_blah:1234/", but this fails too.
The error I get when I try to view packages is a drop-down window that says:
Fetching Package List Failed
Please consult R Console output for details
The GUI then gives:
Error in read.dcf(file = tmpf) : Line starting '<head> ...' is malformed!
The .Rprofile file itself seems to be loading (checked using cat("my profile works\n"))
Couldn't you just use .First ?
http://cran.r-project.org/doc/manuals/R-intro.html#Customizing-the-environment
This thread appears first when searching for setting R proxy on OS X, so here's what I use in my .Rprofile:
Sys.setenv(http_proxy=system("networksetup -getwebproxy Ethernet | awk {'print $2'} | awk {'getline l2; getline l3; print \"http://\"l2\":\"l3'} | head -n 1",intern=TRUE))
Change Ethernet to Airport if necessary.
Credit for the awk part goes to Chealion
I think I have managed to solve this using trial and error...
A combination of .First and Sys.setenv() works.
If anyone has any ideas I'd be interested to know why.

Resources