carnager / rofi-pass

rofi frontend for pass
GNU General Public License v3.0
696 stars 122 forks source link

freebsd & rofi-pass -> keyboard #137

Open kristoferus75 opened 6 years ago

kristoferus75 commented 6 years ago

Hi !

I use rofi-pass in arch linux and it works perfect thanks ! i want it also use on my freebsd but i have the problem that if i copy username & password the "@" is paste as "q" character !

i use this in my config file

# keyboard layout (set this to your actual layout. E.g. keyboard="de us"
keyboard=de

fix_layout=true

layout_cmd () {
  setxkbmap de
}

also if i start "setxkbmap de" before start rofi-pass in commandline it doesnt help :-(


$ setxkbmap -v
Trying to build keymap using the following components:
keycodes:   xfree86+aliases(qwertz)
types:      complete
compat:     complete
symbols:    pc+de+inet(pc105)
geometry:   pc(pc105)

Thanks for help !

kind regards

kristoferus

kristoferus75 commented 6 years ago

intressting if change to us keyboard > it works but after then i have a us keyboard also on xfce :-(

fix_layout=true

layout_cmd () { setxkbmap us }

moviuro commented 6 years ago

That's clearly not satisfactory... What happens when you type setxkbmap de in XFCE, and then autotype a password with rofi-pass?

What about setxkbmap de <variant>? (I don't know of all variants, so look them up)

kristoferus75 commented 6 years ago

Hi ! Here is the xdotool version on freebsd just for info (i think the same is also on my arch pc)

xdotool --v xdotool version 3.20180703.1

if i set :

fix_layout=true

layout_cmd () { setxkbmap us de or setxkbmap de us }

it works not really like it should :-( crazy

carnager commented 6 years ago

so what happens if you simply run xdotool type @ from a terminal?

kristoferus75 commented 6 years ago

it print me a q :-(

carnager commented 6 years ago

Sucks. https://github.com/jordansissel/xdotool/issues/97 this is the xdotool issue behind it and I don't think it will ever be resolved..

In theory one could force us layout in rofi-pass and then restore original layout at the end, but I played with this before and couldn't find a satisfying way to do this.

kristoferus75 commented 6 years ago

workaround with a small shell script :

#!/usr/bin/env bash

~/apps_freebsd/rofi-pass/rofi-pass
setxkbmap de

it works :-)

carnager commented 6 years ago

I wonder if we could do something like this to restore original layout:

#!/usr/bin/env bash                                                   

# get xkb options
readarray xkb < <(setxkbmap -query | sed -e 's/:/=/;s/ //g')

# apply stored settings
for option in "${xkb[@]}"; do
    option=${option//$'\n'/}
    export ${option%%=*}=${option#*=}
done
setxkbmap $layout $variant -option \"$option\" -model $model

comments?

kristoferus75 commented 6 years ago

looks better than my script :-)

noctuid commented 5 years ago

It would be nice if there was some workaround, for example the equivalent of layout_cmd that ran only just before typing text and another command to run after. I'd be fine defining the command to restore the original layout myself. Or maybe #165 as an option (which I'd prefer if possible).

moviuro commented 5 years ago

@carnager looking at the diff between e07055a and 1ac845d, I'd suggest:

It'll look like:

if command -v ydotool >/dev/null 2>&1; then
  _dotool () {
    # smart translator here
  }
elif command -v xdotool >/dev/null 2>&1; then
  _dotool () {
    xdotool "$@"
  }
else
  # OH NO!
fi
carnager commented 5 years ago

Yeah, I am not planning to drop one or the other. There is a reason ydotool is on a separate branch right now :) Right now ydotool does some strange things on my local setup, which first need to be resolved anyway.