Skip to content

Commit 02c7ab7

Browse files
committed
Fix example conf and improve --cols error check
1 parent d7fa054 commit 02c7ab7

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ uninstall:
2929
check:
3030
flake8 libinput-gestures internal internal-test
3131
shellcheck $(SHELLCHECK_OPTS) libinput-gestures-setup list-version-hashes
32+
vermin -i -q -t 3.4 libinput-gestures
33+
vermin -i -q internal internal-test
3234

3335
doc: $(DOCOUT)
3436

libinput-gestures

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class COMMAND_internal(COMMAND):
218218
opt.add_argument('-w', '--wrap', action='store_true',
219219
help='wrap workspaces when switching to/from start/end')
220220
opt.add_argument('-c', '--cols', type=int,
221-
help='number of horizontal columns in virtual desktop grid')
221+
help='number of columns in virtual desktop grid, default=1')
222222
opt.add_argument('--row', type=int, default=0, help=argparse.SUPPRESS)
223223
opt.add_argument('--col', type=int, default=0, help=argparse.SUPPRESS)
224224
opt.add_argument('action', choices=self.commands_list,
@@ -232,17 +232,21 @@ class COMMAND_internal(COMMAND):
232232
if cmdi >= 2:
233233
if args.row or args.col:
234234
opt.error('Legacy "--row" and "--col" not supported')
235-
if not args.cols:
235+
if args.cols is None:
236236
if cmdi < 4:
237237
self.cols = 1
238238
cmdi -= 2
239239
else:
240240
opt.error('"--cols" must be specified')
241+
elif args.cols < 1:
242+
opt.error('"--cols" must be >= 1')
241243
else:
242244
self.cols = args.cols
243245
else:
244246
# Convert old legacy/depreciated arguments to new arguments
245-
if args.cols:
247+
if args.cols is not None:
248+
if args.cols < 1:
249+
opt.error('"--cols" must be >= 1')
246250
self.cols = args.cols
247251
elif args.row:
248252
cmdi += 2

libinput-gestures.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ gesture swipe right xdotool key alt+Left
104104
# gesture swipe left _internal --cols 4 ws_left
105105
# gesture swipe right _internal --cols 4 ws_right
106106
#
107-
# Example of 12 static workspaces, e.g. using KDE virtual-desktops,
107+
# Example of 16 static workspaces, e.g. using KDE virtual-desktops,
108108
# arranged in 4 rows of 4 columns across using swipe up/down/left/right
109109
# to navigate in fixed planes, and also using swipe
110110
# left_up/left_down/right_up/right_down to navigate diagonally. You can

0 commit comments

Comments
 (0)