ViWMFS(rip)/Conf: Remove viWMFS, add cfactor_enable_split option and code cosmetic

This commit is contained in:
Martin Duquesnoy 2011-06-26 16:36:36 +02:00
parent 83c491527d
commit b47c4457f2
7 changed files with 41 additions and 194 deletions

View File

@ -247,6 +247,14 @@ cfactor_set(Client *c, Position p, int fac)
/* Arrange client and row parents */ /* Arrange client and row parents */
cfactor_arrange_row(c, gc, p, fac); cfactor_arrange_row(c, gc, p, fac);
/* Enable split with cfactor_enable_split option */
if(conf.cfactor_enable_split
&& !(tags[c->screen][c->tag].flags & SplitFlag))
{
tags[c->screen][c->tag].flags |= SplitFlag;
infobar_draw_layout(&infobar[c->screen]);
}
return; return;
} }

View File

@ -445,6 +445,7 @@ conf_layout_section(void)
conf.colors.layout_bg = getcolor((fetch_opt_first(layouts, "#000000", "bg").str)); conf.colors.layout_bg = getcolor((fetch_opt_first(layouts, "#000000", "bg").str));
conf.keep_layout_geo = fetch_opt_first(layouts, "false", "keep_layout_geo").boolean; conf.keep_layout_geo = fetch_opt_first(layouts, "false", "keep_layout_geo").boolean;
conf.selected_layout_symbol = fetch_opt_first(layouts, "*", "selected_layout_symbol").str; conf.selected_layout_symbol = fetch_opt_first(layouts, "*", "selected_layout_symbol").str;
conf.cfactor_enable_split = fetch_opt_first(layouts, "false", "cfactor_enable_split").boolean;
if((tmp = fetch_opt_first(layouts, "menu", "system").str) && !strcmp(tmp, "menu")) if((tmp = fetch_opt_first(layouts, "menu", "system").str) && !strcmp(tmp, "menu"))
conf.layout_system = True; conf.layout_system = True;

View File

@ -41,40 +41,40 @@
#define HISTOLEN 128 #define HISTOLEN 128
/* Clients flags definition */ /* Clients flags definition */
#define FreeFlag (1 << 1) #define FreeFlag 0x01
#define MaxFlag (1 << 2) #define MaxFlag 0x02
#define TileFlag (1 << 3) #define TileFlag 0x04
#define HideFlag (1 << 4) #define HideFlag 0x08
#define LMaxFlag (1 << 5) #define LMaxFlag 0x10
#define UnmapFlag (1 << 6) #define UnmapFlag 0x20
#define HintFlag (1 << 7) #define HintFlag 0x40
#define FSSFlag (1 << 8) #define FSSFlag 0x80
#define AboveFlag (1 << 9) #define AboveFlag 0x100
#define UrgentFlag (1 << 10) #define UrgentFlag 0x200
#define FLayFlag (1 << 11) #define FLayFlag 0x400
#define DockFlag (1 << 12) #define DockFlag 0x800
/* Layout flags definition */ /* Layout flags definition */
#define IntegrationFlag (1 << 1) #define IntegrationFlag 0x01
#define ArrangeFlag (1 << 2) #define ArrangeFlag 0x02
/* Tag flags definition */ /* Tag flags definition */
#define TagUrgentFlag (1 << 1) #define TagUrgentFlag 0x01
#define ResizeHintFlag (1 << 2) #define ResizeHintFlag 0x02
#define RequestUpdateFlag (1 << 3) #define RequestUpdateFlag 0x04
#define AboveFCFlag (1 << 4) #define AboveFCFlag 0x08
#define CleanFactFlag (1 << 5) #define CleanFactFlag 0x10
#define StayLastFlag (1 << 6) #define StayLastFlag 0x20
#define SplitFlag (1 << 7) #define SplitFlag 0x40
#define FirstArrangeFlag (1 << 8) #define FirstArrangeFlag 0x80
#define IgnoreEnterFlag (1 << 9) #define IgnoreEnterFlag 0x100
#define TagFlag(t) (1 << (t)) #define TagFlag(t) (1 << (t))
/* BarWindow flags definition */ /* BarWindow flags definition */
#define MappedFlag (1 << 1) #define MappedFlag 0x01
#define StippleFlag (1 << 2) #define StippleFlag 0x02
#define BordFlag (1 << 3) #define BordFlag 0x04
/* XEMBED messages */ /* XEMBED messages */
#define XEMBED_MAPPED (1 << 0) #define XEMBED_MAPPED (1 << 0)
@ -523,6 +523,7 @@ typedef struct
bool layout_system; /* Switch: False, Menu: True. */ bool layout_system; /* Switch: False, Menu: True. */
bool layout_placement; /* Right (normal): False, Left: True. */ bool layout_placement; /* Right (normal): False, Left: True. */
bool keep_layout_geo; bool keep_layout_geo;
bool cfactor_enable_split;
char *tag_expose_name; char *tag_expose_name;
char *expose_layout; char *expose_layout;
char *selected_layout_symbol; char *selected_layout_symbol;

View File

@ -1,143 +0,0 @@
/*
* viwmfs.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
static vicmd_to_uicb vicmd[] =
{
{"r", "reload"},
{"q", "quit"},
{"t", "tag"},
{"tn", "tag_next"},
{"tp", "tag_prev"},
{"l", "set_layout"},
{"layout", "set_layout"},
{"ln", "layout_next"},
{"lp", "layout_prev"},
{"s", "screen_select"},
{"screen", "screen_select"},
{"sn", "screen_next"},
{"sp", "screen_prev"},
{"cc", "client_kill"},
{"ct", "tag_transfert"},
{"ctn", "tag_transfert_next"},
{"ctp", "tag_transfert_prev"},
{"cn", "client_next"},
{"cp", "client_prev"},
{"csn", "client_swap_next"},
{"csp", "client_swap_prev"},
{"mwf", "set_mwfact"},
{"mwfact", "set_mwfact"},
{"nmaster", "set_nmaster"},
{"tm", "toggle_max"},
{"tf", "toggle_free"},
};
static void
viwmfs_help(void)
{
size_t i;
char s[20];
printf("ViWMFS commands list:\n");
for(i = 0; i < LEN(vicmd); ++i)
{
memset(s, ' ', sizeof(s));
s[15 - strlen(vicmd[i].cmd)] = '\0';
printf(" :%s%s %s\n", vicmd[i].cmd, s, vicmd[i].uicb);
}
return;
}
void
viwmfs(int argc, char **argv)
{
size_t i;
char *cmd, str[256] = { 0 };
bool e;
if(!argc)
return;
if(argc > 3)
{
for(i = 2; i < (size_t)argc; ++i)
{
strcat(str, argv[i]);
if(*(str + strlen(str) - 1) != ':')
strcat(str, " ");
}
}
else
strncpy(str, argv[2], sizeof(str));
if(!strcmp(str, "help"))
{
viwmfs_help();
return;
}
if(*str == ':')
{
for(i = 0; i < strlen(str); str[i] = str[i + 1], ++i);
cmd = xstrdup(str);
for(i = 0; cmd[i] && cmd[i] != ' '; ++i);
cmd[i] = '\0';
for(i = 0; i < LEN(vicmd); ++i)
if(!strncmp(cmd, vicmd[i].cmd, strlen(cmd)))
{
exec_uicb_function(vicmd[i].uicb, clean_value(str + strlen(cmd)));
e = True;
break;
}
/* For uicb function with normal name specified */
if(!e)
{
if(!strcmp(str, "h") || !strcmp(str, "help"))
viwmfs_help();
else
exec_uicb_function(cmd, str + strlen(cmd));
}
}
return;
}

View File

@ -456,7 +456,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i; int i;
char *ol = "csVS"; char *ol = "csS";
extern char *optarg; extern char *optarg;
extern int optind; extern int optind;
struct sigaction sa; struct sigaction sa;
@ -465,7 +465,7 @@ main(int argc, char **argv)
all_argv = argv; all_argv = argv;
sprintf(conf.confpath, "%s/"DEF_CONF, getenv("HOME")); sprintf(conf.confpath, "%s/"DEF_CONF, getenv("HOME"));
while((i = getopt(argc, argv, "hviSc:s:C:V:")) != -1) while((i = getopt(argc, argv, "hviSc:s:C:")) != -1)
{ {
/* For options who need WMFS running */ /* For options who need WMFS running */
@ -480,7 +480,6 @@ main(int argc, char **argv)
" -C <file> Load a configuration file\n" " -C <file> Load a configuration file\n"
" -c <uicb_function> <cmd> Execute an uicb function to control WMFS\n" " -c <uicb_function> <cmd> Execute an uicb function to control WMFS\n"
" -s <screen_num> <string> Set the bar(s) statustext\n" " -s <screen_num> <string> Set the bar(s) statustext\n"
" -V <viwmfs cmd> Manage WMFS with vi-like command\n"
" -S Update status script\n" " -S Update status script\n"
" -h Show this page\n" " -h Show this page\n"
" -i Show informations\n" " -i Show informations\n"
@ -522,12 +521,6 @@ main(int argc, char **argv)
XCloseDisplay(dpy); XCloseDisplay(dpy);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
case 'V':
viwmfs(argc, argv);
XCloseDisplay(dpy);
exit(EXIT_SUCCESS);
break;
} }
} }

View File

@ -422,10 +422,6 @@ void uicb_split_move_Top(uicb_t);
void uicb_split_move_Bottom(uicb_t); void uicb_split_move_Bottom(uicb_t);
/* }}} */ /* }}} */
/* viwmfs.c */
void viwmfs(int argc, char **argv);
/* wmfs.c */ /* wmfs.c */
int errorhandler(Display *d, XErrorEvent *event); int errorhandler(Display *d, XErrorEvent *event);
int errorhandlerdummy(Display *d, XErrorEvent *event); int errorhandlerdummy(Display *d, XErrorEvent *event);

15
wmfsrc
View File

@ -73,6 +73,9 @@
# Keep layout geo for free layout # Keep layout geo for free layout
keep_layout_geo = false keep_layout_geo = false
# Enable split mode with client_resize_<direction>
cfactor_enable_split = true
# Symbol displayed for the selected layout in the list # Symbol displayed for the selected layout in the list
selected_layout_symbol = "*" selected_layout_symbol = "*"
@ -308,15 +311,6 @@
prompt = "Exec: " prompt = "Exec: "
command = "exec" command = "exec"
[/set_launcher] [/set_launcher]
#ViWMFS : manage wmfs with vi-based command.
[set_launcher]
name = "viwmfs"
prompt = "> "
command = "wmfs -V"
[/set_launcher]
[/launcher]
[keys] [keys]
# Reload the configuration of wmfs. # Reload the configuration of wmfs.
[key] mod = {"Alt", "Control"} key = "r" func = "reload" [/key] [key] mod = {"Alt", "Control"} key = "r" func = "reload" [/key]
@ -388,9 +382,6 @@
#Launcher. #Launcher.
[key] mod = {"Alt"} key = "p" func = "launcher" cmd = "launcher_exec" [/key] [key] mod = {"Alt"} key = "p" func = "launcher" cmd = "launcher_exec" [/key]
#ViWMFS
[key] mod = {"Alt"} key = "Escape" func = "launcher" cmd = "viwmfs" [/key]
# Set the tag x. # Set the tag x.
[key] mod = {"Alt"} key = "F1" func = "tag" cmd = "1" [/key] [key] mod = {"Alt"} key = "F1" func = "tag" cmd = "1" [/key]
[key] mod = {"Alt"} key = "F2" func = "tag" cmd = "2" [/key] [key] mod = {"Alt"} key = "F2" func = "tag" cmd = "2" [/key]