aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Stevens <nilix@nilfm.cc>2021-06-18 09:55:57 -0600
committerDerek Stevens <nilix@nilfm.cc>2021-06-18 09:55:57 -0600
commit71814a723bd59bdfbde34b7ca32c085243ef7077 (patch)
tree5c115ee3289cb7da73b4f0b0abb4f0498c4f0074
parent34c6e5e02747e6213bd3b0b6d11ca5338fc458ff (diff)
event.c: fix bug in focus request; menu.c, main.c: use libnotify for notifications instead of notify-send to eliminate zombies; new manpage
-rwxr-xr-xREADME.md3
-rw-r--r--event.c3
-rw-r--r--main.c9
-rw-r--r--menu.c51
-rwxr-xr-xmkfile4
-rw-r--r--ryudo.1.md75
6 files changed, 125 insertions, 20 deletions
diff --git a/README.md b/README.md
index d5a061b..0cfde5f 100755
--- a/README.md
+++ b/README.md
@@ -51,7 +51,8 @@ window centered (its exact geometry is configurable via `config.h`).
### Dependencies, Building, Installation
Being forked from Rio, Ryudo requires `plan9port`, `Xlib`, and `Xt`.
-If you enable notifications, it of course requires `notify-send`.
+If you enable notifications, they need `libnotify`.
+(With the exception of `plan9port`, you need the development headers for all the dependencies in addition to the libraries themselves in order to compile).
Build with `build.sh` (calls `mk` and does some other magic), and install with `install.sh` (will install to a local folder if run as a normal user, or to your `$PLAN9/bin/` if run as root).
diff --git a/event.c b/event.c
index 44b928e..717519a 100644
--- a/event.c
+++ b/event.c
@@ -161,6 +161,9 @@ void configurereq(XConfigureRequestEvent* e) {
if (e->value_mask & CWStackMode) {
if (c->virt > 0 && c->virt != virt)
switch_to(c->virt);
+ if (hidden(c)) {
+ unhidec(c, 1);
+ }
top(c);
active(c);
}
diff --git a/main.c b/main.c
index 5a77e06..462a1b6 100644
--- a/main.c
+++ b/main.c
@@ -13,6 +13,9 @@
#include <X11/extensions/shape.h>
#endif
#include "config.h"
+#ifdef VIRTNOTIFY
+#include <libnotify/notify.h>
+#endif
#include "dat.h"
#include "fns.h"
#include "patchlevel.h"
@@ -221,8 +224,14 @@ int main(int argc, char* argv[]) {
for (i = 0; i < num_screens; i++)
scanwins(&screens[i]);
+ #ifdef VIRTNOTIFY
+ notify_init("ryudo");
+ #endif
keysetup();
mainloop(shape_event);
+ #ifdef VIRTNOTIFY
+ notify_uninit();
+ #endif
return 0;
}
diff --git a/menu.c b/menu.c
index 530c477..2b344a8 100644
--- a/menu.c
+++ b/menu.c
@@ -15,6 +15,9 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "config.h"
+#ifdef VIRTNOTIFY
+#include <libnotify/notify.h>
+#endif
#include "dat.h"
#include "fns.h"
@@ -454,6 +457,10 @@ void switch_to_c(int n, Client* c) {
void switch_to(int n) {
#ifdef VIRTNOTIFY
static char virtmsg[32];
+ NotifyNotification* notification = notify_notification_new(
+ VIRTHEADER,
+ NULL,
+ NULL);
#endif
if (n == virt)
return;
@@ -470,23 +477,33 @@ void switch_to(int n) {
ensureactive();
top(current);
#ifdef VIRTNOTIFY
- if (fork() == 0) {
- close(ConnectionNumber(dpy));
- if (dpy != '\0')
- putenv(dpy);
- signal(SIGINT, SIG_DFL);
- signal(SIGTERM, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
- sprintf(virtmsg, VIRTMSG, b2items[virt]);
- execlp(
- "notify-send",
- "notify-send",
- "-c",
- "virtual",
- VIRTHEADER,
- virtmsg,
- (char*)0);
- }
+ sprintf(virtmsg, VIRTMSG, b2items[virt]);
+ notify_notification_update(notification,
+ VIRTHEADER,
+ virtmsg,
+ NULL);
+ notify_notification_set_category(notification, "virtual");
+ notify_notification_show(notification, NULL);
+ notify_notification_close(notification, NULL);
+/* if (fork() == 0) {
+ if (fork() == 0) {
+ close(ConnectionNumber(dpy));
+ if (dpy != '\0')
+ putenv(dpy);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGTERM, SIG_DFL);
+ signal(SIGHUP, SIG_DFL);
+ sprintf(virtmsg, VIRTMSG, b2items[virt]);
+ execlp(
+ "notify-send",
+ "notify-send",
+ "-c",
+ "virtual",
+ VIRTHEADER,
+ virtmsg,
+ (char*)0);
+ }
+ }*/
#endif
}
diff --git a/mkfile b/mkfile
index 052c9a3..f3062aa 100755
--- a/mkfile
+++ b/mkfile
@@ -23,13 +23,13 @@ TARG=rio xshove
# Bug in mk? "$L64 -lXext" gobbles the space, so
# add trailing slash.
L64=`[ -d $X11/lib64 ] && echo 64; echo`
-LDFLAGS=-L$X11/lib$L64/ -lXext -lX11 $LDFLAGS
+LDFLAGS=-L$X11/lib$L64/ -Llibnotify/ -lnotify -lXext -lX11 $LDFLAGS
<|sh mkriorules.sh
$O.rio: $RIOFILES
-CFLAGS=$CFLAGS -DSHAPE -DDEBUG_EV -DDEBUG
+CFLAGS=$CFLAGS -DSHAPE -DDEBUG_EV -DDEBUG -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include/ -I/usr/include/gdk-pixbuf-2.0/
$O.xevents: xevents.$O printevent.$O
$LD -o $target $prereq $LDFLAGS
diff --git a/ryudo.1.md b/ryudo.1.md
new file mode 100644
index 0000000..434cdb0
--- /dev/null
+++ b/ryudo.1.md
@@ -0,0 +1,75 @@
+ryudo(1) -- The floatiling window manager that flows
+===
+
+## SYNOPSIS
+
+`ryudo` [ -font FONTNAME ] [ -term TERMPROG ] [ -virtuals NUMVIRTS ] [ -ffm ] [ -version ] [ exit | restart ]
+
+## DESCRIPTION
+
+Ryudo is a window manager for X which is a fork of `rio` from `plan9port` by Russ Cox, which is itself a fork of David Hogan's `9wm`. Ryudo aims to be a more dynamic and configurable window manager while keeping most of the behavior of Rio.
+
+The `-font` option sets the font in ryudo's menu to FONTNAME, overriding the default/fallback list in the `config.h`. As in rio, this is an X11 font, not a Plan 9 font.
+
+The `-term` option sets the default terminal emulator, overriding the builtin defaults of `urxvt`, `9term`, and `xterm`.
+
+The `-virtuals` option sets the number of virtual desktops (an integer from 1 to 12). The default, and their names, is set in the `config.h`.
+
+The `-ffm` option sets the focus model to "focus-follows-mouse", instead of "click-to-focus".
+
+The `-version` option prints the current version to `stderr` and then exits.
+
+If either `exit` or `restart` is given, the appropriate message is sent to an already-running `ryudo` instance to execute the named action.
+
+## CONFIGURATION
+
+Many configuration options have been enabled as compile-time options configured in the `config.h` configuration file. The `config.def.h` file shipped with the source code documents all of the options in the comments. After changing the configuration, it is necessary to run the `build.sh` and/or `install.sh` script again and restart the program.
+
+## BUILDING AND INSTALLATION
+
+Run the provided `build.sh` and `install.sh` scripts to build and install `ryudo`. If run as root, they will install the program and manual pages to the PLAN9 installation path. If run as a regular user, they will install the program to `~/bin/9/` and not install the manual pages.
+
+Building requires `plan9port` and the `libX11` and `libXT` headers. Optionally, `libnotify` is used to show notifications when switching virtual desktops.
+
+## USAGE
+
+Right-clicking on the desktop or an inactive window opens a menu with the following options (not all enabled by default):
+
+- `New`: Create a terminal window. Press mouse button 3 where one corner of the new window's area should start, hold it down, and drag the mouse to the opposite corner. Release the button to draw the window. The new window will be made active. The terminal program is either specified by the `-term` runtime option or the first of whichever of `urxvt`, `9term`, or `xterm` is installed.
+- `Reshape`: Change the size and location of a window. Click mouse button 3 in the window to be changed, then sweep out the new window geometry as in the `New` operation. The changed window is made active.
+- `Move`: Change the location of a window. Press and hold mouse button 3 on the window to be moved, and then drag the window to its new position. The window is made active.
+- `Maximize`: Not enabled by default. Click mouse button 3 on the window to maximize, and it will fill the entire screen and be made active.
+- `Stick`: Not enabled by default. Click mouse button 3 on a window to toggle its stickiness. If sticky, it will be present on all virtual desktops. If made unsticky, the window will be restricted to the current virtual desktop.
+- `Delete`: Closes a window. Click the window to close with mouse button 3. `SIGHUP` (hangup signal) is sent to all processes in the window's process group.
+- `Hide`: Minimize a window. Click the window with mouse button 3. It will be hidden and its label truncated and appended to the menu. There is a compiled-in limit of 128 hidden windows.
+- `LABEL`: Select any label after the `Hide` option to restore it to the current virtual desktop.
+
+Windows may be arranged by dragging their borders. Mouse buttons 1 or 2 can be used to drag an individual side/corner of a window around, resizing it. Mouse button 3 can be used to move the whole window.
+
+Mouse button 2 on the desktop or an inactive window opens the virtual desktop list.
+
+Mouse button 1 focuses a window. The click is not transferred to the window (you can only interact with it once it has been made active).
+
+Alt-Tab cycles focus through all windows on the current desktop.
+
+The following operations are bindable to key combinations (shown are the default bindings):
+
+- `Launch` (Super + /): Open a new terminal in the center of the screen and make it active.
+- `Reshape` (Super + R): Initiate a reshape operation as if the `Reshape` option was selected in the menu and the currently active window selected for the operation.
+- `Move` (Super + V): Initiate a move operation as if the `Move` option was selected from the menu and the currently active window selected for the operation.
+- `Maximize` (Super + M): Maximize the currently active window.
+- `Hide` (Super + I): Minimize the currently active window.
+- `Unhide` (Super + U): Restore the most recently minimized window.
+- `Delete` (Super + D): Close the currently active window.
+- `Stick` (Super + S): Toggle stickiness of the currently active window.
+- `Zoom` (Super + Z): Toggle zoom mode. In zoom mode, the currently active window is maximized, new windows are opened maximized, and using Alt-Tab to switch to another window maximizes it.
+- `Tile Left` (Super + H): Tile the currently active window to fill the left half of the screen.
+- `Tile Right` (Super + L): Tile the currently active window to fill the right half of the screen.
+- `Tile Top` (Super + K): Tile the currently active window to fill the top half of the screen.
+- `Tile Bottom` (Super + J): Tile the currently active window to fill the bottom half of the screen.
+- `Tile Top-Left` (Super + Q): Tile the currently active window to fill the top-left quarter of the screen.
+- `Tile Bottom-Left` (Super + W): Tile the currently active window to fill the bottom-left quarter of the screen.
+- `Tile Bottom-Right` (Super + O): Tile the currently active window to fill the bottom-right quarter of the screen.
+- `Tile Top-Right` (Super + P): Tile the currently active window to fill the top-right quarter of the screen.
+- `Center` (Super + C): Center the currently active window (primary geometry preference).
+- `Center/Alternate` (Super + Shift + C): Center the currently active window (alternate geometry preference).