So my MWE xmonad.hs is as follows:
import XMonad
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Util.EZConfig
myKeys =
[ ("M-s", shellPrompt def)
, ("M-<Return>", spawn "/usr/bin/alacritty")
, ("M-q", kill)
, ("M1-r", spawn "xmonad --recompile && xmonad --restart")
]
main = do
xmonad $ def
{ modMask = mod4Mask
} `additionalKeysP` myKeys
The key bindings work except for
("M-s", shellPrompt def)
With another config i tried it works as expected but I can not figure out, what's wrong with my MWE above (obviously it compiles just fine). Also I already have a config I am rather content with so I would prefer implementing prompts in my own config instead of trimming down the linked one.
System: Arch Linux
~ $ pacman -Qi xmonad | grep Version
Version : 0.15-72
Any suggestions are much appreciated. Please let me know if you require additional info. Thank you!
EDIT 1:
I added two more key bindings to the mwe:
, ("M-S-e" , spawn $ "xdotool text 'test'")
, ("M-S-w" , spawn $ "xdotool key Cotrol_L+F4")
neither of them works, just like the prompt (xdotool is installed). So there might be a connection?
I have also tried to use the standard syntax for key bindings without using XMonad.Util.EZConfig to no avail.
I had the same issue and this ArchWiki link sent me on the right path solve my problem.
The problem seems to be caused by missing fonts on the system that the xmonad prompt expects.
Excerpt:
Broken/missing XMonad.Prompt and window decorations
XMonad by default uses the font -misc-fixed-----10-------*
[5]. If this font is missing those windows simply fail to render at
all. Easiest fix is to install xorg-fonts-misc.
I am actually running Gentoo 5.4.80 and my solution was to install the x11-base/xorg-x11 package.
Related
I managed to install and run OCaml + OPAM + utop on Windows (in Cygwin) thanks to the awesome guide by Jonathan Protzenko. In utop, I especially want to be able to use ctypes + ctypes.foreign to quickly experiment and prototype accessing various WinAPI calls. Theoretically, I managed to install the ctypes packages successfully (opam install ... succeeds). Unfortunately, when I try to actually load them in utop, they fail miserably with a surprising error message:
utop # #require "ctypes.foreign";;
Error: Reference to undefined global `Ctypes_closure_properties'
Trying to do the same in rlwrap ocaml gives a somewhat longer error message:
# #require "ctypes.foreign";;
C:\OCaml\lib\unix.cma: loaded
C:\OCaml\lib\bigarray.cma: loaded
C:\OCaml\lib\str.cma: loaded
C:\cygwin64\home\Mateusz\.opam\system\lib\bytes: added to search path
C:\cygwin64\home\Mateusz\.opam\system\lib\ctypes: added to search path
C:\cygwin64\home\Mateusz\.opam\system\lib\ctypes\ctypes.cma: loaded
C:\cygwin64\home\Mateusz\.opam\system\lib\ctypes\ctypes-foreign-base.cma: loaded
Cannot load required shared library dllctypes-foreign-base_stubs.
Reason: dllctypes-foreign-base_stubs.dll: Cannot resolve ffi_type_pointer.
C:\cygwin64\home\Mateusz\.opam\system\lib\ctypes\ctypes-foreign-unthreaded.cma: loaded
Characters -1--1:
#require "ctypes.foreign";;
Error: Reference to undefined global `Ctypes_closure_properties'
Note: full transcript of the sessions is here — it contains output of a utop session in the cmd.exe terminal, and also of an additional rlwrap ocaml session in the Cygwin terminal.
I have absolutely no idea why that happens, or how I could further try to debug/pinpoint/diagnose the situation, so that I could try to find some workaround. (And by the way — I'm a total newbie to OCaml & OPAM, although I'm reasonably experienced in C/C++ and Linux generally.) What follows are some questions I have, that I imagine might hopefully help nudge the problem enough to push me through the roadblock:
Is there a way to tweak a git repo (i.e. ctypes) locally and pass it to OPAM instead of the original github one?
I've managed to google up some comment, which seems to mention that "a static version of libffi" might work, as hinted also in ctypes issue #198; but I'm a total newbie to OCaml, and unfortunately I have no faintest idea how I could apply this suggestion to utop?
How can I tell OPAM which libffi to use for ctypes? (specifically, to use "static libffi"?)
How can I check if the mingw64-x86_64-libffi Cygwin package I do have installed is statically linked, or dynamically? or if both variants are provided, then which one is used by ctypes? I found some answers on SO regarding how to detect if a libffi.a is linked with PIC (?) relocations [-fpic?], but they all seemed really hackish and none of the ones I tried seemed really to work, at least in my case.
Any at all help would be highly appreciated. I don't even know who to ask about this, given it's at a crossing of OCaml, OPAM, utop and Cygwin, all of those being huge and somewhat unrelated/orthogonal systems. I've tried posting the issue on ctypes repo, but all it got over a month's time was a "patches-welcome" label.
mingw64-x86_64-libffi ships with static and dynamic libraries, but the gnu linker will use the dynamic versions by default.
Patching the build of ctypes would be very fiddling (the build system of ctypes is rather complex, a mix of scripts and makefiles). So just try the following: delete the dynamic libraries (/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libffi.dll.a and /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libffi-6.dll), rebuild ctypes and then restore the deleted files.
opam-repository-mingw
By the way: https://fdopen.github.io/opam-repository-mingw/installation/ contains a patched version of flexdll (https://github.com/alainfrisch/flexdll/pull/3 applied - the problem is not specific to libffi) that supports the dynamic and static versions of libffi. opam install ctypes-foreign ctypes utop should work out of the box, if /usr/x86_64-w64-mingw32/sys-root/mingw/bin is in your PATH. Full step-by-step guide below:
Download a 64-bit graphical installer and run it.
After installation completes, start the "Cygwin64 Terminal" (gets installed into Cygwin group in the Start Menu).
Type cygwin-install gui to start the Cygwin Setup/Installer and use it to install some text editor (joe or nano or vim or whatever you prefer).
Use the text editor you installed to edit your ~/.bashrc file, add the following line:
export PATH="/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH"
then execute it in your Cygwin Terminal (just type it in the terminal, or run the following command instead):
$ source ~/.bashrc
Install depext which will auto-download any required OS level (native) dependencies for OPAM packages, the use it to install ctypes and utop:
$ opam install depext depext-cygwinports
$ opam depext -i ctypes-foreign ctypes utop
Switch from Cygwin Terminal to cmd.exe, for example by typing the following command in Cygwin Terminal:
$ cmd /c start cmd
Start utop in cmd.exe terminal, and use it to call the MessageBox WinAPI function as a test that all's working well:
c:> utop
utop # #require "ctypes.foreign";;
utop # let dll = Dl.dlopen ~filename:"user32.dll" ~flags:[];;
val dll : Dl.library = <abstr>
utop # open Ctypes;;
utop # let mb =
Foreign.foreign ~from:dll "MessageBoxA"
(ptr void #-> string #-> string #-> uint #-> returning int) ;;
val mb : unit Ctypes_static.ptr -> bytes -> bytes -> Unsigned.uint -> int =
<fun>
utop # mb null "hello" "world" Unsigned.UInt.zero;;
- : int = 1
utop # #quit;;
c:>
[NOTE: not all of the above utop commands may be required, but that's what worked for me.]
I modified a default config of xmonad filled with commented explanations. All I did was change defaultModMask = mod1Mask. to mod4Mask The config later uses the var to set the actual modmask I'm not sure what the issue is. I've played around with setting the value directly and changing to mod3mask, etc. No matter what my mod key is left-alt. I use xmonad --restart between each poke at trying to fix this.
here is the config, search defaultmodmask will jump to areas of interest.
http://paste.ubuntu.com/8766834/
You have to recompile xmonad too after changing your configuration, not just restart it. In exactly execute
xmonad --recompile
xmonad --restart
which should also be bound to ModMask-q per default.
EDIT: It turns out my problem was just a temporary bug in Xmobar. See the accepted answer.
There are lots of solutions to this on Google, and almost none of them are working for me. I'm setting up an Arch system, so my first inclination is to use the config on the Arch wiki. Here's mine:
import XMonad
import XMonad.Hooks.DynamicLog
main = xmonad =<< xmobar defaultConfig { terminal = "gnome-terminal" }
Without an xmobarrc (or with any I've tried to copy), xmobar is visible in the empty workspace, but opening any application covers it up completely. Trying to toggle the bar space with Alt-b doesn't bring it back. I've also tried copying John Goerzen's config files verbatim, and that doesn't work either.
The one hack that has worked (from John Goerzen) is to start trayer in my xinitrc. When trayer is running, somehow it successfully reserves space at the top of the screen, which xmobar can also use. But I'd like to get xmobar working by itself. Thanks for any suggestions.
Solved by OODavo on the #xmonad IRC channel. Turns out the latest xmobar package on Arch (0.16-3) simply has a bug in it that breaks the avoidStruts layout. The workaround is either to downgrade to the previous version, or to build the latest version from git.
Previous version of the package: http://arm.konnichi.com/2012/12/02/community/os/x86_64/xmobar-0.16-1-x86_64.pkg.tar.xz
Instructions for downgrading packages in Arch: https://wiki.archlinux.org/index.php/Downgrading_Packages#How_to_downgrade_a_package
I am using xmonad with xmobar on ubuntu and it works as expected.
I have the following configuration in xmonad.hs
manageHook = manageDocks <+> manageHook defaultConfig
layoutHook = avoidStruts $ layoutHook defaultConfig
my xmobarrc has custom configuration, but nothing specific to alignment.
My xmonad version is 0.11 and xmobar version is 0.18
I dont start xmobar automatically on system startup, I prefer to start it up manually and after it starts, all other windows politely make space for xmobar status bar.
I'm completely new to xmonad but I'd like to start using it to boost my productivity.
This is the guide I've been using (I'm using Apple OS X Snow Leopard)
http://xmonad.org/tour.html#start
So far I've managed to install Haskell-Platform, Cabal, dMenu, and xmonad (using cabal install).
When I attempt to run xmonad from the terminal I run into this error:
SDGL0990Z464C:~ cflynn$ echo $PATH
/Users/cflynn/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
SDGL0990Z464C:~ cflynn$ xmonad
/Users/cflynn/.xmonad/xmonad-i386-darwin: executeFile: does not exist (No such file or directory)
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 2 (X_ChangeWindowAttributes)
Serial number of failed request: 7
Current serial number in output stream: 8
Can anyone explain what this means? Thanks!
Does the file /Users/cflynn/.xmonad/xmonad-i386-darwin exist? It sounds like it does not. You will need to compile your xmonad config and put the resulting executable at that location.
Skip to the bottom of this page - http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_on_Apple_OSX
Add the contents to .xinitrc rather than starting it at the terminal.
http://www.google.com/search?q=X11+macintosh - you need X11 to be installed and running, in order to use a windowmanager that relies on it .) -> is that the case, or am I mistaken for the problems cause?
I'm attempting to install xmonad on my machine and I'm at this point in the instructions
(http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_on_Apple_OSX#Installing_xmonad)
2.2 Configuring Your .profile
Insert the following into your ~/.profile
export PATH=$PATH:~/.cabal/bin:/usr/local/bin
export USERWM=`which xmonad`
Much of this isn't needed until later, but it's good to get it out the way now.
2.2.1 Installing Cabal
I understand what's going on with export PATH=$PATH:~/.cabal/bin:/usr/local/bin but could someone please explain 1. what the USERWM global variable is and what exactly is meant to be assigned to it? (I'm assuming 'which xmonad' isn't meant literally). Is it a version number of xmonad? Something else?
It is later executed in ~/.xinitrc:
source ~/.profile
exec $USERWM
Cheers
Also, the line
export USERWM=`which xmonad`
is correct as is. The shell will treat things in backticks (next to the '1' on top of most keyboards) as a command to be executed. The which command will give the path to xmonad by searching through the PATH variable.
Note that this means
export USERWM='which xmonad'
will not work, since the shell wouldn't run the command with the regular tick marks.