Skip to content

Commit

Permalink
Merge pull request #18 from werererer/development
Browse files Browse the repository at this point in the history
merge: merge changes for v0.3
  • Loading branch information
werererer authored Aug 31, 2021
2 parents dd9bde5 + d8f6c20 commit 9e160c3
Show file tree
Hide file tree
Showing 128 changed files with 9,172 additions and 3,562 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ jobs:
pacman -S --noconfirm lua
pacman -S --noconfirm wayland
pacman -S --noconfirm wayland-protocols
pacman -S --noconfirm check
pacman -S --noconfirm gcovr
pacman -S --noconfirm libnotify
pacman -S --noconfirm scdoc
name: Run in container
- run: |
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Japokwm is a dynamic tiling wayland compositor where you are able to create new
- Create any layout you want with a 3 dimensional Array:
![](edit_layout.gif)
- Layout specific configs
- a client to control the windowmanager from the terminal - japokmsg based on
swaymsg
- a dwm based tagging system instead of normal(boring) workspaces

## Download
[AUR](https://aur.archlinux.org/packages/japokwm-git)
Expand All @@ -32,4 +35,4 @@ japokwm is in it's alpha stage and bugs may accour (If you find them please repo
- unittests

## Acknowledgements
japokwm forked dwl and uses wlroots to do the heavy lifting
japokwm forked dwl and uses wlroots and parts of sway to do the heavy lifting
16 changes: 10 additions & 6 deletions src/stringop.c → common/stringop.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <string.h>
#include <strings.h>
#include <wordexp.h>
#include <wlr/types/wlr_list.h>
#include "stringop.h"

static const char whitespace[] = " \f\n\r\t\v";
Expand Down Expand Up @@ -75,14 +74,13 @@ int lenient_strcmp(char *a, char *b) {
}
}

struct wlr_list split_string(const char *str, const char *delims) {
struct wlr_list res;
wlr_list_init(&res);
GPtrArray *split_string(const char *str, const char *delims) {
GPtrArray *res = g_ptr_array_new();
char *copy = strdup(str);

char *token = strtok(copy, delims);
while (token) {
wlr_list_push(&res, strdup(token));
g_ptr_array_add(res, strdup(token));
token = strtok(NULL, delims);
}
free(copy);
Expand Down Expand Up @@ -150,7 +148,6 @@ void free_argv(int argc, char **argv) {
}

int unescape_string(char *string) {
/* TODO: More C string escapes */
int len = strlen(string);
int i;
for (i = 0; string[i]; ++i) {
Expand Down Expand Up @@ -328,3 +325,10 @@ bool expand_path(char **path) {
wordfree(&p);
return true;
}

void append_string(char **dest, const char *src)
{
int len = strlen(*dest) + strlen(src) + 1;
*dest = realloc(*dest, len);
strcat(*dest, src);
}
137 changes: 68 additions & 69 deletions config/init.lua
Original file line number Diff line number Diff line change
@@ -1,84 +1,83 @@
config.create_workspaces({"0:1", "1:2", "2:3", "3:4", "4:5", "5:6", "6:7", "7:8"})

config.set_sloppy_focus(true)

local function on_start()
-- execute programs or do what ever you want e.g.:
-- action.exec("...")
-- action.exec("japokmsg 'action.create_output()'")
end

event.set_on_start_function(on_start)
-- -- eval string. Everything that will be opened after that will be moved to the
-- -- scratchpad and will be shown
-- action.scratch_show("anki")

event.add_listener("on_start", on_start)

config.set_inner_gaps(0)

local layouts = {"tile", "two_pane", "monocle", "tmp"}
local layouts = {"tmp", "two_pane", "monocle", "tile"}

config.create_layout_set("default", layouts)

config.set_default_layout(layouts[1])

local termcmd = "/usr/bin/termite"
config.set_keybinds({
{"mod-p", function() action.exec("rofi -show run") end},
{"mod-e", function() action.view(info.get_next_empty_workspace(info.get_workspace(), info.direction.right)) end},
{"mod-period", function() action.toggle_workspace() end},
{"mod-S-period", function() action.toggle_layout() end},
{"mod-S-Return", function() action.exec(termcmd) end},
{"mod-a", function() action.increase_nmaster() end},
{"mod-x", function() action.decrease_nmaster() end},
{"mod-k", function() action.focus_on_stack(-1) end},
{"mod-j", function() action.focus_on_stack(1) end},
{"mod-S-j", function() action.focus_on_hidden_stack(0) end},
{"mod-S-k", function() action.focus_on_hidden_stack(-1) end},
{"mod-S-c", function() action.kill(info.this_container_position()) end},
{"mod-S-q", function() action.quit() end},
{"mod-space", function() action.load_next_layout_in_set("default") end},
{"mod-minus", function() action.move_to_scratchpad(info.this_container_position()) end},
{"mod-S-minus", function() action.show_scratchpad() end},
{"mod-S-space", function() action.load_prev_layout_in_set("default") end},
{"mod-m", function() action.load_layout_in_set("default", 1) end},
{"mod-S-t", function() action.load_layout_in_set("default", 2) end},
{"mod-w", function() action.load_layout_in_set("default", 3) end},
{"mod-S-w", function() action.load_layout_in_set("default", 4) end},
{"mod-S-p", function() action.load_layout("tmp") end},
{"mod-b", function() action.toggle_bars() end},
{"mod-S-h", function() action.resize_main(-1/10) end},
{"mod-S-l", function() action.resize_main(1/10) end},
{"mod-S-s", function() action.write_this_overlay("tmp") end},
{"mod-Return", function() action.zoom() end},
-- {"mod-Return", function() action.repush(2, 0) end},
{"mod-1", function() action.view(0) end},
{"mod-2", function() action.view(1) end},
{"mod-3", function() action.view(2) end},
{"mod-4", function() action.view(3) end},
{"mod-5", function() action.view(4) end},
{"mod-6", function() action.view(5) end},
{"mod-7", function() action.view(6) end},
{"mod-8", function() action.view(7) end},
{"mod-9", function() action.view(8) end},
{"mod-C-1", function() action.swap_workspace(info.get_workspace(), 0) end},
{"mod-C-2", function() action.swap_workspace(info.get_workspace(), 1) end},
{"mod-C-3", function() action.swap_workspace(info.get_workspace(), 2) end},
{"mod-C-4", function() action.swap_workspace(info.get_workspace(), 3) end},
{"mod-C-5", function() action.swap_workspace(info.get_workspace(), 4) end},
{"mod-C-6", function() action.swap_workspace(info.get_workspace(), 5) end},
{"mod-C-7", function() action.swap_workspace(info.get_workspace(), 6) end},
{"mod-C-8", function() action.swap_workspace(info.get_workspace(), 7) end},
{"mod-C-9", function() action.swap_workspace(info.get_workspace(), 8) end},
{"mod-S-1", function() action.move_container_to_workspace(0) end},
{"mod-S-2", function() action.move_container_to_workspace(1) end},
{"mod-S-3", function() action.move_container_to_workspace(2) end},
{"mod-S-4", function() action.move_container_to_workspace(3) end},
{"mod-S-5", function() action.move_container_to_workspace(4) end},
{"mod-S-6", function() action.move_container_to_workspace(5) end},
{"mod-S-7", function() action.move_container_to_workspace(6) end},
{"mod-S-8", function() action.move_container_to_workspace(7) end},
{"mod-S-9", function() action.move_container_to_workspace(8) end},
{"mod-r", function() config.reload() end},
{"mod-t", function() action.set_floating(false) end},
-- {"mod-period", function() focusmon(1) end},
-- {"mod-comma", function() focusmon(-1) end},
-- {"mod-d", function() incnmaster(-1) end},
{"M1", function() action.focus_container(info.get_container_under_cursor()) end},
{"mod-M1", function() action.move_resize(info.cursor.mode.move) end},
{"mod-M2", function() action.move_resize(info.cursor.mode.resize) end},
})
-- print("execute finished")
config.bind_key("mod-p", function() action.exec("rofi -show run") end)
config.bind_key("mod-e", function() action.view(info.get_next_empty_workspace(info.get_workspace(), info.direction.right)) end)
config.bind_key("mod-period", function() action.toggle_workspace() end)
config.bind_key("mod-S-period", function() action.toggle_layout() end)
config.bind_key("mod-S-Return", function() action.exec(termcmd) end)
config.bind_key("mod-a", function() action.increase_nmaster() end)
config.bind_key("mod-x", function() action.decrease_nmaster() end)
config.bind_key("mod-k", function() action.focus_on_stack(-1) end)
config.bind_key("mod-j", function() action.focus_on_stack(1) end)
config.bind_key("mod-S-j", function() action.focus_on_hidden_stack(0) end)
config.bind_key("mod-S-k", function() action.focus_on_hidden_stack(-1) end)
config.bind_key("mod-S-c", function() action.kill(info.this_container_position()) end)
config.bind_key("mod-S-q", function() action.quit() end)
config.bind_key("mod-space", function() action.load_next_layout_in_set("default") end)
config.bind_key("mod-minus", function() action.move_to_scratchpad(info.this_container_position()) end)
config.bind_key("mod-S-minus", function() action.show_scratchpad() end)
config.bind_key("mod-S-space", function() action.load_prev_layout_in_set("default") end)
config.bind_key("mod-m", function() action.load_layout_in_set("default", 1) end)
config.bind_key("mod-S-t", function() action.load_layout_in_set("default", 2) end)
config.bind_key("mod-w", function() action.load_layout_in_set("default", 3) end)
config.bind_key("mod-S-w", function() action.load_layout_in_set("default", 4) end)
config.bind_key("mod-S-p", function() action.load_layout("tmp") end)
config.bind_key("mod-b", function() action.toggle_bars() end)
config.bind_key("mod-S-h", function() action.resize_main(-1/10) end)
config.bind_key("mod-S-l", function() action.resize_main(1/10) end)
config.bind_key("mod-S-s", function() action.write_this_overlay("tmp") end)
config.bind_key("mod-Return", function() action.zoom() end)
config.bind_key("mod-1", function() action.view(0) end)
config.bind_key("mod-2", function() action.view(1) end)
config.bind_key("mod-3", function() action.view(2) end)
config.bind_key("mod-4", function() action.view(3) end)
config.bind_key("mod-5", function() action.view(4) end)
config.bind_key("mod-6", function() action.view(5) end)
config.bind_key("mod-7", function() action.view(6) end)
config.bind_key("mod-8", function() action.view(7) end)
config.bind_key("mod-9", function() action.view(8) end)
config.bind_key("mod-C-1", function() action.tag_view(1 << 0) end)
config.bind_key("mod-C-2", function() action.tag_view(1 << 1) end)
config.bind_key("mod-C-3", function() action.tag_view(1 << 2) end)
config.bind_key("mod-C-4", function() action.tag_view(1 << 3) end)
config.bind_key("mod-C-5", function() action.tag_view(1 << 4) end)
config.bind_key("mod-C-6", function() action.tag_view(1 << 5) end)
config.bind_key("mod-C-7", function() action.tag_view(1 << 6) end)
config.bind_key("mod-C-8", function() action.tag_view(1 << 7) end)
config.bind_key("mod-C-9", function() action.tag_view(1 << 8) end)
config.bind_key("mod-S-1", function() action.move_container_to_workspace(0) end)
config.bind_key("mod-S-2", function() action.move_container_to_workspace(1) end)
config.bind_key("mod-S-3", function() action.move_container_to_workspace(2) end)
config.bind_key("mod-S-4", function() action.move_container_to_workspace(3) end)
config.bind_key("mod-S-5", function() action.move_container_to_workspace(4) end)
config.bind_key("mod-S-6", function() action.move_container_to_workspace(5) end)
config.bind_key("mod-S-7", function() action.move_container_to_workspace(6) end)
config.bind_key("mod-S-8", function() action.move_container_to_workspace(7) end)
config.bind_key("mod-S-9", function() action.move_container_to_workspace(8) end)
config.bind_key("mod-r", function() config.reload() end)
config.bind_key("mod-t", function() action.set_floating(false) end)
config.bind_key("mod-M1", function() action.move_resize(info.cursor.mode.move) end)
config.bind_key("mod-M2", function() action.move_resize(info.cursor.mode.resize) end)
config.bind_key("M1", function() action.focus_container(info.get_container_under_cursor()) end)
2 changes: 1 addition & 1 deletion config/layouts/spiral/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local layout_data = {
{0.5, 0.0, 0.5, 0.5},
{0.75, 0.5, 0.25, 0.5},
{0.5, 0.75, 0.25, 0.25},
{0.5, 0.5, 0.125, 0.25},
{0.5, 0.5, 0.125, 0.25},
{0.625, 0.5, 0.125, 0.25},
}
}
Expand Down
11 changes: 4 additions & 7 deletions config/layouts/three_columns/init.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local layout_data = {
{
{0.0, 0.0, 1, 1},
{0.0, 0.0, 1.0, 1},
},
{
{0.0, 0.0, 0.50, 1},
{0.50, 0.0, 0.5, 1},
{0.0, 0.0, 0.5, 1},
{0.5, 0.0, 0.5, 1},
},
{
{0.0, 0.0, 0.5, 1},
Expand All @@ -22,7 +22,7 @@ local layout_data = {
{0.55, 0.0, 0.225, 0.333},
{0.55, 0.333, 0.225, 0.333},
{0.55, 0.666, 0.225, 0.333},
{0.775, 0.0, 0.225, 1.0},
{0.775, 0.0, 0.225, 1},
},
{
{0.0, 0.0, 0.55, 1},
Expand All @@ -44,8 +44,5 @@ local layout_data = {
}

layout.set("three_columns", layout_data)
l.config.set_master_layout_data(
{{{0, 0, 1, 1}}, {{0, 0, 0.5, 1}, {0.5, 0, 0.5, 1}}}
)
l.config.set_resize_direction(info.direction.right)
l.config.set_hidden_edges(info.direction.all)
Loading

0 comments on commit 9e160c3

Please sign in to comment.