GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - N-R-K/sxcs: Minimal X11 Color Picker and Magnifier. [MIRROR OF https://codeberg.org/NRK/sxcs]

BranchesTags
Open more actions menu

Latest commit

 

History

273 Commits
273 Commits

Folders and files

NameName
Last commit message
Last commit date
etc
etc
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
config.h
config.h
 
 
sxcs.1
sxcs.1
 
 
sxcs.c
sxcs.c
 
 

Repository files navigation

sxcs - Simple X Color Sniper

CodeBerg

Color picker and magnifier for X11.

preview

Usage

Button1 will select and print the color to stdout, the output is TAB separated hex, rgb, and hsl. Scroll Up/Down will zoom in and out. Any other mouse button will quit sxcs.

Output format can be chosen via cli argument. Zoom/magnification can be disabled via --mag-none.

$ sxcs --rgb --mag-none
rgb:	22 158 111

Copying the hex output to clipboard (using xclip):

$ sxcs -o --hex | cut -f 2 | xclip -in -selection clipboard

Color output can be disabled via --color-none, which more or less turns sxcs into a magnifier.

The magnifying window can be customized via using --mag-filters <filter-list>, where filter-list is a comma separated list of filters to apply. The filter-list will be applied in order, as given by the user.

The default filter list is the following:

$ sxcs --mag-filters "grid,icircle,xhair"

Following are a couple more examples:

$ sxcs --mag-filters "square,xhair"
square_x
$ sxcs --mag-filters "grid,xhair"
grid_x

Consult the manpage to see a list of all available cli arguments and filters:

$ man sxcs

Dependencies

  • Build Dependencies:

    • C89 compiler
    • Necessary library headers (on some distros you need to install *-dev packages to get header files)
  • Runtime Dependencies:

    • Xlib
    • Xrender
    • POSIX 2001 C standard library

Building

  • Simple build:
$ cc -o sxcs sxcs.c -O3 -s -l X11 -l Xrender

The above command should also work with gcc, clang or any other C compiler that has a POSIX compatible cli interface.

  • Debug build with gcc (also works with clang):
$ gcc -o sxcs sxcs.c -std=c89 -Wall -Wextra -Wpedantic \
    -g3 -D DEBUG -O0 -fsanitize=address,undefined -l X11 -l Xrender
  • If you're editing the code, you may optionally run some static analysis:
$ make -f etc/analyze.mk

Installing

Just copy the executable and the man-page to the appropriate location:

# cp sxcs /usr/local/bin
# cp sxcs.1 /usr/local/share/man/man1

Or using the install utility:

# install -Dm755 sxcs /usr/local/bin/sxcs
# install -Dm644 sxcs.1 /usr/local/share/man/man1/sxcs.1

A zsh completion script is also available for zsh users under etc/zsh-completion.

Limitation

Cursor size bigger than 255x255 causes visual glitches, it seems to be an inherent limitation.

One alternative would be using XComposite and using an override_redirect window. Which is what was being done (incorrectly) before commit 33490dd. I suspect doing this correctly would require way too much code, probably above my self imposed limit of ~800 SLoC for this project.

About

Minimal X11 Color Picker and Magnifier. [MIRROR OF https://codeberg.org/NRK/sxcs]

codeberg.org/NRK/sxcs

Topics

color-pickermagnifierx11zoomer

Resources

Readme
GPL-3.0 license
Activity

Stars

21 stars

Watchers

2 watching

Forks

1 fork
Report repository

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.