Skip to content

Commit c630cfb

Browse files
authored
Project restructuring foundations (#2)
* Working on argument parser & wrapper functions - remove -msse2 flag from makefile - update todo - begin work on argument parsing - add skeleton for wrapper functions - rename requests to core - rename other_requests to helpers * start working again * move src -> fluke, alterations to makefile * Started work on utilities - Move utility working, can move multiple windows by a specified offset - Templates for other utilities - The argument parsing is a bit shoddy right now, will look into using proper parser soon - Fix some stuff with Makefile & config.mk * Major restructuring, new direction for project. - removed most of the old code - simplified directory structure - updated & improved Makefile/config.mk - update README.md - add request_container.hpp - exec function - zip function - add a whole host of functions/types to main.cpp, will clean up soon - flukewm now actually runs :D * Add tinge to repo * Add xcb_keysyms to travis deps * Fix incorrect Makefile output and compile error on clang * Trying to update this shit to gcc9 * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Update README.md & continue fixing travis * Updating to gcc9 contd. * Updating to gcc9 contd. * Updating to gcc9 contd. * Code cleanup and threaded hooks - move most code in main into seperate files - hooks now run on a seperate thread - events are now handed in a blocking fashion, slightly more efficient
1 parent 5ba5eda commit c630cfb

33 files changed

+1037
-839
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@
3131
*.out
3232
*.app
3333

34+
test/
3435
build/
3536
old/
3637

38+
todo
39+
3740
massif.out*
3841
callgrind.out*
3942
cachgrind.out*
4043
perf.data*
4144
cg.out
4245
*.s
46+

.travis.yml

+55-23
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,61 @@
1-
dist: xenial
21
language: cpp
3-
compiler:
4-
- g++
5-
- clang++
2+
sudo: true
3+
dist: bionic
64

7-
addons:
8-
apt:
9-
sources:
10-
- ubuntu-toolchain-r-test
11-
packages:
12-
- libstdc++-8-dev
13-
- libx11-xcb-dev
14-
- libxcb-util-dev
15-
- libxcb-icccm4-dev
16-
- libxcb-randr0-dev
5+
script:
6+
- make
7+
8+
matrix:
9+
include:
10+
- os: linux
11+
language: cpp
12+
addons:
13+
apt:
14+
sources:
15+
- ubuntu-toolchain-r-test
16+
- sourceline: 'ppa:ubuntu-toolchain-r/test'
17+
packages:
18+
- gcc-9
19+
- g++-9
20+
- xcb
21+
- xcb-proto
22+
- libx11-dev
23+
- libx11-xcb-dev
24+
- libxcb1-dev
25+
- libxcb-util-dev
26+
- libxcb-icccm4-dev
27+
- libxcb-randr0-dev
28+
- libxcb-keysyms1-dev
29+
30+
env:
31+
- MATRIX_EVAL="CC=gcc-9 CXX=g++-9"
32+
33+
- os: linux
34+
language: cpp
35+
addons:
36+
apt:
37+
sources:
38+
- ubuntu-toolchain-r-test
39+
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
40+
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
41+
packages:
42+
- clang-9
43+
- xcb
44+
- xcb-proto
45+
- libx11-dev
46+
- libx11-xcb-dev
47+
- libxcb1-dev
48+
- libxcb-util-dev
49+
- libxcb-icccm4-dev
50+
- libxcb-randr0-dev
51+
- libxcb-keysyms1-dev
52+
53+
env:
54+
- MATRIX_EVAL="CC=clang-9 CXX=clang++-9"
1755

1856
before_install:
19-
# C++17
20-
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
21-
- sudo apt-get update -qq
57+
- eval "${MATRIX_EVAL}"
2258

2359
install:
24-
# C++17
25-
- sudo apt-get install -qq g++-8
26-
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
27-
28-
script:
29-
- make debug=yes
60+
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9
61+
- sudo update-alternatives --config gcc

Makefile

+10-34
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,25 @@
44

55
include config.mk
66

7-
SRC=main.cpp
8-
97
all: options flukewm
108

119
config:
12-
mkdir -p build/
10+
@mkdir -p $(BUILD_DIR)
1311

1412
options:
15-
@echo " \033[32;1m=>\033[39m Debug = $(debug)\033[0m"
16-
@echo " \033[32;1m=>\033[39m PGO = $(pgo)\033[0m"
17-
@echo " \033[32;1m=>\033[39m Symbols = $(symbols)\033[0m"
18-
19-
@echo "\n \033[32m=>\033[39m CXX = \033[0m$(CXX)"
20-
@echo " \033[32m=>\033[39m CXXWARN = \033[0m$(FLUKE_CXXWARN)"
21-
@echo " \033[32m=>\033[39m CXXFLAGS = \033[0m$(FLUKE_CXXFLAGS)"
22-
@echo " \033[32m=>\033[39m LDFLAGS = \033[0m$(FLUKE_LDFLAGS)"
13+
@echo " ┌\033[32m target\033[30m····\033[92;1m$(TARGET)\033[0m"
14+
@echo " ├\033[34m debug\033[30m·····\033[94;1m$(debug)\033[0m"
15+
@echo " ├\033[34m symbols\033[30m···\033[94;1m$(debug)\033[0m"
16+
@echo " ├\033[31m compiler\033[30m··\033[91m$(CXX)\033[0m"
17+
@echo " ├\033[31m warnings\033[30m··\033[91m$(PROGRAM_WARNINGS)\033[0m"
18+
@echo " └\033[31m flags\033[30m·····\033[91m$(PROGRAM_CXXFLAGS) $(PROGRAM_LDFLAGS)\033[0m"
2319

2420
flukewm: config
25-
$(CXX) -std=c++17 $(FLUKE_CXXWARN) $(FLUKE_CXXFLAGS) -o build/$@ $(SRC) $(FLUKE_LDFLAGS)
26-
@echo "$(logging)"
21+
@$(COMPILE_COMMAND)
2722

2823
clean:
29-
rm -rf build/ flukewm.tar.gz *.gcda
30-
31-
dist: clean
32-
mkdir -p flukewm-tmp/
33-
cp -Rf LICENSE README.md Makefile main.cpp src/ modules/ docs/ flukewm-tmp/
34-
tar -cf - flukewm-tmp/ | gzip > flukewm.tar.gz
35-
rm -rf flukewm-tmp/
36-
37-
@echo "\n \033[32;1m=>\033[39m Created flukewm.tar.gz\033[0m\n"
38-
39-
install: flukewm
40-
mkdir -p $(DESTDIR)$(PREFIX)/bin
41-
cp -f ./build/flukewm $(DESTDIR)$(PREFIX)/bin
42-
chmod 755 $(DESTDIR)$(PREFIX)/bin/flukewm
43-
44-
@echo "\n \033[32;1m=>\033[39m Installed flukewm to $(DESTDIR)$(PREFIX)/bin/flukewm\033[0m\n"
45-
46-
uninstall:
47-
rm -f $(DESTDIR)$(PREFIX)/bin/flukewm
24+
rm -rf $(BUILD_DIR)/ *.gcda
4825

49-
@echo "\n \033[32;1m=>\033[39m Removed flukewm\033[0m\n"
26+
.PHONY: all options clean
5027

51-
.PHONY: all options clean dist install uninstall
5228

README.md

+20-34
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
```
88

99
# fluke window manager
10-
A simple, fast and efficient window manager for X.
10+
A simple, fast and efficient window manager for X, made with C++ & XCB.
1111

1212
[![build](https://img.shields.io/travis/Jackojc/flukewm.svg?style=flat)](https://travis-ci.org/Jackojc/flukewm)
1313
![c++](https://img.shields.io/badge/c%2B%2B-%3E%3D17-blue.svg?style=flat)
@@ -16,37 +16,30 @@ A simple, fast and efficient window manager for X.
1616
[![issues](https://img.shields.io/github/issues/Jackojc/flukewm.svg?style=flat)](https://github.com/Jackojc/flukewm/issues)
1717
[![discord](https://img.shields.io/discord/537732103765229590.svg?label=discord&style=flat)](https://discord.gg/RmgjcES)
1818
### what is fluke?
19-
Fluke is designed to be a simple and fast controller for X. It can manipulate windows in various ways like resizing, moving, hiding etc. It is intended for use with a hotkey daemon like [sxhkd](https://github.com/baskerville/sxhkd). The hotkey daemon will call flukewm _as needed_ to perform various operations.
19+
Fluke is a simple (but not extremely barebones) window manager for X which uses XCB for more efficient asynchronous IO. Fluke is designed to be configured through source (á la dwm).
2020

2121
### rationale
22-
I wanted a very minimal window manager that could be scripted with ease. I spent a couple of years using [bspwm](https://github.com/baskerville/bspwm) but it felt a bit too feature rich for my needs and was required to run in the background alongside X at all times.
23-
24-
bspwm makes uses of a server/client control model with bspc which is both good and bad. It's good in that it is very easy to script and bad in that it comes at the cost of some latency and extra resource usage.
22+
I wanted a very minimal window manager that suited my workflow, had good hotplug multimonitor support and was written in something a little bit less cryptic than C. I never really found what I was looking for in other window managers and decided to give it a try myself.
2523

2624
### features
2725
> The planned features list is by no means exhaustive, it's just what I have managed to think of right now.
2826
2927
#### current
30-
- Move, resize windows
31-
- Retrieve cursor position relative to root window
32-
- Close/Kill windows
33-
34-
#### planned
35-
- Focus windows (by id, direction, monitor)
36-
- Toggle fullscreen
37-
- Add some grids/layouts
38-
- Grow/Shrink windows
39-
- Snap windows left,right,top,bottom
40-
- Center a window
41-
- Resize window to a percentage of screen size
42-
- Workspaces
28+
- Focus windows using the mouse.
29+
- Adopt orphaned windows by default (allows you to restart flukewm in the case of a crash and not lose any work.)
4330
- Window borders
44-
- Focus on cursor hover
45-
- Implement a way to update a statusbar using xsetroot (something like dwm)
46-
- Move/resize windows using the mouse
47-
- Groups (seperate from workspaces in that you hide or show them regardless of what workspace you're on)
48-
- Respect EWMH for docks, notifications etc.
49-
- Query information about various things (currently focused display, currently focused window, primary display etc.)
31+
- Hooks which run every N ms
32+
33+
#### planned/ideas
34+
- Move & resize windows
35+
- Fullscreen windows
36+
- Center windows
37+
- Window snapping
38+
- Workspaces (N per monitor)
39+
- Groups/Scratchpad (seperate from workspaces in that you hide or show them regardless of what workspace you're on)
40+
- _Basic_ EWMH support for docks, notifications, respectful closing of windows etc.
41+
- Monitor hotplug support (automatically re-adjust windows & layout, maybe a built in autorandr functionality?)
42+
- Keybindings
5043

5144
### prerequisites
5245
- Any C++17 compliant compiler should work (tested with Clang and GCC)
@@ -55,26 +48,19 @@ bspwm makes uses of a server/client control model with bspc which is both good a
5548
- `xcb-util`
5649
- `xcb-randr`
5750
- `xcb-icccm`
58-
- [hyperfine](https://github.com/sharkdp/hyperfine) (optional for benchmarking)
59-
- A running X server for fluke to communicate with
6051

6152
### build & run
62-
- Run `make debug=yes` or `make` for debug and release build respectively (uses GCC by default)
53+
- Run `make` or `make debug=no symbols=no` for debug and release build respectively (uses GCC by default)
6354
- Binary will be placed in `build/flukewm` or you can run using the symlink in the root of the project, `./flukewm`
6455

6556
### installation
66-
> Optionally configure install directory with PREFIX variable.
67-
68-
To install flukewm, simply run `make install` (you might need root).
69-
To uninstall, run `make uninstall`
70-
71-
You may also use `make dist` if you wish to package flukewm as an archive.
57+
> todo...
7258
7359
### license
7460
This project uses the GPLv2 license. (check [LICENSE.md](LICENSE.md))
7561

7662
### acknowledgements
77-
This project was inspired by:
63+
This project was inspired and helped by the source code of the following projects:
7864
- [bspwm](https://github.com/baskerville/bspwm)
7965
- [wmutils](https://github.com/wmutils/core)
8066
- [disputils](https://github.com/tudurom/disputils)

bench

-4
This file was deleted.

config.mk

+23-64
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,50 @@
1-
# options
2-
PREFIX = /usr/local
3-
MANPREFIX = $(PREFIX)/share/man
1+
SRC=main.cpp
2+
STD=c++17
43

5-
XCBINC = /usr/include/xcb/
6-
XCBLIB = /usr/lib/
4+
BUILD_DIR=build
5+
TARGET=flukewm
76

8-
PKG_CONFIG = pkg-config
97

10-
# includes and libs
11-
INCS = -I$(XCBINC) -Isrc/ -I. -Imodules/tinge/
12-
LIBS = -L$(XCBLIB) -lxcb -lxcb-util -lxcb-randr -lxcb-icccm $(LDLIBS)
8+
# Include & Link
9+
INCS=-I. -Isrc/ -Imodules/tinge/
10+
LIBS=-lxcb -lxcb-util -lxcb-randr -lxcb-icccm -lpthread $(LDLIBS)
1311

1412

15-
# preprocessor flags
16-
FLUKE_CPPFLAGS = $(CPPFLAGS)
13+
# Options
14+
PROGRAM_CPPFLAGS=$(CPPFLAGS)
15+
PROGRAM_LDFLAGS=$(LIBS) $(LDFLAGS)
1716

18-
# linker flags
19-
FLUKE_LDFLAGS = $(LIBS) $(LDFLAGS) -static-libstdc++ -static-libgcc
17+
PROGRAM_WARNINGS=-Wall -Wextra -Wmissing-include-dirs -Wsign-conversion -Wshadow -Wundef -Wno-unused $(CXXWARN)
2018

21-
# warnings
22-
FLUKE_CXXWARN = $(CXXWARN) -Wall -Wextra -Wcast-align -Wcast-qual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow=4 -Wundef -Wno-unused
2319

20+
# Make Flags
21+
debug ?= yes
22+
symbols ?= yes
2423

25-
logging =
26-
27-
28-
# optimisation flags
29-
FLUKE_CXXFLAGS = $(INCS) $(FLUKE_CPPFLAGS) $(CXXFLAGS) -m64
30-
31-
debug ?= no
3224

25+
# Debugging
3326
ifeq ($(debug),no)
34-
FLUKE_CXXFLAGS += -Ofast -march=native
35-
FLUKE_LDFLAGS += -flto
36-
37-
ifeq ($(CXX),g++)
38-
FLUKE_CXXFLAGS += -finline-limit=200 -fipa-pta -fsplit-loops -funswitch-loops -fwhole-program
39-
40-
else ifeq ($(CXX),clang++)
41-
FLUKE_CXXFLAGS += -fwhole-program-vtables -fforce-emit-vtables
42-
endif
43-
44-
pgo ?= yes
27+
symbols ?= no
28+
PROGRAM_CXXFLAGS=-O3 -march=native -flto $(CXXFLAGS)
4529

4630
else ifeq ($(debug),yes)
47-
FLUKE_CXXFLAGS += $(INCS) $(FLUKE_CPPFLAGS) $(CXXFLAGS) -Og -march=native
48-
4931
symbols ?= yes
50-
pgo ?= no
32+
PROGRAM_CXXFLAGS=-Og -march=native
5133

5234
else
5335
$(error debug should be either yes or no)
5436
endif
5537

5638

57-
58-
# debugging symbols
59-
symbols ?= no
39+
# Debugging Symbols
6040
ifeq ($(symbols),yes)
61-
FLUKE_CXXFLAGS += -g
41+
PROGRAM_CXXFLAGS += -g
42+
6243
else ifneq ($(symbols),no)
6344
$(error symbols should be either yes or no)
6445
endif
6546

6647

67-
68-
69-
# profile guided optimisation
70-
ifeq ($(pgo),yes)
71-
ifeq (,$(wildcard ./*.gcda))
72-
FLUKE_CXXFLAGS += -fprofile-generate
73-
logging += \033[32;1m=>\033[39m PGO enabled, run program and recompile.\033[0m
74-
75-
else
76-
FLUKE_CXXFLAGS += -fprofile-use
77-
logging += \033[32;1m=>\033[39m Used PGO profile.\033[0m
78-
endif
79-
80-
# compiler specific flags
81-
ifeq ($(CXX),g++)
82-
# FLUKE_CXXFLAGS +=
83-
else ifeq ($(CXX),clang++)
84-
# FLUKE_CXXFLAGS +=
85-
endif
86-
87-
88-
else ifneq ($(pgo),no)
89-
$(error pgo should be either yes or no)
90-
endif
48+
# Accumulate all flags
49+
COMPILE_COMMAND=$(CXX) $(PROGRAM_LDFLAGS) -std=$(STD) $(PROGRAM_WARNINGS) $(PROGRAM_CXXFLAGS) $(INCS) $(PROGRAM_CPPFLAGS) -o $(BUILD_DIR)/$(TARGET) $(SRC)
9150

docs/todo

-17
This file was deleted.

0 commit comments

Comments
 (0)