LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   disable keyboard temporarily so that a book on keyboard does nothing. (https://www.linuxquestions.org/questions/linux-general-1/disable-keyboard-temporarily-so-that-a-book-on-keyboard-does-nothing-4175440274/)

ununun 12-06-2012 08:52 AM

disable keyboard temporarily so that a book on keyboard does nothing.
 
i sometime need to place a book on keyboard but then i also dont want it to press key randomly. so i am looking for a way to,
temporarily disable a keyboard except for few keys like up/down for scrolling and another 'control key' for enabling/disabling.

meanwhile i experiement with keymap.

thanks

Soadyheid 12-07-2012 09:51 AM

Humour me... Why do you need to put a book on the keyboard? :scratch:

Have you tried putting the keyboard on your knees, book on the table/desk?
Putting your keyboard/system on a bigger table/desk which will also accomodate the book?
Put the book on the table/desk and the keyboard standing vertically to the left ot right of the table/desk?
Getting a separate bookstand (like a music stand)?

Then there's...

Get a pdf file of the book and display it on your left or right hand screen? Huh? You don't have two screens?
Nail the book to the wall behind your screen... (sorry becomming silly now so I'll stop. :D

Then again...maybe unplug the keyboard and fit a USB number keypad(much smaller)? You'd get home, pg up, arrow keys,etc.

Play bonny! :hattip:

User\ Name=`echo $USER` 12-07-2012 01:48 PM

I agree with Soadyheid. First of all, I don't know why you would be doing such a thing, but if you have to, I'd say move it or unplug it.

Out of curiosity, is this just a hypothetical question to see if it can be done, or is it for a reason?

rknichols 12-07-2012 09:58 PM

s/book/cat/ and you would have my reason for wanting to disable the keyboard occasionally. (Of course, I'm not the one "placing" the cat on the keyboard.)

ununun 12-07-2012 10:38 PM

i have a laptop which is either or my lap or a small desk. so cant do anything suggested.

Quote:

Out of curiosity, is this just a hypothetical question to see if it can be done, or is it for a reason?
i know its bit silly, but imagine you reading from a pdf in laptop which has two usb connections and one power, now you want to take notes and moving this whole setup seems trickier than disabling the keyboard temporarily and then keyboard (of laptop) can work as support pad too. before any one say, cant close the lid either.

i am still digging though but i think an almost-null keymap with only few assigned keys (control key at least) would work. can double keystroke be assigned as a global shortcut system wide (independent of X) ?

Soadyheid 12-09-2012 05:15 AM

Quote:

i have a laptop which is either or my lap or a small desk.
Aha! This is a vital piece of information which you didn't supply when you originally posted the question! :tisk:

The solution is therefore much clearer!

Quote:

i know its bit silly, but imagine you reading from a pdf in laptop which has two usb connections and one power, now you want to take notes and moving this whole setup...
Wrong! You don't move the laptop, you move the notes! :D

If the notes you are taking are on loose paper (or will be fitted into a loose leaf binder) Buy a clip board and. with the laptop on the table, hold the clip board in one hand while writing notes with the other. The clip board can be laid on your lap/the floor or wherever while you use the laptop.
Use a hard backed notebook if loose leaf is not an option.

Tah Dah!

Play Bonny! :hattip:

H_TeXMeX_H 12-09-2012 05:20 AM

I would use xlock or xlockmore to lock the screen, that way you need to put in a password and that's unlikely to be entered with a book. It's not 100%, but the only 100% solution is to unplug the keyboard or stop putting a book on the keyboard.

ununun 12-09-2012 08:15 AM

got it (almost) .

it uses xmodmap so it depends on X .
the basic idea is to use different .Xmodmap .

.Xmodmap_null
Code:

keycode 8 =
keycode 9 = Escape NoSymbol Escape
keycode 10 =
keycode 11 =
keycode 12 =
keycode 13 =
keycode 14 =
keycode 15 =
keycode 16 =
keycode 17 =
keycode 18 =
keycode 19 =
keycode 20 =
keycode 21 =
keycode 22 =
keycode 23 = Tab ISO_Left_Tab Tab ISO_Left_Tab Tab ISO_Left_Tab
keycode 24 =
keycode 25 =
keycode 26 =
keycode 27 =
keycode 28 =
keycode 29 =
keycode 30 =
keycode 31 =
keycode 32 =
keycode 33 =
keycode 34 =
keycode 35 =
keycode 36 =
keycode 37 =
keycode 38 =
keycode 39 =
keycode 40 =
keycode 41 =
keycode 42 =
keycode 43 =
keycode 44 =
keycode 45 =
keycode 46 =
keycode 47 =
keycode 48 =
keycode 49 =
keycode 50 =
keycode 51 =
keycode 52 =
keycode 53 =
keycode 54 =
keycode 55 =
keycode 56 =
keycode 57 =
keycode 58 =
keycode 59 =
keycode 60 =
keycode 61 =
keycode 62 =
keycode 63 =
keycode 64 = Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L
keycode 65 =
keycode 66 =
keycode 67 =
keycode 68 =
keycode 69 =
keycode 70 =
keycode 71 =
keycode 72 =
keycode 73 =
keycode 74 =
keycode 75 =
keycode 76 =
keycode 77 =
keycode 78 =
keycode 79 =
keycode 80 =
keycode 81 =
keycode 82 =
keycode 83 =
keycode 84 =
keycode 85 =
keycode 86 =
keycode 87 =
keycode 88 =
keycode 89 =
keycode 90 =
keycode 91 =
keycode 92 =
keycode 93 =
keycode 94 =
keycode 95 =
keycode 96 =
keycode 97 =
keycode 98 =
keycode 99 =
keycode 100 =
keycode 101 =
keycode 102 =
keycode 103 =
keycode 104 =
keycode 105 =
keycode 106 =
keycode 107 =
keycode 108 =
keycode 109 =
keycode 110 =
keycode 111 = Up NoSymbol Up
keycode 112 =
keycode 113 = Left NoSymbol Left
keycode 114 = Right NoSymbol Right
keycode 115 =
keycode 116 = Down NoSymbol Down
keycode 117 =
keycode 118 =
keycode 119 =
keycode 120 =
keycode 121 =
keycode 122 =
keycode 123 =
keycode 124 =
keycode 125 =
keycode 126 =
keycode 127 =
keycode 128 =
keycode 129 =
keycode 130 =
keycode 131 =
keycode 132 =
keycode 133 = Super_L NoSymbol Super_L
keycode 134 =
keycode 135 =
keycode 136 =
keycode 137 =
keycode 138 =
keycode 139 =
keycode 140 =
keycode 141 =
keycode 142 =
keycode 143 =
keycode 144 =
keycode 145 =
keycode 146 =
keycode 147 =
keycode 148 =
keycode 149 =
keycode 150 =
keycode 151 =
keycode 152 =
keycode 153 =
keycode 154 =
keycode 155 =
keycode 156 =
keycode 157 =
keycode 158 =
keycode 159 =
keycode 160 =
keycode 161 =
keycode 162 =
keycode 163 =
keycode 164 =
keycode 165 =
keycode 166 =
keycode 167 =
keycode 168 =
keycode 169 =
keycode 170 =
keycode 171 =
keycode 172 =
keycode 173 =
keycode 174 =
keycode 175 =
keycode 176 =
keycode 177 =
keycode 178 =
keycode 179 =
keycode 180 =
keycode 181 =
keycode 182 =
keycode 183 =
keycode 184 =
keycode 185 =
keycode 186 =
keycode 187 =
keycode 188 =
keycode 189 =
keycode 190 =
keycode 191 =
keycode 192 =
keycode 193 =
keycode 194 =
keycode 195 =
keycode 196 =
keycode 197 =
keycode 198 =
keycode 199 =
keycode 200 =
keycode 201 =
keycode 202 =
keycode 203 =
keycode 204 =
keycode 205 =
keycode 206 =
keycode 207 =
keycode 208 =
keycode 209 =
keycode 210 =
keycode 211 =
keycode 212 =
keycode 213 =
keycode 214 =
keycode 215 =
keycode 216 =
keycode 217 =
keycode 218 =
keycode 219 =
keycode 220 =
keycode 221 =
keycode 222 =
keycode 223 =
keycode 224 =
keycode 225 =
keycode 226 =
keycode 227 =
keycode 228 =
keycode 229 =
keycode 230 =
keycode 231 =
keycode 232 =
keycode 233 =
keycode 234 =
keycode 235 =
keycode 236 =
keycode 237 =
keycode 238 =
keycode 239 =
keycode 240 =
keycode 241 =
keycode 242 =
keycode 243 =
keycode 244 =
keycode 245 =
keycode 246 =
keycode 247 =
keycode 248 =
keycode 249 =
keycode 250 =
keycode 251 =
keycode 252 =
keycode 253 =
keycode 254 =
keycode 255 =

so
Code:

xmodmap .Xmodmap_null
would temp*ly disable the keyboard. the only keys that would work is Super_L, Esc, Up, Down, Left, Right, Alt_L, Tab . so even in disable mode i would still be able to switch between windows (hence the books) and scroll . keyboard can be revert back to normal mode by assigning an executable file (here change_xmodmap.sh) to a key combination (here Super_L + Esc).

change_xmodmap.sh
Code:

#!/bin/bash

file=~/.IsXmodmapNull

if [ -e $file ] ; then
        xmodmap ~/.Xmodmap
        rm $file
        notify-send "book-xmodmap disabled"
else
        xmodmap ~/.Xmodmap_null
        touch $file
        notify-send "book-xmodmap enabled"
fi

i was wondering if double keystroke like tap can be used as key combination ?

Quote:

Originally Posted by Soadyheid
If the notes you are taking are on loose paper (or will be fitted into a loose leaf binder) Buy a clip board and. with the laptop on the table, hold the clip board in one hand while writing notes with the other. The clip board can be laid on your lap/the floor or wherever while you use the laptop.
Use a hard backed notebook if loose leaf is not an option.

you really want to solve the problem from another angle. :)

Quote:

Originally Posted by H_TeXMeX_H
I would use xlock or xlockmore to lock the screen, that way you need to put in a password and that's unlikely to be entered with a book. It's not 100%, but the only 100% solution is to unplug the keyboard or stop putting a book on the keyboard.

i cant. i still want to read book and scroll through pages.

hope it helps rknichols.

thanks everyone.

TobiSGD 12-09-2012 08:49 AM

Quote:

Originally Posted by ununun (Post 4845648)
i was wondering if double keystroke like tap can be used as key combination ?

Use a key combination that is very unlikely to be pressed by a book, like Ctrl+Alt+F12.

May be a dumb question, but if you want to make notes, why don't you just launch your favorite text editor and use the keyboard instead of disabling it? I for one can type faster that write with the hand and if your WM or DE has a scratchpad function (may be named different in other WMs/DEs as i3) it is very easy to show the editor only when needed (on any screen).

ununun 12-09-2012 09:03 AM

Quote:

Originally Posted by TobiSGD
Use a key combination that is very unlikely to be pressed by a book, like Ctrl+Alt+F12.

faster stroke is also very unlikely to be replicated by book and also its also very quick for me .

Quote:

Originally Posted by TobiSGD
May be a dumb question, but if you want to make notes, why don't you just launch your favorite text editor and use the keyboard instead of disabling it? I for one can type faster that write with the hand and if your WM or DE has a scratchpad function (may be named different in other WMs/DEs as i3) it is very easy to show the editor only when needed (on any screen).

not only i like the complexity that paper-pen provides but also i am math student . i did try to take notes in lyx for a while, but i did not like it very much. however for anything programming related i am most likely to use vim.


All times are GMT -5. The time now is 09:31 PM.