Giter Club home page Giter Club logo

worm's Introduction

Worm

Worm is a tiny, dynamic, tag-based window manager written in the Nim language. It supports both a floating mode and master-stack tiling with gaps and struts. Check out the screenshots on the wiki for some examples of how it looks.

Build / install

Install Nim >= 1.6.0, for example through Choosenim. Clone this repo and run

$ nimble build -d:release

And you should end up with two binaries; strip and use!

Alternatively, for users using Arch, you can use the AUR package worm-git.

$ yay -S worm-git

Configuration

Autostart

Worm will try to execute the file ~/.config/worm/rc on startup. Simply create it as a shell-script to execute your favorite applications with worm. (don't forget to make it executable).

An example can be found here.

Keybindings

Worm does not have a built-in keyboard mapper, so you should use something like sxhkd. Please read the docs to understand how wormc works before writing your own sxhkdrc.

An example sxhkdrc can be found here.

License

Licensed under the MIT license. See the LICENSE file for more info.

Credits

Thanks to phisch for making the logo!

Thanks to everyone else that's opened an issue, a PR, or just tried out worm.

worm's People

Contributors

andbenn avatar archargelod avatar codic12 avatar codic13 avatar edenqwq avatar flyingcakes85 avatar freakingeek avatar heavyrain266 avatar hochata avatar lambdadog avatar mixcoac avatar moson-mo avatar solitudesf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

worm's Issues

Respect dock windows better

We can treat them as special status clients and keep them raised.

Or the least we can do is at least respect their boundaries for maximization etc

Some frames made transparent by default when using picom/compton

Alacritty and Firefox are two examples of windows that gain "frame transparency" when picom is running with default configuration. xterm and emacs are two examples of windows that do not.

(with default frame colors)
framenobg
framenobg2

Transparency seems to be partially based on darkness of frame, perhaps?

I'm going to continue debugging this, but my first guess is that there's perhaps some property the frame should be setting that marks them "off limits", even if the window requests transparency (or whatever it is that firefox is doing that xterm isn't)? Or maybe something should be done when setting the background color, as the buttons (the entirety of the pixie Image it's drawn into, that is, including the portions where the window background color is drawn in) are unaffected.

The minimize-active-hovered-path makes the wm crash

If I run wormc minimize-active-hovered-path ~/.config/worm/icons/minimize-hover.png which is a 20x20 png file, it just crashes the window manager. However the ,minimize hovered inactive one, and everything of close and maximize is working, only this one is making the wm crash.

unfloat

When I tried to take a float object (window) I can't make it static again

I'm sure its a user error.

here is my sxhkdrc file.

Restart worm

super + ctrl + r
worm

Open terminal kitty

super + Return
kitty

#ctrl + space

ulauncher &

super + d
ulauncher &

super + b
brave &

Quit worm

ctrl + alt + q
pkill worm

Close app

super + q
wormc close-active-client

Maximize app

super + f
wormc maximize-active-client

Minimize app

super + h
wormc minimize-active-client

Tags

super + {_, shift + } {1-9}
wormc {switch,move-active}-tag {1-9}

Set master windows

super + m
wormc master-active

Float a window

super + shift + space
wormc float-active

[Request] Window spawn origin

This probably kinda dumb request, but i think having ability to customize where window get spawned is really cool,
this will allow window to get spawned in center, top right, bottom right, bottom left.
command can be wormc window_origin {center, top_left, top_right, bottom_left, bottom_right} or something similar.

GTK XDnD (drag&drop) broken

I first noticed this issue in Firefox when I was unable to drag tabs without them popping out into a window of their own, but I've since reproduced in the Nemo file manager as well (dragging and dropping files fails to produce any results). Drag and drop does work in Dolphin, which is written using Qt rather than GTK, and drag and drop functions as normal in both Firefox and Nemo in kwin so it seems some particularity of GTK's XDnD implementation isn't being accounted for by worm.

All I've been able to find about peculiarities in GTK's drag and drop so far is this comment in i3's source code but I'm not certain it's relevant.

Setting button-size larger than value at first render causes clipped image

It took me a bit to hunt down exactly the circumstances of this bug, but what buttonSize is set to at first render seems to be a "max" for button-size changes without clipping after that.

Due to this, it's possible to increase button-size from 14 by setting it in your rcfile (which is executed before first render), but any increases at runtime cause the image to be clipped on the right side.

ex:

(with button-size set to 20 in rcfile)
wormc20

(after wormc button-size 22 is run)
wormc22

Unused import 'log'

Tiny cosmetic thing: there's a warning about importing but not using log in file configurenotify.nim.

Is quick-tap to initiate window grab intended?

One thing that's been bugging me since I've started using Worm as my primary WM is occasionally when I click something on a window, it starts to drag the window around.

I eventually narrowed it down to specifically when I do a rapid single-click without moving my pointer, and after a bit of digging found the code that causes it:

discard self.dpy.XGrabPointer(client.frame.window, true, PointerMotionMask or
ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime)

Is this intended? If so, would it be possible to gate it behind a setting somewhere?

I've played with deleting the lines of code and it just makes using the WM feel way less "glitchy", as with it included it's far too easy for me to accidentally trigger a drag.

Change size of master/stack

Right now in tiling mode it's 50/50 (with gaps the master window is $GAPS bigger, which you shouldn't notice unless you have huge gaps).

A common alternative seems to be, eg 60/40. i think that this should be configurable at runtime with commands to increment and decrement the %.

Error loading shared library libXft

I’m currently setting up worm on my laptop running void, and when trying to run the worm binary, im getting the error

“could not load: libXft.so
(compile with -d:nimDebugDlOpen for more information)”

After being compiled with the option mentioned above, it cant load shared library libX11 and libXft, “No such file or directory”

I’m sure both libraries are installed, so I got no idea what it could be

Window Title Max Length

As the title said, having max length for window title on the titlebar would be really useful.
Instead of showing something like this:
image

would be better if its showing like: Some Long Titlebar text here aaaa... <close button>

[Bug] `focus-mode` does not work.

Documented Behaviour:
focus-mode(int)` : Sets the focus mode. 1: is focus-follows-click (like Microsoft Windows). 2: is the traditional X11 focus-follows-mouse.

Observed Behaviour:
wormc focus-mode 2 does not result in activation/focus of inactive client on mouse hover. The same situation is observed in both tile and float modes.

moving titlebar should work

Right now to move windows you do mod+lmb/rmb.
However, in the case where a frame should be drawn, the user should be able to simply click and move the frame without a modifier. This involves selecting for button press, release, and pointer motion events on the frame window and then moving both the frame and it's child

BadAccess

18:38:31 | INFO | wm.nim:35 | Opened display
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: 23
Current serial number in output stream: 24

Polybar error collects issues

If you're installing polybar using aur.archlinux.org packages make sure to install requests version 2.27.1 using pip install requests==2.27.1 otherwise polybar will fail to build.

Also nim c isn't recognized when using git build. make sure to use choosenim update stable , and or choosenim update devel.

Consider making wormc a thinner client

I imagine this will only ever pop up when developing on worm for most users, but when working on #70 I spent a while attempting to debug why the new config options weren't working, and it was due to my rcfile using my system wormc, rather than ~/devel/worm/wormc.

That said, it would also be of benefit to reduce down configuration to a "single source of truth" -- currently to add a configuration option you:

  1. add a new IPC atom in src/atoms.nim
  2. add it to the Config type in src/types.nim
  3. implement boilerplate for the option in src/wormc.nim
  4. implement the setter for the option in src/events/clientmessage.nim
  5. and finally, you can actually use the configuration option in your code

You could get rid of 1 and 3 in a single step (as well as what I mention above, avoiding errors from an easy-to-make mistake) by simply having wormc take its input and send it directly to worm which handles it in its entirety.

Feature Requests

  1. Allow the user to change the mouse mod key used to resize/move windows (similar to bspwm's bspc config pointer_modifier)
  2. Focus windows when hovering over them (similar to bspwm's bspc config focus_follows_pointer)
  3. Cycle through windows using something like Alt + Tab

Transparency does not work

(in applications, while running a EWMH-compliant compositor such as picom or xcompmgr or compton etc)

Looks like it's because of reparenting which makes sense.

Use Arrow key to move from a workspace to another

Example on sxhkdrc:

super + {Left, Right}
       wormc switch-tag {-1,+1} 

It consists to go to the actualworkspace +1 or -1 (so it depends on on which workspace you are).
The same thing with move-active-tag.

worm binary dlopens non existing .so files

The problem occurs on a host system, where -devel packages are not present

libX11.so: cannot open shared object file: No such file or directory
libX11.so: cannot open shared object file: No such file or directory
libXft.so: cannot open shared object file: No such file or directory
could not load: libXft.so

Must be an internal thing, as the binary is not linked against x11 or xft:

ldd ./worm
	linux-vdso.so.1 (0x00007ffc0a31e000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f05d1508000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f05d14fd000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f05d14f7000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f05d1331000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f05d1761000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f05d1310000)

Not using any preinstalled packages here:

  Verifying dependencies for [email protected]
    Prompt: No local packages.json found, download it from internet? -> [forced yes]

This might work on Arch, where .so are part of a main package, but no other distribution will allow to run worm without installing tons of -devel packages.
The binary was built using nim 1.6.0

Suggestion, small feature

It would be nice to add a feature in wormc to get the ID of the actual active tag (so you'll be able to use arrow keys to move from a tag to another)

Roadmap?

A general overview of the planned features, refactoring plans and some way to keep track of who is working on what would be useful for new contributors.

Or at least, I would like to contribute whenever I have some free time, but I am not sure how should I implement things, or if what I am doing might conflict with someone else's work.

I have seen some projects use Github Projects or Discussions for that. Even using the Wiki might be useful.

atoms.nim missing - can't build

Hi,

build fails. I guess some code got restructured into atoms.nim (which has probably been forgotten to be added in git...)

Error: cannot open file: atoms

regards,
mo

Font fallbacks for window title

I Noticed that emoji and non Latin characters are becoming this square-ish text.
image
by having support to configure "multiple" fonts will allow to use it as a fallback fonts for this issue.

Delete the commit that introduced target folder

13cbcf9

You can use an interactive rebase to remove target folder from repo.

Or use the following command in project root.

git filter-branch --tree-filter 'rm -f target' HEAD

Do note that this will change commit hashes and you'll need to force push once ( git push -f ), but I don't see much issue in that since there aren't any public forks.

Requesting this since the target files are still in git history and that pulls up the size when cloning.

Resize windows?

Hello, is there any way to resize application window in floating mode? It seems that windows do not have handlers to intercept mouse events on borders...

bspc rule -a

Can worm add rules for each app like “bspc rule -a”?

Offsets in wine

In win32 apps running under wine, for some reason clicks are offset by the titlebar height. I don't know which protocol I'm not supporting which would fix this (I think the implementation of _NET_FRAME_EXTENTS is right)... but it happens in some other WMs too.

Tiling layout

Master-stack is a simple algorithm:

  • 1 window takes all of the screen
  • 2 windows, each takes half vertically
  • Else, on the left 1 window (100% height, 50% width) on the right the rest, each having 50% horizontal and some amount of vertical space (which is the same for all on the right)

Flesh out tags

Expose more use cases via the ipc system. provide some atoms.

Not able to compile

Sorry if there is any mistake on my side, but I can't compile worm and it shows an error while doing it.

Here is the full output when running nimble build -d:release --gc:arc:

  Verifying dependencies for [email protected]
      Info: Dependency on x11@any version already satisfied
  Verifying dependencies for [email protected]
   Building worm/wormc using c backend
   Building worm/worm using c backend
/home/wc/.cache/nim/worm_r/@mworm.nim.c: In function ‘getProperty__9aiI5srh3lf4yinTF7HA9aGQ’:
/home/wc/.cache/nim/worm_r/@mworm.nim.c:3022:26: error: incompatible types when assigning to type ‘tyObject_Option__hcmjwL9c5ECYpHnVevXHwEQ’ from type ‘tyObject_Option__9bcZreTqxpOXg5u4xcKsUEw’
 3022 |                 result = colontmpD__2;
      |                          ^~~~~~~~~~~~
/home/wc/.cache/nim/worm_r/@mworm.nim.c: In function ‘handleUnmapNotify__IBNx9c2pqwde9cI9bE9afvcRpw’:
/home/wc/.cache/nim/worm_r/@mworm.nim.c:4423:27: error: incompatible types when assigning to type ‘tyObject_Option__hcmjwL9c5ECYpHnVevXHwEQ’ from type ‘tyObject_Option__9bcZreTqxpOXg5u4xcKsUEw’
 4423 |         (*self).focused = T12_;
      |                           ^~~~
/home/wc/.cache/nim/worm_r/@mworm.nim.c: In function ‘handleDestroyNotify__UtpRh9a9bdEb3vV3vfdWHAsw’:
/home/wc/.cache/nim/worm_r/@mworm.nim.c:4509:27: error: incompatible types when assigning to type ‘tyObject_Option__hcmjwL9c5ECYpHnVevXHwEQ’ from type ‘tyObject_Option__9bcZreTqxpOXg5u4xcKsUEw’
 4509 |         (*self).focused = T12_;
      |                           ^~~~
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_FORTIFY_SOURCE=2 -O3 -fno-strict-aliasing -fno-ident   -I/usr/lib/nim -I/home/wc/tmp/worm/src -o /home/wc/.cache/nim/worm_r/@mworm.nim.c.o /home/wc/.cache/nim/worm_r/@mworm.nim.c' failed with exit code: 1


       Tip: 5 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: worm
        ... Execution failed with exit code 1
        ... Command: /usr/bin/nim c --colors:on --noNimblePath -d:release --gc:arc -d:NimblePkgVersion=0.1.0 --path:/home/wc/.nimble/pkgs/x11-1.1 --hints:off -o:/home/wc/tmp/worm/worm /home/wc/tmp/worm/src/worm.nim

Worm doesn't start

I have tried using git repo and copying over the binaries to /usr/bin/ and chmod +x on both of them.

I have tried using yay -S worm-git using xessions for sddm and lightdm. When I click on worm in the login manager I can only move the cursor.

I have setup all the config files:
/home/nixfreak/.config/worm
├── polybar
│   └── config.ini
├── rc
└── sxhkdrc

I have setup the same config file as in the examples to rc file.

Nothing works , also I had to remove nim 1.6.1 version and devel because the build using yay wanted to install only 1.4.
I nim on a daily basis and nimble.

I am using an archinux x86-64 Linux chaosArch 5.17.4-arch1-1 #1 SMP PREEMPT Wed, 20 Apr 2022 18:29:28 +0000 x86_64 GNU/Linux
I have nimc version
Nim Compiler Version 1.6.6 [Linux: amd64]
Compiled at 2022-05-05
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 0565a70eab02122ce278b98181c7d1170870865c
active boot switches: -d:release

If I could debug this why the executable isn't working I would , just no clue where to start.

Add a gitignore

Having a gitignore will prevent accidentally committing target folder (or any other folder that shouldn't be committed)

More robust button rendering/styling

For users largely using worm as a floating WM like myself, the button styling and rendering are okay, but not great. Typically I'd like my buttons to change on hover (to indicate that if I click, I will be clicking them and not the space surrounding them) and with everything else having active and inactive coloration, it'd be nice if the buttons could have the same. With the default config's coloration, for example, a black button disappears on a foreground window but looks perfect on a background window.

Some thought needs to be put into how to achieve this however -- ideally you could just give SVG elements a class like worm-fill or worm-stroke and worm could change their colors dynamically, but looking at pixie it doesn't look like this kind of behavior is exposed in any way.

It's still probably technically doable -- just separate out a codepath for SVG files, parse the XML, find all elements with class worm-{fill,stroke}, and set their fill or stroke value or whatever the case may be to the selected color, then render back to text and pass to decodeSvg -- but it wouldn't be particularly clean.

Perhaps worth looking into upstream contributions to pixie's SVG support? SVGs in the browser support styling, with CSS being able to set certain values (including fill and stroke), but since Pixie isn't a browser it does seem like there possibly ought to be a way to pass styles in when rendering an SVG that's not CSS.

How to statically set the size of an application

Example: using a graphics library i.e. niup , fidget I can choose the height and length.
When I execute on worm no matter what I do the application goes full screen.
How can I change the size of an application when running on worm?

Qt menus

This only affects Qt. It also only affects menus. Menus are fine when you launch an application. As soon as you move or resize it menus open up in the wrong place, which shouldn't happen because I send a ConfigureNotify to let applications know this is happening. Interestingly enough, when you fullscreen and unfullsceren the said window, the issue is fixed until you move/resize again... but obviously setting and unsetting _NET_WM_STATE_FULLSCREEN on moves/resizes is probably not the best idea?

autostart script

Use Rust's ChildProcess functionality to spawn $XDG_CONFIG_HOME/autostart when worm starts, if it exists. Otherwise print a warning and continue execution.

This is a fairly trivial task, but very useful

License

Hi @codic12

could you add a file with the license info?

thanks,
mo

Move and resize windows

Hello.
I have a fairly low level in window management systems, and I couldn't find from the doc how to set hotkeys for basic actions such as moving and resizing the current.
It looks like the only wormrc function that might allow that is window.modifier(uint32), but I did not manage to find my way in the explanation. Any help would be welcome here.

Thanks !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.