From oneself at gmail.com Wed Nov 21 18:49:27 2018 From: oneself at gmail.com (Eyal Erez) Date: Wed, 21 Nov 2018 13:49:27 -0500 Subject: [xmonad] Suspend Keybinding Temporarily Message-ID: Hi, I'm getting some collisions between my xmonad keybindings and an application I'm running (it's a game that is suppose to run full screen but in reality just uses a large window). I was wondering if I could suspend or change some keybindings from a script that I can run before the app launches and then restore later. Is this at all possible? Happy to entertain other options. -- *Eyal Erez <**oneself at gmail.com* *>* There are 10 types of people, those who know binary and those who don't. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvstrand at gmail.com Thu Nov 22 16:45:53 2018 From: tjarvstrand at gmail.com (=?UTF-8?Q?Thomas_J=C3=A4rvstrand?=) Date: Thu, 22 Nov 2018 17:45:53 +0100 Subject: [xmonad] Can't lock screen with light-locker-command Message-ID: Hi! I just moved back to xmonad after having used qtile for a few years and I'm having trouble locking my screen using light-locker-command. When calling "light-locker-command -l" from the command line, I get the this back: "Received error message from the locker: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ScreenSaver was not provided by any .service files" I'm running Ubuntu's mini.iso, lightdm, and a simple session file that just calls /etc/X11/Xsession. My .xsession only adds "~/.cabal/bin" to the PATH and execs xmonad. xmonad version is 0.15 but I get the same behaviour when installing xmonad via apt and running the package's session. I have tried purging and reinstalling both lightdm and light-locker. The curious thing is that the same lock command works fine if I run qtile from my .xsession instead of xmonad. Any pointers would be greatly appreciated! Thanks! Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From asjo at koldfront.dk Thu Nov 22 18:54:34 2018 From: asjo at koldfront.dk (=?utf-8?Q?Adam_Sj=C3=B8gren?=) Date: Thu, 22 Nov 2018 19:54:34 +0100 Subject: [xmonad] Can't lock screen with light-locker-command References: Message-ID: <878t1lgcyd.fsf@tullinup.koldfront.dk> Thomas writes: > Any pointers would be greatly appreciated! Not quite what you are asking for, perphaps, but I use xscreensaver to lock my screen, which I just start in a login-script with the "-no-splash" option, and lock using a key: ("M-S-l", spawn "xscreensaver-command -activate") Best regards, Adam -- "Hur långt man än har kommit Adam Sjøgren är det alltid längre kvar" asjo at koldfront.dk From tjarvstrand at gmail.com Thu Nov 22 20:42:53 2018 From: tjarvstrand at gmail.com (=?UTF-8?Q?Thomas_J=C3=A4rvstrand?=) Date: Thu, 22 Nov 2018 21:42:53 +0100 Subject: [xmonad] Can't lock screen with light-locker-command In-Reply-To: <878t1lgcyd.fsf@tullinup.koldfront.dk> References: <878t1lgcyd.fsf@tullinup.koldfront.dk> Message-ID: Hi again! I suppose what I would like to figure out is why it doesn't work to lock my screen using light-locker from the command line. Unfortunately I'm not a huge fan of the visuals of xscreensaver and would like to stay with light-locker if possible. Thomas On Thu, 22 Nov 2018, 19:55 Adam Sjøgren, wrote: > Thomas writes: > > > Any pointers would be greatly appreciated! > > Not quite what you are asking for, perphaps, but I use xscreensaver to > lock my screen, which I just start in a login-script with the > "-no-splash" option, and lock using a key: ("M-S-l", spawn > "xscreensaver-command -activate") > > > Best regards, > > Adam > > -- > "Hur långt man än har kommit Adam Sjøgren > är det alltid längre kvar" asjo at koldfront.dk > > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Thu Nov 22 20:44:26 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 22 Nov 2018 15:44:26 -0500 Subject: [xmonad] Can't lock screen with light-locker-command In-Reply-To: References: <878t1lgcyd.fsf@tullinup.koldfront.dk> Message-ID: Something's wrong with connectivity to dbus. Would have to see how your session is set up to know what's going on. On Thu, Nov 22, 2018 at 3:43 PM Thomas Järvstrand wrote: > Hi again! > > I suppose what I would like to figure out is why it doesn't work to lock > my screen using light-locker from the command line. Unfortunately I'm not a > huge fan of the visuals of xscreensaver and would like to stay with > light-locker if possible. > > Thomas > > On Thu, 22 Nov 2018, 19:55 Adam Sjøgren, wrote: > >> Thomas writes: >> >> > Any pointers would be greatly appreciated! >> >> Not quite what you are asking for, perphaps, but I use xscreensaver to >> lock my screen, which I just start in a login-script with the >> "-no-splash" option, and lock using a key: ("M-S-l", spawn >> "xscreensaver-command -activate") >> >> >> Best regards, >> >> Adam >> >> -- >> "Hur långt man än har kommit Adam Sjøgren >> är det alltid längre kvar" >> asjo at koldfront.dk >> >> _______________________________________________ >> xmonad mailing list >> xmonad at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad >> > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > -- brandon s allbery kf8nh allbery.b at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From regj at arch-ed.dk Thu Nov 22 20:51:55 2018 From: regj at arch-ed.dk (Rasmus Edgar) Date: Thu, 22 Nov 2018 21:51:55 +0100 Subject: [xmonad] Can't lock screen with light-locker-command In-Reply-To: References: <878t1lgcyd.fsf@tullinup.koldfront.dk> Message-ID: Hi Adam, If you are willing to try something else, I can recommend slock, which works perfectly with XMonad and is extremely barebones. https://tools.suckless.org/slock/ Br, Rasmus Edgar Brandon Allbery skrev den 2018-11-22 21:44: > Something's wrong with connectivity to dbus. Would have to see how your > session is set up to know what's going on. > > On Thu, Nov 22, 2018 at 3:43 PM Thomas Järvstrand > wrote: > Hi again! > I suppose what I would like to figure out is why it doesn't work to > lock my screen using light-locker from the command line. Unfortunately > I'm not a huge fan of the visuals of xscreensaver and would like to > stay with light-locker if possible. > > Thomas > > On Thu, 22 Nov 2018, 19:55 Adam Sjøgren, wrote: > Thomas writes: > >> Any pointers would be greatly appreciated! > > Not quite what you are asking for, perphaps, but I use xscreensaver to > lock my screen, which I just start in a login-script with the > "-no-splash" option, and lock using a key: ("M-S-l", spawn > "xscreensaver-command -activate") > > Best regards, > > Adam > > -- > "Hur långt man än har kommit Adam > Sjøgren > är det alltid längre kvar" > asjo at koldfront.dk > > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad -- brandon s allbery kf8nh allbery.b at gmail.com _______________________________________________ xmonad mailing list xmonad at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad From fercerpav at gmail.com Sat Nov 24 09:11:59 2018 From: fercerpav at gmail.com (Paul Fertser) Date: Sat, 24 Nov 2018 12:11:59 +0300 Subject: [xmonad] Can't lock screen with light-locker-command In-Reply-To: References: Message-ID: <20181124091158.GS17309@home.paul.comp> Hello, On Thu, Nov 22, 2018 at 05:45:53PM +0100, Thomas Järvstrand wrote: > having trouble locking my screen using light-locker-command. When calling > "light-locker-command -l" from the command line, I get the this back: > "Received error message from the locker: > GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name > org.freedesktop.ScreenSaver was not provided by any .service files" This means that the application is trying to use an FDO DBus API to do the actual locking. And indeed, its description says: It relies on lightdm for locking and unlocking your session via ConsoleKit/UPower or logind/systemd. > I'm running Ubuntu's mini.iso, lightdm, and a simple session file that just So since you're using lightdm already what you need to figure out is what package exactly is supposed to be providing org.freedesktop.ScreenSaver on your system. I hope your distro people can help figuring that out, the issue seems to be absolutely unrelated to XMonad. HTH -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav at gmail.com From tjarvstrand at gmail.com Sat Nov 24 18:37:07 2018 From: tjarvstrand at gmail.com (=?UTF-8?Q?Thomas_J=C3=A4rvstrand?=) Date: Sat, 24 Nov 2018 19:37:07 +0100 Subject: [xmonad] Can't lock screen with light-locker-command In-Reply-To: <20181124091158.GS17309@home.paul.comp> References: <20181124091158.GS17309@home.paul.comp> Message-ID: Thanks for the reply! I do however believe that it is related to xmonad somehow, or at least how I'm starting it, since the same command works fine when I'm in a qtile session. Unfortunately I'm very much a newbie when in comes to DBus and systemd Thomas On Sat, 24 Nov 2018, 10:12 Paul Fertser, wrote: > Hello, > > On Thu, Nov 22, 2018 at 05:45:53PM +0100, Thomas Järvstrand wrote: > > having trouble locking my screen using light-locker-command. When calling > > "light-locker-command -l" from the command line, I get the this back: > > "Received error message from the locker: > > GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name > > org.freedesktop.ScreenSaver was not provided by any .service files" > > This means that the application is trying to use an FDO DBus API to do > the actual locking. And indeed, its description says: > > It relies on lightdm for locking and unlocking your session via > ConsoleKit/UPower or logind/systemd. > > > I'm running Ubuntu's mini.iso, lightdm, and a simple session file that > just > > So since you're using lightdm already what you need to figure out is > what package exactly is supposed to be providing > org.freedesktop.ScreenSaver on your system. I hope your distro people > can help figuring that out, the issue seems to be absolutely unrelated > to XMonad. > > HTH > -- > Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! > mailto:fercerpav at gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Nov 24 18:40:44 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 24 Nov 2018 13:40:44 -0500 Subject: [xmonad] Can't lock screen with light-locker-command In-Reply-To: References: <20181124091158.GS17309@home.paul.comp> Message-ID: The difference is that xmonad doesn't start a dbus session for you. Look at the dbus-launch command for how to start a session, depending on how that session is set up. For example, if you are using .xsession, you'll want to use the eval version to make it available to everything launched from .xsession instead of only from xmonad. On Sat, Nov 24, 2018 at 1:37 PM Thomas Järvstrand wrote: > Thanks for the reply! I do however believe that it is related to xmonad > somehow, or at least how I'm starting it, since the same command works fine > when I'm in a qtile session. Unfortunately I'm very much a newbie when in > comes to DBus and systemd > > Thomas > > On Sat, 24 Nov 2018, 10:12 Paul Fertser, wrote: > >> Hello, >> >> On Thu, Nov 22, 2018 at 05:45:53PM +0100, Thomas Järvstrand wrote: >> > having trouble locking my screen using light-locker-command. When >> calling >> > "light-locker-command -l" from the command line, I get the this back: >> > "Received error message from the locker: >> > GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name >> > org.freedesktop.ScreenSaver was not provided by any .service files" >> >> This means that the application is trying to use an FDO DBus API to do >> the actual locking. And indeed, its description says: >> >> It relies on lightdm for locking and unlocking your session via >> ConsoleKit/UPower or logind/systemd. >> >> > I'm running Ubuntu's mini.iso, lightdm, and a simple session file that >> just >> >> So since you're using lightdm already what you need to figure out is >> what package exactly is supposed to be providing >> org.freedesktop.ScreenSaver on your system. I hope your distro people >> can help figuring that out, the issue seems to be absolutely unrelated >> to XMonad. >> >> HTH >> -- >> Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! >> mailto:fercerpav at gmail.com >> > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > -- brandon s allbery kf8nh allbery.b at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvstrand at gmail.com Sat Nov 24 18:54:30 2018 From: tjarvstrand at gmail.com (=?UTF-8?Q?Thomas_J=C3=A4rvstrand?=) Date: Sat, 24 Nov 2018 19:54:30 +0100 Subject: [xmonad] Can't lock screen with light-locker-command In-Reply-To: References: <20181124091158.GS17309@home.paul.comp> Message-ID: Awesome, thank you a million! It wasn't the actual issue but it pointed me in the right direction! The problem was that ~/.dbus and its contents were owned by root and not readable by my user. Deleting the directory solved the problem. Thanks again! Thomas lör 24 nov. 2018 kl 19:40 skrev Brandon Allbery : > The difference is that xmonad doesn't start a dbus session for you. Look > at the dbus-launch command for how to start a session, depending on how > that session is set up. For example, if you are using .xsession, you'll > want to use the eval version to make it available to everything launched > from .xsession instead of only from xmonad. > > On Sat, Nov 24, 2018 at 1:37 PM Thomas Järvstrand > wrote: > >> Thanks for the reply! I do however believe that it is related to xmonad >> somehow, or at least how I'm starting it, since the same command works fine >> when I'm in a qtile session. Unfortunately I'm very much a newbie when in >> comes to DBus and systemd >> >> Thomas >> >> On Sat, 24 Nov 2018, 10:12 Paul Fertser, wrote: >> >>> Hello, >>> >>> On Thu, Nov 22, 2018 at 05:45:53PM +0100, Thomas Järvstrand wrote: >>> > having trouble locking my screen using light-locker-command. When >>> calling >>> > "light-locker-command -l" from the command line, I get the this back: >>> > "Received error message from the locker: >>> > GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name >>> > org.freedesktop.ScreenSaver was not provided by any .service files" >>> >>> This means that the application is trying to use an FDO DBus API to do >>> the actual locking. And indeed, its description says: >>> >>> It relies on lightdm for locking and unlocking your session via >>> ConsoleKit/UPower or logind/systemd. >>> >>> > I'm running Ubuntu's mini.iso, lightdm, and a simple session file that >>> just >>> >>> So since you're using lightdm already what you need to figure out is >>> what package exactly is supposed to be providing >>> org.freedesktop.ScreenSaver on your system. I hope your distro people >>> can help figuring that out, the issue seems to be absolutely unrelated >>> to XMonad. >>> >>> HTH >>> -- >>> Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! >>> mailto:fercerpav at gmail.com >>> >> _______________________________________________ > > >> xmonad mailing list >> xmonad at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad >> > > > -- > brandon s allbery kf8nh > allbery.b at gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oneself at gmail.com Tue Nov 27 19:28:40 2018 From: oneself at gmail.com (Eyal Erez) Date: Tue, 27 Nov 2018 14:28:40 -0500 Subject: [xmonad] Shift Spotify to the right workspace Message-ID: Hi, I have a workspace called "music" and I'm trying to shift the Spotify linux client there. I put this as part of my manage hook, but it doesn't seem to work. Spotify starts up in whatever workspace I happen to be (this works fine for many other apps). , className =? "Spotify" --> doShift "music" , className =? "spotify" --> doShift "music" , title =? "spotify" --> doShift "music" Looking at xprop, I see the following: _NET_WM_ICON(CARDINAL) = WM_CLASS(STRING) = "spotify", "Spotify" WM_NAME(STRING) = "Spotify" _NET_WM_NAME(UTF8_STRING) = "Spotify" _NET_WM_DESKTOP(CARDINAL) = 2 WM_STATE(WM_STATE): window state: Normal icon window: 0x0 XdndProxy(WINDOW): window id # 0x4c00002 WM_NORMAL_HINTS(WM_SIZE_HINTS): program specified location: 0, 0 window gravity: Static _NET_WM_PID(CARDINAL) = 8317 WM_LOCALE_NAME(STRING) = "en_US.UTF-8" WM_CLIENT_MACHINE(STRING) = "eyal" WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, _NET_WM_PING Is Spotify not setting something right or not at the right time? -- *Eyal Erez <**oneself at gmail.com* *>* There are 10 types of people, those who know binary and those who don't. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Nov 27 19:42:03 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 27 Nov 2018 14:42:03 -0500 Subject: [xmonad] Shift Spotify to the right workspace In-Reply-To: References: Message-ID: IIRC it's a web-based client, so that only gets set after initial load and rendering; before that, it probably identifies as some variety of HTML widget / mini-browser. You'll need http://hackage.haskell.org/package/xmonad-contrib-0.15/docs/XMonad-Hooks-DynamicProperty.html to match it. (It's actually violating the protocol if it's not setting WM_CLASS properly initially, but any more nobody cares about such things.) On Tue, Nov 27, 2018 at 2:29 PM Eyal Erez wrote: > Hi, > > I have a workspace called "music" and I'm trying to shift the Spotify > linux client there. I put this as part of my manage hook, but it doesn't > seem to work. Spotify starts up in whatever workspace I happen to be (this > works fine for many other apps). > > , className =? "Spotify" --> doShift "music" > , className =? "spotify" --> doShift "music" > , title =? "spotify" --> doShift "music" > > Looking at xprop, I see the following: > > _NET_WM_ICON(CARDINAL) = > WM_CLASS(STRING) = "spotify", "Spotify" > WM_NAME(STRING) = "Spotify" > _NET_WM_NAME(UTF8_STRING) = "Spotify" > _NET_WM_DESKTOP(CARDINAL) = 2 > WM_STATE(WM_STATE): > window state: Normal > icon window: 0x0 > XdndProxy(WINDOW): window id # 0x4c00002 > WM_NORMAL_HINTS(WM_SIZE_HINTS): > program specified location: 0, 0 > window gravity: Static > _NET_WM_PID(CARDINAL) = 8317 > WM_LOCALE_NAME(STRING) = "en_US.UTF-8" > WM_CLIENT_MACHINE(STRING) = "eyal" > WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, _NET_WM_PING > > Is Spotify not setting something right or not at the right time? > > > -- > *Eyal Erez <**oneself at gmail.com* *>* > > There are 10 types of people, those who know binary and those who don't. > > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > -- brandon s allbery kf8nh allbery.b at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgf.dma at gmail.com Wed Nov 28 18:19:44 2018 From: sgf.dma at gmail.com (Dmitriy Matrosov) Date: Wed, 28 Nov 2018 21:19:44 +0300 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: References: Message-ID: Hi. On 11/21/2018 09:49 PM, Eyal Erez wrote: > Hi, > > I'm getting some collisions between my xmonad keybindings and an > application I'm running (it's a game that is suppose to run full screen > but in reality just uses a large window).  I was wondering if I could > suspend or change some keybindings from a script that I can run before > the app launches and then restore later. > > Is this at all possible?  Happy to entertain other options. Here is proof of concept: import XMonad import XMonad.Hooks.EwmhDesktops import System.Directory import System.FilePath main :: IO () main = do let xcf = ewmh $ def { modMask = mod4Mask , handleExtraArgs = disableKeys } xmonad xcf disableKeys :: [String] -> XConfig Layout -> IO (XConfig Layout) disableKeys _ xcf = do xd <- getXMonadDir let disableFn = xd "disable_keys" b <- doesFileExist disableFn if b then do trace "Disabling all keys." removeFile disableFn return (xcf {keys = \_ -> mempty}) else return xcf To disable all keys create file `~/.xmonad/disable_keys` and then restart xmonad with `xmonad --restart`. All keys will be disabled _and_ file deleted (to avoid locking yourself), thus next restart will restore all keys back. As far as i understand, xmonad grabs keys in `X.Main.launch` before entering main loop. Thus, the one way to change key grab is to restart xmonad. I need to modify `XConfig` before calling X.Main.launch`, and this may be done by `handleExtraArgs` (called in `launch'` in `X.Main.xmonad`). Unfortunately, it seems, that xmonad does not allow to pass extra cmd arguments during restart (`X.Operations.restart` always starts xmonad with name `xmonad` and no arguments). Also, i can't use extensible state in `handleExtraArgs`, because it runs in `IO` (`X` context is not yet built at that time). Thus, to pass something to it, i may use either file or (probably) `--replace`. The above version uses file. And i have no luck with `--replace`: it seems, `xmonad` can't replace itself?.. From allbery.b at gmail.com Wed Nov 28 18:25:00 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 28 Nov 2018 13:25:00 -0500 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: References: Message-ID: Not by default; there's already a bug ( https://github.com/xmonad/xmonad/issues/78) about our not obeying the ICCCM replace protocol unless started by replacing some other WM. There's a few other places you can hide extra parameters; starting that early, the environment is probably the easiest to use, provided they're not too large (see why there's a state file now). On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov wrote: > Hi. > > On 11/21/2018 09:49 PM, Eyal Erez wrote: > > Hi, > > > > I'm getting some collisions between my xmonad keybindings and an > > application I'm running (it's a game that is suppose to run full screen > > but in reality just uses a large window). I was wondering if I could > > suspend or change some keybindings from a script that I can run before > > the app launches and then restore later. > > > > Is this at all possible? Happy to entertain other options. > > Here is proof of concept: > > > import XMonad > import XMonad.Hooks.EwmhDesktops > > import System.Directory > import System.FilePath > > > main :: IO () > main = do > let xcf = ewmh $ def > { modMask = mod4Mask > , handleExtraArgs = disableKeys > } > xmonad xcf > > disableKeys :: [String] -> XConfig Layout -> IO (XConfig Layout) > disableKeys _ xcf = do > xd <- getXMonadDir > let disableFn = xd "disable_keys" > b <- doesFileExist disableFn > if b > then do > trace "Disabling all keys." > removeFile disableFn > return (xcf {keys = \_ -> mempty}) > else return xcf > > > To disable all keys create file `~/.xmonad/disable_keys` and then > restart xmonad with `xmonad --restart`. All keys will be disabled > _and_ file deleted (to avoid locking yourself), thus next restart will > restore all keys back. > > As far as i understand, xmonad grabs keys in `X.Main.launch` before > entering main loop. Thus, the one way to change key grab is to restart > xmonad. I need to modify `XConfig` before calling X.Main.launch`, and > this may be done by `handleExtraArgs` (called in `launch'` in > `X.Main.xmonad`). Unfortunately, it seems, that xmonad does not allow > to pass extra cmd arguments during restart (`X.Operations.restart` > always starts xmonad with name `xmonad` and no arguments). Also, i > can't use extensible state in `handleExtraArgs`, because it runs in > `IO` (`X` context is not yet built at that time). Thus, to pass > something to it, i may use either file or (probably) `--replace`. The > above version uses file. And i have no luck with `--replace`: it > seems, `xmonad` can't replace itself?.. > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > -- brandon s allbery kf8nh allbery.b at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgf.dma at gmail.com Thu Nov 29 11:01:08 2018 From: sgf.dma at gmail.com (Dmitriy Matrosov) Date: Thu, 29 Nov 2018 14:01:08 +0300 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: References: Message-ID: <5ED9B6B4-6E9C-4045-BE93-CB98D9EE4E0C@gmail.com> On November 28, 2018 9:25:00 PM GMT+03:00, Brandon Allbery wrote: >Not by default; there's already a bug ( >https://github.com/xmonad/xmonad/issues/78) about our not obeying the >ICCCM >replace protocol unless started by replacing some other WM. > >There's a few other places you can hide extra parameters; starting that >early, the environment is probably the easiest to use, provided they're >not >too large (see why there's a state file now). Hm, i don't understand how to use environment. I need to pass something to running xmonad process (to which i send XMONAD_RESTART). As far as i know, i can't change environment of another process.. >On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov >wrote: > >> Hi. >> >> On 11/21/2018 09:49 PM, Eyal Erez wrote: >> > Hi, >> > >> > I'm getting some collisions between my xmonad keybindings and an >> > application I'm running (it's a game that is suppose to run full >screen >> > but in reality just uses a large window). I was wondering if I >could >> > suspend or change some keybindings from a script that I can run >before >> > the app launches and then restore later. >> > >> > Is this at all possible? Happy to entertain other options. >> >> Here is proof of concept: >> >> >> import XMonad >> import XMonad.Hooks.EwmhDesktops >> >> import System.Directory >> import System.FilePath >> >> >> main :: IO () >> main = do >> let xcf = ewmh $ def >> { modMask = mod4Mask >> , handleExtraArgs = disableKeys >> } >> xmonad xcf >> >> disableKeys :: [String] -> XConfig Layout -> IO (XConfig >Layout) >> disableKeys _ xcf = do >> xd <- getXMonadDir >> let disableFn = xd "disable_keys" >> b <- doesFileExist disableFn >> if b >> then do >> trace "Disabling all keys." >> removeFile disableFn >> return (xcf {keys = \_ -> mempty}) >> else return xcf >> >> >> To disable all keys create file `~/.xmonad/disable_keys` and then >> restart xmonad with `xmonad --restart`. All keys will be disabled >> _and_ file deleted (to avoid locking yourself), thus next restart >will >> restore all keys back. >> >> As far as i understand, xmonad grabs keys in `X.Main.launch` before >> entering main loop. Thus, the one way to change key grab is to >restart >> xmonad. I need to modify `XConfig` before calling X.Main.launch`, and >> this may be done by `handleExtraArgs` (called in `launch'` in >> `X.Main.xmonad`). Unfortunately, it seems, that xmonad does not allow >> to pass extra cmd arguments during restart (`X.Operations.restart` >> always starts xmonad with name `xmonad` and no arguments). Also, i >> can't use extensible state in `handleExtraArgs`, because it runs in >> `IO` (`X` context is not yet built at that time). Thus, to pass >> something to it, i may use either file or (probably) `--replace`. The >> above version uses file. And i have no luck with `--replace`: it >> seems, `xmonad` can't replace itself?.. >> _______________________________________________ >> xmonad mailing list >> xmonad at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad >> From allbery.b at gmail.com Thu Nov 29 18:50:01 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 29 Nov 2018 13:50:01 -0500 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: <5ED9B6B4-6E9C-4045-BE93-CB98D9EE4E0C@gmail.com> References: <5ED9B6B4-6E9C-4045-BE93-CB98D9EE4E0C@gmail.com> Message-ID: You were talking about restart, between the running xmonad and its replacement via executeFile. There, you can use the environment. There is no way to pass information between an invoked "xmonad --restart" and the running xmonad. On Thu, Nov 29, 2018 at 6:01 AM Dmitriy Matrosov wrote: > > > On November 28, 2018 9:25:00 PM GMT+03:00, Brandon Allbery < > allbery.b at gmail.com> wrote: > >Not by default; there's already a bug ( > >https://github.com/xmonad/xmonad/issues/78) about our not obeying the > >ICCCM > >replace protocol unless started by replacing some other WM. > > > >There's a few other places you can hide extra parameters; starting that > >early, the environment is probably the easiest to use, provided they're > >not > >too large (see why there's a state file now). > > Hm, i don't understand how to use environment. I need to pass something to > running xmonad process (to which i send XMONAD_RESTART). As far as i know, > i can't change environment of another process.. > > > >On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov > >wrote: > > > >> Hi. > >> > >> On 11/21/2018 09:49 PM, Eyal Erez wrote: > >> > Hi, > >> > > >> > I'm getting some collisions between my xmonad keybindings and an > >> > application I'm running (it's a game that is suppose to run full > >screen > >> > but in reality just uses a large window). I was wondering if I > >could > >> > suspend or change some keybindings from a script that I can run > >before > >> > the app launches and then restore later. > >> > > >> > Is this at all possible? Happy to entertain other options. > >> > >> Here is proof of concept: > >> > >> > >> import XMonad > >> import XMonad.Hooks.EwmhDesktops > >> > >> import System.Directory > >> import System.FilePath > >> > >> > >> main :: IO () > >> main = do > >> let xcf = ewmh $ def > >> { modMask = mod4Mask > >> , handleExtraArgs = disableKeys > >> } > >> xmonad xcf > >> > >> disableKeys :: [String] -> XConfig Layout -> IO (XConfig > >Layout) > >> disableKeys _ xcf = do > >> xd <- getXMonadDir > >> let disableFn = xd "disable_keys" > >> b <- doesFileExist disableFn > >> if b > >> then do > >> trace "Disabling all keys." > >> removeFile disableFn > >> return (xcf {keys = \_ -> mempty}) > >> else return xcf > >> > >> > >> To disable all keys create file `~/.xmonad/disable_keys` and then > >> restart xmonad with `xmonad --restart`. All keys will be disabled > >> _and_ file deleted (to avoid locking yourself), thus next restart > >will > >> restore all keys back. > >> > >> As far as i understand, xmonad grabs keys in `X.Main.launch` before > >> entering main loop. Thus, the one way to change key grab is to > >restart > >> xmonad. I need to modify `XConfig` before calling X.Main.launch`, and > >> this may be done by `handleExtraArgs` (called in `launch'` in > >> `X.Main.xmonad`). Unfortunately, it seems, that xmonad does not allow > >> to pass extra cmd arguments during restart (`X.Operations.restart` > >> always starts xmonad with name `xmonad` and no arguments). Also, i > >> can't use extensible state in `handleExtraArgs`, because it runs in > >> `IO` (`X` context is not yet built at that time). Thus, to pass > >> something to it, i may use either file or (probably) `--replace`. The > >> above version uses file. And i have no luck with `--replace`: it > >> seems, `xmonad` can't replace itself?.. > >> _______________________________________________ > >> xmonad mailing list > >> xmonad at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > >> > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > -- brandon s allbery kf8nh allbery.b at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgf.dma at gmail.com Thu Nov 29 21:05:45 2018 From: sgf.dma at gmail.com (Dmitriy Matrosov) Date: Fri, 30 Nov 2018 00:05:45 +0300 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: References: <5ED9B6B4-6E9C-4045-BE93-CB98D9EE4E0C@gmail.com> Message-ID: On 11/29/2018 09:50 PM, Brandon Allbery wrote: > You were talking about restart, between the running xmonad and its > replacement via executeFile. There, you can use the environment. There > is no way to pass information between an invoked "xmonad --restart" and > the running xmonad. > > On Thu, Nov 29, 2018 at 6:01 AM Dmitriy Matrosov > wrote: > > > > On November 28, 2018 9:25:00 PM GMT+03:00, Brandon Allbery > > wrote: > >Not by default; there's already a bug ( > >https://github.com/xmonad/xmonad/issues/78) about our not obeying the > >ICCCM > >replace protocol unless started by replacing some other WM. > > > >There's a few other places you can hide extra parameters; starting > that > >early, the environment is probably the easiest to use, provided > they're > >not > >too large (see why there's a state file now). > > Hm, i don't understand how to use environment. I need to pass > something to running xmonad process (to which i send > XMONAD_RESTART). As far as i know, i can't change environment of > another process.. > > > >On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov > > > >wrote: > > > >> Hi. > >> > >> On 11/21/2018 09:49 PM, Eyal Erez wrote: > >> > Hi, > >> > > >> > I'm getting some collisions between my xmonad keybindings and an > >> > application I'm running (it's a game that is suppose to run full > >screen > >> > but in reality just uses a large window).  I was wondering if I > >could > >> > suspend or change some keybindings from a script that I can run > >before > >> > the app launches and then restore later. > >> > > >> > Is this at all possible?  Happy to entertain other options. > >> > >> Here is proof of concept: > >> > >> > >>          import XMonad > >>          import XMonad.Hooks.EwmhDesktops > >> > >>          import System.Directory > >>          import System.FilePath > >> > >> > >>          main :: IO () > >>          main = do > >>                  let xcf = ewmh $ def > >>                              { modMask = mod4Mask > >>                              , handleExtraArgs = disableKeys > >>                              } > >>                  xmonad xcf > >> > >>          disableKeys :: [String] -> XConfig Layout -> IO (XConfig > >Layout) > >>          disableKeys _ xcf = do > >>              xd <- getXMonadDir > >>              let disableFn = xd "disable_keys" > >>              b <- doesFileExist disableFn > >>              if b > >>                then do > >>                  trace "Disabling all keys." > >>                  removeFile disableFn > >>                  return (xcf {keys = \_ -> mempty}) > >>                else return xcf > >> > >> > >> To disable all keys create file `~/.xmonad/disable_keys` and then > >> restart xmonad with `xmonad --restart`. All keys will be disabled > >> _and_ file deleted (to avoid locking yourself), thus next restart > >will > >> restore all keys back. > >> > >> As far as i understand, xmonad grabs keys in `X.Main.launch` before > >> entering main loop. Thus, the one way to change key grab is to > >restart > >> xmonad. I need to modify `XConfig` before calling > X.Main.launch`, and > >> this may be done by `handleExtraArgs` (called in `launch'` in > >> `X.Main.xmonad`). Unfortunately, it seems, that xmonad does not > allow > >> to pass extra cmd arguments during restart (`X.Operations.restart` > >> always starts xmonad with name `xmonad` and no arguments). Also, i > >> can't use extensible state in `handleExtraArgs`, because it runs in > >> `IO` (`X` context is not yet built at that time).  Thus, to pass > >> something to it, i may use either file or (probably) > `--replace`. The > >> above version uses file. And i have no luck with `--replace`: it > >> seems, `xmonad` can't replace itself?.. > >> _______________________________________________ > >> xmonad mailing list > >> xmonad at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > >> > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > > -- > brandon s allbery kf8nh > allbery.b at gmail.com From sgf.dma at gmail.com Thu Nov 29 21:07:36 2018 From: sgf.dma at gmail.com (Dmitriy Matrosov) Date: Fri, 30 Nov 2018 00:07:36 +0300 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: References: <5ED9B6B4-6E9C-4045-BE93-CB98D9EE4E0C@gmail.com> Message-ID: <0d1ef995-1664-029d-8f53-bdacd74f7e48@gmail.com> On 11/29/2018 09:50 PM, Brandon Allbery wrote: > You were talking about restart, between the running xmonad and its > replacement via executeFile. There, you can use the environment. There > is no way to pass information between an invoked "xmonad --restart" and > the running xmonad. You mean, `executeFile` preserves environment? So, i may change it from running xmonad (by e.g. keybinding) and then restart it? > On Thu, Nov 29, 2018 at 6:01 AM Dmitriy Matrosov > wrote: > > > > On November 28, 2018 9:25:00 PM GMT+03:00, Brandon Allbery > > wrote: > >Not by default; there's already a bug ( > >https://github.com/xmonad/xmonad/issues/78) about our not obeying the > >ICCCM > >replace protocol unless started by replacing some other WM. > > > >There's a few other places you can hide extra parameters; starting > that > >early, the environment is probably the easiest to use, provided > they're > >not > >too large (see why there's a state file now). > > Hm, i don't understand how to use environment. I need to pass > something to running xmonad process (to which i send > XMONAD_RESTART). As far as i know, i can't change environment of > another process.. > > > >On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov > > > >wrote: > > > >> Hi. > >> > >> On 11/21/2018 09:49 PM, Eyal Erez wrote: > >> > Hi, > >> > > >> > I'm getting some collisions between my xmonad keybindings and an > >> > application I'm running (it's a game that is suppose to run full > >screen > >> > but in reality just uses a large window).  I was wondering if I > >could > >> > suspend or change some keybindings from a script that I can run > >before > >> > the app launches and then restore later. > >> > > >> > Is this at all possible?  Happy to entertain other options. > >> > >> Here is proof of concept: > >> > >> > >>          import XMonad > >>          import XMonad.Hooks.EwmhDesktops > >> > >>          import System.Directory > >>          import System.FilePath > >> > >> > >>          main :: IO () > >>          main = do > >>                  let xcf = ewmh $ def > >>                              { modMask = mod4Mask > >>                              , handleExtraArgs = disableKeys > >>                              } > >>                  xmonad xcf > >> > >>          disableKeys :: [String] -> XConfig Layout -> IO (XConfig > >Layout) > >>          disableKeys _ xcf = do > >>              xd <- getXMonadDir > >>              let disableFn = xd "disable_keys" > >>              b <- doesFileExist disableFn > >>              if b > >>                then do > >>                  trace "Disabling all keys." > >>                  removeFile disableFn > >>                  return (xcf {keys = \_ -> mempty}) > >>                else return xcf > >> > >> > >> To disable all keys create file `~/.xmonad/disable_keys` and then > >> restart xmonad with `xmonad --restart`. All keys will be disabled > >> _and_ file deleted (to avoid locking yourself), thus next restart > >will > >> restore all keys back. > >> > >> As far as i understand, xmonad grabs keys in `X.Main.launch` before > >> entering main loop. Thus, the one way to change key grab is to > >restart > >> xmonad. I need to modify `XConfig` before calling > X.Main.launch`, and > >> this may be done by `handleExtraArgs` (called in `launch'` in > >> `X.Main.xmonad`). Unfortunately, it seems, that xmonad does not > allow > >> to pass extra cmd arguments during restart (`X.Operations.restart` > >> always starts xmonad with name `xmonad` and no arguments). Also, i > >> can't use extensible state in `handleExtraArgs`, because it runs in > >> `IO` (`X` context is not yet built at that time).  Thus, to pass > >> something to it, i may use either file or (probably) > `--replace`. The > >> above version uses file. And i have no luck with `--replace`: it > >> seems, `xmonad` can't replace itself?.. > >> _______________________________________________ > >> xmonad mailing list > >> xmonad at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > >> > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > > -- > brandon s allbery kf8nh > allbery.b at gmail.com From allbery.b at gmail.com Thu Nov 29 21:11:20 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 29 Nov 2018 16:11:20 -0500 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: <0d1ef995-1664-029d-8f53-bdacd74f7e48@gmail.com> References: <5ED9B6B4-6E9C-4045-BE93-CB98D9EE4E0C@gmail.com> <0d1ef995-1664-029d-8f53-bdacd74f7e48@gmail.com> Message-ID: Yes. More specifically, it's ultimately using the execve() syscall, via one of the wrappers which propagates the environment (which one depends on whether it's asked to do $PATH search or not). On Thu, Nov 29, 2018 at 4:07 PM Dmitriy Matrosov wrote: > On 11/29/2018 09:50 PM, Brandon Allbery wrote: > > You were talking about restart, between the running xmonad and its > > replacement via executeFile. There, you can use the environment. There > > is no way to pass information between an invoked "xmonad --restart" and > > the running xmonad. > > You mean, `executeFile` preserves environment? So, i may change it from > running xmonad (by e.g. keybinding) and then restart it? > > > On Thu, Nov 29, 2018 at 6:01 AM Dmitriy Matrosov > > wrote: > > > > > > > > On November 28, 2018 9:25:00 PM GMT+03:00, Brandon Allbery > > > wrote: > > >Not by default; there's already a bug ( > > >https://github.com/xmonad/xmonad/issues/78) about our not obeying > the > > >ICCCM > > >replace protocol unless started by replacing some other WM. > > > > > >There's a few other places you can hide extra parameters; starting > > that > > >early, the environment is probably the easiest to use, provided > > they're > > >not > > >too large (see why there's a state file now). > > > > Hm, i don't understand how to use environment. I need to pass > > something to running xmonad process (to which i send > > XMONAD_RESTART). As far as i know, i can't change environment of > > another process.. > > > > > > >On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov > > > > > >wrote: > > > > > >> Hi. > > >> > > >> On 11/21/2018 09:49 PM, Eyal Erez wrote: > > >> > Hi, > > >> > > > >> > I'm getting some collisions between my xmonad keybindings and > an > > >> > application I'm running (it's a game that is suppose to run > full > > >screen > > >> > but in reality just uses a large window). I was wondering if I > > >could > > >> > suspend or change some keybindings from a script that I can run > > >before > > >> > the app launches and then restore later. > > >> > > > >> > Is this at all possible? Happy to entertain other options. > > >> > > >> Here is proof of concept: > > >> > > >> > > >> import XMonad > > >> import XMonad.Hooks.EwmhDesktops > > >> > > >> import System.Directory > > >> import System.FilePath > > >> > > >> > > >> main :: IO () > > >> main = do > > >> let xcf = ewmh $ def > > >> { modMask = mod4Mask > > >> , handleExtraArgs = disableKeys > > >> } > > >> xmonad xcf > > >> > > >> disableKeys :: [String] -> XConfig Layout -> IO (XConfig > > >Layout) > > >> disableKeys _ xcf = do > > >> xd <- getXMonadDir > > >> let disableFn = xd "disable_keys" > > >> b <- doesFileExist disableFn > > >> if b > > >> then do > > >> trace "Disabling all keys." > > >> removeFile disableFn > > >> return (xcf {keys = \_ -> mempty}) > > >> else return xcf > > >> > > >> > > >> To disable all keys create file `~/.xmonad/disable_keys` and then > > >> restart xmonad with `xmonad --restart`. All keys will be disabled > > >> _and_ file deleted (to avoid locking yourself), thus next restart > > >will > > >> restore all keys back. > > >> > > >> As far as i understand, xmonad grabs keys in `X.Main.launch` > before > > >> entering main loop. Thus, the one way to change key grab is to > > >restart > > >> xmonad. I need to modify `XConfig` before calling > > X.Main.launch`, and > > >> this may be done by `handleExtraArgs` (called in `launch'` in > > >> `X.Main.xmonad`). Unfortunately, it seems, that xmonad does not > > allow > > >> to pass extra cmd arguments during restart > (`X.Operations.restart` > > >> always starts xmonad with name `xmonad` and no arguments). Also, > i > > >> can't use extensible state in `handleExtraArgs`, because it runs > in > > >> `IO` (`X` context is not yet built at that time). Thus, to pass > > >> something to it, i may use either file or (probably) > > `--replace`. The > > >> above version uses file. And i have no luck with `--replace`: it > > >> seems, `xmonad` can't replace itself?.. > > >> _______________________________________________ > > >> xmonad mailing list > > >> xmonad at haskell.org > > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > >> > > _______________________________________________ > > xmonad mailing list > > xmonad at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > > > > > > -- > > brandon s allbery kf8nh > > allbery.b at gmail.com > > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > -- brandon s allbery kf8nh allbery.b at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgf.dma at gmail.com Fri Nov 30 20:08:28 2018 From: sgf.dma at gmail.com (Dmitriy Matrosov) Date: Fri, 30 Nov 2018 23:08:28 +0300 Subject: [xmonad] Fwd: Re: Suspend Keybinding Temporarily In-Reply-To: <59885eaa-ebc7-c0c7-0d4c-96accd12aa38@gmail.com> References: <59885eaa-ebc7-c0c7-0d4c-96accd12aa38@gmail.com> Message-ID: Sorry, i've sent mail privately instead of sending it to the list. -------- Forwarded Message -------- Subject: Re: [xmonad] Suspend Keybinding Temporarily Date: Fri, 30 Nov 2018 23:07:01 +0300 From: Dmitriy Matrosov To: Brandon Allbery On 11/30/2018 12:11 AM, Brandon Allbery wrote: > Yes. More specifically, it's ultimately using the execve() syscall, via > one of the wrappers which propagates the environment (which one depends > on whether it's asked to do $PATH search or not). So.. here is version using environment: import XMonad import XMonad.Operations import XMonad.Util.EZConfig import System.Environment import Control.Exception main :: IO () main = do let xcf = def { modMask = mod4Mask , handleExtraArgs = disableKeysE } `additionalKeys` [ ((mod4Mask, xK_d), disableKeysOn) ] xmonad xcf disableKeysOn :: X () disableKeysOn = do trace "Preparing to disable keys and restarting.." io $ setEnv "XMONAD_DISABLE_KEYS" "1" restart "xmonad" True disableKeysE :: [String] -> XConfig Layout -> IO (XConfig Layout) disableKeysE _ xcf = do me <- lookupEnv "XMONAD_DISABLE_KEYS" case me of Just _ -> do trace "Disabling all keys." unsetEnv "XMONAD_DISABLE_KEYS" return (xcf {keys = \_ -> mempty}) Nothing -> return xcf It also restarts xmonad on key press (when disabling keys) and all works fine, but.. xmonad frequently crashes with xmonad: failed to create OS thread: Resource temporarily unavailable I don't think this crash relates somehow to using environment, and it happened from time to time before too, but still.. Can you advise, how to fix it? > On Thu, Nov 29, 2018 at 4:07 PM Dmitriy Matrosov > wrote: > > On 11/29/2018 09:50 PM, Brandon Allbery wrote: > > You were talking about restart, between the running xmonad and its > > replacement via executeFile. There, you can use the environment. > There > > is no way to pass information between an invoked "xmonad > --restart" and > > the running xmonad. > > You mean, `executeFile` preserves environment? So, i may change it from > running xmonad (by e.g. keybinding) and then restart it? > > > On Thu, Nov 29, 2018 at 6:01 AM Dmitriy Matrosov > > > >> wrote: > > > > > > > > On November 28, 2018 9:25:00 PM GMT+03:00, Brandon Allbery > > > >> wrote: > > >Not by default; there's already a bug ( > > >https://github.com/xmonad/xmonad/issues/78) about our not > obeying the > > >ICCCM > > >replace protocol unless started by replacing some other WM. > > > > > >There's a few other places you can hide extra parameters; > starting > > that > > >early, the environment is probably the easiest to use, provided > > they're > > >not > > >too large (see why there's a state file now). > > > > Hm, i don't understand how to use environment. I need to pass > > something to running xmonad process (to which i send > > XMONAD_RESTART). As far as i know, i can't change environment of > > another process.. > > > > > > >On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov > > > >> > > >wrote: > > > > > >> Hi. > > >> > > >> On 11/21/2018 09:49 PM, Eyal Erez wrote: > > >> > Hi, > > >> > > > >> > I'm getting some collisions between my xmonad > keybindings and an > > >> > application I'm running (it's a game that is suppose to > run full > > >screen > > >> > but in reality just uses a large window). I was > wondering if I > > >could > > >> > suspend or change some keybindings from a script that I > can run > > >before > > >> > the app launches and then restore later. > > >> > > > >> > Is this at all possible? Happy to entertain other options. > > >> > > >> Here is proof of concept: > > >> > > >> > > >> import XMonad > > >> import XMonad.Hooks.EwmhDesktops > > >> > > >> import System.Directory > > >> import System.FilePath > > >> > > >> > > >> main :: IO () > > >> main = do > > >> let xcf = ewmh $ def > > >> { modMask = mod4Mask > > >> , handleExtraArgs = disableKeys > > >> } > > >> xmonad xcf > > >> > > >> disableKeys :: [String] -> XConfig Layout -> IO > (XConfig > > >Layout) > > >> disableKeys _ xcf = do > > >> xd <- getXMonadDir > > >> let disableFn = xd "disable_keys" > > >> b <- doesFileExist disableFn > > >> if b > > >> then do > > >> trace "Disabling all keys." > > >> removeFile disableFn > > >> return (xcf {keys = \_ -> mempty}) > > >> else return xcf > > >> > > >> > > >> To disable all keys create file `~/.xmonad/disable_keys` > and then > > >> restart xmonad with `xmonad --restart`. All keys will be > disabled > > >> _and_ file deleted (to avoid locking yourself), thus next > restart > > >will > > >> restore all keys back. > > >> > > >> As far as i understand, xmonad grabs keys in > `X.Main.launch` before > > >> entering main loop. Thus, the one way to change key grab > is to > > >restart > > >> xmonad. I need to modify `XConfig` before calling > > X.Main.launch`, and > > >> this may be done by `handleExtraArgs` (called in `launch'` in > > >> `X.Main.xmonad`). Unfortunately, it seems, that xmonad > does not > > allow > > >> to pass extra cmd arguments during restart > (`X.Operations.restart` > > >> always starts xmonad with name `xmonad` and no > arguments). Also, i > > >> can't use extensible state in `handleExtraArgs`, because > it runs in > > >> `IO` (`X` context is not yet built at that time). Thus, > to pass > > >> something to it, i may use either file or (probably) > > `--replace`. The > > >> above version uses file. And i have no luck with > `--replace`: it > > >> seems, `xmonad` can't replace itself?.. > > >> _______________________________________________ > > >> xmonad mailing list > > >> xmonad at haskell.org > > > > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > >> > > _______________________________________________ > > xmonad mailing list > > xmonad at haskell.org > > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > > > > > > -- > > brandon s allbery kf8nh > > allbery.b at gmail.com > > > > _______________________________________________ > xmonad mailing list > xmonad at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > > -- > brandon s allbery kf8nh > allbery.b at gmail.com From allbery.b at gmail.com Fri Nov 30 20:18:51 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 30 Nov 2018 15:18:51 -0500 Subject: [xmonad] Suspend Keybinding Temporarily In-Reply-To: <59885eaa-ebc7-c0c7-0d4c-96accd12aa38@gmail.com> References: <5ED9B6B4-6E9C-4045-BE93-CB98D9EE4E0C@gmail.com> <0d1ef995-1664-029d-8f53-bdacd74f7e48@gmail.com> <59885eaa-ebc7-c0c7-0d4c-96accd12aa38@gmail.com> Message-ID: Er. What version of ghc? That sounds like either a ghc runtime bug, or a system configuration issue. In particular, xmonad creates no threads itself, so that would be the ghc runtime's IO manager thread. On Fri, Nov 30, 2018 at 3:07 PM Dmitriy Matrosov wrote: > On 11/30/2018 12:11 AM, Brandon Allbery wrote: > > Yes. More specifically, it's ultimately using the execve() syscall, via > > one of the wrappers which propagates the environment (which one depends > > on whether it's asked to do $PATH search or not). > > So.. here is version using environment: > > import XMonad > import XMonad.Operations > import XMonad.Util.EZConfig > > import System.Environment > import Control.Exception > > main :: IO () > main = do > let xcf = def > { modMask = mod4Mask > , handleExtraArgs = disableKeysE > } > `additionalKeys` > [ ((mod4Mask, xK_d), disableKeysOn) ] > xmonad xcf > > disableKeysOn :: X () > disableKeysOn = do > trace "Preparing to disable keys and restarting.." > io $ setEnv "XMONAD_DISABLE_KEYS" "1" > restart "xmonad" True > > disableKeysE :: [String] -> XConfig Layout -> IO (XConfig Layout) > disableKeysE _ xcf = do > me <- lookupEnv "XMONAD_DISABLE_KEYS" > case me of > Just _ -> do > trace "Disabling all keys." > unsetEnv "XMONAD_DISABLE_KEYS" > return (xcf {keys = \_ -> mempty}) > Nothing -> return xcf > > It also restarts xmonad on key press (when disabling keys) and all > works fine, but.. xmonad frequently crashes with > > xmonad: failed to create OS thread: Resource temporarily > unavailable > > I don't think this crash relates somehow to using environment, and it > happened from time to time before too, but still.. Can you advise, > how to fix it? > > > On Thu, Nov 29, 2018 at 4:07 PM Dmitriy Matrosov > > wrote: > > > > On 11/29/2018 09:50 PM, Brandon Allbery wrote: > > > You were talking about restart, between the running xmonad and > its > > > replacement via executeFile. There, you can use the environment. > > There > > > is no way to pass information between an invoked "xmonad > > --restart" and > > > the running xmonad. > > > > You mean, `executeFile` preserves environment? So, i may change > it from > > running xmonad (by e.g. keybinding) and then restart it? > > > > > On Thu, Nov 29, 2018 at 6:01 AM Dmitriy Matrosov > > > > > >> wrote: > > > > > > > > > > > > On November 28, 2018 9:25:00 PM GMT+03:00, Brandon Allbery > > > > > >> wrote: > > > >Not by default; there's already a bug ( > > > >https://github.com/xmonad/xmonad/issues/78) about our not > > obeying the > > > >ICCCM > > > >replace protocol unless started by replacing some other WM. > > > > > > > >There's a few other places you can hide extra parameters; > > starting > > > that > > > >early, the environment is probably the easiest to use, > provided > > > they're > > > >not > > > >too large (see why there's a state file now). > > > > > > Hm, i don't understand how to use environment. I need to pass > > > something to running xmonad process (to which i send > > > XMONAD_RESTART). As far as i know, i can't change > environment of > > > another process.. > > > > > > > > > >On Wed, Nov 28, 2018 at 1:20 PM Dmitriy Matrosov > > > > > >> > > > >wrote: > > > > > > > >> Hi. > > > >> > > > >> On 11/21/2018 09:49 PM, Eyal Erez wrote: > > > >> > Hi, > > > >> > > > > >> > I'm getting some collisions between my xmonad > > keybindings and an > > > >> > application I'm running (it's a game that is suppose to > > run full > > > >screen > > > >> > but in reality just uses a large window). I was > > wondering if I > > > >could > > > >> > suspend or change some keybindings from a script that I > > can run > > > >before > > > >> > the app launches and then restore later. > > > >> > > > > >> > Is this at all possible? Happy to entertain other > options. > > > >> > > > >> Here is proof of concept: > > > >> > > > >> > > > >> import XMonad > > > >> import XMonad.Hooks.EwmhDesktops > > > >> > > > >> import System.Directory > > > >> import System.FilePath > > > >> > > > >> > > > >> main :: IO () > > > >> main = do > > > >> let xcf = ewmh $ def > > > >> { modMask = mod4Mask > > > >> , handleExtraArgs = > disableKeys > > > >> } > > > >> xmonad xcf > > > >> > > > >> disableKeys :: [String] -> XConfig Layout -> IO > > (XConfig > > > >Layout) > > > >> disableKeys _ xcf = do > > > >> xd <- getXMonadDir > > > >> let disableFn = xd "disable_keys" > > > >> b <- doesFileExist disableFn > > > >> if b > > > >> then do > > > >> trace "Disabling all keys." > > > >> removeFile disableFn > > > >> return (xcf {keys = \_ -> mempty}) > > > >> else return xcf > > > >> > > > >> > > > >> To disable all keys create file `~/.xmonad/disable_keys` > > and then > > > >> restart xmonad with `xmonad --restart`. All keys will be > > disabled > > > >> _and_ file deleted (to avoid locking yourself), thus next > > restart > > > >will > > > >> restore all keys back. > > > >> > > > >> As far as i understand, xmonad grabs keys in > > `X.Main.launch` before > > > >> entering main loop. Thus, the one way to change key grab > > is to > > > >restart > > > >> xmonad. I need to modify `XConfig` before calling > > > X.Main.launch`, and > > > >> this may be done by `handleExtraArgs` (called in > `launch'` in > > > >> `X.Main.xmonad`). Unfortunately, it seems, that xmonad > > does not > > > allow > > > >> to pass extra cmd arguments during restart > > (`X.Operations.restart` > > > >> always starts xmonad with name `xmonad` and no > > arguments). Also, i > > > >> can't use extensible state in `handleExtraArgs`, because > > it runs in > > > >> `IO` (`X` context is not yet built at that time). Thus, > > to pass > > > >> something to it, i may use either file or (probably) > > > `--replace`. The > > > >> above version uses file. And i have no luck with > > `--replace`: it > > > >> seems, `xmonad` can't replace itself?.. > > > >> _______________________________________________ > > > >> xmonad mailing list > > > >> xmonad at haskell.org > > > > > > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > >> > > > _______________________________________________ > > > xmonad mailing list > > > xmonad at haskell.org > > > > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > > > > > > > > > > -- > > > brandon s allbery kf8nh > > > allbery.b at gmail.com > > > > > > > _______________________________________________ > > xmonad mailing list > > xmonad at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad > > > > > > > > -- > > brandon s allbery kf8nh > > allbery.b at gmail.com > > -- brandon s allbery kf8nh allbery.b at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: