Code Monkey home page Code Monkey logo

sowm's Introduction

sowm (Simple Shitty Opinionated Window Manager)

An itsy bitsy floating window manager (220~ sloc!).

  • Floating only.
  • Fullscreen toggle.
  • Window centering.
  • Mix of mouse and keyboard workflow.
  • Focus with cursor.
  • Rounded corners (through patch)
  • Titlebars (through patch)

  • Alt-Tab window focusing.
  • All windows die on exit.
  • No window borders.
  • No ICCCM.
  • No EWMH.
  • etc etc etc

Patches available here: https://github.com/dylanaraps/sowm/pulls

Default Keybindings

Window Management

combo action
Mouse focus under cursor
MOD4 + Left Mouse move window
MOD4 + Right Mouse resize window
MOD4 + f maximize toggle
MOD4 + c center window
MOD4 + q kill window
MOD4 + 1-6 desktop swap
MOD4 + Shift +1-6 send window to desktop
MOD1 + TAB (alt-tab) focus cycle

Programs

combo action program
MOD4 + Return terminal st
MOD4 + d dmenu dmenu_run
MOD4 + p scrot scr
MOD4 + w wallpaper cycler bud
XF86_AudioLowerVolume volume down amixer
XF86_AudioRaiseVolume volume up amixer
XF86_AudioMute volume toggle amixer
XF86_MonBrightnessUp brightness up bri
XF86_MonBrightnessDown brightness down bri

Dependencies

  • xlib (usually libX11).

Installation

  1. Copy config.def.h to config.h and modify it to suit your needs.
  2. Run make to build sowm.
  3. Copy it to your path or run make install.
    • DESTDIR and PREFIX are supported.
  4. (Optional) Apply patch with git apply patches/patch-name
    • In case of applying multiple patches, it has to be done manually.

If you are using GDM, save the following to /usr/share/xsessions/sowm.desktop. It is still recommended to start sowm from .xinitrc or through your own xinit implementation.

[Desktop Entry]
Name=sowm
Comment=This session runs sowm as desktop manager
Exec=sowm
Type=Application

Thanks

sowm's People

Contributors

4y8 avatar dylanaraps avatar eti0 avatar kiedtl avatar leon-plickat avatar lieux avatar reciate avatar seungheonoh avatar timothy-joseph avatar venam avatar zsugabubus 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

sowm's Issues

detect resolution change

hi dylan,

as written or irc earlier, it would be nice to have a mechanism to detect any resolution change to keep sowm safe and working as expected while manipulating windows (fs, move center...)

thanks in advance o/

Question: Why does the normal kill patch attempt to patch itself.

When I tried to patch SOWM with the normal kill patch, sowm.c patches fine but the file also seems to patch the patch file, removing the section that modifies sowm.c
See the patch output:

patching file patches/sowm-normal-kill.patch
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file patches/sowm-normal-kill.patch.rej
patching file sowm.c
Hunk #1 succeeded at 185 (offset 5 lines).

And the reject file:

--- patches/sowm-normal-kill.patch
+++ patches/sowm-normal-kill.patch
@@ -1,23 +0,0 @@
-diff --git a/sowm.c b/sowm.c
-index 0d74d4b..ff70968 100644
---- a/sowm.c
-+++ b/sowm.c
-@@ -326,7 +326,17 @@ void win_del(Window w) {
-    "Shoot first and don't ask questions later?.."
- */
- void win_kill() {
--    if (win_current() != root) XKillClient(d, cur);
-+    if (win_current() == root) return;
-+
-+    XEvent ev = { .type = ClientMessage };
-+
-+    ev.xclient.window       = cur;
-+    ev.xclient.format       = 32;
-+    ev.xclient.message_type = XInternAtom(d, "WM_PROTOCOLS", True);
-+    ev.xclient.data.l[0]    = XInternAtom(d, "WM_DELETE_WINDOW", True);
-+    ev.xclient.data.l[1]    = CurrentTime;
-+
-+    XSendEvent(d, cur, False, NoEventMask, &ev);
- }
-
- /*

Is this intended, it doesn't seem to be required. Is meant to stop the user from applying the patch multiple times?

Can't apply rounded corners patch

Hi there, trying to apply patch for rounded corners without success:

$ git apply patches/sowm-rounded-corners.patch
error: patch failed: sowm.c:201
error: sowm.c: patch does not apply

Any easy solution available?

How to exit when using GDM (and other questions)

Hi. I really like this wm but I have a few questions:

  1. I'm using GDM and created a sowm.desktop file in /usr/local/share/xsessions. So getting into sowm is not problem. But how can I exit so I end up back at the login manager?

  2. I applied the patch to get rounded corners but they appear jagged and don't look nice. Is there a way to reverse the patch?

  3. I edited the Makefile to change the default install location to /usr/local. As I understand I can change this from the CLI. Is this how:

sudo make PREFIX=/usr/local install

  1. Instead of dmenu_run I'm using 'rofi -show drun' in config.def.h but it isn't working. Any advice?

Many thanks. It's a very sweet wm :)

Edit: Ok, Iโ€™m an idiot. I solved it. Closing.

sowm not launching?

Hi, this is sort of a stupid question, but i can't get sowm to launch properly.

I cloned the repo, copied the config, ran make then sudo make install

Finally, i added exec sowm to the end of my .xinitrc

When i reboot, i have a black screen, and nothing launches. Anything i may have missed?
Here's my full .xinitrc:

  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

[ -f ~/.Xresources ] && xrdb ~/.Xresources

exec sowm

Any idea where i've gone wrong? Thanks

Failed rounded corners patch

$ patch -p1 < patches/sowm-rounded-corners.patch
patching file Makefile
patching file config.def.h
patching file sowm.c
Hunk #2 succeeded at 43 (offset 1 line).
Hunk #3 succeeded at 106 (offset -1 lines).
Hunk #4 FAILED at 206.
Hunk #5 FAILED at 280.
2 out of 5 hunks FAILED -- saving rejects to file sowm.c.rej

and the sowm.c.rej

--- sowm.c
+++ sowm.c
@@ -206,9 +211,44 @@ void win_fs() {

         } else
             XMoveResizeWindow(d, cur, c->wx, c->wy, c->ww, c->wh);
+
+        win_round_corners(cur, c->f ? 0 : ROUND_CORNERS);
     }
 }

+void win_round_corners(Window w, int rad) {
+    unsigned int ww, wh, dia = 2 * rad;
+
+    win_size(w, &(int){1}, &(int){1}, &ww, &wh);
+
+    if (ww < dia || wh < dia) return;
+
+    Pixmap mask = XCreatePixmap(d, w, ww, wh, 1);
+
+    if (!mask) return;
+
+    XGCValues xgcv;
+    GC shape_gc = XCreateGC(d, mask, 0, &xgcv);
+
+    if (!shape_gc) {
+        XFreePixmap(d, mask);
+        return;
+    }
+
+    XSetForeground(d, shape_gc, 0);
+    XFillRectangle(d, mask, shape_gc, 0, 0, ww, wh);
+    XSetForeground(d, shape_gc, 1);
+    XFillArc(d, mask, shape_gc, 0, 0, dia, dia, 0, 23040);
+    XFillArc(d, mask, shape_gc, ww-dia-1, 0, dia, dia, 0, 23040);
+    XFillArc(d, mask, shape_gc, 0, wh-dia-1, dia, dia, 0, 23040);
+    XFillArc(d, mask, shape_gc, ww-dia-1, wh-dia-1, dia, dia, 0, 23040);
+    XFillRectangle(d, mask, shape_gc, rad, 0, ww-dia, wh);
+    XFillRectangle(d, mask, shape_gc, 0, rad, ww, wh-dia);
+    XShapeCombineMask(d, w, ShapeBounding, 0, 0, mask, ShapeSet);
+    XFreePixmap(d, mask);
+    XFreeGC(d, shape_gc);
+}
+
 void win_to_ws(const Arg arg) {
     int tmp = ws;
     win_current();
@@ -280,6 +320,7 @@ void map_request(XEvent *e) {
     if (wx == 0 && wy == 0) win_center((Arg){.i = w});

     XMapWindow(d, w);
+    win_round_corners(w, ROUND_CORNERS);
     win_focus(w);
     win_add(w);
 }

Have status bars span across all workspaces

Is there some way to have a statusbar (e.g. polybar) span across all workspaces like the way it works in i3. If this is not currently implemented could someone please give me some pointer for making a patch to allow this.
Thanks
~ M

Unexpected behavior of focused window with picom

I have use picom to blur all currently unfocused windows. In sowm the focused window gets blurred as well, which makes it very difficult to distinguish between focused and unfocused windows, especially when you can't have borders that change colors.

Window takes up more space than screen when fullscreened using the border patch

Hello,

When a window is fullscreened (using my border patch), the window is resized and its size is outside the bounds of the screen. I tried modifying the parameters in win_fs like so:

void win_fs(const Arg arg) {
    if (!cur) return;

    if ((cur->f = cur->f ? 0 : 1)) {
        win_size(cur->w, &cur->wx, &cur->wy, &cur->ww, &cur->wh);
        XMoveResizeWindow(d, cur->w, 0, 0, sw - BORDER_WIDTH, sh - BORDER_WIDTH);

    } else {
        XMoveResizeWindow(d, cur->w, cur->wx, cur->wy, cur->ww - BORDER_WIDTH, cur->wh - BORDER_WIDTH);
    }
}

However, this attempt was futile as the window continued to resize to the wrong position. I realize I should be fixing this problem, as it's my patch, but I don't know how to. One weird thing I noticed is that the window content itself went over the edge of the screen too.

Thanks in advance.

[Question] Close child windows?

Is there a way to close child windows, without killing the entire process? I use ripcord, and you have to close the call window in order to leave the call, but currently I can only do this using mod4+q and restarting ripcord.

Multiple monitor support?

I'm doing my first Arch Linux install with sowm, but when I maximize a window, it stretches over both my displays. I don't know if this is an issue with sowm or if it's my display settings, but I have tried seperating X screens and setting up Xinerama, but that didn't work.

Move to xcb

Not hard, and can be done in stages.

Thoughts?

Recommended quit command.

Hi,
I would like to setup a key combo to quit sowm eg like dwm Alt+Shift+q
Would killall sowm be OK?
Can you recommend a command?

[QUESTION]The wallpaper cycler

In the hotkeys section, there is shown a hotkey to cycle wallpapers. It says the program used is bud. But I cant find any app named bud.

Can't use my new sowm :(

I'm trying to restore an old notebook with arch and sowm, installed dmenu and st for default keybinding, added sowm to xinitrc. but upon startx sowm start (i think, black screen with mouse cursor) but no keybinding is taken (dmenu or st)... I need an help

question: when is map_request called?

Please tell me what map_request does, and when is it called? I'm want to try to make focused windows a different color than regular windows. Thanks in advance.

fix coding style in sowm.c

I think it would be a good idea to fix code style in sowm.c to conform to usual style.

  • move function prototypes to sowm.h (also global variables, data structures, basically anything that's not a function.)

  • add prototypes for function that don't have them

  • add some formatting to the Makefile, for heaven's sake

  • OPTIONALLY compile with -Wold-style-declaration -Wmissing-prototype -Werror for stricter code style

If you think this a good idea I can submit a PR for this

Thanks, kiedtl

Strange 2bswm-patch resize behaviour

I applied the 2bswm patch and it was working, with move and resize behaving as expected. However, something changed recently. The resize effect seems to be applying to the left and top of the window, as opposed to the right and bottom (as usual).

Example: MOD+Shift+j should be resizing the window DOWN, making it larger vertically. Instead, it's resizing UP (at the top of the window instead of the bottom).

Hopefully I've explained this usefully.

Also, most patches are being applied to sown.c. But when I do a git pull it keeps getting overwritten and I have to apply my patches all over again. Is there a better method for doing this?

Thanks.

Also: what does the sowm-init patch do? It was be nice if patch functionality was stated (when it isn't obvious :)

bud not working in arch linux

Hello, how do I install the wallpaper cycler "bud" or where can I download and install it ?, apparently in my gnu/linux distribution (arch linux) it doesn't work, regards!

Tiling mode

Can you make a patch for tiling mode please?

Compiling after new changes

After I've cloned the repo, I make my changes to config.h and run make and make install. Thereafter, I can start sowm as intended. However, if I make new changes to config.h and run make again I get the message

make: Nothing to be done for 'all'.

Afterwards I tried to run make install which works as intended but the newer changes are not applied. Am I missing some flags?

Great wm btw! :)

Where is the config file stored?

Where is the config file stored? Do I have to recompile sowm for changes to it to take effect, or is it enough to restart or somehow refresh? Many thanks in advance!

Multihead support

Hi there, testing sowm on my working laptop and it's not working well with multihead setup. For example, if i dragged window to secondary display and press MOD+F to go fullscreen - it moves the window back to primary display and making it fullscreen there. I suppose it is not expected behavior. Would be nice to have a separate desktops on different screens. A-la dwm. And keybindings to move windows from one screen to another.
Thanks for your time.

TODO

  • win_to_ws (needs to set focus to next window).
  • ws_go (needs to set focus to window).
  • win_next (sometimes duplicates current window).
  • win_del (*needs to set focus to next window).

i need some help with sowm!

I have compiles sowm on Debian and installed it with sudo make install, but i can't get it to show up in Lightdm or GDM as a option? How can i do that sorry for my lack of skills.

I could't find any other forum/reddit to write this on.

Bug in titlebar patch

I'm using st terminal on kiss. If I have one terminal window overlapping another and change focus to the unfocused window, the titlebar remains behind the newly unfocused window

browser moves to workplace when link clicked in program on other workplace

When clicking a web link in a program on lets say desk2, if a browser is already open on desk1 it will now move to desk2. I prefer the browser would not move but the bigger issue is that it has some buggy behavior as it will disappear from all virtual desktops when switching between them. Cycling through the desktops again will make it reappear but its not easy to return to previous behavior as pressing Mod-Shift 1 will not make it stay back on desk1. The only way to fix it seems to be to close the browser and open another one on the correct desktop.

Its a minor annoyance but thought I would mention it, otherwise good work on a nice minimal window manager and I like how you added possible upgrades via patches!

User shortcuts doesn't work

Hello,

I have defined some shortcuts in my config.def.h and they doesn't work. The shortcuts are the following:

const char* tile[]    = {"tile", "-s", 0};
const char* zathura[] = {"zathura",    0};
{MOD, XK_t,      run, {.com = tile}},
{MOD, XK_z,      run, {.com = zathura}},

My config.def.h

#ifndef CONFIG_H
#define CONFIG_H

#define MOD Mod4Mask

const char* menu[]    = {"dmenu_run",      0};
const char* scrot[]   = {"scr",            0};
const char* briup[]   = {"bri", "10", "+", 0};
const char* bridown[] = {"bri", "10", "-", 0};
const char* voldown[] = {"amixer", "sset", "Master", "5%-",         0};
const char* volup[]   = {"amixer", "sset", "Master", "5%+",         0};
const char* volmute[] = {"amixer", "sset", "Master", "toggle",      0};
const char* colors[]  = {"bud", "/home/goldie/Pictures/Wallpapers", 0};
const char* term[]    = {"st", "-f", "DejaVuSansMono-11", "-g", "104x28+0+20", "-e", "fish", 0};
const char* tile[]    = {"tile", "-s", 0};
const char* zathura[] = {"zathura",    0};

static struct key keys[] = {
    {MOD,      XK_q,   win_kill,   {0}},
    {MOD,      XK_c,   win_center, {0}},
    {MOD,      XK_f,   win_fs,     {0}},
    {Mod1Mask, XK_Tab, win_next,   {0}},

    {MOD,      XK_KP_Home,   win_top_left, {0}},
    {MOD,      XK_KP_Prior,   win_top_right, {0}},
    {MOD,      XK_KP_End,   win_bottom_left, {0}},
    {MOD,      XK_KP_Next,   win_bottom_right, {0}},

    {MOD,           XK_k,  win_move,  {.com = (const char*[]){"move",   "n"}, .i = 10}},
    {MOD,           XK_j,  win_move,  {.com = (const char*[]){"move",   "s"}, .i = 10}},
    {MOD,           XK_l,  win_move,  {.com = (const char*[]){"move",   "e"}, .i = 10}},
    {MOD,           XK_h,  win_move,  {.com = (const char*[]){"move",   "w"}, .i = 10}},

    {MOD|ShiftMask, XK_k,  win_move,  {.com = (const char*[]){"resize", "n"}, .i = 10}},
    {MOD|ShiftMask, XK_j,  win_move,  {.com = (const char*[]){"resize", "s"}, .i = 10}},
    {MOD|ShiftMask, XK_l,  win_move,  {.com = (const char*[]){"resize", "e"}, .i = 10}},
    {MOD|ShiftMask, XK_h,  win_move,  {.com = (const char*[]){"resize", "w"}, .i = 10}},


    {MOD, XK_d,      run, {.com = menu}},
    {MOD, XK_w,      run, {.com = colors}},
    {MOD, XK_p,      run, {.com = scrot}},
    {MOD, XK_space,  run, {.com = term}},
    {MOD, XK_t,      run, {.com = tile}},
    {MOD, XK_z,      run, {.com = zathura}},

    {0,   XF86XK_AudioLowerVolume,  run, {.com = voldown}},
    {0,   XF86XK_AudioRaiseVolume,  run, {.com = volup}},
    .
    .
    .

tile is a user defined script, so I thought it was the problem. But even zathura which is in /usr/bin doesn't work. I have customized the term command and it works perfectly fine. I use sowm 1.6. Other similar issues didn't help me.

Window initializing process

The windows that had been opened before sowm is not recognized properly and sowm does not have control on those windows.

For example, if I run st before sowm, and try to move or control the pre-opened st, sowm fails(sometimes with Segfault)

Shortcut customization

Is there a way to use single-key shortcuts? How does the the customization of shortcuts work?

TODO

  • Pointer follows focus.
  • Fix sending a window to another workspace.
  • Fullscreen toggle.
  • Center window.
  • Rounded corners.
  • A whole lotta clean up.

Focus cycle to root window

Today I tried sowm, and I realize some problems.

Let's say we have two windows in the same workspace. When I cycle through them, it does not cycle between them. It is cycling window1, window 2, root window, which is very annoying. Also, if I cycled on root window and close it, the whole windows manager crash, and I have to use tty to get rid of it.

Another possible improvement is let the focused window have some hint, like colored border or something.

Windows-to-workspaces stopped working

I've noticed recently that the window-to-workspace function has stopped working for me. MOD+Shift+ws just opens the workspace without moving the window there. Has anyone else noticed this? I've applied the normal-kill, almost-tags-1.0, wheelresize, and 2bswm patches (although it still didn't work with a fresh sowm install, patch free).

Here is the output to make. Lots of warnings :)

Thanks! Let me know if more info is needed.

New rect-to-move patch function?

Dumb question. I've just applied this patch but am not sure what it does. Can someone help?

Edit: Ok. It allows resizing the window without having to grab the edges, which was awkward just using a trackpad. Thank God! Closing ...

Not working at all

After the update, when I'm trying to run sowm, it fails with

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:  9

Window outline/border

Would it be possible to add coloured borders around the windows?
I could possibly do a patch myself but have to clue where to start or if it would be possible. Any pointers?

Bug in handlebar patch

Easiest described by saying if you have 2 terminal windows open and move one of them over the other with the handlebar, they will follow each other and sometimes swap focus. Also if they are a different size the larger window will shrink to the size of the smaller one. Does not happen in unpatched sowm.

bar support

This will live in a patch and seems fairly simple to add. :)

Specifying startup apps?

Probably a dumb question, but is there any way to specify a list of startup apps? I'm using a login manager, atm.

Thanks.

2bwm-like window movement

I think it would be a good idea to include 2bwm-movement in sowm -- to aid those who are used to a more keyboard-driven interface.

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.