From a16b64305282576a67ef581491fe226e5195b8b8 Mon Sep 17 00:00:00 2001 From: Yigit Colakoglu Date: Sun, 11 Apr 2021 14:55:09 +0300 Subject: [PATCH] Grabc added --- .../themes/ClearVision_v6.theme.css | 114 ---- .../themes/DarkDiscord.theme.css | 14 - .config/X11/xinitrc | 2 +- .config/dunst/dunstrc | 4 + .config/vim/after/ftplugin/tex.vim | 2 +- .config/vim/plugin/grammarous.vim | 3 +- .config/vim/plugin/lightline.vim | 178 +---- .config/vim/plugin/plugins.vim | 2 +- .local/bin/grabcolor | 10 + .local/src/build.sh | 1 + .local/src/dwm/keybind.h | 6 +- .local/src/grabc/LICENSE.txt | 19 + .local/src/grabc/Makefile | 58 ++ .local/src/grabc/README.md | 109 +++ .local/src/grabc/grabc | Bin 0 -> 18040 bytes .local/src/grabc/grabc.1 | 187 ++++++ .local/src/grabc/grabc.c | 631 ++++++++++++++++++ .local/src/grabc/grabc.o | Bin 0 -> 14424 bytes .local/src/grabc/grabc.pod | 50 ++ .local/src/grabc/install-sh | 250 +++++++ .local/src/grabc/mkinstalldirs | 40 ++ .local/src/paleofetch/config.h | 4 +- 22 files changed, 1405 insertions(+), 279 deletions(-) delete mode 100644 .config/BetterDiscord/themes/ClearVision_v6.theme.css delete mode 100644 .config/BetterDiscord/themes/DarkDiscord.theme.css create mode 100755 .local/bin/grabcolor create mode 100644 .local/src/grabc/LICENSE.txt create mode 100644 .local/src/grabc/Makefile create mode 100644 .local/src/grabc/README.md create mode 100755 .local/src/grabc/grabc create mode 100644 .local/src/grabc/grabc.1 create mode 100644 .local/src/grabc/grabc.c create mode 100644 .local/src/grabc/grabc.o create mode 100644 .local/src/grabc/grabc.pod create mode 100755 .local/src/grabc/install-sh create mode 100755 .local/src/grabc/mkinstalldirs diff --git a/.config/BetterDiscord/themes/ClearVision_v6.theme.css b/.config/BetterDiscord/themes/ClearVision_v6.theme.css deleted file mode 100644 index d98c85c4..00000000 --- a/.config/BetterDiscord/themes/ClearVision_v6.theme.css +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @name ClearVision - * @author ClearVision Team - * @version 6 - * @description Highly customizable theme for BetterDiscord. - * @source https://github.com/ClearVision/ClearVision-v6 - * @website https://clearvision.gitlab.io - * @invite 2fKpjAR - */ - -/* Credits to Zerthox for making the original theme. */ - -/* IMPORT CSS */ -@import url(https://clearvision.gitlab.io/v6/main.css); - -/* SETTINGS */ -:root { - - /* ACCENT COLORS */ - --main-color: #2780e6; /* main accent color (hex, rgb or hsl) [default: #2780e6] */ - --hover-color: #1e63b3; /* hover accent color (hex, rgb or hsl) [default: #1e63b3] */ - --success-color: #43b581; /* success accent color (hex, rgb or hsl) [default: #43b581] */ - --danger-color: #982929; /* danger accent color (hex, rgb or hsl) [default: #982929] */ - - /* Customization Patch */ - --channel-unread: var(--main-color); /* Unread Server channel color. [default: var(--main-color)] THIS OVERRIDES YOUR MAIN COLOR*/ - --channel-color: rgba(255,255,255,0.3); /*Read Server channel color [default: rgba(255,255,255,0.3);]*/ - --muted-color: rgba(255,255,255,0.1); /*Muted channel color [default: rgba(255,255,255,0.1);]*/ - --url-color: var(--main-color); /*The color of url links [default: var(--main-color)]*/ - - /* STATUS COLORS */ - --online-color: #43b581; /* online status color (hex, rgb or hsl) [default: #43b581] */ - --idle-color: #faa61a; /* idle status color (hex, rgb or hsl) [default: #faa61a] */ - --dnd-color: #982929; /* dnd status color (hex, rgb or hsl) [default: #982929] */ - --streaming-color: #593695; /* streaming status color (hex, rgb or hsl) [default: #593695] */ - --offline-color: #808080; /* offline/invisible status color (hex, rgb or hsl) [default: #808080] */ - - /* GENERAL */ - --main-font: Whitney, Helvetica Neue, Helvetica, Arial, sans-serif; /* main font for app (font must be installed) [default: Whitney, Helvetica Neue, Helvetica, Arial, sans-serif] */ - --code-font: Consolas, Liberation Mono, Menlo, Courier, monospace; /* font for codeblocks (font must be installed) [default: Consolas, Liberation Mono, Menlo, Courier, monospace] */ - --server-columns: 1; /* amount of server list columns [default: 1] */ - --channels-width: 220px; /* channel list width (240px for Discord default) [default: 220px] */ - --members-width: 240px; /* member list width [default: 240px] */ - --avatar-roundness: 50%; /* avatar roundness (0% for squares, 50% for circles) [default: 50%] */ - - /* APP BACKGROUND */ - --background-shading: 100%; /* app background shading (0 for complete smoothness) [default: 100%] */ - --background-overlay: rgba(0, 0, 0, 0.6); /* app background overlay color/gradient [default: rgba(0, 0, 0, 0.6)] */ - --background-image: url(https://clearvision.gitlab.io/images/sapphire.jpg); /* app background image (link must be HTTPS) [default: url(https://clearvision.gitlab.io/images/sapphire.jpg)]*/ - --background-position: center; /* app background position [default: center] */ - --background-size: cover; /* app background size [default: cover] */ - --background-repeat: no-repeat; /* app background repeat [default: no-repeat] */ - --background-attachment: fixed; /* app background attachment [default: fixed] */ - --background-brightness: 100%; /* app background brightness (< 100% for darken, > 100% for lighten) [default: 100%] */ - --background-contrast: 100%; /* app background contrast [default: 100%] */ - --background-saturation: 100%; /* app background saturation [default: 100%] */ - --background-invert: 0%; /* app background invert (0 - 100%) [default: 0%] */ - --background-grayscale: 0%; /* app background grayscale ( 0 - 100%) [default: 0%] */ - --background-sepia: 0%; /* app background sepia (0 - 100%) [default: 0%] */ - --background-blur: 0px; /* app background blur [default: 0px] */ - - /* HOME BUTTON ICON */ - --home-icon: url(https://clearvision.gitlab.io/icons/discord.svg); /* home button icon (link must be HTTPS) [default: url(https://clearvision.gitlab.io/icons/discord.svg)]*/ - --home-position: center; /* home button icon position [default: center] */ - --home-size: 40px; /* home button icon size [default: 40px] */ - - /* MODAL BACKDROP */ - --backdrop-overlay: rgba(0, 0, 0, 0.8); /* modal backdrop overlay color/gradient [default: rgba(0, 0, 0, 0.8)] */ - --backdrop-image: var(--background-image); /* modal backdrop image (link must be HTTPS) [default: var(---background-image)] */ - --backdrop-position: var(--background-position); /* modal backdrop position [default: var(---background-position)] */ - --backdrop-size: var(--background-size); /* modal backdrop size [default: var(---background-size)] */ - --backdrop-repeat: var(--background-repeat); /* modal backdrop repeat [default: var(---background-repeat)] */ - --backdrop-attachment: var(--background-attachment); /* modal backdrop attachment [default: var(--background-attachment)] */ - --backdrop-brightness: var(--background-brightness); /* modal backdrop brightness (< 100% for darken, > 100% for lighten) [default: var(---background-brightness)] */ - --backdrop-contrast: var(--background-contrast); /* modal backdrop contrast [default: var(---background-contrast)] */ - --backdrop-saturation: var(--background-saturation); /* modal backdrop saturation [default: var(---background-saturation)] */ - --backdrop-invert: var(--background-invert); /* modal backdrop invert (0 - 100%) [default: var(---background-invert)] */ - --backdrop-grayscale: var(--background-grayscale); /* modal backdrop grayscale ( 0 - 100%) [default: var(---background-grayscale)] */ - --backdrop-sepia: var(--background-sepia); /* modal backdrop sepia (0 - 100%) [default: var(---background-sepia)] */ - --backdrop-blur: var(--background-blur); /* modal backdrop blur [default: var(--background-blur)] */ - - /* USER POPOUT BACKGROUND */ - --user-popout-image: var(--background-image); /* app background image (link must be HTTPS) [default: var(---background-image)] */ - --user-popout-position: var(--background-position); /* user popout background position [default: var(---background-position)] */ - --user-popout-size: var(--background-size); /* user popout background size [default: var(---background-size)] */ - --user-popout-repeat: var(--background-repeat); /* user popout background repeat [default: var(---background-repeat)] */ - --user-popout-attachment: var(--background-attachment); /* user popout background attachment [default: var(--background-attachment)] */ - --user-popout-brightness: var(--background-brightness); /* user popout background brightness (< 100% for darken, > 100% for lighten) [default: var(---background-brightness)] */ - --user-popout-contrast: var(--background-contrast); /* user popout background contrast [default: var(---background-contrast)] */ - --user-popout-saturation: var(--background-saturation); /* user popout background saturation [default: var(---background-saturation)] */ - --user-popout-invert: var(--background-invert); /* user popout background invert (0 - 100%) [default: var(---background-invert)] */ - --user-popout-grayscale: var(--background-grayscale); /* user popout background grayscale (0 - 100%) [default: var(---background-grayscale)] */ - --user-popout-sepia: var(--background-sepia); /* user popout background sepia (0 - 100%) [default: var(---background-sepia)] */ - --user-popout-blur: calc(var(--background-blur) + 3px); /* user popout background blur [default: calc(var(--background-blur) + 3px)] */ - - /* USER MODAL BACKGROUND */ - --user-modal-image: var(--background-image); /* app background image (link must be HTTPS) [default: var(---background-image)] */ - --user-modal-position: var(--background-position); /* user modal background position [default: var(---background-position)] */ - --user-modal-size: var(--background-size); /* user modal background size [default: var(---background-size)] */ - --user-modal-repeat: var(--background-repeat); /* user modal background repeat [default: var(---background-repeat)] */ - --user-modal-attachment: var(--background-attachment); /* user modal background attachment [default: var(--background-attachment)] */ - --user-modal-brightness: var(--background-brightness); /* user modal background brightness (< 100% for darken, > 100% for lighten) [default: var(---background-brightness)] */ - --user-modal-contrast: var(--background-contrast); /* user modal background contrast [default: var(---background-contrast)] */ - --user-modal-saturation: var(--background-saturation); /* user modal background saturation [default: var(---background-saturation)] */ - --user-modal-invert: var(--background-invert); /* user modal background invert (0 - 100%) [default: var(---background-invert)] */ - --user-modal-grayscale: var(--background-grayscale); /* user modal background grayscale (0 - 100%) [default: var(---background-grayscale)] */ - --user-modal-sepia: var(--background-sepia); /* user modal background sepia (0 - 100%) [default: var(---background-sepia)] */ - --user-modal-blur: calc(var(--background-blur) + 3px); /* user modal background blur [default: calc(var(--background-blur) + 3px)] */ - - /* THEME BD COLORS */ - --bd-blue: var(--main-color); /* betterdiscord main color [default: var(--main-color)] */ - --bd-blue-hover: var(--hover-color); /* betterdiscord hover color [default: var(--hover-color)] */ - --bd-blue-active: var(--hover-color); /* betterdiscord active color [default: var(--hover-color)] */ -} diff --git a/.config/BetterDiscord/themes/DarkDiscord.theme.css b/.config/BetterDiscord/themes/DarkDiscord.theme.css deleted file mode 100644 index 80cd338c..00000000 --- a/.config/BetterDiscord/themes/DarkDiscord.theme.css +++ /dev/null @@ -1,14 +0,0 @@ -/** - - * @name Dark Discord - * @version 1.0 - * @description An actual dark mode for discord. - * @source https://github.com/zzzmario/dark-discord - * @authorId 583062692596547585 - * @author mario - * @donate https://paypal.me/zzzmario - * @invite 7JceW7S - -**/ - -@import url(https://zzzmario.github.io/dark-discord/src/source.css); diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc index 1de29bd6..fd22ec2a 100755 --- a/.config/X11/xinitrc +++ b/.config/X11/xinitrc @@ -65,7 +65,7 @@ xset dpms 600 600 600 $BROWSER & -pass 2> /dev/null > /dev/null && qtpass & +#pass 2> /dev/null > /dev/null && qtpass & redshift -x 2> /dev/null > /dev/null redshift -r -l "$LATLONG" > /dev/null 2> /dev/null & diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index 2be729b4..7ebea28b 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -82,4 +82,8 @@ [keyboard] appname =  Keyboard history_ignore = yes + +[color] + appname =  Color Grabbed + history_ignore = yes # vim: ft=cfg diff --git a/.config/vim/after/ftplugin/tex.vim b/.config/vim/after/ftplugin/tex.vim index baf8ff01..453311fa 100644 --- a/.config/vim/after/ftplugin/tex.vim +++ b/.config/vim/after/ftplugin/tex.vim @@ -1,3 +1,3 @@ setlocal wrap linebreak nolist -autocmd BufWritePost *.tex :GrammarousCheck +autocmd BufWritePost *.tex :GrammarousCheck --lang=en-GB diff --git a/.config/vim/plugin/grammarous.vim b/.config/vim/plugin/grammarous.vim index 1a92758b..1d0b0f23 100644 --- a/.config/vim/plugin/grammarous.vim +++ b/.config/vim/plugin/grammarous.vim @@ -3,7 +3,7 @@ let g:grammarous#default_comments_only_filetypes = { \ '*' : 1, 'help' : 0, 'markdown' : 0, 'tex': 0, \ } -let g:grammarous#enabled_categories = {'tex' : ['PUNCTUATION', +let g:grammarous#enabled_categories = {'*' : ['PUNCTUATION', \'COLLOQUIALISMS', 'COMPOUNDING', 'CONFUSED_WORDS', 'FALSE_FRIENDS', \ 'GENDER_NEUTRALITY', 'GRAMMAR', 'MISC', 'PLAIN_ENGLISH', \ 'PUNCTUATION', 'REDUNDANCY', 'REGIONALISMS', 'REPETITIONS', @@ -13,3 +13,4 @@ let g:grammarous#enabled_categories = {'tex' : ['PUNCTUATION', \ 'GENDER_NEUTRALITY', 'GRAMMAR', 'MISC', 'PLAIN_ENGLISH', \ 'PUNCTUATION', 'REDUNDANCY', 'REGIONALISMS', 'REPETITIONS', \ 'SEMANTICS', 'STYLE', 'TYPOGRAPHY',]} + diff --git a/.config/vim/plugin/lightline.vim b/.config/vim/plugin/lightline.vim index c866ddae..002142bb 100644 --- a/.config/vim/plugin/lightline.vim +++ b/.config/vim/plugin/lightline.vim @@ -1,161 +1,53 @@ let g:lightline = { \ 'colorscheme': 'material_vim', \ 'active': { +\ 'right': [ [ 'lineinfo' ], [ 'percent', 'wordcount' ], [ 'fileformat', 'fileencoding', 'filetype' ] ], \ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'filename', 'modified' ] ], -\ 'right':[[ 'filetype', 'percent', 'lineinfo' ], [ 'cocstatus' ]] +\ }, +\ 'component_function': { +\ 'wordcount': 'WordCount', \ }, \ 'tabline': { -\ 'left': [['explorer_pad'], ['buffers']], -\ 'right': [['gitbranch', 'smarttabs']] +\ 'left': [ ['buffers'] ], +\ 'right': [ ['close'] ], \ }, \ 'component_expand': { -\ 'buffers': 'lightline#bufferline#buffers', -\ 'smarttabs': 'SmartTabsIndicator', -\ 'trailing': 'lightline#trailing_whitespace#component' -\ }, -\ 'component_function': { -\ 'explorer_pad': 'lightline#explorer_pad#left_pad', -\ 'percent': 'LightlinePercent', -\ 'lineinfo': 'LightlineLineinfo', -\ 'filename': 'LightlineFilename', -\ 'fullname': 'LightlineFullname', -\ 'mode': 'LightlineMode', -\ 'gitbranch': 'LightlineGitbranch', -\ 'readonly': 'LightlineReadonly', -\ 'modified': 'LightlineModified', -\ 'filetype': 'LightlineFiletype', -\ 'cocstatus': 'LightlineCoc', +\ 'buffers': 'lightline#bufferline#buffers', \ }, \ 'component_type': { -\ 'buffers': 'tabsel', -\ 'trailing': 'warning' -\ }, +\ 'buffers': 'tabsel', +\ } \ } -function! s:trim(maxlen, str) abort - let trimed = len(a:str) > a:maxlen ? a:str[0:a:maxlen] . '..' : a:str - return trimed -endfunction - -function! LightlineCoc() abort - if winwidth(0) < 60 - return '' - endif - - return coc#status() -endfunction - -function! LightlinePercent() abort - if winwidth(0) < 60 - return '' - endif - - let l:percent = line('.') * 100 / line('$') . '%' - return printf('%-4s', l:percent) -endfunction - -function! LightlineLineinfo() abort - if winwidth(0) < 86 - return '' - endif - - let l:current_line = printf('%-3s', line('.')) - let l:max_line = printf('%-3s', line('$')) - let l:lineinfo = ' ' . l:current_line . '/' . l:max_line - return l:lineinfo -endfunction - -function! LightlineFilename() abort - let l:prefix = expand('%:p') =~? "fugitive://" ? '(fugitive) ' : '' - let l:maxlen = winwidth(0) - winwidth(0) / 2 - let l:relative = expand('%:.') - let l:tail = expand('%:t') - let l:noname = 'No Name' - - if winwidth(0) < 50 - return '' +function! WordCount() + let currentmode = mode() + if !exists("g:lastmode_wc") + let g:lastmode_wc = currentmode endif - - if winwidth(0) < 86 - return l:tail ==# '' ? l:noname : l:prefix . s:trim(l:maxlen, l:tail) + " if we modify file, open a new buffer, be in visual ever, or switch modes + " since last run, we recompute. + if &modified || !exists("b:wordcount") || currentmode =~? '\c.*v' || currentmode != g:lastmode_wc + let g:lastmode_wc = currentmode + let l:old_position = getpos('.') + let l:old_status = v:statusmsg + execute "silent normal g\" + if v:statusmsg == "--No lines in buffer--" + let b:wordcount = 0 + else + let s:split_wc = split(v:statusmsg) + if index(s:split_wc, "Selected") < 0 + let b:wordcount = str2nr(s:split_wc[11]) + else + let b:wordcount = str2nr(s:split_wc[5]) + endif + let v:statusmsg = l:old_status + endif + call setpos('.', l:old_position) + return b:wordcount + else + return b:wordcount endif - - return l:relative ==# '' ? l:noname : l:prefix . s:trim(l:maxlen, l:relative) -endfunction - -function! LightlineFullname() abort - let l:relative = expand('%') - - return l:relative -endfunction - -function! LightlineModified() abort - return &modified ? '*' : '' -endfunction - -function! LightlineMode() abort - let ftmap = { - \ 'coc-explorer': 'EXPLORER', - \ 'fugitive': 'FUGITIVE', - \ 'vista': 'OUTLINE' - \ } - return get(ftmap, &filetype, lightline#mode()) -endfunction -let g:lightline.component_function = { 'lineinfo': 'LightlineLineinfo' } - -function! LightlineLineinfo() abort - if winwidth(0) < 86 - return '' - endif - - let l:current_line = printf('%-3s', line('.')) - let l:max_line = printf('%-3s', line('$')) - let l:lineinfo = ' ' . l:current_line . '/' . l:max_line - return l:lineinfo -endfunction - -function! LightlineReadonly() abort - let ftmap = { - \ 'coc-explorer': '', - \ 'fugitive': '', - \ 'vista': '' - \ } - let l:char = get(ftmap, &filetype, '') - return &readonly ? l:char : '' -endfunction - -function! LightlineGitbranch() abort - if exists('*fugitive#head') - let maxlen = 20 - let branch = fugitive#head() - return branch !=# '' ? ' '. s:trim(maxlen, branch) : '' - endif - return fugitive#head() -endfunction - -function! LightlineFiletype() abort - let l:icon = WebDevIconsGetFileTypeSymbol() - return winwidth(0) > 86 ? (strlen(&filetype) ? &filetype . ' ' . l:icon : l:icon) : '' -endfunction - -function! String2() - return 'BUFFERS' -endfunction - -function! SmartTabsIndicator() abort - let tabs = lightline#tab#tabnum(tabpagenr()) - let tab_total = tabpagenr('$') - return tabpagenr('$') > 1 ? ('TABS ' . tabs . '/' . tab_total) : '' -endfunction - -" autoreload -command! LightlineReload call LightlineReload() - -function! LightlineReload() abort - call lightline#init() - call lightline#colorscheme() - call lightline#update() endfunction let g:lightline#trailing_whitespace#indicator = '' diff --git a/.config/vim/plugin/plugins.vim b/.config/vim/plugin/plugins.vim index cd20626c..b37db88a 100644 --- a/.config/vim/plugin/plugins.vim +++ b/.config/vim/plugin/plugins.vim @@ -24,7 +24,7 @@ Plug 'farmergreg/vim-lastplace' Plug 'jlanzarotta/bufexplorer' Plug 'jeffkreeftmeijer/vim-numbertoggle' Plug 'rhysd/vim-grammarous' - +Plug 'chrisbra/NrrwRgn' "Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } Plug 'sheerun/vim-polyglot' Plug 'M4R7iNP/vim-inky' diff --git a/.local/bin/grabcolor b/.local/bin/grabcolor new file mode 100755 index 00000000..2d25d3d4 --- /dev/null +++ b/.local/bin/grabcolor @@ -0,0 +1,10 @@ +#!/bin/sh + +# This script uses grabc (https://github.com/muquit/grabc) to grab +# a pixel from your screen and copy its value to clipboard + +color=$(grabc) + +printf "%s" "$color" | xclip -selection clipboard + +notify-send -h "string:fgcolor:$color" -a " Color Grabbed" "$color" diff --git a/.local/src/build.sh b/.local/src/build.sh index 42d41464..9be6ace8 100755 --- a/.local/src/build.sh +++ b/.local/src/build.sh @@ -3,6 +3,7 @@ for d in */ ; do echo "Building in $d" cd $d + make sudo make install if [ $? -ne 0 ]; then echo "An error occured..." diff --git a/.local/src/dwm/keybind.h b/.local/src/dwm/keybind.h index 74433cc2..0e9f5a83 100644 --- a/.local/src/dwm/keybind.h +++ b/.local/src/dwm/keybind.h @@ -47,6 +47,7 @@ static const char *bwmenu[] = {"/home/yigit/.local/bin/password_manager", NULL}; static const char *wallabag[] = {"/home/yigit/.local/bin/dmenu-wallabag", "-s", NULL}; static const char *wiki[] = {"/home/yigit/.local/bin/dmenu-arch", NULL}; +static const char *grabcolor[] = {"/home/yigit/.local/bin/grabcolor", NULL}; static const char *network_manager[] = {"/home/yigit/.local/bin/connman_dmenu", NULL}; static const char *killall[] = {"/home/yigit/.local/bin/dmenu-killall", NULL}; static const char *mconnect[] = {"/home/yigit/.local/bin/dmenu-mconnect"}; @@ -73,8 +74,8 @@ static Key keys[] = { { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY|ShiftMask, XK_i, spawn, {.v = screensaver} }, { MODKEY|ShiftMask, XK_n, spawn, {.v = notification } }, - { MODKEY, XK_Right, setmfact, {.f = +0.05} }, - { MODKEY, XK_Left, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_Down, setcfact, {.f = -0.25} }, { MODKEY, XK_Up, setcfact, {.f = +0.25} }, { MODKEY|ShiftMask, XK_z, zoom, {0} }, @@ -143,6 +144,7 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_d, spawn, {.v = udevil} }, { MODKEY|ShiftMask, XK_u, spawn, {.v = udevil_umount} }, { MODKEY, XK_y, spawn, {.v = youtube} }, + { MODKEY|ShiftMask, XK_g, spawn, {.v = grabcolor} }, { MODKEY, XK_s, togglescratch, {.ui = 0 } }, { MODKEY|ShiftMask, XK_s, togglescratch, {.ui = 1 } }, { MODKEY, XK_m, togglescratch, {.ui = 2 } }, diff --git a/.local/src/grabc/LICENSE.txt b/.local/src/grabc/LICENSE.txt new file mode 100644 index 00000000..d526b8e2 --- /dev/null +++ b/.local/src/grabc/LICENSE.txt @@ -0,0 +1,19 @@ +License is MIT + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/.local/src/grabc/Makefile b/.local/src/grabc/Makefile new file mode 100644 index 00000000..5de8e528 --- /dev/null +++ b/.local/src/grabc/Makefile @@ -0,0 +1,58 @@ +## +# Makefile automatically generated by genmake 1.0, Mar-16-97 +# genmake 1.0 by ma_muquit@fccc.edu, RCS +## +CC= cc +DEFS= +PROGNAME= grabc +LIBS= -L/usr/X11R6/lib -lX11 + +INCLUDES= -I. +cp=/bin/cp -fv +DESTDIR = +binary=./grabc +manpage=./grabc.1 +bindir=/usr/local/bin +mandir=/usr/local/share/man/man1 + +# replace -O with -g in order to debug + +DEFINES= $(INCLUDES) $(DEFS) -D__USE_FIXED_PROTOTYPES__ -DSYS_UNIX=1 +CFLAGS= -O $(DEFINES) + +SRCS = grabc.c + +OBJS = grabc.o + +.c.o: + rm -f $@ + $(CC) $(CFLAGS) -c $*.c + +all: $(PROGNAME) + +$(PROGNAME) : $(OBJS) + $(CC) $(CFLAGS) -o $(PROGNAME) $(OBJS) $(LIBS) + +doc: + pod2man grabc.pod > grabc.1 + +install: installdirs install-bin install-man + +install-bin: + ${cp} ${binary} ${DESTDIR}${bindir} + +installdirs: + $(SHELL) ./mkinstalldirs ${DESTDIR}${bindir} + $(SHELL) ./mkinstalldirs ${DESTDIR}${mandir} + +install-man: + ${cp} ${manpage} ${DESTDIR}${mandir} + +deb: + /bin/rm -f *.deb + /bin/rm -rf /tmp/grabc + make DESTDIR=/tmp/grabc install + fpm -s dir -t deb -C /tmp/grabc --name grabc --version 1.0.2 --iteration 1 --description "A program to id entify a pixel color on an X Window" + /bin/rm -rf /tmp/grabc +clean: + rm -f $(OBJS) $(PROGNAME) core *.deb diff --git a/.local/src/grabc/README.md b/.local/src/grabc/README.md new file mode 100644 index 00000000..165dae5e --- /dev/null +++ b/.local/src/grabc/README.md @@ -0,0 +1,109 @@ +# grabc +A command line tool to identify a pixel color on an X Window. + +When this program is run, the mouse pointer is grabbed and changed to +a cross hair and when the mouse is clicked, the color of the clicked +pixel is written to stdout in hex prefixed with # + +This program can be useful when you see a color and want to use the +color in xterm or your window manager's border but no clue what the +name of the color is. It's silly to use a image processing software +to find it out. (That's how I described it 20 years ago, so keeping it +this way for historical reasons - Apr-11-2018). + +# Synopsis + +``` +grabc v1.0.2 +A program to identify a pixel color of an X Window +by muquit@muquit.com https://www.muquit.com/ + +Usage: grabc [options] +Where the options are: + -v - show version info + -h - show this usage + -hex - print pixel value as Hex on stdout + -rgb - print pixel value as RGB on stderr + -W - print the Window id at mouse click + -w id - window id in hex, use with -l +x+y + -l +x+y - pixel co-ordinate. requires window id + -d - show debug messages + -a - Print all 16 bits of color. Default is high order 8 bits +Example: +* Print pixel color in hex on stdout: + $ grabc +* Show usage: + $ grabc -h +* Print Window Id (Note the upper case W): + $ grabc -W +* Print pixel color of Window with id 0x13234 at location 10,20 + $ grabc -w 0x13234 -l +10+20 +``` + +# How to compile +Older version of this program is available on Ubuntu. However, if you need to get the latest version, you have to compile it yourself. + +* You will need ```libx11-dev``` package if you are on Ubuntu. +``` + sudo apt-get -y install libx11-dev +``` +* To compile, at the shell prompt, type: +``` + make +``` + +* To install, at the shell prompt, type: +``` + sudo make install +``` +The binary *grabc* will be install in /usr/local/bin/ and the man page *grabc.1* +will be installed in /usr/local/share/man/man1/ + +If you want to install it in some other directory: +``` + make DESTDIR=/tmp/grabc install +``` + +* If you want to create a debian package, install [fpm](https://github.com/jordansissel/fpm) first, then type: +``` + make deb +``` + +* Install the debian package: +``` + sudo dpkg -i ./grabc_1.0.2-1_amd64.deb +``` + +* To uninstall the debian package: +``` + sudo dpkg -r grabc +``` + +# Know Issues + +* If color grabbed from root window, it might always show #000000 (Depending +on the Window Manager in use) + + +# ChangeLog + +# v1.0.2 + * Was not working properly on Ubuntu Terminal. It was using default Colormap. Do not use default colormap, rather get it from window attributes. + * If could not get XImage from target window, it is probably root window, + so try to grab it from there. +* Added some options +* Color can be grabbed from a specific location + +* Change Copyright to MIT from GNU GPL + +(Apr-10-2018) + +# v1.0.1 +* first cut + +(march-16-1997) + + +# License + +MIT diff --git a/.local/src/grabc/grabc b/.local/src/grabc/grabc new file mode 100755 index 0000000000000000000000000000000000000000..4962cc06747fd18885e781421ed66c42cb4e20da GIT binary patch literal 18040 zcmeHP3vgT2nLhF(m^>^8LYf2uH;F=>haEewI&KV-BPZ8XN!-LHrU4XLl5K%(3F#`f zvzgZ5IE(5SGF|AhU1lfjb|Kx;Hrs7O2wQM!NZM}OO@X%IQE(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p&lb?&i zA*;=>f^$e-Y`g?6I>ux@MP+Is>bmmalEr)*`krWce$FW8jMjz;&RnU3NI7O&#TvCZ zK}83na#F<^ryR)Z#bGklJ?WI$pE){~dp;`1l=;AxI8>FB%qru3U52j>6sNE_?Nl*- z8Z62x`JB_yov6fq9hT*dJ`>cI2;l%M2Ck5D)i+kqtW-(joj#lcs|@sYBMU)|m`IVE zo;i#cX|Z6~M+!0)4I8YIw@sxH>_wbrBcw%mZ>ze2qHX?4Rg2y46V^9 zeYGy5s9Opv|COAgpGG>Z`6ynk`zWe@hgq@JRDZ%HYGTFkRYEc)vI zO(?oByC5lyD1Bw}D;9nAJ44ZFN>Ea3|Nl3suj-#^QczNZ8qO3{{VV7RM5z2qU;Um` z)T0C?wdVg_i~h(*gi-;AcS*@=K}VFLq?(1Nbr!Ov{8zstMx_1@i@avxr^)=KyV+Ew zZ~d)7zEUt#)%Qe-xSx{wACeVM&mjjcRc. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "GRABC 1" +.TH GRABC 1 "2018-04-16" "perl v5.22.1" "User Contributed Perl Documentation" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +grabc \- A tool to identify a pixel color of an X Window. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 3 +\& grabc v1.0.2 +\& A program to identify a pixel color of an X Window +\& by muquit@muquit.com https://www.muquit.com/ +\& +\& Usage: grabc [options] +\& Where the options are: +\& \-v \- show version info +\& \-h \- show this usage +\& \-hex \- print pixel value as Hex on stdout +\& \-rgb \- print pixel value as RGB on stderr +\& \-W \- print the Window id at mouse click +\& \-w id \- window id in hex, use \-l +x+y +\& \-l +x+y \- pixel co\-ordinate. requires window id +\& \-d \- show debug messages +\& \-a \- Print all 16 bits of color. Default is high order 8 bits +\& Example: +\& * Print pixel color in hex on stdout: +\& $ grabc +\& * Show usage: +\& $ grabc \-h +\& * Print Window Id (Note the upper case W): +\& $ grabc \-W +\& * Print pixel color of Window iwith id 0x13234 at location 10,20 +\& $ grabc \-w 0x13234 \-l +10+20 +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +grabc is a simple but very useful program to determine the color string in +hex (or in \s-1RGB\s0 components) by clicking on a pixel on the screen. While web +browsing, lots of time you find a nice color and wonder what color is that. +Well just use grabc! +.PP +When this program is run, the mouse pointer is grabbed and changed to a +cross hair and when the mouse is clicked, the color of the clicked pixel +is written to stdout in hex prefixed with #. +.SH "LICENSE" +.IX Header "LICENSE" +\&\s-1MIT\s0 +.SH "AUTHOR" +.IX Header "AUTHOR" +grabc is written by Muhammad Muquit . +Homepage: . diff --git a/.local/src/grabc/grabc.c b/.local/src/grabc/grabc.c new file mode 100644 index 00000000..91a5ec08 --- /dev/null +++ b/.local/src/grabc/grabc.c @@ -0,0 +1,631 @@ +/* A program to pick a color by clicking the mouse. + * + * RCS: + * $Revision$ + * $Date$ + * + * Description: + * + * When this program is run, the mouse pointer is grabbed and changed to + * a cross hair and when the mouse is clicked, the color of the clicked + * pixel is written to stdout in hex prefixed with # + * + * This program can be useful when you see a color and want to use the + * color in xterm or your window manager's border but no clue what the + * name of the color is. It's silly to use a image processing software + * to find it out. + * + * Example: + * xterm -bg `grabc` -fg `grabc` (silly but esoteric!) + * + * Development History: + * who when why + * ma_muquit@fccc.edu march-16-1997 first cut + * muquit@muquit.com Apr-10-2018 Do not use default colormap, + * rather get it from window attributes. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef True +#define True 1 +#endif + +#ifndef False +#define False 0 +#endif + +#define VERSION_S "1.0.2" + +static int g_debug = False; +static int g_print_in_hex = True; +static int g_print_in_rgb = False; +static int g_print_all_16_bits = False; +static Window g_window_id = (Window) NULL; +static int g_loc_specified = False; +static int g_x = 1; +static int g_y = 1; +static unsigned int g_width = 0; +static unsigned int g_height = 0; +static Cursor g_cross_cursor=(Cursor) NULL; + +/* private function prototypes */ +static Window select_window (Display *,int *x,int *y); + +static Window findSubWindow(Display *display,Window top_winodw, + Window window_to_check,int *x,int *y); + +static Window get_window_color(Display *display,XColor *color); +static int MXError(Display *display,XErrorEvent *error); + +static void show_usage(void) +{ + char + **p; + + static char *options[]= + { +" -v - show version info", +" -h - show this usage", +" -hex - print pixel value as Hex on stdout", +" -rgb - print pixel value as RGB on stderr", +" -W - print the Window id at mouse click", +" -w id - window id in hex, use -l +x+y", +" -l +x+y - pixel co-ordinate. requires window id", +" -d - show debug messages", +" -a - Print all 16 bits RGB components of color", +" Default is high order 8 bits of components", +"Example:", +"* Print pixel color in hex on stdout:", +" $ grabc", +"* Show usage:", +" $ grabc -h", +"* Print Window Id (Note the upper case W):", +" $ grabc -W", +"* Print pixel color of Window iwith id 0x13234 at location 10,20", +" $ grabc -w 0x13234 -l +10+20", +(char *) NULL + + }; + + (void) printf("\n"); + (void) printf("grabc v%s\n",VERSION_S); + (void) printf("A program to identify a pixel color of an X Window\n"); + (void) printf("by muquit@muquit.com https://www.muquit.com/\n\n"); + (void) printf("Usage: grabc [options]\n"); + (void) printf("Where the options are:\n"); + for (p=options; *p != NULL; p++) + { + (void) fprintf(stdout,"%s\n",*p); + (void) fflush(stdout); + } +} + + +static void log_debug(const char *fmt,...) +{ + va_list + args; + if (!g_debug) + { + return; + } + va_start(args, fmt); + (void) fprintf(stderr,"[Debug]: "); + vfprintf(stderr,fmt,args); + (void) fprintf(stderr,"\n"); + va_end(args); +} + +static Cursor get_cross_cursor(Display *display) +{ + if (g_cross_cursor == (Cursor) NULL) + { + g_cross_cursor=XCreateFontCursor(display,XC_tcross); + if (g_cross_cursor == (Cursor) NULL) + { + (void) fprintf (stderr,"ERROR: Failed to create Cross Cursor!\n"); + exit(1); + } + } + return g_cross_cursor; +} +static Window grab_mouse(Display *display,Window root_window) +{ + int + status; + + Window + subwindow; + + XEvent + event; + + Cursor + target_cursor; + + + if (g_window_id != (Window) NULL) + { + return g_window_id; + } + + target_cursor = get_cross_cursor(display); + status=XGrabPointer(display,root_window,False, + (unsigned int) ButtonPressMask,GrabModeSync, + GrabModeAsync,root_window,target_cursor,CurrentTime); + if (status == GrabSuccess) + { + XAllowEvents(display,SyncPointer,CurrentTime); + XWindowEvent(display,root_window,ButtonPressMask,&event); + subwindow = event.xbutton.subwindow; + } + else + { + return root_window; + } + + return subwindow; +} +static void upgrab_mouse(Display *display) +{ + if (g_window_id != (Window) NULL) + { + XUngrabPointer(display,CurrentTime); + } +} + + + + + +/* +** function to select a window +** output parameters: x,y (coordinate of the point of click) +** reutrns Window +** exits if mouse can not be grabbed +*/ +static Window select_window(Display *display,int *x,int *y) +{ + Cursor + target_cursor; + + int + status; + + Window + target_window, + root_window; + + XEvent + event; + + /* + ** If window id and location is specified return the window id as + ** target window. Also initilaize x, y those specified with -l + */ + if ((g_window_id != (Window) NULL) && g_loc_specified) + { + log_debug("Returning passing window: %lx",g_window_id); + (*x) = g_x; + (*y) = g_y; + return g_window_id; + } + target_window=(Window) NULL; + target_cursor = get_cross_cursor(display); + root_window=XRootWindow(display,XDefaultScreen(display)); +// log_debug("Root Window ID: 0x%08lx",root_window); + + status=XGrabPointer(display,root_window,False, + (unsigned int) ButtonPressMask,GrabModeSync, + GrabModeAsync,root_window,target_cursor,CurrentTime); + if (status == GrabSuccess) + { + XAllowEvents(display,SyncPointer,CurrentTime); + XWindowEvent(display,root_window,ButtonPressMask,&event); + Window subwindow = event.xbutton.subwindow; + + if (event.type == ButtonPress) + { + target_window=findSubWindow(display,root_window, + subwindow, + &event.xbutton.x, + &event.xbutton.y ); + + if (target_window == (Window) NULL) + { + (void) fprintf (stderr, + "ERROR: Failed to get target window, getting root window!\n"); + target_window=root_window; + } + if (!g_loc_specified) + { + XUngrabPointer(display,CurrentTime); + } + } + + } + else + { + (void) fprintf (stderr,"ERROR: Failed to grab mouse pointer!\n"); + exit(1); + } + + /* free things we do not need, always a good practice */ + (*x)=event.xbutton.x; + (*y)=event.xbutton.y; + + return (target_window); +} + +/* find a window */ +static Window findSubWindow(Display *display,Window top_window, + Window window_to_check,int *x,int *y) +{ + int + newx, + newy; + + Window + window; + + if (top_window == (Window) NULL) + return ((Window) NULL); + + if (window_to_check == (Window) NULL) + return ((Window) NULL); + + /* initialize automatics */ + window=window_to_check; + + while ((XTranslateCoordinates(display,top_window,window_to_check, + *x,*y,&newx,&newy,&window) != 0) && + (window != (Window) NULL)) + { + if (window != (Window) NULL) + { + top_window=window_to_check; + window_to_check=window; + (*x)=newx; + (*y)=newy; + } + } + + if (window == (Window) NULL) + window=window_to_check; + + + (*x)=newx; + (*y)=newy; + + return (window); +} + +/* + * get the color of the pixel of the point of mouse click + * output paramter: XColor *color + * + * returns + * target Window on success + * NULL on failure + * + */ + +static Window get_window_color(Display *display,XColor *color) +{ + Window + root_window, + target_window; + + XImage + *ximage; + + int + x, + y; + + Status + status; + + root_window=XRootWindow(display,XDefaultScreen(display)); + target_window=select_window(display,&x,&y); + + log_debug(" Root Window Id: 0x%08lx",root_window); + log_debug("Target Window Id: 0x%08lx X,Y: +%d+%d",target_window,x,y); + + if (target_window == (Window) NULL) + return (Window) NULL; + + ximage=XGetImage(display,target_window,x,y,1,1,AllPlanes,ZPixmap); + if (ximage == (XImage *) NULL) + { + /* Try root window */ + log_debug("Could not get XImage from Window: 0x%08lx",target_window); + log_debug("Trying to get XImage from root window: 0x%08lx",root_window); + ximage=XGetImage(display,root_window,x,y,1,1,AllPlanes,ZPixmap); + if (ximage == (XImage *) NULL) + { + log_debug("Could not get XImage from target or root window"); + return (Window) NULL; + } + else + { + log_debug("OK successfully got XImage from root window"); + target_window = root_window; + } + + } + + color->pixel=XGetPixel(ximage,0,0); + XDestroyImage(ximage); + + return (target_window); +} + +/* forgiving X error handler */ + +static int MXError (Display *display, XErrorEvent *error) +{ + int + xerrcode; + + xerrcode = error->error_code; + + if (xerrcode == BadAlloc || + (xerrcode == BadAccess && error->request_code==88)) + { + return (False); + } + else + { + switch (error->request_code) + { + case X_GetGeometry: + { + if (error->error_code == BadDrawable) + return (False); + break; + } + + case X_GetWindowAttributes: + case X_QueryTree: + { + if (error->error_code == BadWindow) + return (False); + break; + } + + case X_QueryColors: + { + if (error->error_code == BadValue) + return(False); + break; + } + } + } + return (True); +} + +int main(int argc,char **argv) +{ + Display + *display; + + int + x, + y, + status; + + XColor + color; + + int + rc, + i, + r, + g, + b; + + Window + window_id, + target_window; + + XWindowAttributes + window_attributes; + + char + *option; + + for (i=1; i < argc; i++) + { + option = argv[i]; + switch(*(option+1)) + { + case 'a': + { + g_print_all_16_bits = True; + break; + } + case 'd': + { + g_debug = True; + break; + } + + case 'h': + { + if (strncmp("hex",option+1,3) == 0) + { + g_print_in_hex = True; + } + else + { + show_usage(); + return(1); + } + break; + } + + case 'r': + { + if (strncmp("rgb",option+1,3) == 0) + { + g_print_in_rgb = True; + } + break; + } + + case 'w': + { + if (*option == '-') + { + i++; + if (i == argc) + { + (void) fprintf(stderr,"ERROR: Missing Window id\n"); + return(1); + } + } + g_window_id = (Window) strtol(argv[i],NULL, 16); + break; + } + case 'W': + { + display=XOpenDisplay((char *) NULL); + if (display == NULL) + { + (void) fprintf(stderr,"ERROR: Could not open Display\n"); + return(1); + } + Window window = select_window(display, &x, &y); + if (window != (Window) NULL) + { + log_debug("Window ID: 0x%08lx",window); + (void) fprintf(stdout,"0x%lx\n",window); + } + return(1); + break; + } + + case 'l': + { + if (*option == '-') + { + i++; + if (i == argc) + { + (void) fprintf(stderr,"ERROR: Missing location +x+y\n"); + return(1); + } + } + rc = XParseGeometry(argv[i], &g_x,&g_y,&g_width,&g_height); + if (rc == 0) + { + (void) fprintf(stderr,"ERROR: Could not parse location: %s\n",argv[i]); + (void) fprintf(stderr,"Example: -l +10+20\n"); + return(1); + } + g_loc_specified = True; + + break; + } + + case 'v': + { + (void) fprintf(stderr,"grabc v%s\n",VERSION_S); + return(1); + break; + } + + default: + { + break; + } + } + } + + if (g_loc_specified && (g_window_id == (Window) NULL)) + { + (void) fprintf(stderr,"ERROR: Please specify window id with -w in hex to use this option\n"); + (void) fprintf(stderr,"Use -W option to find the Window Id\n"); + return(1); + } + + display=XOpenDisplay((char *) NULL); + XSetErrorHandler(MXError); + + if (display == (Display *) NULL) + { + (void) fprintf (stderr,"ERROR: Failed to open DISPLAY!\n"); + exit(1); + } + + target_window = get_window_color(display,&color); + if (target_window != (Window) NULL) + { + status = XGetWindowAttributes(display, target_window, + &window_attributes); + if (status == False || window_attributes.map_state != IsViewable) + { + (void) fprintf(stderr,"ERROR: Could not get Window Attributes\n"); + return(1); + } + XQueryColor(display, window_attributes.colormap, &color); + if (g_print_all_16_bits) + { + (void) fprintf(stdout,"#%04x%04x%04x\n", + (unsigned int)color.red, + (unsigned int) color.green, + (unsigned int) color.blue); + (void) fflush(stdout); + if (g_print_in_rgb) + { + (void) fprintf(stderr,"%d,%d,%d\n", + (unsigned int)color.red, + (unsigned int) color.green, + (unsigned int) color.blue); + } + + } + else + { + r=(color.red >> 8); + g=(color.green >> 8); + b=(color.blue >> 8); + log_debug("Color: #%02x%02x%02x",r,g,b); + (void) fprintf (stdout,"#%02x%02x%02x\n",r,g,b); + (void) fflush(stdout); + /* + ** write the values in decimal on stderr + */ + if (g_print_in_rgb) + { + (void) fprintf(stderr,"%d,%d,%d\n",r,g,b); + } + } + } + else + { + (void) fprintf (stderr,"ERROR: Failed to grab color!\n"); + } + return (0); +} diff --git a/.local/src/grabc/grabc.o b/.local/src/grabc/grabc.o new file mode 100644 index 0000000000000000000000000000000000000000..8a99c567dc0bf63d7241dbbcfbec7ff65e18f63c GIT binary patch literal 14424 zcmeHNeRN#Kb)S`FBZS!%A0Y-qI)*ja*jj5P2aMuitv;-$u*QllV{r^wuXmrc3#;8_ z_pK!ppCT%Wcq7aBB)CmUTAY#wIFLetW58)a!8Ue!(w0&;hmQh=lEy+5TpC;;wCcU{ z?(AMY>$UXs-_Fr{GxM9@+_`h_oq6xg>W=pCnhK9c=;RUCigHb(LVT~WTy9pyW^tZ4 zSNQf{FMa!e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J2d|m`{8LS{Z z7=RN`UWH>&)yKxDqSycj@E48Z>g)T!f6s`sS}0r(Fw_(u?H zI|(ookzV+RF_UKSf6F9v*FNErnyK;xJ!fl*IU-;llBq_8U4ETg$)K+chDiE>Mook=e$dsJ976Q8*+VANK?2__qOu6rw}PPLe*% z^!J&@Nu26~nEihQy0x4)Iy+L6?ys5Oh638fY5$ef->H|@U-$nLD4jkXxV~6WR}#lJ2klH{00A-+4aXVZWyi7*6Fkd_arz!0ar|Pu3-RZU Xi8-dD&N64~e}eRX#1>P!JNy3^d~JKe literal 0 HcmV?d00001 diff --git a/.local/src/grabc/grabc.pod b/.local/src/grabc/grabc.pod new file mode 100644 index 00000000..85f2c2fb --- /dev/null +++ b/.local/src/grabc/grabc.pod @@ -0,0 +1,50 @@ +=head1 NAME + +grabc - A tool to identify a pixel color of an X Window. + +=head1 SYNOPSIS + + grabc v1.0.2 + A program to identify a pixel color of an X Window + by muquit@muquit.com https://www.muquit.com/ + + Usage: grabc [options] + Where the options are: + -v - show version info + -h - show this usage + -hex - print pixel value as Hex on stdout + -rgb - print pixel value as RGB on stderr + -W - print the Window id at mouse click + -w id - window id in hex, use -l +x+y + -l +x+y - pixel co-ordinate. requires window id + -d - show debug messages + -a - Print all 16 bits of color. Default is high order 8 bits + Example: + * Print pixel color in hex on stdout: + $ grabc + * Show usage: + $ grabc -h + * Print Window Id (Note the upper case W): + $ grabc -W + * Print pixel color of Window iwith id 0x13234 at location 10,20 + $ grabc -w 0x13234 -l +10+20 + +=head1 DESCRIPTION + +grabc is a simple but very useful program to determine the color string in +hex (or in RGB components) by clicking on a pixel on the screen. While web +browsing, lots of time you find a nice color and wonder what color is that. +Well just use grabc! + +When this program is run, the mouse pointer is grabbed and changed to a +cross hair and when the mouse is clicked, the color of the clicked pixel +is written to stdout in hex prefixed with #. + +=head1 LICENSE + +MIT + +=head1 AUTHOR + +grabc is written by Muhammad Muquit Emuquit@muquit.comE. +Homepage: L. diff --git a/.local/src/grabc/install-sh b/.local/src/grabc/install-sh new file mode 100755 index 00000000..058b26c8 --- /dev/null +++ b/.local/src/grabc/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/.local/src/grabc/mkinstalldirs b/.local/src/grabc/mkinstalldirs new file mode 100755 index 00000000..4992567c --- /dev/null +++ b/.local/src/grabc/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2000/09/20 19:05:51 gson Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/.local/src/paleofetch/config.h b/.local/src/paleofetch/config.h index 247a33e1..9b21689c 100644 --- a/.local/src/paleofetch/config.h +++ b/.local/src/paleofetch/config.h @@ -9,8 +9,8 @@ { "OS: ", get_os, true }, \ { "Kernel: ", get_kernel, true }, \ { "Uptime: ", get_uptime, false }, \ - { "Shell: ", get_shell, false }, \ - { "Terminal: ", get_terminal, false }, \ + { "Shell: ", get_shell, true }, \ + { "Terminal: ", get_terminal, true }, \ { "CPU: ", get_cpu, true }, \ { "Memory: ", get_memory, false }, \ SPACER \