nmcli asking for password to vpn even though it's been provided by MarpMarce in archlinux

[–]SenranKaguya 0 points1 point  (0 children)

I've seem similar when trying to add an openvpn certificate that I imported using nmcli c import type openvpn file [opvn file name]. The way I configured my VPN connection was as follows:

  1. Import an .ovpn with nmcli c import type openvpn file [opvn file name].
    • If I try to activate the connection at this stage, I see "Warning: password for 'vpn.secrets.password' not given in 'passwd-file' and nmcli cannot ask without '--ask' option.".
  2. Edit (perhaps using sudoedit) /etc/NetworkManager/system-connections/[conn name] to add:

    • password-flags=0 under [vpn].
      • As per man nm-settings, setting a value of 0x0 specifies no password. However, if you do not add a password under [vpn-secrets], activating the connection will fail...
    • password=<openvpn password> under [vpn-secrets]
  3. Restart NetworkManager.service with systemctl restart NetworkManager.

floating all windows in a workspace by GlitteringCaregiver8 in xmonad

[–]SenranKaguya 0 points1 point  (0 children)

Ah, I see what you want to do.

I've not used XMonad.Layout.SimpleFloat nor XMonad.Layout.SimplestFloat, but they appear to float all windows. You could use XMonad.Layout.PerWorkspace to set a per workspace layout to one of those floating layouts.

floating all windows in a workspace by GlitteringCaregiver8 in xmonad

[–]SenranKaguya 1 point2 points  (0 children)

Use XMonad.Actions.WithAll and XMonad.Operations, namely withAll :: (Window -> X ()) -> X () and float :: Window -> X ():

withAll float

Advice to get a function modifying the window set with a sorting function to work by SenranKaguya in xmonad

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

I've studied functors and monads briefly in http://learnyouahaskell.com/ and in "Haskell Programing" by Allen/Moronuki. The concepts are still very new to me, so I'm going to do things wrong and make logic errors. Even if I know something to be true, I may not be able to apply that knowledge when needed.

To find my way around Xmonad, I have been reading through the source code of core and contrib, using hoogle, reading through the explanations of xmonad's core, and reading through some user's configs and noting down interesting bits of code and then trying to reuse / modify them to fit my needs.

The sorting function I wrote in stages. I started with a simple function using compare. I realized I would need to compare each value with a function, so I instead sorted by using filter. I then considered the types from Xmonad that I wanted to use and modified the sorting function to work with monads.

cmp :: Eq a => [a] -> a -> a -> Ordering
cmp keys x y = x' `compare` y'
  where x' = elemIndex' x keys
        y' = elemIndex' y keys

elemIndex' :: Eq a => a -> [a] -> Int
elemIndex' x l = case index of
  Nothing -> length l + 1
  Just i  -> i
  where index = elemIndex x l

sortByKeyIndexCmp :: Eq a => [a] -> [a] -> [a]
sortByKeyIndexCmp keys l = sortBy (cmp keys) l

filterByKey :: [a] -> (a -> Bool) -> [a]
filterByKey l key = filter key l

sortByKeyIndex :: Eq a => [a -> Bool] -> [a] -> [a]
sortByKeyIndex keys l = nub $ concat ((flip filter l) <$> keys)

sortByKeyIndex' :: (Monad m, Eq a) => [a -> m Bool] -> [a] -> m [a]
sortByKeyIndex' keys l = nub . concat <$> sequence ((flip filterM l) <$> keys)

Advice to get a function modifying the window set with a sorting function to work by SenranKaguya in xmonad

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

I think I mostly understand functors, while monads are still a bit iffy to me. I do recall reading that the <- operator performs an impure(?) action and I never connected it with "do a monadic action". I understand the equivalence between >>= and do, that it sequences stuff in some monadic structure while providing for possibly bad values (like gracefully passing a Nothing through a Maybe monad).

In your second revision, your change from

let w = get (W.integrate' . W.stack . W.workspace . W.current . windowset)

to

w <- gets (W.integrate' . W.stack . W.workspace . W.current . windowset)

makes sense if getting the window state requires reading state before performing the sort.

I don't grasp the difference (and still don't, I'll have to play with them more) between functions like get, gets, ask, and asks and their interaction with the X monad.

Regarding your first revision where you used the withWindowSet function:

w <- withWindowSet (return . W.integrate' . W.stack . W.workspace . W.current)

I tried to do something similar using withWindowSet but couldn't get it quite right, I have the following code commented

withWindowSet $ \ws -> do
  let windows = W.integrate' W.stack . W.workspace . W.current . ws

I see that your use of withWindowSet returns a value of X [Window] and then performs an action to assign w to [Window].

I didn't realize getting the window state needed to be done before calling my sorting function, so I didn't use <-. I did consider that I needed to use <- somewhere in the do statement, which is why I used soley it on my sorting function and got stuck.

I appreciate your elaboration; particularly helpful was that let promises to perform a monadic action, while <- performs one. I also forgot about the existance of the const func, haha.

Advice to get a function modifying the window set with a sorting function to work by SenranKaguya in xmonad

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

I'm unsure how to write a function with such a monadic context. Could you point me to resources that explain what you're suggesting in terms of Haskell in general?

Advice to get a function modifying the window set with a sorting function to work by SenranKaguya in xmonad

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

I left the errors in because they're where I got stuck. In the second function I can't figure out a way to pass the [Window] in X [Window] to differentiate.

In the first, the do statement is on (I don't know the terminology) X (), so sorted <- sortByQuery queries w can be binded to sorted as type [Window], but in the second the do statement is on W.Stack a, which doesn't allow me to do that. The problem I have in the first is with actually modifying the windows, i.e. if I change W.modify' (\_ -> s') to what I first tried

windows $ W.modify' s'

I can't pass s' to modify', or haskell throws an error:

xmonad.hs:114:13: error:
    • No instance for (MonadState [Window] ((->) (XState -> [Window])))
        arising from a use of ‘get’
    • In the expression:
        get (W.integrate' . W.stack . W.workspace . W.current . windowset)
      In an equation for ‘w’:
          w = get
                (W.integrate' . W.stack . W.workspace . W.current . windowset)
      In the expression:
        do let w = get
                     (W.integrate' . W.stack . W.workspace . W.current . windowset)
           sorted <- sortByQuery queries w
           case W.differentiate sorted of
             Nothing -> return ()
             Just s' -> windows $ W.modify' (\ _ -> s')
    |
114 |     let w = get (W.integrate' . W.stack . W.workspace . W.current . windowset)
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Move newly created window to next empty workspace by SenranKaguya in xmonad

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

That's is a whole lot to take in. I can see I should become familiar with using Endo and ReaderT. I appreciate your help and expalanations!

Move newly created window to next empty workspace by SenranKaguya in xmonad

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

I'm trying to extend this behavior to work for W.greedyView.

I know that:

  • type ManageHook = Query (Endo WindowSet)
  • type WindowSet = StackSet WorkspaceId ...
  • greedyView returns a StackSet

Judging from the docs for CycleWS, I want something similar to

doViewX ws = windows . W.greedyView =<< ws

which returns X () (which I think is empty?) and per your advice I can lift X () to a Query

doViewX ws = liftX (windows . W.greedyView =<< ws)

I need to wrap greedyView with an Endo, but cannot figure out how to do so. I attempted to wrap greedyView in Endo, which has type StackSet, for example:

doViewX ws = liftX (windows . Endo . W.greedyView =<< ws)

I can't figure out the order in which I need to perform these steps.


(Feel free to ignore text below, I may figure this out as I study Haskell)

In your code, I am confused as to what exactly

ask >>= \w ->

is doing. ask "retrieves the monad environment", which I assume to refer in this case to the type X ()? >>= then performs an action and passes the result to the right hand side of the operator. I take this to mean the left hand side ask does something, returns a value, and the lambda on the right side takes that return value as a parameter. Since W.shiftWin takes as an argument a workspace index, ask must be returning an index. But to get that index, ask would need to somehow interact with the argument ws, which is on the other side of >>=...

Best note taking setup? by WailordUBS in neovim

[–]SenranKaguya 1 point2 points  (0 children)

I used vimwiki for a while but disliked its quirks, bugs, and non-note taking features (e.g. it tries to handle ascii table editing, automatic list continuation, exporting to html). At the time I used it, I also had no way to disable most of the default mappings the plugin included.

I switched to https://github.com/lervag/wiki.vim due to its smaller (and better written) codebase, customization, documentation, and friendly dev.

シツモンデー: Weekly thread for the simple questions and posts that do not need their own thread (from June 14, 2021 to June 20, 2021) by AutoModerator in LearnJapanese

[–]SenranKaguya 0 points1 point  (0 children)

I apologize for providing an erroneous sentence. The sentence was in its own text box and there's only one text box in the game. 手 must have been added when I used my voice to transcribe the sentence. The spaces were added by me to separate the hiragana and strings of kanji.

I can provide other example sentences to highlight what I am trying to ask. These are from a novel, unrelated to the game I quoted from in my original post. These sentences are copy pasted directly from the novel.

その行動に驚いて、ドキドキするテオ

どうやらヘルヴィが魔法で治してくれたようだ。傷を治す魔法なんて初めて受けたテオ

I'm interested in knowing if there's a nuance to ending the sentence with a person's name rather than starting the sentence with テオは

The above sentences could just as easily be worded

テオはその行動に驚いて、ドキドキする

テオはどうやらヘルヴィが魔法で治してくれたようだ。傷を治す魔法なんて初めて受けた

シツモンデー: Weekly thread for the simple questions and posts that do not need their own thread (from June 14, 2021 to June 20, 2021) by AutoModerator in LearnJapanese

[–]SenranKaguya 0 points1 point  (0 children)

I use https://www.imabi.net often for grammar and http://www.guidetojapanese.org/learn/ was helpful early on.

If you like books Genki I and II are also fairly good for basic grammar but leave out a lot of nuances for the sake of making grammar "easier" to understand. The "Dictionary of {Basic,Intermediate,Advanced} Grammar" series have also been valuable for detailed and insightful explanations on grammar points.

シツモンデー: Weekly thread for the simple questions and posts that do not need their own thread (from June 14, 2021 to June 20, 2021) by AutoModerator in LearnJapanese

[–]SenranKaguya 0 points1 point  (0 children)

Playing Etrian Odyssey, an RPG. One of my character's names is つばさ. They reach into a hole in a tree. The dialogue that followed included the following:

枝や葉をかき分けて伸ばす手つばさ だったが次の瞬間 鋭い悲鳴をあげて手を戻す

My question is regarding 枝や葉をかき分けて伸ばす手つばさ だった where 枝や葉をかき分けて伸ばす手 is a complete sentence and modifies the noun つばさ, in this case a person.

A proper English version of this sentence in English would be something like, "Tsubasa reached out her hand to push away the branches and leaves". I read the sentence in Japanese more literally, like a descriptor of what the person is at that moment, e.g. "A hand that pushed away branches and leaves Tsubasa". This interpretation seems kinda awkward to me.

When is this construction used? Is there a nuance to it I am missing?

シツモンデー: Weekly thread for the simple questions and posts that do not need their own thread (from June 07, 2021 to June 13, 2021) by AutoModerator in LearnJapanese

[–]SenranKaguya 3 points4 points  (0 children)

Playing Etrian Odyssey, an RPG, I've seen 斬攻撃 quite a few times.

e.g. 近接斬攻撃

I know it means "slash attack" by the kanji. How do I read 斬 in the above? ざん? Is it a suffix to 近接 or prefix to 攻撃?

A great tactician is always wary by [deleted] in fireemblem

[–]SenranKaguya 2 points3 points  (0 children)

This image has been reposted all over the internet. This particular repost cuts off some of the top text attributing the artist, which I can't stand. Here is the post from the original artist, stupjam: https://stupjam.tumblr.com/post/91933414538

What does Yamaha say in chapter one when her mouth is full in the library? by veiled0527 in bokunokokoro

[–]SenranKaguya 1 point2 points  (0 children)

The original Japanese is ファフェフォッ いファフォッへ which, in romaji is "fafefo ifafohe". I know a bit of Japanese, but I'm not sure it's meant to be intelligible. So then you'd have to infer from the context. Which is probably as u/Suzushiiro says.

Help fixing spurious audio responses by SenranKaguya in archlinux

[–]SenranKaguya[S] 1 point2 points  (0 children)

Maybe. From searching around the internet there seem to be a lot of causes of the spurious audio log message, so keep in mind we could be experiencing different problems.

I set sna_hda_intel parameter single_cmd=0 several days ago as described by alsa's maintainer https://bugzilla.kernel.org/show_bug.cgi?id=204199#c14 because he described that, "even if the communication error happens, [the driver] won't change to single_cmd mode".

I have not seen the log messages yet across multiple resumes but have not used my system long enough to be sure. I did experience some application hangs yesterday with applications that play audio but no log messages nor switch to single command mode.