събота, 24 март 2018 г.

Howto change key bindings

My space key is sadly broken. I need a new laptop but I'd like to wait for the new  i8-i9 processors to arrive.  Anyway, the point is that the space is a key nobody notices until it's gone and then you realise that's the most used key on your keyboard. And life sucks without it.
So after a week of struggle with external keyboard, I decided to do the things the linux way.
I found a program xkeybidings which does exactly this.  Here you can find its wiki  and archwiki .  At first it was a bit unclear how to make it function properly, but after reading this tutorial, it worked!
 So first install xkeybindings
$sudo equo install xkeybindings
After the installation is complete, you need to do
$xbindkeys --defaults > /home/your-user-name/.xbindkeysrc
to get the default config file
Open .xbindkeysrc with a text editor.
If you don't know the name of the key you need, run in terminal
xbindkeys -k
xbindkeys -mk
for one or more keys - basically, you press the key you need and its name is written in the third line of the terminal (you need only it)
Now you can add your commands to the  .xbindkeysrc
In my case,  I added:
"xvkbd -xsendevent -text " ""
   Alt + Alt_L + period
   Alt + Alt_L + D

The first line makes my left shift key to a space. For the moment this seems like the most convenient choice - I tried with "menu" but that seems difficult to hit as I never use this key. 
I also tried binding it to capslock but I couldn't figure how to unbind it first and that changed the case after it added the interval.
You can turn off capslock with:
setxkbmap -option ctrl:nocaps
(or to turn it on with $ setxkbmap -option) but that also doesn't help. I turned it off so that I don't press it by accident.

The second line allows me to start kwrite by holding Alt+.
The third line starts dolphin by holding alt+d
You can add as many commands as you like. Though that's not that much because there are already many predefined key shortcuts in KDE.
In any case, this program is a lifesaver as I have so much to do and I definitely don't want to buy a new laptop before the new processors are out.

Also, in order for your new bindings to take effect, you need to run
after each restart or change in the config file. I wrote a script:
killall xbindkeys

which can be then executed with 
$sh script.sh
P.S. If you need the number of certain key, you can find them here.

вторник, 30 януари 2018 г.

No sound in steam (some games at least)

For some reasons, some games in Steam don't have sound on my system. For example, X rebirth. It worked with the internal speakers but they suck, so I had to do something about it.
Here's what works for me:
1) In pavucontrol set the output device you want to use as "Fallback" - for me, these are my USB speakers.
2) Then in a konsole do:
$export SDL_AUDIODRIVER=pulseaudio
3) And then start steam with the runtime enabled.
And now I have sound.

неделя, 10 декември 2017 г.

How to monitor what's using the GPU

Something very funny since I'm using my GPU for holiday mining. When I run calculation on Maple, my GPU falls dramatically. Which I find very odd. It shouldn't be like this at all - I have enough cores to and RAM to rum CPU calculation together with GPU one.
So anyway, here's how you find what's using your GPU:
$fuser -v /dev/nvidiactl
It shows just the ethminer for me. You can do also:
$fuser -v /dev/nvidia*
if you want to see all the nvidia stuff.

Some other useful commands (source):
lspci -vnnn | perl -lne 'print if /^\d+\:.+(\[\S+\:\S+\])/' | grep VGA
this shows which is your active VGA controller.
Other things:
doesn't appear to work on my system. Claims I don't have the nvidia xdriver.
This one:
sudo lshw -C display
shows the two controllers.
A very cool more complicated command:
sudo lspci  -v -s  $(sudo lspci | grep ' VGA ' | cut -d" " -f 1)
will give you a lot  of info on your main VGA.
I think I have mentioned here already the
A cool thing is also to use Chrome and about:gpu where you can find all kinds of info.