News for hackers. Stuff that matters.
Re:WSL2 can now mount Linux ext4 disks directly by dharmaturtle on Tuesday November 09, 2021 @09:26AM (#29162132)
Mostly because my Windows setup works for me and moving to Linux would be a large disruption for questionable benefit. Things about my Windows setup which (I think) are hard to recreate on Linux, ignoring the possibility of writing my own code/tool:

* AutoHotKey. Alt/Capslock + IJKL is a universal way to get arrowkeys - e.g. it works in Chrome/a note taking app/Terminal. I'm not against getting a QMK keyboard, but I'm not aware of any laptop keyboards which support QMK. Switching between the two will get real annoying real fast.

* 7+ Taskbar Tweaker. My taskbar hides window names for programs like Spotify/Outlook/Slack (programs which usually have 1 window), but shows window names for programs like Chrome/Terminal/VSCode (programs which usually have multiple windows).

* Logitech software. My mouse has buttons hooked up to F13-F20 (yeah, there's more past F12), which AutoHotKey listens for and does specific stuff depending on what program is currently in focus.

The above are relatively important for my computing happiness, and I'm not entirely sure what I'll gain from moving to Linux.

If you can can address any of these points, please LMK! My reasons not to move to Linux have been growing fewer and fewer, but I've yet to find reasons to move to Linux.

Edit: Actually now that I think about this... I can just setup the mouse on a Windows box and it should just keep sending F13 etc. to a Linux box. So now I only have 2 reasons keeping me on Windows: AutoHotKey and an easily customizable Taskbar. The latter reason will also likely prevent me from upgrading to Win11.

Re:WSL2 can now mount Linux ext4 disks directly by chmod775 on Tuesday November 09, 2021 @10:05AM (#29162665)
Your second point really depends on the window manager/taskbar you want to use (they don't have to be the same program).

Your first and last points can be trivially achieved by mapping those keys via xmodmap - for instance:

    ! keycodes of your right and left alt keys
    keycode 108 = Mode_switch
    keycode 64 = Mode_switch

    ! remap the i key to emit Up when pressing Alt+i
    keysym i = i I Up Up
You can use the 'xev' utility to quickly find out the keycodes of keys on your system (just hover the window, press your button, and read the keycode). But all that is only necessary if your desktop environment doesn't ship with key mapping functionality already.

If you're on wayland instead of Xorg, then you'll have to use xkb to set this up.

There's also a bunch of AutoHotkey-like tools, but they're probably not necessary for something as simple as you're describing. The first that come to mind are AutoKey, SikuliX and IronAHK (a cross-platform rewrite of AutoHotkey, but I think it's discontinued).

Most desktop environments ship with functionality to (at least) run a command when you press a certain key. Others, like AwesomeWM, are way more powerful.

Re:WSL2 can now mount Linux ext4 disks directly by dharmaturtle on Tuesday November 09, 2021 @10:22AM (#29162883)
Thanks for this! I have some stuff to google now. Great to hear that what I want is "simple" - I think it's pretty basic too :)

My AHK stuff is a bit more complicated - my scripts total about 5000 LOC, but a lot of that is inflated cause it also doubles as a window manager. It does a bunch of other minor stuff, e.g. Alt-IJKL also combos with Shift for selection and Ctrl for word skipping, but I'm sure xmodmap and other tools you mentioned can handle that.

Re:WSL2 can now mount Linux ext4 disks directly by chmod775 on Tuesday November 09, 2021 @10:39AM (#29163134)
That sounds like AwesomeWM might be a good fit for you. A lot of the 'window manager' is essentially Lua, which doubles as the configuration language. If, upon pressing the F12 key, you want your windows to perform a choreographed dance before organizing themselves into neat rows ordered by name, it is the window manager for you. Since all the interesting parts are written in Lua, you can easily modify it to look and behave like anything reasonable - and most unreasonable things - you can come up with.

Alt-IJKL, when remapped at a low level like that, should behave exactly like arrow keys and combo with Ctrl/Shift like you would expect. You don't have to do anything extra.

Re:WSL2 can now mount Linux ext4 disks directly by fragmede on Tuesday November 09, 2021 @11:56AM (#29164148)
There are absolutely reasons not to switch to Desktop Linux, but support for weird custom configs is a reason to use Linux. Xmonad and other tiling window managers have been ported to back to windows and os x, they're so important to users. Someone's already mentioned how to use xmodmap to get global custom key bindings.

Now, whether it's worth it to you, who has already learned autohotkey's syntax, to move to Linux, I can't say. Linux is a game of differently confusing config files from Windows and sometimes it's about the devil you know vs the one you don't.

Re:WSL2 can now mount Linux ext4 disks directly by oblio on Tuesday November 09, 2021 @10:32AM (#29163027)
I don't use desktop Linux anymore, just a comment: if it's a techie oriented tool and automation related, Linux probably has it in some form (more likely 5000 different forms), and it's probably best in class.

Where Linux suffers is support for many big commercial applications (MS Office for obvious reasons, Adobe software, etc.) and hardware support (which can be hit and miss, depending on your luck).

But if you're thinking: "how could I automate whatever desktop action operation?" Linux for sure can do it. I have no idea right now how you'd it, but I'd be shocked if it couldn't. There's sooo much configurability.

Re:WSL2 can now mount Linux ext4 disks directly by smoldesu on Tuesday November 09, 2021 @10:31AM (#29163023)
Just a few thoughts from a random dev who's been daily driving Linux for ~2 years after ditching Mac/Windows:

- AHK is kinda tough to replace on Linux, since you're kinda stealing the display manager's job. Since there are now two display managers in use (the older x11 and newer Wayland), you'd need to find a solution that works for you. It seems to be pretty easy on x11 though[0], and if Wayland doesn't offer similar functionality I'll be quite surprised.

- Taskbar manipulation is handled by your window manager, and you can typically get pretty granular with it. I don't have the exact same setup as you, but I do have a second taskbar on my second display specifically for Spotify/IRC.

- AFAIK, Linux was the progenitor of the extended function row :)

In conclusion, your sticking points are probably going to continue to be sticking points for the foreseeable future. I hope that doesn't discourage you from enjoying Linux though, even through WSL.

[0] https://wiki.archlinux.org/title/X_keyboard_extension#Caps_h...

Re:WSL2 can now mount Linux ext4 disks directly by dharmaturtle on Tuesday November 09, 2021 @10:44AM (#29163219)
Oh fantastic. Your link eventually led me to find "Vim-like Layer for Xorg and Wayland", which is pretty much what I want. https://cedaei.com/posts/vim-like-layer-for-xorg-wayland/

Now I just need to learn Vim :D

Re:WSL2 can now mount Linux ext4 disks directly by csdvrx on Tuesday November 09, 2021 @12:43PM (#29164759)
Which mouse are you using?

I'm currently looking for a new mouse and trackball that I would use with AutoHotKey (yeah I'm windows fangirl - what can I say, it's just way more productive than Linux)

I read good things here about the Logitech MX Anywhere S2 so I'm thinking about getting one.

The more buttons, the merrier!

Re:WSL2 can now mount Linux ext4 disks directly by dharmaturtle on Tuesday November 09, 2021 @01:24PM (#29165333)
I use two actually - the G700 when at my desk, and G604 when travelling. I really, really like the G700 - I've bought a total of four of them now. Unfortunately Logitech's stopped making them, hence the 604, which is actually not bad. I still prefer the 700's shape/heft, but it's a minor thing. You likely have smaller hands so the 604 will probably suit you fine. The 700(s) has a terrible battery life (like literally 1 day), but the 604 can go months without a recharge (if on bluetooth). Both have toggleable smooth/segmented scrolling, a tiltwheel, a cluster of thumb buttons, a high DPI, and can do FN13+ keys as mentioned. I forgot how I got FN13+ keys onto the 604, but here's the `profile.dat` that I use for my 700s: https://pastebin.com/Sp50Bnpn The process for getting it on to the 604 may or may not be similar.

The thumb buttons do stuff like CtrlW/AltF4 (depending on the program), toggle between maximize/restore, minimize, media play/pause, and summon media player. Pretty basic stuff:

    #IfWinActive ahk_exe chrome.exe
    F14::
    WinGet MX, MinMax, A
    If MX
    WinRestore A
    Else WinMaximize A
    Return
    F13::SendInput ^+t
    F15::WinMinimize,A
    F16::SendInput ^+{Tab}
    F17::SendInput ^{Tab}
    F18::SendInput !{Right}
    F19::SendInput !{Left}
    F20::SendInput ^w
    F21::Media_Play_Pause
Oh, and one of my more favorite AHK things:

    RButton & WheelUp::Send {Volume_Up 1}
    RButton & WheelDown::Send {Volume_Down 1}
    RButton & F17:: Send {Volume_Mute} ;; aka right click + mousetilt = mute
Re:WSL2 can now mount Linux ext4 disks directly by csdvrx on Tuesday November 09, 2021 @02:05PM (#29165957)
> You likely have smaller hands

If you add the qualifier "than you", yes, it's not a very risky prediction given the difference between genders in the hand size distribution and the demographics of HN users: https://geogebraintheclassroom.blogspot.com/2015/11/introduc...

Objectively, I usually get glove size 6 to 6.5, but I do consider my hand quite big. I guess I could plug the numbers from http://www.fownesbrothers.com/press/2016/5/10/glove-size-doe... in the distribution above to compute my percentile and see if my perception is accurate.

All this to say, I'll have to be careful to adjust the recommendation by size, as mouse (or trackball) size is an important factor in comfort, and my perception may not be accurate.

> Oh, and one of my more favorite AHK things:

Chording!!! Yes!!! Extending the idea to mouse keys is very inspiring!!

FWIW, like many people I have Caps and Enter using that: Caps and Enter are respectively Esc and Enter when used alone, or Left and Right control when used with other keys.

But wait, it goes further:

- my Shift keys behave as Page Up and Page Down when used alone,

- my Alt keys behave as Home and End when used alone,

- my Control keys behave as Insert and Delete when used alone

In practice, this puts the edit keys very close to my fingers, even on laptop-style keyboards.

I don't always use these alternatives, but I've noticed a tendency for modern keyboard to remove these edit keys, so I want to have a solution ready for when I can't find good keyboards anymore.

Re:WSL2 can now mount Linux ext4 disks directly by dharmaturtle on Tuesday November 09, 2021 @03:32PM (#29167063)
I have no idea what glove size I am... but yeah I'm a dude.

> I've noticed a tendency for modern keyboard to remove these edit keys...

The teeny tiny arrow keys on modern laptops is actually part of the reason why I have Caps+IJKL be arrow keys. I have a lot of opinions/feelings about arrow keys. (Why are the most commonly used keys so small??? /rage)

For me Caps + H and semicolon are home/end, Y/P are PgUp/Down, U/O are 4lefts/4rights, and 8/, are 4ups/4downs. The 4's are surprisingly useful, especially when navigating. Home and End combo with Ctrl to yield beginning/end of document, which is also nice. (so like Ctrl+Caps+H = beginning). Everything combos with Ctrl and Shift for wordskipping/selection which is really nice.

I haven't tried making modifiers do different things when used alone - that's a neat idea.

Re:WSL2 can now mount Linux ext4 disks directly by csdvrx on Tuesday November 09, 2021 @04:30PM (#29167737)
> I have no idea what glove size I am... but yeah I'm a dude.

My prediction wasn't very risky given the demographics of HN :)

> The teeny tiny arrow keys on modern laptops is actually part of the reason why I have Caps+IJKL be arrow keys.

I'm currently back to Lenovo, mostly for the wonderful keyboards that still have decent sized arrow keys and Page Up / Page Down nearby on both side of the up arrow, so I don't feel this need, but the modern trend of teeny up/down next tothe HUGE left/right is concerning.

I might end up doing like just you. In fact, I might start adding shortcuts right now.

I'm thinking of doing a mapping with Alt, as my Caps key is chorded as Control, and I can't imagine doing without Ctrl-K or Ctrl-L, but. Did you have any specific reason to go with IJKL instead of WASD?

> Everything combos with Ctrl and Shift for wordskipping/selection which is really nice.

It's wonderful to meet fellow minded people :)

My AHK scripts work the same: to go to the beginning of a webpage, I press and hold right Alt, then press on left Alt to send a Home. To to go the end, I use the same keys, but in the opposite order!

It quickly gets into muscle memory!

> I haven't tried making modifiers do different things when used alone - that's a neat idea.

Here's my current implementation which still leaves much to be desired but mostly perform acceptably. Try it for yourself and see if you like it! I've found using less chording whenever possible made sense, and I find myself often scrolling down page by using the Shift key instead of space, as it's just more conveniently placed as a big button right where my thumb rests while holding my laptop

~LShift::

KeyWait, LShift

If (A_TimeSinceThisHotkey < 300 and A_PriorKey = "LShift") {

   if (GetKeyState("RAlt", "P") || ( GetKeyState("LAlt", "P")  && !(GetKeyState("CapsLock", "P") || GetKeyState("Enter", "P") ) ) ) {

           SendInput !{PgUp}

          } else {

           SendInput,{PgUp}

          }

 }
return

~RShift::

   if (GetKeyState("RAlt", "P") || ( GetKeyState("LAlt", "P")  && !(GetKeyState("CapsLock", "P") || GetKeyState("Enter", "P") ) ) ) {

     SendInput !{PgDn}

   } else {

    SendInput {PgDn}

         }

        }
return

*LAlt::

KeyWait, LAlt

If (A_TimeSinceThisHotkey < 300 and A_PriorKey = "LAlt") {

   if (GetKeyState("LShift", "P") || ( GetKeyState("RShift", "P")  && !(GetKeyState("CapsLock", "P") || GetKeyState("Enter", "P") ) ) ) {

     SendInput +{Home}

   } else {

    SendInput {Home}

         }

        }
return

*RAlt::

KeyWait, RAlt

If (A_TimeSinceThisHotkey < 300 and A_PriorKey = "RAlt") {

   if (GetKeyState("RShift", "P") || ( GetKeyState("LShift", "P")  && !(GetKeyState("CapsLock", "P") || GetKeyState("Enter", "P") ) ) ) {

    SendInput +{End}

  } else {

    SendInput {End}

         }

 }
return

Replace CapsLock and Enter by your own chording keys if needed, to allow composition.

If you end up improving on that, please send me your improved AHK script! My email is my username at outlook dot com.

Re:WSL2 can now mount Linux ext4 disks directly by dharmaturtle on Tuesday November 09, 2021 @07:30PM (#29169524)
TIL about A_PriorKey, thanks!

My own scripts are hardly prettier. AHK is not a great language, and I've put very little effort into learning its syntax. Here's my implementation Alt IJKL & friends: https://pastebin.com/F0xgWHH9 Same invitation to you. If you find a way to improve it, email me at my HN handle at gmail :D Note that it has explicit stuff to work with the AltTab window.

I daily drive a Thinkpad X1, but honestly these days Alt+IJKL is so ingrained into my muscle memory that I make grumbly noises when I try to use them on another coworker's machine and fail. Well at least I used to precovid.

> Did you have any specific reason to go with IJKL instead of WASD?

Ergonomics, primarily. I didn't want to twist the fingers of my left hand to try to hit Ctrl/Shift/Alt WASD while my right hand is sitting snickering. Oh. And I just realized I could have used the right alt + WASD. I went with LeftAlt because Caps is also on the left. You can certainly choose to go with RightAlt, though I would encourage you to try ESDF so you get to leave your fingers on the homerow. Also means you have a bit more room for QAZ if you wanna do anything fancy with them.

I suppose I could try and make RightAlt+ESDF mouse movement... but TrackPoint. Might be useful for when I'm at the desktop though. Anyway, being able to left click from the keyboard is surprisingly useful. (CtrlCaps for me.) Often times my mouse is exactly where I want it to be. Happens multiple times a day.

> To to go the end, I use the same keys, but in the opposite order!

That is fantastic.

Re:WSL2 can now mount Linux ext4 disks directly by brokenmachine on Tuesday November 09, 2021 @10:22PM (#29170703)
Thanks for the tip on the G604.

I also have I think 6 g700s'!!

My favorite was the old Logitech MX with the autoswitching hyperscroll. But I couldn't live without hyperscroll at all anymore.

AHK is also super useful but I've only done a couple of things so far.

Re:WSL2 can now mount Linux ext4 disks directly by pxc on Saturday November 13, 2021 @01:21AM (#29207864)
The keyboards in System76's new models (any with their custom EC firmware) support up to 4 programmable layers

idk if they actually work with QMK, but they use the same configurator as their custom keyboard for desktops, which can run QMK

The Plasma desktop environment lets you modify window behavior on a per-application or per-window basis OOTB, including having them skip the taskbar.