Browse Source

pretty much done now

naelstrof 7 years ago
parent
commit
ebd1b98f9d
5 changed files with 112 additions and 2 deletions
  1. 14
    1
      CMakeLists.txt
  2. 1
    1
      README.md
  3. 26
    0
      modules/FindXExt.cmake
  4. 71
    0
      slop.1
  5. BIN
      slop.1.gz

+ 14
- 1
CMakeLists.txt View File

@@ -9,6 +9,16 @@ project(slop)
9 9
 
10 10
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
11 11
 
12
+set( CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Directory where man pages reside. (/usr/share/man, /usr/local/share/man, etc.)" )
13
+
14
+set( CMAKE_COMPRESS_MAN TRUE CACHE BOOL "Whether or not to compress the man pages for install." )
15
+
16
+if ( CMAKE_COMPRESS_MAN )
17
+    set( MANTARGET "slop.1.gz" )
18
+else()
19
+    set( MANTARGET "slop.1" )
20
+endif()
21
+
12 22
 include_directories("${PROJECT_BINARY_DIR}")
13 23
 
14 24
 add_definitions(-DSLOP_VERSION="v5.3.21")
@@ -39,11 +49,13 @@ add_executable(${EXECUTABLE_NAME} src/options.cpp
39 49
                                   src/main.cpp)
40 50
 
41 51
 set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
52
+
42 53
 find_package(GLM REQUIRED)
43 54
 find_package(X11 REQUIRED)
44 55
 find_package(XExt REQUIRED)
45 56
 find_package(GLX REQUIRED)
46 57
 find_package(OpenGL REQUIRED)
58
+
47 59
 include_directories(${X11_INCLUDE_DIR}
48 60
                     ${GLM_INCLUDE_DIR}
49 61
                     ${XEXT_INCLUDE_DIR}
@@ -59,4 +71,5 @@ target_link_libraries(${EXECUTABLE_NAME} ${X11_LIBRARIES}
59 71
 
60 72
 install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
61 73
 install( TARGETS ${LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
62
-install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_PREFIX}/include" )
74
+install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_PREFIX}/include" COMPONENT development )
75
+install( FILES "${CMAKE_SOURCE_DIR}/${MANTARGET}" DESTINATION  "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )

+ 1
- 1
README.md View File

@@ -9,7 +9,7 @@ TODO:
9 9
 - [x] Keyboard
10 10
 - [x] Shaders
11 11
 - [x] Custom output formatting
12
-- [ ] Manpages
12
+- [x] Manpages
13 13
 - [x] Option parsing
14 14
 - [x] Highlighting
15 15
 - [x] Mouse stuff

+ 26
- 0
modules/FindXExt.cmake View File

@@ -0,0 +1,26 @@
1
+# - Find XExt
2
+# Find the XExtension libraries (WARNING: It's geared and tested specifically for the XShape extension though)
3
+#
4
+#  This module defines the following variables:
5
+#     XEXT_FOUND        - 1 if XEXT_INCLUDE_DIR & XEXT_LIBRARY are found, 0 otherwise
6
+#     XEXT_INCLUDE_DIR  - where to find Xlib.h, etc.
7
+#     XEXT_LIBRARY      - the X11 library
8
+#
9
+
10
+find_path( XEXT_INCLUDE_DIR
11
+           NAMES X11/extensions/shape.h
12
+           PATH_SUFFIXES X11/extensions
13
+           DOC "The XExtension include directory" )
14
+
15
+find_library( XEXT_LIBRARY
16
+              NAMES Xext
17
+              PATHS /usr/lib /lib
18
+              DOC "The XExtension library" )
19
+
20
+if( XEXT_INCLUDE_DIR AND XEXT_LIBRARY )
21
+    set( XEXT_FOUND 1 )
22
+else()
23
+    set( XEXT_FOUND 0 )
24
+endif()
25
+
26
+mark_as_advanced( XEXT_INCLUDE_DIR XEXT_LIBRARY )

+ 71
- 0
slop.1 View File

@@ -0,0 +1,71 @@
1
+.\" Manpage for slop.
2
+.\" Contact naelstrof@gmail.com to correct errors or typos.
3
+.TH SLOP 1 2017-03-21 Linux "slop man page"
4
+.SH NAME
5
+slop \- select operation
6
+.SH SYNOPSIS
7
+slop [OPTIONS]
8
+.SH DESCRIPTION
9
+slop is an application that queries for a selection from the user and prints the region to stdout. It grabs the mouse and turns it into a crosshair, lets the user click and drag to make a selection (or click on a window) while drawing a pretty box around it, then finally prints the selection's dimensions to stdout.
10
+.SH OPTIONS
11
+.TP
12
+.BR \-h ", " \-\-help
13
+Print help and exit.
14
+.TP
15
+.BR \-v ", " \-\-version
16
+Print version and exit.
17
+.TP
18
+.BR \-x ", " \-\-xdisplay=\fIhostname:number.screen_number\fR
19
+Sets the xdisplay to use.
20
+.TP
21
+.BR \-k ", " \-\-nokeyboard
22
+Disables the ability to cancel selections with the keyboard.
23
+.TP
24
+.BR \-b ", " \-\-bordersize=\fIFLOAT\fR
25
+Sets the selection rectangle's thickness.
26
+.TP
27
+.BR \-p ", " \-\-padding=\fIFLOAT\fR
28
+Sets the padding size for the selection, this can be negative.
29
+.TP
30
+.BR \-t ", " \-\-tolerance=\fIFLOAT\fR
31
+How far in pixels the mouse can move after clicking, and still be detected as a normal click instead of a click-and-drag. Setting this to 0 will disable window selections. Alternatively setting it to 9999999 would force a window selection.
32
+.TP
33
+.BR \-c ", " \-\-color=\fIFLOAT,FLOAT,FLOAT,FLOAT\fR
34
+Sets the selection rectangle's color. Supports RGB or RGBA input. Depending on the system's window manager/OpenGL support, the opacity may be ignored.
35
+.TP
36
+.BR \-s ", " \-\-shader=\fISTRING\fR
37
+This sets the vertex shader, and fragment shader combo to use when drawing the final framebuffer to the screen. This obviously only works when OpenGL is enabled. The shaders are loaded from ~/.config/slop. See https://github.com/naelstrof/slop for more information on how to create your own shaders.
38
+.TP
39
+.BR \-f ", " \-\-format=\fISTRING\fR
40
+Sets the output format for slop. Format specifiers are %x, %y, %w, %h, %i, and %g. If actual percentage signs are desired in output, use a double percentage sign like so `%%`.
41
+.TP
42
+.BR \-n ", " \-\-nodecorations
43
+Attempt to select child windows, instead of the surface-level windows. This will typically avoid window decorations.
44
+.TP
45
+.BR \-l ", " \-\-highlight
46
+Instead of outlining a selection, slop will highlight it instead. This is particularly useful if the color is set to an opacity lower than 1.
47
+.SH EXAMPLES
48
+To emulate a windows XP selection, you can use something like this:
49
+.PP
50
+.nf
51
+.RS
52
+slop --highlight --tolerance=0 --color=0.3,0.4,0.6,0.4
53
+.RE
54
+.fi
55
+.PP
56
+In order to avoid using
57
+.BR eval(1)
58
+in your scripts (pretty big security issue), you can use slop like this instead:
59
+.PP
60
+.nf
61
+.RS
62
+read -r X Y W H G ID < <(slop -f "%x %y %w %h %g %i")
63
+.RE
64
+.fi
65
+.PP
66
+.SH SEE ALSO
67
+.BR maim(1) 
68
+.SH BUGS
69
+No known bugs.
70
+.SH AUTHOR
71
+Dalton Nell (naelstrof@gmail.com)

BIN
slop.1.gz View File