GithubHelp home page GithubHelp logo

newm's Introduction

newm

License AUR Join the chat at https://gitter.im/jbuchermn-newm/community

IMAGE

Current state

Unfortunately I no longer have time to spend on this project. So, this repo is currently unmaintained. Check out newm-atha!

Idea

newm is a Wayland compositor written with laptops and touchpads in mind. The idea is, instead of placing windows inside the small viewport (that is, the monitor) to arrange them along an arbitrarily large two-dimensional wall (generally without windows overlapping) and focus the compositors job on moving around along this wall efficiently and providing ways to the user to rearrange the wall such that they find the overall layout intuitive.

So, windows are placed on a two-dimensional grid of tiles taking either one by one, one by two, two by one, ... tiles of that grid. The compositor shows a one by one, two by two, ... view of that grid but scales the windows so they are usable on any zoom level (that is, zooming out the compositor actually changes the windows sizes). This makes for example switching between a couple of fullscreen applications very easy - place them in adjacent one by one tiles and have the compositor show a one by one view. And if you need to see them in parallel, zoom out. Then back in, and so on...

The basic commands therefore are navigation (left, right, top, bottom) and zoom-in and -out. These commands can be handled very intuitively on the touchpad (one- and two-finger gestures are reserved for interacting with the apps):

  • Use three fingers to move around the wall
  • Use four fingers to zoom out (move them upward) or in (downward)

To be able to arrange the windows in a useful manner, use

  • Logo (default , unless configured otherwise) + one finger on the touchpad to move windows
  • Logo (default , unless configured otherwise) + two fingers on the touchpad to change the extent of a window

To get a quick overview of all windows, just hit the Logo (default , unless configured otherwise) key. Additionally with a quick 5-finger swipe a launcher panel can be opened.

These behaviours can (partly) be configured (see below for setup). By default (check default_config.py), the following key bindings (among others) are in place

  • Logo-hjkl: Move around
  • Logo-un: Scale
  • Logo-HJKL: Move windows around
  • Logo-Ctrl-hjkl: Resize windows
  • Logo-f: Toggle a fullscreen view of the focused window (possibly resizing it)
  • ...

Roadmap

v0.3 has been merged into master, new features include

  • Improve panel functionality
  • Better bars
    • Support always-present top and bottom bars
    • Slide in bars
  • Borders
    • Draw borders around some floating windows (quite ugly floating windows on v0.2)
    • Possibly highlight focused window using a border
  • Enable window swallowing
  • Blurred window backgrounds
  • Better key bindings
  • DBus gestures
  • Better window stacking

Installing

Arch Linux

NixOS

Install via flakes (see also dotfiles-nix):

nix build "github:jbuchermn/newm#newm"
./result/bin/start-newm -d

Note that this probably does not work outside nixOS. To fix OpenGL issues on other linux distros using nix as a (secondary) package manager, see nixGL. Additionally, PAM authentication appears to be broken in this setup.

Installing with pip

pywm is the abstraction layer for and main dependency of newm. If all prerequisites are installed, the command:

pip3 install --user git+https://github.com/jbuchermn/pywm

should suffice.Additionally, unless configured otherwise, newm depends on alacritty for a default terminal emulator.

To install newm:

pip3 install --user git+https://github.com/jbuchermn/newm

Installing newm this way means it cannot be used as a login manager, as it can only be started by your current user (see below)

Starting and tests

Start newm using

start-newm -d

-d is the debug flag and gives more output to $HOME/.cache/newm_log.

Configuration

Setting up the config file and first example

Configuring is handled via Python and read from either $HOME/.config/newm/config.py or (lower precedence) /etc/newm/config.py. Take default_config.py as a basis; details on the possible keys are provided below.

For example, copy (path of default_config.py in the example assumes pip installation)

cd
mkdir -p .config/newm
cp .local/lib/pythonX.Y/site-packages/newm/default_config.py .config/newm/config.py
vim .config/newm/config.py

and adjust, e.g. for a German HiDPI MacBook with a wallpaper placed in the home folder,

import os
from pywm import (
    PYWM_MOD_LOGO,
    PYWM_MOD_ALT
)

def on_startup():
    os.system("waybar &")

def on_reconfigure():
    os.system("notify-send newm \"Reloaded configuration\" &")

bar = {
    'enabled': False,
}

background = {
    'path': os.environ['HOME'] + '/wallpaper.jpg'
}

outputs = [
    { 'name': 'eDP-1', 'scale': 2. }
]

pywm = {
    'xkb_model': "macintosh",
    'xkb_layout': "de,de",
    'xkb_options': "caps:escape",
}

Configuring

The configuration works by evaluating the python config file and extracting the variables which the file exports. So basically you can do whatever you please to provide the configuration values, this is why certain config elements are callbacks. Some elements are hierarchical, to set these use Python dicts - e.g. for x.y:

x = {
    'y': 2.0
}

The configuration can be dynamically updated (apart from a couple of fixed keys) using Layout.update_config (by default bound to Mod+C).

See config for a documentation on all configurable values.

Be aware that functions (as in keybindings, on_startup, ...) are run synchronously in the compositor thread. Blocking there will block the whole system.

Troubleshooting: Touchpad

It is very much encouraged to use evdev, instead of python gestures (see config), however these might not work right from the start. Try:

ls -al /dev/input/event*
evtest

This is a required prerequisite to use the python-side (smoother) gestures. C-side or DBus gestures do not require this.

As a sidenote, this is not necessary for a Wayland compositor in general as the devices can be accessed through systemd-logind or seatd or similar. However the python evdev module does not allow instantiation given a file descriptor (only a path which it then opens itself), so usage of that module would no longer be possible in this case (plus at first sight there is no easy way of getting that file descriptor to the Python side). Also wlroots (libinput in the backend) does not expose touchpads as what they are (touch-down, touch-up, touch-motion for any number of parallel slots), but only as pointers (motion / axis), so gesture detection around libinput-events is not possible as well.

Therefore, we're stuck with the less secure (and a lot easier) way of using the (probably named input) group.

Next steps

Using newm-cmd

newm-cmd provides a way to interact with a running newm instance from command line:

  • newm-cmd inhibit-idle prevents newm from going into idle states (dimming the screen)
  • newm-cmd config reloads the configuration
  • newm-cmd lock locks the screen
  • newm-cmd open-virtual-output <name> opens a new virtual output (see newm-sidecar)
  • newm-cmd close-virtual-output <name> close a virtual output
  • newm-cmd clean removes orphaned states, which can happen, but shouldn't (if you encounter the need for this, please file a bug)
  • newm-cmd debug prints out some debug info on the current state of views
  • newm-cmd unlock unlocks the compositor (if explicitly enabled in config) - this is useful in case you have trouble setting up the lock screen.

Using newm for login

This setup depends on greetd. Make sure to install newm as well as pywm and a newm panel in a way in which the greeter-user has access, i.e. either form the AUR, or e.g.:

sudo pip3 install git+https://github.com/jbuchermn/pywm
sudo pip3 install git+https://github.com/jbuchermn/newm

Place configuration in /etc/newm/config.py and check, after logging in as greeter, that start-newm works and shows the login panel (login itself should not work). If it works, set

command = "start-newm"

in /etc/greetd/config.toml.

newm's People

Contributors

cben avatar crag666 avatar feathecutie avatar jbuchermn avatar pandademic avatar patsonical avatar pinkcreeper100 avatar xpmo avatar yuckdevchan 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

newm's Issues

Windows are closed but workspaces are not removed

When I close a window normally the workspaces are readjusted, but something is wrong because sometimes it doesn't happen. for example when I open dbveaber and close it, his workspace still appears, now the same thing happens with thunar and kitty. In the image I have only one terminal open but it seems that there are more windows open when there are none. The workspaces keep appearing and if I move with the touchpad I do it empty because there are no windows in that position.

only terminal

Normally when there is only one window and you do ModPress the window is in the center but this does not happen because newm thinks there are more open windows and therefore creates more workspaces

I can't click on popup

I'm testing applications, when I open datagrid or any jetbrans ide I can't click about your pop-ups

Customizable opening position and size float windows

The floating windows option works perfectly, now the problem arises that the floating windows are quite small, I would like to be able to configure the size and position of those floating windows when they open, I have this configuration in sway:

for_window [app_id="zenity"] floating enable
for_window [app_id="wdisplays"] floating enable
for_window [app_id="io.crow_translate.CrowTranslate"] floating enable
for_window [app_id="catapult"] floating enable; move up 400
for_window [app_id="pavucontrol"] floating enable, resize set width 40 ppt height 60 ppt
for_window [app_id="blueman-manager"] floating enable, resize set width 40 ppt height 60 ppt
I would like to be able to have it in newm.

I currently have this in newm:

def should_float(view):
    os.system(f'echo {view.app_id} >> app_id.txt')
    if view.app_id == "pavucontrol":
        return True
    if view.app_id == "blueman-manager":
        return True
    return None

but imagine something like:

def should_float(view):
    os.system(f'echo {view.app_id} >> app_id.txt')
    if view.app_id == "pavucontrol":
        width = 40 # ppt
        heigh = 60 # # ppt
        position = (400, 200) # px
        return True, width, heigh, position
    return None

but you could have a better implementation

mpv and imv are not visible

I am using newm v0.2 and apply the patches for wlroots that it told me, everything seems to work correctly, but when trying to see a video with mpv, mpv never becomes visible only the audio is heard, I try imv which is an image viewer the result is the same, in both cases you only see a space on the desktop as if you had the application but only the background is seen.

3 windows see 2
mpv not found

Black screen, cant open alacritty

When running newm, i just get a black screen, and Logo+Enter does nothing. If i try to run

WAYLAND_DISPLAY="wayland-0" alacritty

from tty2 it doesnt error, but it also doesnt show up in newm. From what I understand, the logs show it creates the window, but its not displayed. I'm not sure if this is relevant, but im running it as

cd path/to/newm
PATH="$PATH:." python -u -c "from newmimport run; run()"

as i have newm installed in a venv.

Also not sure if relevant, but logs are inconsistent (sometimes errors from wlroots etc) and each time i get

[WARNING] layout.py:820 ...: Unexpected: View <View 3 (root): Alacritty, Alacritty, toplevel, 20593, xwayland=False, floating=false> state not found

Chromium based web browsers don't work

I installed Brave and Chromium. Both of them don't work. When I try to run them from the terminal, I just get the output:
Trace/breakpoint trap

Do you know what the problem is? It's running on Artix Linux on a ThinkPad X220 (yes I'm the same person).

Both web browsers work under sway.

Thanks in advance.

Define applications as floating

There is a feature of swaywm that I miss, it is the ability to define applications as floating, for example pavucontrol or nwg-shell applications

[packaging] Is it allowed/possible to install pywm and newm separately?

Hello! I'm Anderson Torres, a maintainer of some packages in NixOS.
I came across newm by the Github suggestions, and I'm now interested in packaging it.

I noticed that the AUR script you have provided, and it downloads and installs both pywm and newm in the same directory, despite they are being maintained in different repositories.

That being said, and before trying it by myself, I think I should ask: is it necessary to download both sources and install them at the same time?

waybar does not work

After updating the new changes of newm v2, I noticed that waybar is not showing, at first I thought that it just did not start, after checking my configuration I realized that everything was fine however when doing a htop and filtering the waybar name Note that if it was started but not shown, kill the process and start again waybar is shown, then the conclusion I reached that after updating something, it changes that it does not allow waybar to start as it did before.

The scale cannot be used on two monitors

The scale cannot be used on two monitors, I have two scales on my two monitors, one at 0.7 and the other at 0.6, but when trying, the screen darkens and deforms

too big popup

I am testing applications, but when they open pop-up windows, the pop-up windows are huge, this behavior did not happen before, in the version before the error with catapult

Custom Resolution

In swaywm I can define custom resolutions for example in sway I have my laptop monitor at 1920x1080 but newm only detects 1366x768, is there any way to achieve this in newm. I already tried all the settings and it doesn't seem to work

Archlinux version error

I am using the arch version of newm, however the version is not respected when building this causes the package to always be marked as outdated

Alt-Tab function

This would be a very useful feature that I would like to have in newm, pressing Alt-Tab to cycle through currently open applications, as Windows, Mac or Linux does on other desktops, it is a feature that not even swaywm has.

Flickering in some regions of the screen

Before v0.2 joined with master this behavior did not occur. Now sometimes some of the regions of the screen flicker constantly, this happens for a while then stops and then at some point it happens again

I can't share screen

First of all this project is incredible and beautiful, the way of moving between windows is incredible. I work as a remote software developer so I have daily meetings where I share my screen, but I have tried to do it in newm and I just couldn't. In swaywm everything works correctly. Any solution?

Error after update arch linux

@jbuchermn After updating arch linux newm did not start. Tracing the problem I realized that python was updated to version 3.10 maybe that is the problem and if it is, how could I solve it

V3 Description Roadmap

It will be possible to add to the v3 readme the roadmap designed for that branch so that it is easier to know how to collaborate

Installation attempt

I tried to install this compositor on void linux with theese commands:

sudo xbps-install python3-psutil-5.8.0_1
git clone https://github.com/jbuchermn/newm
cd newm
python3 setup.py build
python3 setup.py install
./scripts-3.9/start-newm

but the compositor doesn't start. I tried to start it manually from a python3 console using from newm import run but seems like pywm is missing:

>>> from newm import run
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/site-packages/newm-0.0.9-py3.9.egg/newm/__init__.py", line 9, in <module>
    from .run import run
  File "/usr/lib/python3.9/site-packages/newm-0.0.9-py3.9.egg/newm/run.py", line 5, in <module>
    from .layout import Layout
  File "/usr/lib/python3.9/site-packages/newm-0.0.9-py3.9.egg/newm/layout.py", line 12, in <module>
    from pywm import (
ModuleNotFoundError: No module named 'pywm'

I'm wondering if this is pywm, but i'm unsure, since it's a Xorg wm. If this is the case I don't know how to install it because it's not installable via pip3.

A wiki for setup

I love the visual aspect but heck, I don't know how to configure it, I don't really understand anything or how to navigate or change the window, I would like a wiki to be created where that is explained, in particular it is python but I don't know what options I have to configure , it would be good to have functions like the ones you have in swaywm even though to be honest your project is superior in terms of aesthetics

Trackpad not working

I can move the mouse around etc, but trackpad gestures like Logo + 2 finger touch doesnt work to resize.

Unable to find dependecies : python-imageio

Hi,

I am currently trying to use newm, but i am unable to complete the command "makepkg -si"

I encountered this error :

[0] makepkg -si                

==> Making package: newm-git 0.1.r27.g33aea1f.a6d799f-1 (dim. 05 déc. 2021 16:11:55)

==> Checking runtime dependencies...

==> Installing missing dependencies...

error: target not found: python-imageio

==> ERROR: 'pacman' failed to install missing dependencies.

==> Missing dependencies:

  -> python-imageio

==> Checking buildtime dependencies...

==> ERROR: Could not resolve all dependencies.

for the other dependecies like numpy I did : sudo pacman -S python-numpy

does anyone have the same error ?

I am on artix openrc.

thanks in advance.

Error select area with slurp

Now that I try to print grim -g "$ (slurp)" ~ / screen - "$ (date +% s)". Png, I could not select a region, the cursor is fully freeze. I can't do anything other than forcibly shutting down the laptop

obs-studio cannot be used inside neem

I have always used obs studio with swaywm but with newm it behaves strangely, it does not allow resizing and when if you can, all windows do too, when it is opened it changes the arrangement of the windows among many more problems. Try and see what I say

how to remove the border in an active window in v0.3

I'm testing the v3 of newm and all his work is incredible, but there is something that personally I do not like is the border of the selected window, is there any configuration to remove this border? Or in any case change the color?

package request for arch linux

Your work looks spectacular, I have tried to install it but I have not yet been able to, I would like to use your project for my desktop for daily use, I use arch linux I think it would be great if there was a package there

electron apps don't work with wayland flags

I just compiled the v2 of newm and if everything works fine the shape rendering part is solved, now the problem is that when trying to open google chrome with the flags so that it runs native in wayland it does not open. Before changing to version 2 the application did open. I provided more electron applications and the error was the same.
i will also show the configuration i currently have
start newm
environment vars

Pinch to zoom wont work on firefox or evince

just trying this cool compositor, touchpad gestures work perfectly fine on the diferent views, but the gestures that are hardcoded in wayland apps like firefox or evince like pinch to zoom wont work.
thanks for the great job! looking forward for this wonderful project future!

Process on start

How can I start applications at the start of newm. In sway that can be done just by writing exec in the configuration file, this as it is done in newm, I did this but I don't know if it is working, since I inspect with htop and the process does not appear, I have the impression that the process is added to the newm startup process but I don't know if this is true, I also wanted to use subprocess for this task. Enlighten me please.
cofig file newm

how to use layout.ensure_locked

By mistake, I pressed this function, but I did not know how to remove it, I literally had to restart to use the system again, would there be a chance to tell me how it works?

rofi wayland does not work

i use a fork of rofi that works with wayland, currently i use it with sway, but i want to switch to this wm, but rofi doesn't work
(process:7509): Wayland-ERROR **: 09:04:21.390: Rofi on wayland requires support for the layer shell protocol

Unable to start newm in minimal Artix install

I'm not able to start newm with the command start-newm from TTY in a minimal Artix Linux installation on a ThinkPad X220.

This is the content of the newm_log log file:

[INFO] config.py:70 2021-11-14 13:48:57: Loading config at /usr/lib/python3.9/site-packages/newm/default_config.py
[DEBUG] pywm.py:89 2021-11-14 13:48:57: PyWM init
[WARNING] auth_backend.py:111 2021-11-14 13:48:57: Could not find greeter: greeter
[DEBUG] pywm.py:390 2021-11-14 13:48:57: PyWM run
Running PyWM...
00:00:00.000 [INFO] [libseat] [libseat/backend/seatd.c:80] Could not connect to socket /run/seatd.sock: No such file or directory
00:00:00.000 [INFO] [libseat] [libseat/libseat.c:76] Backend 'seatd' failed to open seat, skipping
00:00:00.003 [ERROR] [libseat] [libseat/backend/logind.c:310] Could not activate session: Permission denied
00:00:00.003 [INFO] [libseat] [libseat/libseat.c:76] Backend 'logind' failed to open seat, skipping
00:00:00.003 [ERROR] [libseat] [libseat/libseat.c:79] No backend was able to open a seat
00:00:00.003 [ERROR] [backend/session/session.c:84] Unable to create seat: Function not implemented
00:00:00.003 [ERROR] [backend/session/session.c:218] Failed to load session backend
00:00:00.003 [ERROR] [backend/backend.c:353] Failed to start a DRM session
python: ../src/wm/wm_server.c:177: wm_server_init: Assertion `server->wlr_backend' failed.

I installed newm through the AUR. As far as I know, all the dependencies listed in https://aur.archlinux.org/packages/newm-git/ are installed.

Am I missing something?

Thanks in advance.

Screen sharing do not work

I tried on all meeting platforms and the problem persists, I notice that the cursor does not change shape, when I share the screen in swaywm the cursor takes the shape of a cross, a behavior that does not occur in newm. I already tried the solutions that he gave me, but none seems to work I think that is not that problem, I have the theory that maybe it is in the mause events, today that I use it all day I notice that at times the cursor changes size. from being small to being extremely large.

Include tray in panel

I want to use nm-applet and I wish I could have its tray-icon here, also for telegram and other applications that use it, I was also thinking that maybe it could be that waybar is supported that already has an implementation of this

layout.move_next() view only moves in a workspace

This works, the problem is that it only cycles through single monitor apps, not all currently open apps. I would like to have something like what you did with ModPress, include the option of only_active_workspace = True

Floating windows open in a different location

This behavior did not happen before, I am using the newest version of v0.2, then when I open pavucontrol whose window I have defined as floating it opens in a different place than the one it was called in the first place.
oen pavucontrol
is open in other space

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.