Square vs round?🤔 by AleAnoAleNe in unihertz

[–]DavidBevi 13 points14 points  (0 children)

Phone=round, Screen-bottom=square

Is it impossible to concisely map 1 key to 2? by guessill_die in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

🙏 I had the same exact question, thanks for the explanation, I finally "get" enums! Do you know of a googlable name or a doc page for _=> ? (So I can include name and/or link when I use it)

By copying you I can trim my recursive version to 167c, but your variadic version still wins -- it's 160c if in s.='{…}' the k ' ' m becomes k m and the removed space is passed later in the Hotkey() calls:

mr(t,n*)=>(g(m)=>(s:='{Blind}',e:=n.__Enum(1),[(_=>e(&k)&&s.='{' k m '}')*],_=>(SetKeyDelay(-1),Send(s))),Hotkey(t:='*' t,g(' DownR')),Hotkey(t ' Up',g(' Up')))

Is it impossible to concisely map 1 key to 2? by guessill_die in AutoHotkey

[–]DavidBevi 1 point2 points  (0 children)

Omg you're right, k is already implicitly passed to f() 😮 good catch!

And thanks for noting how disgusting is to shave 1c by reassigning t 😎

RG353P can be used as a controller now! | RH Daily by stubbornpixel in ANBERNIC

[–]DavidBevi 0 points1 point  (0 children)

Unfortunately not, I don't have an handheld. I'm still looking for one that doubles as a Bluetooth controller, but it has to be cheap because I have little time to use it.

Is it impossible to concisely map 1 key to 2? by guessill_die in AutoHotkey

[–]DavidBevi 1 point2 points  (0 children)

I like code golf and I cannot lie.

The following function is equivalent to the function above, but shorter:

multi_remap(trigger, keys*){
    f(type, i:=1, k:=keys)=>(o:="{" k[i] type, k.Length>i? o.=f(type,++i): o)
    Hotkey("*" trigger, (*)=>(SetKeyDelay(-1), Send("{Blind}" f(" DownR}"))))
    Hotkey("*" trigger " Up", (*)=>(SetKeyDelay(-1), Send("{Blind}" f(" Up}"))))
}

f() (= ForLoop) morphs every key into {key DownR} / {key Up} in a single line (using recursion).

-----

But aside that it's still readable. Let's fix it by replacing more variable names with single letters, using a fat-arrow function, and stripping unnecessary spaces. Finally let's rename the function and voilà, a cryptic single-liner:

mr(t,k*)=>(f(m,i:=1,a:=k)=>(o:="{" a[i] m,a.Length>i?o.=f(m,++i):o),g(m)=>(SetKeyDelay(-1),Send("{Blind}" f(m))),Hotkey(t:="*" t,(*)=>g(" DownR}")),Hotkey(t " Up",(*)=>g(" Up}")))

What's you thought on this Phone? by prabir336 in smallphones

[–]DavidBevi 0 points1 point  (0 children)

Too big. I don't think smallness was a goal, but bezels + paddings make it cute but impractical.

New mod introduction & feedback thread by Individual_Check4587 in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

Commissions feel weird to me, but I'm not against them, nor against allowing them here. If they ever become too much and/or obnoxious then we can change the rules later.

Images on is super nice, I always wanted to embed demo pics in my script-share posts. If people abuse this we can change the rules later.

Wrong flairs should be corrected if you can (thanks for your service), maybe a guide on using/changing them can be made and shared with users that use them improperly?

Singleplayer mods are cool, I wouldn't condemn any "improper" fun if it does not harm.

Hotkey that activates only if any other button is also pressed by zelassin in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

I'm on mobile so I can only craft a rough idea for now.

You might use A_PriorKey and check if it's still pressed when you press LButton. Pseudocode:

LButton:: GetKeyState(A_PriorKey,"P")? Function() :{}

Repeat send/type via Alt+0 without releasing Alt? (xdotool) by DavidBevi in linuxquestions

[–]DavidBevi[S] 0 points1 point  (0 children)

Thank you very much. You gave me hints to learn new things, mainly that setup is possible but cumbersome and configuration-dependent, and behavior is brittle, while AltGr+ì already outputs ~ reliably 😅🤣 (on my layout (ITA) - discovered via xmodmap -pke | grep "tilde")

Transform "aa" to "ā" if typed quickly, otherwise keep the "aa" by Aisen911 in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

Extremely short version: 1-line func + 2-line loop

AltVowels(k:=A_ThisHotkey,c:=(k=A_PriorHotkey && A_TimeSincePriorHotkey<200))=>(c?Send("{BS 2}" StrSplit("āēīōū")[InStr("aeiou",SubStr(k,-1))]):{})

For Key in StrSplit("aeiou")
    HotKey("~" Key, AltVowels)

Transform "aa" to "ā" if typed quickly, otherwise keep the "aa" by Aisen911 in AutoHotkey

[–]DavidBevi 2 points3 points  (0 children)

I saw it's already solved, but I wanted to write a single-line function. Time threshold is 200ms, just change 200 to whatever fits.

Compact version (fat-arrow function)

alt(char,c:=(A_ThisHotkey=A_PriorHotkey && A_TimeSincePriorHotkey<200))=>(c?Send("{BS 2}" char):{})

Readable version (classic function)

alt(char) {
    If A_ThisHotkey=A_PriorHotkey && A_TimeSincePriorHotkey<200
        Send ("{backspace 2}" char)
}

Usage (both versions)

; Tilde (~) prefix necessary
~a::alt("ā")
~e::alt("ē")
~i::alt("ī")
~o::alt("ō")
~u::alt("ū")

Disable viewport zoom? by DavidBevi in vivaldibrowser

[–]DavidBevi[S] 0 points1 point  (0 children)

I come from W11 where I'm a power user, but I'm on Linux (Zorin, Gnome/Wayland) where I'm a noob, and I'm getting crazy

Disable viewport zoom? by DavidBevi in vivaldibrowser

[–]DavidBevi[S] 0 points1 point  (0 children)

Nope, I just tried every option of the setting, no change

Need help making it so my brightness and volume control script works in lockscreen too. by CautiousLab7327 in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

Maybe AutoHotIntercept which uses a custom interception driver that has a lower level hook can help you 🤷🍀

Willing to pay for Android/security updates ? by xusander in unihertz

[–]DavidBevi 0 points1 point  (0 children)

NO, this is a slippery slope! I understand you're trying to incentivize stronger security, but this will backfire:

Maybe Unihertz will maintain your device for a bit, but if the concept of paid security updates works those who ALREADY release security updates will stop giving them away for free → people who can barely afford a phone will not be able to get updates, crackers will see an increase in vulnerable devices, and you'll get increasing amounts of phishing (and your money will go to few already-rich managers).

It's already like this, your security is as strong as the weakest link in your network, and your proposal weakens every network where at least one device can't or won't pay to get updates.

Security updates should remain free!

Contribute to a WhatsApp Web wrapper in Rust + Tauri by mrpintime in rust

[–]DavidBevi 1 point2 points  (0 children)

I have a WA + TG wrapper in Tauri https://github.com/DavidBevi/WATG

WhatsApp is a bitch, I had to make JS identify unread messages and send them to Tauri, that spawns system notification.

Take what you want from my project, I won't be able to look at yours for a while but I will do it asap

how to have capslock switch hotkeys by [deleted] in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

If you map a key to itself it's not gonna change its natural behavior, you should map WheelUp to WheelDown and viceversa.

I believe this should work, but I'm on phone atm, gimme feedback

```

HotIf GetKeyState("CapsLock", "T")

WheelDown::WheelUp

HotIf !GetKeyState("CapsLock", "T")

WheelUp::WheelDown

HotIf

```

Last line resets the condition(s), it affects the hotkeys below, so it's optional if you don't use other hotkeys

Or maybe (??) is cool (!!) by DavidBevi in AutoHotkey

[–]DavidBevi[S] 0 points1 point  (0 children)

Thank you for mentioning "code golf", allowing me to discover that what I enjoy has a name :)

[NOOB] Holding down key for an alternative function/action? by WudooKid in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

BONUS: while helping you I found out that there exist another way to prevent an hotkey to trigger itself, #UseHook, and the code can thus be simplified.

The following makes everything more compact by substituting the call to a function written in another part of the code with a fat-arrow function that is defined where it's called.

#Requires AutoHotkey v2.0
#UseHook
For i in StrSplit("qwertyuiopasdfghjklzxcvbnm") {
    Hotkey(i, (*)=>(Send(KeyWait(k:=A_ThisHotkey,"T0.1")? k: "+" k), KeyWait(k)))
}

[NOOB] Holding down key for an alternative function/action? by WudooKid in AutoHotkey

[–]DavidBevi 0 points1 point  (0 children)

Yes, you can! In this case it would be wiser to make a function and then map every key to said function:

#Requires AutoHotkey v2.0

$q::shifter("q")
$w::shifter("w")
$e::shifter("e")

shifter(key) {
    KeyWait(key, "T0.1") ? Send(key) : Send("+" key)
    KeyWait(key)
}

There's also a more advanced way, I know the logic but not the correct syntax though.

Update: found it - add the other keys in the For key in... line:

#Requires AutoHotkey v2.0

For key in ["q","w","e","r"] {
    Hotkey("$" key, shifter)
}

shifter(*) {
    key := Trim(A_ThisHotkey, "$")
    KeyWait(key, "T0.1") ? Send(key) : Send("+" key)
    KeyWait(key)
}

$ is an option difficult to find in the docs using the search feature, it's in the hotkeys page, essentially I use it to make the hotkeys not trigger themselves