This commit is contained in:
lelgenio 2019-10-15 21:28:41 -03:00
parent 5a562167cf
commit 9c080ece40
33 changed files with 9734 additions and 0 deletions

View file

@ -0,0 +1,16 @@
[
{
"key": "ctrl+shift+c",
"command": "workbench.action.terminal.new"
},
{
"key":"ctrl+,",
"command":"workbench.action.openSettingsJson"
},{
"key":"ctrl+shift+,",
"command":"workbench.action.openGlobalKeybindingsFile"
},{
"key": "ctrl+b",
"command":"workbench.action.toggleSidebarVisibility"
}
]

View file

@ -0,0 +1,3 @@
{
"locale": "pt-br"
}

View file

@ -0,0 +1,55 @@
{
"window.titleBarStyle": "native",
"terminal.integrated.rendererType": "dom",
"explorer.confirmDelete": false,
"window.menuBarVisibility": "hidden",
"git.autofetch": true,
"git.confirmSync": false,
"explorer.confirmDragAndDrop": false,
"editor.renderWhitespace": "boundary",
"workbench.activityBar.visible": false,
"workbench.editor.showTabs": false,
"files.autoSave": "off",
"workbench.editor.tabCloseButton": "off",
"window.closeWhenEmpty": true,
"workbench.editor.closeEmptyGroups": true,
"editor.minimap.renderCharacters": false,
"window.zoomLevel": 0.2,
"vim.foldfix": true,
"materialTheme.accent": "Red",
"material-icon-theme.folders.color": "#cc5757",
"editor.fontFamily": "'Roboto Mono', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",
"terminal.integrated.fontFamily": "Roboto Mono",
"editor.fontSize": 15,
"workbench.colorTheme": "Material Theme Darker High Contrast",
"workbench.iconTheme": "material-icon-theme",
"workbench.colorCustomizations": {
"statusBar.foreground": "#ffffff",
"statusBar.background": "#cc5757",
"editorCursor.background": "#fff",
"editorCursor.foreground": "#cc5757dd",
"editor.background": "#202020",
"editorWhitespace.foreground": "#303030",
"activityBarBadge.background": "#cc5757",
"list.activeSelectionForeground": "#cc5757",
"list.inactiveSelectionForeground": "#cc5757",
"list.highlightForeground": "#cc5757",
"scrollbarSlider.activeBackground": "#cc575750",
"editorSuggestWidget.highlightForeground": "#cc5757",
"textLink.foreground": "#cc5757",
"progressBar.background": "#cc5757",
"pickerGroup.foreground": "#cc5757",
"tab.activeBorder": "#cc5757",
"notificationLink.foreground": "#cc5757",
"editorWidget.resizeBorder": "#cc5757",
"editorWidget.border": "#cc5757",
"settings.modifiedItemIndicator": "#cc5757",
"settings.headerForeground": "#cc5757",
"panelTitle.activeBorder": "#cc5757",
"breadcrumb.activeSelectionForeground": "#cc5757",
"menu.selectionForeground": "#cc5757",
"menubar.selectionForeground": "#cc5757",
"editor.findMatchBorder": "#cc5757",
"selection.background": "#cc575740"
},
}

69
emacs/.emacs.d/init.el Normal file
View file

@ -0,0 +1,69 @@
(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(package-initialize)
(require 'evil)
(evil-mode 1)
;; language server
(require 'lsp-mode)
(require 'lsp-ui)
(require 'yasnippet)
(add-hook 'prog-mode-hook #'lsp)
(add-hook 'lsp-mode-hook #'lsp-ui-mode)
;; Line numbers
(add-hook 'prog-mode-hook #'display-line-numbers-mode)
(setq display-line-numbers 'relative)
(setq-default display-line-numbers-type 'visual
display-line-numbers-current-absolute t)
;; Whitespace
(whitespace-mode)
(customize-set-variable 'indent-tabs-mode nil)
(customize-set-variable 'standard-indent 4)
(customize-set-variable 'tab-width 4)
(customize-set-variable 'tab-stop-list '(4 8 12))
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Keybinds
(global-set-key (kbd "C-;") 'comment-line)
(global-set-key (kbd "C-,") (lambda() (interactive)
(find-file "~/.emacs.d/init.el")))
(set-face-attribute 'default nil :height 200)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(custom-enabled-themes (quote (wombat)))
'(fringe-mode 0 nil (fringe))
'(global-whitespace-mode t)
'(global-whitespace-newline-mode t)
'(inhibit-startup-screen t)
'(menu-bar-mode nil)
'(package-selected-packages (quote (yasnippet lsp-ui lsp-mode evil)))
'(scroll-bar-mode nil)
'(tool-bar-mode nil)
'(tooltip-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "#202020" :foreground "#f6f3e8" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 200 :width normal :foundry "default" :family "default"))))
'(line-number ((t (:inherit (shadow default) :foreground "#cc5757"))))
'(line-number-current-line ((t (:inherit line-number :foreground "white"))))
'(whitespace-big-indent ((t (:foreground "dark gray"))))
'(whitespace-space ((t (:foreground "darkgray"))))
'(whitespace-tab ((t (:foreground "dim gray")))))
(set-frame-parameter (selected-frame) 'alpha 10 )
(add-to-list 'default-frame-alist '(alpha . 10))

View file

@ -0,0 +1,14 @@
[dmenu]
dmenu_command = rofi
[dmenu_passphrase]
nf = #222222
nb = #222222
rofi_obscure = True
[database]
database_1 = ~/Nextcloud/Senhas/Senhas.kdbx
pw_cache_period_min = 360
type_library = ydotool
autotype_default = {USERNAME}{TAB}{PASSWORD}{ENTER}

47
mpd/.config/mpd/mpd.conf Normal file
View file

@ -0,0 +1,47 @@
#
# Files and directories #######################################################
#
music_directory "~/Música"
playlist_directory "~/.config/mpd/playlists"
db_file "~/.config/mpd/database"
log_file "syslog"
pid_file "~/.config/mpd/pid"
state_file "~/.config/mpd/state"
# General music daemon options ################################################
#
restore_paused "yes"
auto_update "yes"
# Symbolic link behavior ######################################################
#
follow_outside_symlinks "yes"
follow_inside_symlinks "yes"
# Input #######################################################################
#
input {
plugin "curl"
}
# Audio Output ################################################################
#
audio_output {
type "pulse"
name "My Pulse Output"
mixer_type "software"
}
audio_output {
type "fifo"
name "FIFO Output"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
# Normalization automatic volume adjustments ##################################
#
volume_normalization "yes"
# Character Encoding ##########################################################
#
filesystem_charset "UTF-8"

File diff suppressed because it is too large Load diff

Binary file not shown.

203
nvim/.config/nvim/init.vim Normal file
View file

@ -0,0 +1,203 @@
"
" Plugins
"
" Install plug if it isn't already
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
augroup PLUG
au!
autocmd VimEnter * PlugInstall
augroup END
endif
call plug#begin('~/.config/nvim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'chrisbra/Colorizer'
Plug 'junegunn/vim-easy-align'
" Language server support
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\}
" Fuzzy find
Plug 'junegunn/fzf'
" Completions
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" Comments
Plug 'tpope/vim-commentary'
" Status bar
"Plug 'vim-airline/vim-airline'
"Plug 'vim-airline/vim-airline-themes'
" Bufferlist (integrates with airline)
"Plug 'bling/vim-bufferline'
" Color scheme
Plug 'dikiaap/minimalist'
" Language support
Plug 'sheerun/vim-polyglot'
" Plug 'dense-analysis/ale'
" Plug 'davidhalter/jedi-vim'
" Simplify movement
"Plug 'easymotion/vim-easymotion'
" Simplify file management
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
" Format using prettier
" Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
" Make markdown fun again
"Plug 'junegunn/limelight.vim'
" Better buffer management
"Plug 'qpkorr/vim-bufkill'
" Utilities
"Plug 'xolox/vim-misc'
" Notes
"Plug 'xolox/vim-notes'
call plug#end()
"
" Syntax options
"
" Enable syntax and set color scheme
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab
set virtualedit=block
"destaque no númer de linhas
set number
set relativenumber
"display whitespace
set listchars=tab:>-,trail:~,extends:>,precedes:<
set listchars=space:_,eol:;,tab:>-,trail:~,extends:>,precedes:<
"set list
"ativa o mouse
set mouse =a
set clipboard +=unnamedplus
set title
"
" Gay colors
"
if (empty($TMUX))
if (has('nvim'))
let $NVIM_TUI_ENABLE_TRUE_COLOR = 1
endif
if (has('termguicolors'))
set termguicolors
endif
endif
colorscheme minimalist
set background=dark
"background color is transparent
highlight Normal guibg=None
highlight EndOfBuffer guibg=None
highlight SpecialKey guibg=None guifg=#cc5757
"Line numers
highlight LineNr term=bold ctermfg=9 guifg=#cc5757 guibg=None
"Make whitespace is dark
highlight NonText ctermfg=black guifg=#303030
highlight SpecialKey ctermfg=black guifg=#303030
"Current line
set cursorline
highlight CursorLine term=bold cterm=bold gui=Bold guibg=#303030
highlight CursorLineNr term=bold cterm=bold gui=Bold guibg=None guifg=white
"
" Keys
"
" Easy comment toggle
nmap <silent> gc :Commentary<CR>
xmap <silent> gc :Commentary<CR>
" Toggle file manager
map <silent> <C-n> :NERDTreeToggle %:p:h<CR>
" EasyAlign
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
" Simplify window navigation
nnoremap <silent> <C-h> <C-w><C-h>
nnoremap <silent> <C-j> <C-w><C-j>
nnoremap <silent> <C-k> <C-w><C-k>
nnoremap <silent> <C-l> <C-w><C-l>
" Interact with language server
map <silent> <C-Space> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> gh :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> gr :call LanguageClient#textDocument_references()<CR>
nnoremap <silent> gs :call LanguageClient#textDocument_documentSymbol()<CR>
nnoremap <silent> gR :call LanguageClient#textDocument_rename()<CR>
"
" Lanugage Server
"
" " Set this variable to 1 to fix files when you save them.
" let g:ale_fix_on_save = 1
" let g:ale_linters = {
" \ 'python': ['pyls'],
" \}
" let g:ale_fixers = {
" \ '*': ['remove_trailing_lines', 'trim_whitespace'],
" \ 'javascript': ['prettier', 'eslint'],
" \ 'python': ['black'],
" \}
set hidden
let g:LanguageClient_serverCommands = {
\ 'c': ['cquery', '--log-file=/tmp/cq.log'],
\ 'cpp': ['cquery', '--log-file=/tmp/cq.log'],
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'],
\ 'python': ['/usr/bin/pyls'],
\ }
let g:deoplete#enable_at_startup = 1
" Configure deoplete to use language server
call deoplete#custom#source('LanguageClient',
\ 'min_pattern_length',
\ 2)
"python env
" MUST NOT BE INDENTED!
py3 << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF

View file

@ -0,0 +1,7 @@
https://swaywm.org/ Sway
https://www.youtube.com/ YouTube
https://raw.githubusercontent.com/slashbeast/conf-mgmt/master/roles/home_files/files/DOTzshrc https://raw.githubusercontent.com/slashbeast/conf-mgmt/master/roles/home_files/files/DOTzshrc
https://github.com/unixorn/awesome-zsh-plugins GitHub - unixorn/awesome-zsh-plugins: A collection of ZSH frameworks, plugins & themes inspired by the various awesome list collections out there.
https://www.qutebrowser.org/quickstart.html qutebrowser quickstart | qutebrowser
https://web.whatsapp.com/ WhatsApp Web
https://github.com/jakehamilton/dotfiles/blob/master/neovim/init.vim dotfiles/init.vim at master · jakehamilton/dotfiles

View file

@ -0,0 +1,257 @@
# Autogenerated config.py
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# Uncomment this to still load settings configured via autoconfig.yml
# config.load_autoconfig()
# Aliases for commands. The keys of the given dictionary are the
# aliases, while the values are the commands they map to.
# Type: Dict
c.aliases = {'q': 'close', 'qa': 'quit', 'w': 'session-save', 'wq': 'quit --save', 'wqa': 'quit --save'}
# User agent to send. Unset to send the default. Note that the value
# read from JavaScript is always the global value.
# Type: String
c.content.headers.user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'file://*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome://*/*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'qute://*/*')
# Allow websites to show notifications.
# Type: BoolAsk
# Valid values:
# - true
# - false
# - ask
config.set('content.notifications', False, 'https://www.1337x.to')
# Shrink the completion to be smaller than the configured size if there
# are no scrollbars.
# Type: Bool
c.completion.shrink = True
# CSS border value for hints.
# Type: String
c.hints.border = '2px solid #cc5757'
# Hide the statusbar unless a message is shown.
# Type: Bool
c.statusbar.hide = True
# When to show favicons in the tab bar.
# Type: String
# Valid values:
# - always: Always show favicons.
# - never: Always hide favicons.
# - pinned: Show favicons only on pinned tabs.
c.tabs.favicons.show = 'never'
# How to behave when the last tab is closed.
# Type: String
# Valid values:
# - ignore: Don't do anything.
# - blank: Load a blank page.
# - startpage: Load the start page.
# - default-page: Load the default page.
# - close: Close the window.
c.tabs.last_close = 'close'
# When to show the tab bar.
# Type: String
# Valid values:
# - always: Always show the tab bar.
# - never: Always hide the tab bar.
# - multiple: Hide the tab bar if only one tab is open.
# - switching: Show the tab bar when switching tabs.
c.tabs.show = 'multiple'
# Duration (in milliseconds) to show the tab bar before hiding it when
# tabs.show is set to 'switching'.
# Type: Int
c.tabs.show_switching_delay = 2000
# Format to use for the tab title. The following placeholders are
# defined: * `{perc}`: Percentage as a string like `[10%]`. *
# `{perc_raw}`: Raw percentage, e.g. `10`. * `{current_title}`: Title of
# the current web page. * `{title_sep}`: The string ` - ` if a title is
# set, empty otherwise. * `{index}`: Index of this tab. * `{id}`:
# Internal tab ID of this tab. * `{scroll_pos}`: Page scroll position. *
# `{host}`: Host of the current web page. * `{backend}`: Either
# ''webkit'' or ''webengine'' * `{private}`: Indicates when private mode
# is enabled. * `{current_url}`: URL of the current web page. *
# `{protocol}`: Protocol (http/https/...) of the current web page. *
# `{audio}`: Indicator for audio/mute status.
# Type: FormatString
c.tabs.title.format = '{current_title}'
# Width (in pixels) of the progress indicator (0 to disable).
# Type: Int
c.tabs.indicator.width = 0
# Background color of the completion widget for odd rows.
# Type: QssColor
c.colors.completion.odd.bg = '#202020'
# Background color of the completion widget for even rows.
# Type: QssColor
c.colors.completion.even.bg = '#303030'
# Background color of the completion widget category headers.
# Type: QssColor
c.colors.completion.category.bg = '#303030'
# Background color of the selected completion item.
# Type: QssColor
c.colors.completion.item.selected.bg = '#cc5757'
# Top border color of the selected completion item.
# Type: QssColor
c.colors.completion.item.selected.border.top = '#550000'
# Bottom border color of the selected completion item.
# Type: QssColor
c.colors.completion.item.selected.border.bottom = '#550000'
# Foreground color of the matched text in the selected completion item.
# Type: QtColor
c.colors.completion.item.selected.match.fg = 'white'
# Color of the scrollbar in the completion view.
# Type: QssColor
c.colors.completion.scrollbar.bg = '#303030'
# Font color for hints.
# Type: QssColor
c.colors.hints.fg = 'white'
# Background color for hints. Note that you can use a `rgba(...)` value
# for transparency.
# Type: QssColor
c.colors.hints.bg = '#303030'
# Font color for the matched part of hints.
# Type: QtColor
c.colors.hints.match.fg = '#cc5757'
# Highlight color for keys to complete the current keychain.
# Type: QssColor
c.colors.keyhint.suffix.fg = '#cc5757'
# Background color of the keyhint widget.
# Type: QssColor
c.colors.keyhint.bg = 'rgba(30, 30, 30, 95%)'
# Background color of the statusbar.
# Type: QssColor
c.colors.statusbar.normal.bg = '#202020'
# Background color of the statusbar in command mode.
# Type: QssColor
c.colors.statusbar.command.bg = '#202020'
# Background color of the statusbar in caret mode with a selection.
# Type: QssColor
c.colors.statusbar.caret.selection.bg = '#cc5757'
# Background color of the tab bar.
# Type: QssColor
c.colors.tabs.bar.bg = '#202020'
# Background color of unselected odd tabs.
# Type: QtColor
c.colors.tabs.odd.bg = '#202020'
# Background color of unselected even tabs.
# Type: QtColor
c.colors.tabs.even.bg = '#202020'
# Foreground color of selected odd tabs.
# Type: QtColor
c.colors.tabs.selected.odd.fg = 'white'
# Background color of selected odd tabs.
# Type: QtColor
c.colors.tabs.selected.odd.bg = '#cc5757'
# Foreground color of selected even tabs.
# Type: QtColor
c.colors.tabs.selected.even.fg = 'white'
# Background color of selected even tabs.
# Type: QtColor
c.colors.tabs.selected.even.bg = '#cc5757'
# Background color of pinned selected odd tabs.
# Type: QtColor
c.colors.tabs.pinned.selected.odd.bg = '#303030'
# Background color of pinned selected even tabs.
# Type: QtColor
c.colors.tabs.pinned.selected.even.bg = '#303030'
# Font used in the completion widget.
# Type: Font
c.fonts.completion.entry = '16px Roboto'
# Font used in the completion categories.
# Type: Font
c.fonts.completion.category = '16px Roboto Mono'
# Font used for the debugging console.
# Type: QtFont
c.fonts.debug_console = '16px Roboto Mono'
# Font used for the downloadbar.
# Type: Font
c.fonts.downloads = '16px Roboto Mono'
# Font used for the hints.
# Type: Font
c.fonts.hints = 'bold 16px Roboto Mono'
# Font used in the keyhint widget.
# Type: Font
c.fonts.keyhint = '16px Roboto Mono'
# Font used for error messages.
# Type: Font
c.fonts.messages.error = '16px Roboto Mono'
# Font used for info messages.
# Type: Font
c.fonts.messages.info = '16px Roboto Mono'
# Font used for warning messages.
# Type: Font
c.fonts.messages.warning = '16px Roboto Mono'
# Font used for prompts.
# Type: Font
c.fonts.prompts = '16px Roboto'
# Font used in the statusbar.
# Type: Font
c.fonts.statusbar = '16px Roboto Mono'
# Font used in the tab bar.
# Type: QtFont
c.fonts.tabs = '14px Roboto'
# Bindings for normal mode
config.bind(',m', 'spawn mpv {url}')
config.bind(';m', 'hint url spawn mpv {url}')
config.bind('J', 'tab-prev')
config.bind('K', 'tab-next')
config.bind('j', 'scroll down')
config.bind('k', 'scroll up')

View file

@ -0,0 +1,351 @@
// ==UserScript==
// @name Auto Close YouTube Ads
// @namespace http://fuzetsu.acypa.com
// @version 1.4.1
// @description Close and/or Mute YouTube ads automatically!
// @author fuzetsu
// @match *://*.youtube.com/*
// @exclude *://*.youtube.com/subscribe_embed?*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_registerMenuCommand
// @require https://gitcdn.xyz/repo/fuzetsu/userscripts/b38eabf72c20fa3cf7da84ecd2cefe0d4a2116be/wait-for-elements/wait-for-elements.js
// @require https://gitcdn.xyz/repo/kufii/My-UserScripts/fa4555701cf5a22eae44f06d9848df6966788fa8/libs/gm_config.js
// ==/UserScript==
/* globals GM_getValue GM_setValue GM_deleteValue GM_registerMenuCommand GM_config waitForElems waitForUrl */
/**
* This section of the code holds the css selectors that point different parts of YouTube's
* user interface. If the script ever breaks and you don't want to wait for me to fix it
* chances are that it can be fixed by just updating these selectors here.
*/
const CSS = {
// the button used to skip an ad
skipButton: '.videoAdUiSkipButton,.ytp-ad-skip-button',
// the area showing the countdown to the skip button showing
preSkipButton: '.videoAdUiPreSkipButton,.ytp-ad-preview-container',
// little x that closes banner ads
closeBannerAd: '.close-padding.contains-svg,a.close-button,.ytp-ad-overlay-close-button',
// button that toggle mute on the video
muteButton: '.ytp-mute-button',
// the slider bar handle that represents the current volume
muteIndicator: '.ytp-volume-slider-handle',
// container for ad on video
adArea: '.videoAdUi,.ytp-ad-player-overlay',
// container that shows ad length eg 3:23
adLength: '.videoAdUiAttribution,.ytp-ad-duration-remaining',
// container for header ad on the home page
homeAdContainer: '#masthead-ad'
}
const util = {
log: (...args) => console.log(`%c${SCRIPT_NAME}:`, 'font-weight: bold;color: purple;', ...args),
clearTicks: ticks => {
ticks.forEach(tick =>
!tick ? null : typeof tick === 'number' ? clearInterval(tick) : tick.stop()
)
ticks.length = 0
},
keepTrying: (wait, action) => {
const tick = setInterval(() => action() && clearInterval(tick), wait)
return tick
},
storeGet: key => {
if (typeof GM_getValue === 'undefined') {
const value = localStorage.getItem(key)
return value === 'true' ? true : value === 'false' ? false : value
}
return GM_getValue(key)
},
storeSet: (key, value) =>
typeof GM_setValue === 'undefined' ? localStorage.setItem(key, value) : GM_setValue(key, value),
storeDel: key =>
typeof GM_deleteValue === 'undefined' ? localStorage.removeItem(key) : GM_deleteValue(key),
q: (query, context) => (context || document).querySelector(query),
qq: (query, context) => Array.from((context || document).querySelectorAll(query)),
get: (obj, str) => util.getPath(obj, str.split('.').reverse()),
getPath: (obj, path) =>
obj == null ? null : path.length > 0 ? util.getPath(obj[path.pop()], path) : obj
}
const SCRIPT_NAME = 'Auto Close YouTube Ads'
const SHORT_AD_MSG_LENGTH = 12000
const TICKS = []
let DONT_SKIP = false
const config = GM_config([
{
key: 'muteAd',
label: 'Mute ads?',
type: 'bool',
default: true
},
{
key: 'hideAd',
label: 'Hide video ads?',
type: 'bool',
default: true
},
{
key: 'secWaitBanner',
label: 'Banner ad close delay (seconds)',
type: 'number',
default: 0,
min: 0
},
{
key: 'secWaitVideo',
label: 'Video ad skip delay (seconds)',
type: 'number',
default: 0,
min: 0
},
{
key: 'minAdLengthForSkip',
label: 'Dont skip video shorter than this (seconds)',
type: 'number',
default: 0,
min: 0
},
{
key: 'muteEvenIfNotSkipping',
label: 'Mute video even if not skipping',
type: 'bool',
default: true
},
{
key: 'debug',
label: 'Show extra debug information.',
type: 'bool',
default: false
},
{
key: 'version',
type: 'hidden',
default: 1
}
])
const configVersion = 2
let conf = config.load()
config.onsave = cfg => (conf = cfg)
// config upgrade procedure
function upgradeConfig() {
let lastVersion
while (conf.version < configVersion && lastVersion !== conf.version) {
util.log('upgrading config version, current = ', conf.version, ', target = ', configVersion)
lastVersion = conf.version
switch (conf.version) {
case 1: {
const oldConf = {
muteAd: util.storeGet('MUTE_AD'),
hideAd: util.storeGet('HIDE_AD'),
secWait: util.storeGet('SEC_WAIT')
}
if (oldConf.muteAd != null) conf.muteAd = !!oldConf.muteAd
if (oldConf.hideAd != null) conf.hideAd = !!oldConf.hideAd
if (oldConf.secWait != null && !isNaN(oldConf.secWait))
conf.secWaitBanner = conf.secWaitVideo = parseInt(oldConf.secWait)
conf.version = 2
config.save(conf)
;['SEC_WAIT', 'HIDE_AD', 'MUTE_AD'].forEach(util.storeDel)
break
}
}
}
}
upgradeConfig()
function createMessageElement() {
const elem = document.createElement('div')
elem.setAttribute(
'style',
'border: 1px solid white;border-right: none;background: rgb(0,0,0,0.75);color:white;position: absolute;right: 0;z-index: 1000;top: 10px;padding: 10px;padding-right: 20px;cursor: pointer;pointer-events: all;'
)
return elem
}
function showMessage(container, text, ms) {
const message = createMessageElement()
message.textContent = text
container.appendChild(message)
util.log(`showing message [${ms}ms]: ${text}`)
setTimeout(() => message.remove(), ms)
}
function setupCancelDiv(ad) {
const skipArea = util.q(CSS.preSkipButton, ad)
const skipText = skipArea && skipArea.textContent.trim().replace(/\s+/g, ' ')
if (skipText && !['will begin', 'will play'].some(snip => skipText.includes(snip))) {
const cancelClass = 'acya-cancel-skip'
let cancelDiv = util.q('.' + cancelClass)
if (cancelDiv) cancelDiv.remove()
cancelDiv = createMessageElement()
cancelDiv.className = cancelClass
cancelDiv.textContent = (conf.muteAd ? 'Un-mute & ' : '') + 'Cancel Auto Skip'
cancelDiv.onclick = () => {
util.log('cancel clicked')
DONT_SKIP = true
cancelDiv.remove()
const muteButton = getMuteButton()
const muteIndicator = getMuteIndicator()
if (conf.muteAd && muteButton && muteIndicator && isMuted(muteIndicator)) muteButton.click()
}
ad.appendChild(cancelDiv)
} else {
util.log("skip button area wasn't there for some reason.. couldn't place cancel button.")
}
}
function parseTime(str) {
const [minutes, seconds] = str
.split(' ')
.pop()
.split(':')
.map(num => parseInt(num))
util.log(str, minutes, seconds)
return minutes * 60 + seconds || 0
}
const getMuteButton = () => util.q(CSS.muteButton)
const getMuteIndicator = () => util.q(CSS.muteIndicator)
const isMuted = m => m.style.left === '0px'
function getAdLength(ad) {
if (!ad) return 0
const time = ad.querySelector(CSS.adLength)
return time ? parseTime(time.textContent) : 0
}
function waitForAds() {
DONT_SKIP = false
TICKS.push(
waitForElems({
sel: CSS.skipButton,
onmatch: btn => {
util.log('found skip button')
util.keepTrying(500, () => {
if (!btn) return true
// if not visible
if (btn.offsetParent === null) return
setTimeout(() => {
if (DONT_SKIP) {
util.log('not skipping...')
DONT_SKIP = false
return
}
util.log('clicking skip button')
btn.click()
}, conf.secWaitVideo * 1000)
return true
})
}
}),
waitAndClick(CSS.closeBannerAd, conf.secWaitBanner * 1000),
waitForElems({
sel: CSS.adArea,
onmatch: ad => {
// reset don't skip
DONT_SKIP = false
const adLength = getAdLength(ad)
const isShort = adLength < conf.minAdLengthForSkip
const debug = () =>
conf.debug
? `[DEBUG adLength = ${adLength}, minAdLengthForSkip = ${conf.minAdLengthForSkip}]`
: ''
if (isShort && !conf.muteEvenIfNotSkipping) {
DONT_SKIP = true
return showMessage(
ad,
`Shot AD detected, will not skip or mute. ${debug()}`,
SHORT_AD_MSG_LENGTH
)
}
if (conf.hideAd) {
ad.style.zIndex = 10
ad.style.background = 'black'
}
// show option to cancel automatic skip
if (!isShort) setupCancelDiv(ad)
if (!conf.muteAd) return
const muteButton = getMuteButton()
const muteIndicator = getMuteIndicator()
if (!muteIndicator) return util.log('unable to determine mute state, skipping mute')
muteButton.click()
util.log('Video ad detected, muting audio')
// wait for the ad to disappear before unmuting
util.keepTrying(250, () => {
if (!util.q(CSS.adArea)) {
if (isMuted(muteIndicator)) {
muteButton.click()
util.log('Video ad ended, unmuting audio')
} else {
util.log('Video ad ended, audio already unmuted')
}
return true
}
})
if (isShort) {
DONT_SKIP = true
return showMessage(
ad,
`Short AD detected, will not skip but will mute. ${debug()}`,
SHORT_AD_MSG_LENGTH
)
}
}
})
)
}
const waitAndClick = (sel, ms, cb) =>
waitForElems({
sel: sel,
onmatch: btn => {
util.log('Found ad, closing in', ms, 'ms')
setTimeout(() => {
btn.click()
if (cb) cb(btn)
}, ms)
}
})
util.log('Started')
if (window.self === window.top) {
let videoUrl
// close home ad whenever encountered
waitForElems({ sel: CSS.homeAdContainer, onmatch: ad => ad.remove() })
// wait for video page
waitForUrl(/^https:\/\/www\.youtube\.com\/watch\?.*v=.+/, () => {
if (videoUrl && location.href !== videoUrl) {
util.log('Changed video, removing old wait')
util.clearTicks(TICKS)
}
videoUrl = location.href
util.log('Entered video, waiting for ads')
waitForAds()
TICKS.push(
waitForUrl(
url => url !== videoUrl,
() => {
videoUrl = null
util.clearTicks(TICKS)
util.log('Left video, stopped waiting for ads')
},
true
)
)
})
} else {
if (/^https:\/\/www\.youtube\.com\/embed\//.test(location.href)) {
util.log('Found embedded video, waiting for ads')
waitForAds()
}
}
GM_registerMenuCommand('Auto Close Youtube Ads - Manage Settings', config.setup)

View file

@ -0,0 +1,726 @@
# ===================================================================
# This file contains the default startup commands for ranger.
# To change them, it is recommended to create either /etc/ranger/rc.conf
# (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom
# commands there.
#
# If you copy this whole file there, you may want to set the environment
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
#
# The purpose of this file is mainly to define keybindings and settings.
# For running more complex python code, please create a plugin in "plugins/" or
# a command in "commands.py".
#
# Each line is a command that will be run before the user interface
# is initialized. As a result, you can not use commands which rely
# on the UI such as :delete or :mark.
# ===================================================================
# ===================================================================
# == Options
# ===================================================================
# Which viewmode should be used? Possible values are:
# miller: Use miller columns which show multiple levels of the hierarchy
# multipane: Midnight-commander like multipane view showing all tabs next
# to each other
set viewmode miller
#set viewmode multipane
# How many columns are there, and what are their relative widths?
set column_ratios 1,3,4
# Which files should be hidden? (regular expression)
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
# Show hidden files? You can toggle this by typing 'zh'
set show_hidden false
# Ask for a confirmation when running the "delete" command?
# Valid values are "always", "never", "multiple" (default)
# With "multiple", ranger will ask only if you delete multiple files at once.
set confirm_on_delete multiple
# Use non-default path for file preview script?
# ranger ships with scope.sh, a script that calls external programs (see
# README.md for dependencies) to preview images, archives, etc.
#set preview_script ~/.config/ranger/scope.sh
# Use the external preview script or display simple plain text or image previews?
set use_preview_script true
# Automatically count files in the directory, even before entering them?
set automatically_count_files true
# Open all images in this directory when running certain image viewers
# like feh or sxiv? You can still open selected files by marking them.
set open_all_images true
# Be aware of version control systems and display information.
set vcs_aware true
# State of the four backends git, hg, bzr, svn. The possible states are
# disabled, local (only show local info), enabled (show local and remote
# information).
set vcs_backend_git enabled
set vcs_backend_hg disabled
set vcs_backend_bzr disabled
set vcs_backend_svn disabled
# Use one of the supported image preview protocols
set preview_images true
# Set the preview image method. Supported methods:
#
# * w3m (default):
# Preview images in full color with the external command "w3mimgpreview"?
# This requires the console web browser "w3m" and a supported terminal.
# It has been successfully tested with "xterm" and "urxvt" without tmux.
#
# * iterm2:
# Preview images in full color using iTerm2 image previews
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
# with image preview support.
#
# This feature relies on the dimensions of the terminal's font. By default, a
# width of 8 and height of 11 are used. To use other values, set the options
# iterm2_font_width and iterm2_font_height to the desired values.
#
# * terminology:
# Previews images in full color in the terminology terminal emulator.
# Supports a wide variety of formats, even vector graphics like svg.
#
# * urxvt:
# Preview images in full color using urxvt image backgrounds. This
# requires using urxvt compiled with pixbuf support.
#
# * urxvt-full:
# The same as urxvt but utilizing not only the preview pane but the
# whole terminal window.
#
# * kitty:
# Preview images in full color using kitty image protocol.
# Requires python PIL or pillow library.
# If ranger does not share the local filesystem with kitty
# the transfer method is changed to encode the whole image;
# while slower, this allows remote previews,
# for example during an ssh session.
# Tmux is unsupported.
set preview_images_method w3m
# Delay in seconds before displaying an image with the w3m method.
# Increase it in case of experiencing display corruption.
set w3m_delay 0.02
# Default iTerm2 font size (see: preview_images_method: iterm2)
set iterm2_font_width 8
set iterm2_font_height 11
# Use a unicode "..." character to mark cut-off filenames?
set unicode_ellipsis false
# BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic).
# Requires the python-bidi pip package
set bidi_support false
# Show dotfiles in the bookmark preview box?
set show_hidden_bookmarks true
# Which colorscheme to use? These colorschemes are available by default:
# default, jungle, snow, solarized
set colorscheme default
# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
set preview_files true
set preview_directories true
set collapse_preview true
# Save the console history on exit?
set save_console_history true
# Draw the status bar on top of the browser window (default: bottom)
set status_bar_on_top false
# Draw a progress bar in the status bar which displays the average state of all
# currently running tasks which support progress bars?
set draw_progress_bar_in_status_bar true
# Draw borders around columns? (separators, outline, both, or none)
# Separators are vertical lines between columns.
# Outline draws a box around all the columns.
# Both combines the two.
set draw_borders both
# Display the directory name in tabs?
set dirname_in_tabs true
# Enable the mouse support?
set mouse_enabled true
# Display the file size in the main column or status bar?
set display_size_in_main_column true
set display_size_in_status_bar true
# Display the free disk space in the status bar?
set display_free_space_in_status_bar true
# Display files tags in all columns or only in main column?
set display_tags_in_all_columns true
# Set a title for the window?
set update_title false
# Set the title to "ranger" in the tmux program?
set update_tmux_title true
# Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature.
set shorten_title 3
# Show hostname in titlebar?
set hostname_in_titlebar true
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
set tilde_in_titlebar false
# How many directory-changes or console-commands should be kept in history?
set max_history_size 20
set max_console_history_size 50
# Try to keep so much space between the top/bottom border when scrolling:
set scroll_offset 8
# Flush the input after each key hit? (Noticeable when ranger lags)
set flushinput true
# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
set padding_right true
# Save bookmarks (used with mX and `X) instantly?
# This helps to synchronize bookmarks between multiple ranger
# instances but leads to *slight* performance loss.
# When false, bookmarks are saved when ranger is exited.
set autosave_bookmarks true
# Save the "`" bookmark to disk. This can be used to switch to the last
# directory by typing "``".
set save_backtick_bookmark true
# You can display the "real" cumulative size of directories by using the
# command :get_cumulative_size or typing "dc". The size is expensive to
# calculate and will not be updated automatically. You can choose
# to update it automatically though by turning on this option:
set autoupdate_cumulative_size false
# Turning this on makes sense for screen readers:
set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
set sort natural
# Additional sorting options
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
set xterm_alt_key false
# Whether to include bookmarks in cd command
set cd_bookmarks true
# Changes case sensitivity for the cd command tab completion
set cd_tab_case sensitive
# Use fuzzy tab completion with the "cd" command. For example,
# ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
set cd_tab_fuzzy false
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
# disable this feature.
set preview_max_size 0
# The key hint lists up to this size have their sublists expanded.
# Otherwise the submaps are replaced with "...".
set hint_collapse_threshold 10
# Add the highlighted file to the path in the titlebar
set show_selection_in_titlebar true
# The delay that ranger idly waits for user input, in milliseconds, with a
# resolution of 100ms. Lower delay reduces lag between directory updates but
# increases CPU load.
set idle_delay 2000
# When the metadata manager module looks for metadata, should it only look for
# a ".metadata.json" file in the current directory, or do a deep search and
# check all directories above the current one as well?
set metadata_deep_search false
# Clear all existing filters when leaving a directory
set clear_filters_on_dir_change false
# Disable displaying line numbers in main column.
# Possible values: false, absolute, relative.
set line_numbers relative
# When line_numbers=relative show the absolute line number in the
# current line.
set relative_current_zero true
# Start line numbers from 1 instead of 0
set one_indexed false
# Save tabs on exit
set save_tabs_on_exit false
# Enable scroll wrapping - moving down while on the last item will wrap around to
# the top and vice versa.
set wrap_scroll true
# Set the global_inode_type_filter to nothing. Possible options: d, f and l for
# directories, files and symlinks respectively.
set global_inode_type_filter
# This setting allows to freeze the list of files to save I/O bandwidth. It
# should be 'false' during start-up, but you can toggle it by pressing F.
set freeze_files false
# ===================================================================
# == Local Options
# ===================================================================
# You can set local options that only affect a single directory.
# Examples:
# setlocal path=~/downloads sort mtime
# ===================================================================
# == Command Aliases in the Console
# ===================================================================
alias e edit
alias q quit
alias q! quit!
alias qa quitall
alias qa! quitall!
alias qall quitall
alias qall! quitall!
alias setl setlocal
alias filter scout -prts
alias find scout -aets
alias mark scout -mr
alias unmark scout -Mr
alias search scout -rs
alias search_inc scout -rts
alias travel scout -aefklst
# ===================================================================
# == Define keys for the browser
# ===================================================================
# Basic
map Q quitall
map q quit
copymap q ZZ ZQ
map R reload_cwd
map F set freeze_files!
map <C-r> reset
map <C-l> redraw_window
map <C-c> abort
map <esc> change_mode normal
map ~ set viewmode!
map i display_file
map ? help
map W display_log
map w taskview_open
map S shell $SHELL
map : console
map ; console
map ! console shell%space
map @ console -p6 shell %%s
map # console shell -p%space
map s console shell%space
map r chain draw_possible_programs; console open_with%%space
map f console find%space
map cd console cd%space
map <C-p> chain console; eval fm.ui.console.history_move(-1)
# Change the line mode
map Mf linemode filename
map Mi linemode fileinfo
map Mm linemode mtime
map Mp linemode permissions
map Ms linemode sizemtime
map Mt linemode metatitle
# Tagging / Marking
map t tag_toggle
map ut tag_remove
map "<any> tag_toggle tag=%any
map <Space> mark_files toggle=True
map v mark_files all=True toggle=True
map uv mark_files all=True val=False
map b bulkrename
map V toggle_visual_mode
map uV toggle_visual_mode reverse=True
# For the nostalgics: Midnight Commander bindings
map <F1> help
map <F2> rename_append
map <F3> display_file
map <F4> edit
map <F5> copy
map <F6> cut
map <F7> console mkdir%space
map <F8> console delete
map <F10> exit
# In case you work on a keyboard with dvorak layout
map <UP> move up=1
map <DOWN> move down=1
map <LEFT> move left=1
map <RIGHT> move right=1
map <HOME> move to=0
map <END> move to=-1
map <PAGEDOWN> move down=1 pages=True
map <PAGEUP> move up=1 pages=True
map <CR> move right=1
#map <DELETE> console delete
map <INSERT> console touch%space
# VIM-like
copymap <UP> k
copymap <DOWN> j
copymap <LEFT> h
copymap <RIGHT> l
copymap <HOME> gg
copymap <END> G
copymap <PAGEDOWN> <C-F>
copymap <PAGEUP> <C-B>
map J move down=0.5 pages=True
map K move up=0.5 pages=True
copymap J <C-D>
copymap K <C-U>
# Jumping around
map H history_go -1
map L history_go 1
map ] move_parent 1
map [ move_parent -1
map } traverse
map { traverse_backwards
map ) jump_non
map gh cd ~
map ge cd /etc
map gu cd /usr
map gd cd /dev
map gl cd -r .
map gL cd -r %f
map go cd /opt
map gv cd /var
map gm cd /media
map gi eval fm.cd('/run/media/' + os.getenv('USER'))
map gM cd /mnt
map gs cd /srv
map gp cd /tmp
map gr cd /
map gR eval fm.cd(ranger.RANGERDIR)
map g/ cd /
map g? cd /usr/share/doc/ranger
# External Programs
map E edit
map du shell -p du --max-depth=1 -h --apparent-size
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
map yp yank path
map yd yank dir
map yn yank name
map y. yank name_without_extension
# Filesystem Operations
map = chmod
map cw console rename%space
map a rename_append
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
map pp paste
map po paste overwrite=True
map pP paste append=True
map pO paste overwrite=True append=True
map pl paste_symlink relative=False
map pL paste_symlink relative=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
map D console delete
map dd cut
map ud uncut
map da cut mode=add
map dr cut mode=remove
map dt cut mode=toggle
map yy copy
map uy uncut
map ya copy mode=add
map yr copy mode=remove
map yt copy mode=toggle
# Temporary workarounds
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
# Searching
map / console search%space
map n search_next
map N search_next forward=False
map ct search_next order=tag
map cs search_next order=size
map ci search_next order=mimetype
map cc search_next order=ctime
map cm search_next order=mtime
map ca search_next order=atime
# Tabs
map <C-n> tab_new
map <C-w> tab_close
map <TAB> tab_move 1
map <S-TAB> tab_move -1
map <A-Right> tab_move 1
map <A-Left> tab_move -1
map gt tab_move 1
map gT tab_move -1
map gn tab_new
map gc tab_close
map uq tab_restore
map <a-1> tab_open 1
map <a-2> tab_open 2
map <a-3> tab_open 3
map <a-4> tab_open 4
map <a-5> tab_open 5
map <a-6> tab_open 6
map <a-7> tab_open 7
map <a-8> tab_open 8
map <a-9> tab_open 9
map <a-r> tab_shift 1
map <a-l> tab_shift -1
# Sorting
map or set sort_reverse!
map oz set sort=random
map os chain set sort=size; set sort_reverse=False
map ob chain set sort=basename; set sort_reverse=False
map on chain set sort=natural; set sort_reverse=False
map om chain set sort=mtime; set sort_reverse=False
map oc chain set sort=ctime; set sort_reverse=False
map oa chain set sort=atime; set sort_reverse=False
map ot chain set sort=type; set sort_reverse=False
map oe chain set sort=extension; set sort_reverse=False
map oS chain set sort=size; set sort_reverse=True
map oB chain set sort=basename; set sort_reverse=True
map oN chain set sort=natural; set sort_reverse=True
map oM chain set sort=mtime; set sort_reverse=True
map oC chain set sort=ctime; set sort_reverse=True
map oA chain set sort=atime; set sort_reverse=True
map oT chain set sort=type; set sort_reverse=True
map oE chain set sort=extension; set sort_reverse=True
map dc get_cumulative_size
# Settings
map zc set collapse_preview!
map zd set sort_directories_first!
map zh set show_hidden!
map <C-h> set show_hidden!
copymap <C-h> <backspace>
copymap <backspace> <backspace2>
map zI set flushinput!
map zi set preview_images!
map zm set mouse_enabled!
map zp set preview_files!
map zP set preview_directories!
map zs set sort_case_insensitive!
map zu set autoupdate_cumulative_size!
map zv set use_preview_script!
map zf console filter%space
copymap zf zz
# Filter stack
map .n console filter_stack add name%space
map .m console filter_stack add mime%space
map .d filter_stack add type d
map .f filter_stack add type f
map .l filter_stack add type l
map .| filter_stack add or
map .& filter_stack add and
map .! filter_stack add not
map .r console filter_stack rotate
map .c filter_stack clear
map .* filter_stack decompose
map .p filter_stack pop
map .. filter_stack show
# Bookmarks
map `<any> enter_bookmark %any
map '<any> enter_bookmark %any
map m<any> set_bookmark %any
map um<any> unset_bookmark %any
map m<bg> draw_bookmarks
copymap m<bg> um<bg> `<bg> '<bg>
# Generate all the chmod bindings with some python help:
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
# ===================================================================
# == Define keys for the console
# ===================================================================
# Note: Unmapped keys are passed directly to the console.
# Basic
cmap <tab> eval fm.ui.console.tab()
cmap <s-tab> eval fm.ui.console.tab(-1)
cmap <ESC> eval fm.ui.console.close()
cmap <CR> eval fm.ui.console.execute()
cmap <C-l> redraw_window
copycmap <ESC> <C-c>
copycmap <CR> <C-j>
# Move around
cmap <up> eval fm.ui.console.history_move(-1)
cmap <down> eval fm.ui.console.history_move(1)
cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1)
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
cmap <a-b> eval fm.ui.console.move_word(left=1)
cmap <a-f> eval fm.ui.console.move_word(right=1)
copycmap <a-b> <a-left>
copycmap <a-f> <a-right>
# Line Editing
cmap <backspace> eval fm.ui.console.delete(-1)
cmap <delete> eval fm.ui.console.delete(0)
cmap <C-w> eval fm.ui.console.delete_word()
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
cmap <C-k> eval fm.ui.console.delete_rest(1)
cmap <C-u> eval fm.ui.console.delete_rest(-1)
cmap <C-y> eval fm.ui.console.paste()
# And of course the emacs way
copycmap <ESC> <C-g>
copycmap <up> <C-p>
copycmap <down> <C-n>
copycmap <left> <C-b>
copycmap <right> <C-f>
copycmap <home> <C-a>
copycmap <end> <C-e>
copycmap <delete> <C-d>
copycmap <backspace> <C-h>
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
# and <backspace2> (code 127). To be sure, use both.
copycmap <backspace> <backspace2>
# This special expression allows typing in numerals:
cmap <allow_quantifiers> false
# ===================================================================
# == Pager Keybindings
# ===================================================================
# Movement
pmap <down> pager_move down=1
pmap <up> pager_move up=1
pmap <left> pager_move left=4
pmap <right> pager_move right=4
pmap <home> pager_move to=0
pmap <end> pager_move to=-1
pmap <pagedown> pager_move down=1.0 pages=True
pmap <pageup> pager_move up=1.0 pages=True
pmap <C-d> pager_move down=0.5 pages=True
pmap <C-u> pager_move up=0.5 pages=True
copypmap <UP> k <C-p>
copypmap <DOWN> j <C-n> <CR>
copypmap <LEFT> h
copypmap <RIGHT> l
copypmap <HOME> g
copypmap <END> G
copypmap <C-d> d
copypmap <C-u> u
copypmap <PAGEDOWN> n f <C-F> <Space>
copypmap <PAGEUP> p b <C-B>
# Basic
pmap <C-l> redraw_window
pmap <ESC> pager_close
copypmap <ESC> q Q i <F3>
pmap E edit_file
# ===================================================================
# == Taskview Keybindings
# ===================================================================
# Movement
tmap <up> taskview_move up=1
tmap <down> taskview_move down=1
tmap <home> taskview_move to=0
tmap <end> taskview_move to=-1
tmap <pagedown> taskview_move down=1.0 pages=True
tmap <pageup> taskview_move up=1.0 pages=True
tmap <C-d> taskview_move down=0.5 pages=True
tmap <C-u> taskview_move up=0.5 pages=True
copytmap <UP> k <C-p>
copytmap <DOWN> j <C-n> <CR>
copytmap <HOME> g
copytmap <END> G
copytmap <C-u> u
copytmap <PAGEDOWN> n f <C-F> <Space>
copytmap <PAGEUP> p b <C-B>
# Changing priority and deleting tasks
tmap J eval -q fm.ui.taskview.task_move(-1)
tmap K eval -q fm.ui.taskview.task_move(0)
tmap dd eval -q fm.ui.taskview.task_remove()
tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
tmap <delete> eval -q fm.ui.taskview.task_remove()
# Basic
tmap <C-l> redraw_window
tmap <ESC> taskview_close
copytmap <ESC> q Q w <C-c>

View file

@ -0,0 +1,223 @@
# vim: ft=cfg
#
# This is the configuration file of "rifle", ranger's file executor/opener.
# Each line consists of conditions and a command. For each line the conditions
# are checked and if they are met, the respective command is run.
#
# Syntax:
# <condition1> , <condition2> , ... = command
#
# The command can contain these environment variables:
# $1-$9 | The n-th selected file
# $@ | All selected files
#
# If you use the special command "ask", rifle will ask you what program to run.
#
# Prefixing a condition with "!" will negate its result.
# These conditions are currently supported:
# match <regexp> | The regexp matches $1
# ext <regexp> | The regexp matches the extension of $1
# mime <regexp> | The regexp matches the mime type of $1
# name <regexp> | The regexp matches the basename of $1
# path <regexp> | The regexp matches the absolute path of $1
# has <program> | The program is installed (i.e. located in $PATH)
# env <variable> | The environment variable "variable" is non-empty
# file | $1 is a file
# directory | $1 is a directory
# number <n> | change the number of this command to n
# terminal | stdin, stderr and stdout are connected to a terminal
# X | $DISPLAY is not empty (i.e. Xorg runs)
#
# There are also pseudo-conditions which have a "side effect":
# flag <flags> | Change how the program is run. See below.
# label <label> | Assign a label or name to the command so it can
# | be started with :open_with <label> in ranger
# | or `rifle -p <label>` in the standalone executable.
# else | Always true.
#
# Flags are single characters which slightly transform the command:
# f | Fork the program, make it run in the background.
# | New command = setsid $command >& /dev/null &
# r | Execute the command with root permissions
# | New command = sudo $command
# t | Run the program in a new terminal. If $TERMCMD is not defined,
# | rifle will attempt to extract it from $TERM.
# | New command = $TERMCMD -e $command
# Note: The "New command" serves only as an illustration, the exact
# implementation may differ.
# Note: When using rifle in ranger, there is an additional flag "c" for
# only running the current file even if you have marked multiple files.
#-------------------------------------------
# Websites
#-------------------------------------------
# Rarely installed browsers get higher priority; It is assumed that if you
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
# other hand are often only installed as fallback browsers.
ext x?html?, has surf, X, flag f = surf -- file://"$1"
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has dwb, X, flag f = dwb -- "$@"
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
ext x?html?, has luakit, X, flag f = luakit -- "$@"
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
ext x?html?, has midori, X, flag f = midori -- "$@"
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
ext x?html?, has opera, X, flag f = opera -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
ext x?html?, has links2, terminal = links2 "$@"
ext x?html?, has links, terminal = links "$@"
ext x?html?, has lynx, terminal = lynx -- "$@"
ext x?html?, has w3m, terminal = w3m "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
# Define the "editor" for text files as first action
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
#--------------------------------------------
# Code
#-------------------------------------------
ext py = python -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext sh = sh -- "$1"
ext php = php -- "$1"
#--------------------------------------------
# Audio without X
#-------------------------------------------
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
#--------------------------------------------
# Video/Audio with a GUI
#-------------------------------------------
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
#--------------------------------------------
# Video without X:
#-------------------------------------------
mime ^video, terminal, !X, has mpv = mpv -- "$@"
#-------------------------------------------
# Documents
#-------------------------------------------
ext pdf, has llpp, X, flag f = llpp "$@"
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has mupdf, X, flag f = mupdf "$@"
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
ext pdf, has evince, X, flag f = evince -- "$@"
ext pdf, has atril, X, flag f = atril -- "$@"
ext pdf, has okular, X, flag f = okular -- "$@"
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
ext pdf, has open, X, flag f = open "$@"
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
ext djvu, has zathura,X, flag f = zathura -- "$@"
ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
ext djvu, has djview, X, flag f = djview -- "$@"
ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
#-------------------------------------------
# Image Viewing:
#-------------------------------------------
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh -- "$@"
mime ^image, has mirage, X, flag f = mirage -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has eog, X, flag f = eog -- "$@"
mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has nomacs, X, flag f = nomacs -- "$@"
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"
#-------------------------------------------
# Archives
#-------------------------------------------
# avoid password prompt by providing empty password
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
# This requires atool
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
# Listing and extracting archives without atool:
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
ext zip, has unzip = unzip -l "$1" | less
ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done
ext ace, has unace = unace l "$1" | less
ext ace, has unace = for file in "$@"; do unace e "$file"; done
ext rar, has unrar = unrar l "$1" | less
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
#-------------------------------------------
# Flag t fallback terminals
#-------------------------------------------
# Rarely installed terminal emulators get higher priority; It is assumed that
# if you install a rare terminal emulator, you probably use it.
# gnome-terminal/konsole/xterm on the other hand are often installed as part of
# a desktop environment or as fallback terminal emulators.
mime ^ranger/x-terminal-emulator, has termite = termite -x '"$@"'
#-------------------------------------------
# Misc
#-------------------------------------------
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
# The very last action, so that it's never triggered accidentally, is to execute a program:
mime application/x-executable = "$1"

View file

@ -0,0 +1,35 @@
/*
vim: filetype=css
*/
configuration {
fullscreen: true;
show-icons: true;
modi: "drun";
terminal: "termite";
}
* {
// Default bg is transparent.
background-color: transparent;
// Default text is white
text-color: white;
spacing: 30;
}
#window {
font: "Roboto 16";
fullscreen: true;
transparency: "background";
background-color: #303030CC;
children: [ dummy1, hdum, dummy2 ];
}
#hdum {
orientation: horizontal;
children: [ dummy3, mainbox, dummy4 ];
}
#element selected {
text-color: #cc5757;
}

36
scripts/border-select Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
if [ ! -f /usr/bin/metacity ]; then
zenity --warning --text="<b>You do not appear to have Metacity installed.</b>\n\nThe Compiz GTK window decorator uses Metacity libraries to operate. The Metacity theme is what this tool adjusts.\n\nInstall the metacity package if you would like to use the Compiz GTK window decorator."
fi
main_window() {
selection=$(
zenity --height 450 --width 320 --list --ok-label="Apply" --cancel-label="Close" --title="Metacity themes" \
--column="Current theme: $( if [ $(gsettings get org.gnome.desktop.wm.preferences theme) == "''" ]; then
echo Default
else
gsettings get org.gnome.desktop.wm.preferences theme
fi)" \
"Compiz GWD default" \
$(
for d in /usr/share/themes/*/metacity-1; do
echo $d | sed 's:/usr/share/themes/::' | sed 's:/metacity-1::'
done
)
)
}
while [ $? = 0 ]; do
if [ "$selection" == "Compiz GWD default" ]; then
gsettings set org.gnome.desktop.wm.preferences theme ""
elif [ "$selection" != "" ]; then
gsettings set org.gnome.desktop.wm.preferences theme "$selection"
fi
main_window
done
IFS=$SAVEIFS

33
scripts/install.sh Normal file
View file

@ -0,0 +1,33 @@
pacman -S git pacman-contrib base base-devel --needed
# getting yay
git clone http://aur.archlinux.org/yay.git
cd yay
makepkg -si
# Install a lot of things
yay -Syu --noconfirm --needed \
# DE
sway light mako pulseaudio udiskie\
httpie jq keepmenu\
# Theming
materia-custom-accent papirus-icon-theme-git papirus-folders-git capitaine-cursors \
# Terminal stuff
termite neovim ranger zsh mimeo atool\
# Shell
zsh zsh-completions zsh-syntax-highlighting antigen-git powerline-fonts\
# Web
qutebrowser \
# Gaming
steam lutris \
# Media
gimp kdenlive mpv mpd mpc ncmpcpp
#useradd -mG wheel lelgenio
su -u lelgenio -c 'cd ~;git clone http://github.com/lelgenio/dotfiles.git .config;.config;scripts/install-user'
if [ ! -f /etc/zsh/zshenv ]
then
mkdir -p /etc/zsh
.dots/myetc/etc/zsh/zshenv /etc/zsh/zshenv
fi

293
scripts/lightson Executable file
View file

@ -0,0 +1,293 @@
#!/usr/bin/env bash
# lightson+
# Copyright (c) 2018 spinal.by at gmail com
# Copyright (c) 2014 devkral at web de
# url: https://github.com/devkral/lightsonplus
#based on
# Copyright (c) 2011 iye.cba at gmail com
# url: https://github.com/iye/lightsOn
# This script is licensed under GNU GPL version 2.0 or above
# Description: Bash script that prevents the screensaver and display power
# management (DPMS) from being activated while watching fullscreen videos
# on Firefox, Chrome and Chromium. Media players like mplayer, VLC and minitube
# can also be detected.
# One of {x, k, gnome-}screensaver must be installed.
# HOW TO USE:
# "./lightson+ -d 2 &" will check every 2 minutes if Mplayer, VLC, Firefox or
# Chromium are fullscreen and delay screensaver and Power Management if so.
# If you don't pass an argument, the checks are done every minute.
# Select the programs to be checked
mplayer_detection=1
vlc_detection=1
totem_detection=1
firefox_flash_detection=1
chromium_flash_detection=1
#chrome_app_name="Netflix"
webkit_flash_detection=1
html5_detection=1
steam_detection=0
minitube_detection=0
audio_detection=0
#minload=1.5
delay=1
# realdisp
realdisp=`echo "$DISPLAY" | cut -d. -f1`
inhibitfile="/tmp/lightsoninhibit-$UID-$realdisp"
pidfile="/tmp/lightson-$UID-$realdisp.pid"
# YOU SHOULD NOT NEED TO MODIFY ANYTHING BELOW THIS LINE
die() {
echo "$@" >&2
exit 1
}
pidcreate() {
# just one instance can run simultaneously
if [ ! -e "$pidfile" ]; then
echo "$$" > "$pidfile"
else
if [ -d "/proc/$(cat "$pidfile")" ]; then
die "Another instance is running, abort!"
else
echo "$$" > "$pidfile"
fi
fi
}
pidremove() {
if [ ! -e "$pidfile" ]; then
echo "Error: missing pidfile" >&2
elif [ ! -f "$pidfile" ]; then
echo -e "Error: \"$pidfile\" is not a file\n" >&2
else
if [ "$(cat "$pidfile")" != "$$" ]; then
die "Another instance is running, abort!"
else
rm -f "$pidfile"
fi
fi
exit 0
}
pidcreate
trap "pidremove" EXIT
# Enumerate all the attached screens
displays=""
while read id; do
displays="$displays $id"
done< <(xvinfo | sed -n 's/^screen #\([0-9]\+\)$/\1/p')
# Detect screensaver being used
if [ `dbus-send --session --print-reply=literal --type=method_call --dest=org.freedesktop.ScreenSaver /ScreenSaver/ org.freedesktop.ScreenSaver.GetActive &> /dev/null; echo $?` -eq 0 ]; then
screensaver="freedesktop-screensaver"
#elif [ `pgrep -c gnome-shell` -ge 1 ] ;then
# screensaver="xdofallback"
elif [ `pgrep -c xscreensaver` -ge 1 ]; then
screensaver="xscreensaver"
elif [ `pgrep -c mate-screensaver` -ge 1 ]; then
screensaver="mate-screensaver"
elif [ `pgrep -c xautolock` -ge 1 ]; then
screensaver="xautolock"
elif [ -e "/usr/bin/xdotool" ]; then
screensaver="xdofallback"
else
screensaver=""
die "No screensaver detected"
fi
checkFullscreen() {
# loop through every display looking for a fullscreen window
for display in $displays; do
# get id of active window and clean output
active_win_id=`DISPLAY=$realdisp.${display} xprop -root _NET_ACTIVE_WINDOW`
active_win_id=${active_win_id##*# }
active_win_id=${active_win_id:0:9} # eliminate potentially trailing spaces
top_win_id=`DISPLAY=$realdisp.${display} xprop -root _NET_CLIENT_LIST_STACKING`
top_win_id=${active_win_id##*, }
top_win_id=${top_win_id:0:9} # eliminate potentially trailing spaces
# Check if Active Window (the foremost window) is in fullscreen state
if [ ${#active_win_id} -ge 3 ]; then
isActiveWinFullscreen=`DISPLAY=$realdisp.${display} xprop -id $active_win_id | grep _NET_WM_STATE_FULLSCREEN`
else
isActiveWinFullscreen=""
fi
if [ ${#top_win_id} -ge 3 ]; then
isTopWinFullscreen=`DISPLAY=$realdisp.${display} xprop -id $top_win_id | grep _NET_WM_STATE_FULLSCREEN`
else
isTopWinFullscreen=""
fi
if [[ "$isActiveWinFullscreen" = *NET_WM_STATE_FULLSCREEN* ]] || [[ "$isTopWinFullscreen" = *NET_WM_STATE_FULLSCREEN* ]]; then
isAppRunning && delayScreensaver
fi
done
}
# Check if active window is mplayer, vlc or firefox
# Then change IFs to detect more specifically the apps "<vlc>" and if process name exist
isAppRunning() {
# Get title of active window
active_win_title=`xprop -id $active_win_id | grep "WM_CLASS(STRING)" | sed 's/^.*", //;s/"//g'`
case "$active_win_title" in
*[Cc]hromium*)
[ "$chromium_flash_detection" = 1 ] && [ `pgrep -fc "chromium --type=ppapi"` -ge 1 ] && return 0
[ "$html5_detection" = 1 ] && [ `pgrep -c chromium` -ge 1 ] && checkAudio "chromium" && return 0
;;
*[Cc]hrome*)
[ "$chromium_flash_detection" = 1 ] && [ `pgrep -fc "chrome --type=ppapi"` -ge 1 ] && return 0
[ "$html5_detection" = 1 ] && [ `pgrep -c chrome` -ge 1 ] && checkAudio "chrom" && return 0
;;
*Firefox*)
[ "$html5_detection" = 1 ] && [ `pgrep -c firefox` -ge 1 ] && checkAudio "firefox" && return 0
;;
*opera*)
[ "$html5_detection" = 1 ] && [ `pgrep -c opera` -ge 1 ] && checkAudio "opera" && return 0
;;
*epiphany*)
[ "$html5_detection" = 1 ] && [ `pgrep -c epiphany` -ge 1 ] && checkAudio "epiphany" && return 0
;;
*unknown*|*plugin-container*)
[ "$firefox_flash_detection" = 1 ] && [ `pgrep -c plugin-container` -ge 1 ] && return 0
;;
*WebKitPluginProcess*)
[ "$webkit_flash_detection" = 1 ] && [ `pgrep -fc ".*WebKitPluginProcess.*flashp.*"` -ge 1 ] && return 0
;;
*MPlayer|mplayer*)
[ "$mplayer_detection" = 1 ] && [ `pgrep -c mplayer` -ge 1 ] && checkAudio mplayer && return 0
;;
*vlc*|*VLC*)
[ $vlc_detection = 1 ] && [ `pgrep -c vlc` -ge 1 ] && checkAudio vlc && return 0
;;
*totem*)
[ $totem_detection = 1 ] && [ `pgrep -c totem` -ge 1 ] && checkAudio totem && return 0
;;
*steam*)
[ $steam_detection = 1 ] && [ `pgrep -c steam` -ge 1 ] && return 0
;;
*minitube*)
[ $minitube_detection = 1 ] && [ `pgrep -c minitube` -ge 1 ] && return 0
;;
*)
if [ -n "$chrome_app_name" ]; then
# Check if google chrome is running in app mode
[[ "$active_win_title" == *$chrome_app_name* ]] && [ `pgrep -fc "chrome --app"` -ge 1 ] && return 0
fi
;;
esac
[ -n "$minload" ] && [ "$(echo "$(sed 's/ .*$//' /proc/loadavg) > $minload" | bc -q)" -eq "1" ] && return 0
false
}
checkAudio() {
# Check if application is streaming sound to PulseAudio
[ $audio_detection = 0 ] && return 0
pacmd list-sink-inputs | grep -Eiq "application.name = .*$1.*"
}
delayScreensaver() {
# Reset inactivity time counter so screensaver is not started
case $screensaver in
"xscreensaver" )
xscreensaver-command -deactivate > /dev/null;;
"mate-screensaver" )
mate-screensaver-command --poke > /dev/null;;
"xautolock" )
xautolock -disable
xautolock -enable;;
"xdofallback" )
xdotool key shift
;;
"freedesktop-screensaver" )
dbus-send --session --reply-timeout=2000 --type=method_call --dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SimulateUserActivity;;
esac
# Check if DPMS is on. If it is, deactivate and reactivate again. If it is not, do nothing.
dpmsStatus=`xset -q | grep -c 'DPMS is Enabled'`
[ "$dpmsStatus" = 1 ] && xset -dpms && xset dpms
}
help() {
echo "USAGE: $ lighsonplus [FLAG1 ARG1] ... [FLAGn ARGn]"
echo "FLAGS (ARGUMENTS must be 0 or 1, except stated otherwise):"
echo ""
echo " -d, --delay Time interval in minutes, default is 1 min"
echo " -pa, --audio Audio detection"
echo " -mp, --mplayer mplayer detection"
echo " -v, --vlc VLC detection"
echo " -t, --totem Totem detection"
echo " -ff, --firefox-flash Firefox flash plugin detection"
echo " -cf, --chromium-flash Chromium flash plugin detection"
echo " -ca, --chrome-app Chrome app detection, app name must be passed"
echo " -wf, --webkit-flash Webkit flash detection"
echo " -h5, --html5 HTML5 detection"
echo " -s, --steam Steam detection"
echo " -mt, --minitube MiniTube detection"
echo " -la, --minload Load average detection"
}
checkBool() {
[ -n "$2" ] && [[ $2 = [01] ]] || die "Invalid argument. 0 or 1 expected after \"$1\" flag."
}
while [ -n "$1" ]; do
case $1 in
"-d" | "--delay" )
[[ -z "$2" || "$2" = *[^0-9]* ]] && die "Invalid argument. Time in minutes expected after \"$1\" flag. Got \"$2\"" || delay=$2;;
"-ca" | "--chrome-app" )
[ -n "$2" ] && chrome_app_name="$2" || die "Missing argument. Chrome app name expected after \"$1\" flag.";;
"-la" | "--minload" )
[ -n "$2" ] && [[ "$(echo "$2 > 0" | bc -q)" -eq 1 ]] && minload=$2 || die "Invalid argument. >0 expected after \"$1\" flag.";;
"-pa" | "--audio" )
checkBool "$@"; audio_detection=$2;;
"-mp" | "--mplayer" )
checkBool "$@"; mplayer_detection=$2;;
"-v" | "--vlc" )
checkBool "$@"; vlc_detection=$2;;
"-t" | "--totem" )
checkBool "$@"; totem_detection=$2;;
"-ff" | "--firefox-flash" )
checkBool "$@"; firefox_flash_detection=$2;;
"-cf" | "--chromium-flash" )
checkBool "$@"; chromium_flash_detection=$2;;
"-wf" | "--webkit-flash" )
checkBool "$@"; webkit_flash_detection=$2;;
"-h5" | "--html5" )
checkBool "$@"; html5_detection=$2;;
"-s" | "--steam" )
checkBool "$@"; steam_detection=$2;;
"-mt" | "--minitube" )
checkBool "$@"; minitube_detection=$2;;
"-h" | "--help" )
help && exit 0;;
* )
die "Invalid argument. See -h, --help for more information.";;
esac
# Arguments must always be passed in tuples
shift 2
done
# Convert delay to seconds. We substract 10 for assurance.
delay=$[delay*60-10]
echo "Start lightson+ mainloop"
while true; do
[ -f "$inhibitfile" ] && delayScreensaver || checkFullscreen
sleep $delay
done
exit 0

47
scripts/mate-panel-auto-opaque Executable file
View file

@ -0,0 +1,47 @@
#!/bin/bash
# Requires: xprop
##################################
# Adjust values to suit
PANEL=top
PANEL_ALPHA_REGULAR=0
PANEL_ALPHA_MAXIMUM=1
##################################
##################################
# don't change anything below here
gsettings set org.mate.panel.toplevel.background:/org/mate/panel/toplevels/top/background/ type "color"
CURR=0
while true
do
MAX_FND=0
for w in $(xprop -notype -root _NET_CLIENT_LIST 2>/dev/null | cut -d'#' -f2 | tr ',' '\n' | awk '{print $1}')
do
if [[ "$(xprop -id $w -notype _NET_WM_DESKTOP 2>/dev/null | cut -d' ' -f3)" -eq "$(xprop -root -notype _NET_CURRENT_DESKTOP 2>/dev/null | cut -d' ' -f3)" ]]
then
if xprop -id $w _NET_WM_STATE | grep -E "MAXIMIZED_HORZ.*MAXIMIZED_VERT" > /dev/null 2>&1
then
if xprop -id $w WM_STATE | grep -E "window state: Normal" > /dev/null 2>&1
then
MAX_FND=1
break
fi
fi
fi
done
if [[ $MAX_FND -eq 1 && $CURR -eq 0 ]]
then
gsettings set org.mate.panel.toplevel.background:/org/mate/panel/toplevels/${PANEL}/background/ color "rgba(60,59,55,$PANEL_ALPHA_MAXIMUM)"
CURR=1
elif [[ $MAX_FND -eq 0 && $CURR -eq 1 ]]
then
gsettings set org.mate.panel.toplevel.background:/org/mate/panel/toplevels/${PANEL}/background/ color "rgba(60,59,55,$PANEL_ALPHA_REGULAR)"
CURR=0
fi
sleep 1
done
exit 0

20
scripts/pulse-sink Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
opts="Fone\nSpeaker\nHDMI"
out=$(echo -e $opts | rofi -p "Saida:" -no-custom -only-matching -dmenu)
if [ "$out" == "HDMI" ]
then
pacmd set-card-profile 0 output:hdmi-stereo+input:analog-stereo
elif [ "$out" == "Speaker" ] || [ "$out" == "Fone" ]
then
pacmd set-card-profile 0 output:analog-stereo+input:analog-stereo
if [ "$out" == "Speaker" ]
then
pacmd set-sink-port @DEFAULT_SINK@ analog-output-speaker
else
pacmd set-sink-port @DEFAULT_SINK@ analog-output-headphones
fi
fi

9
scripts/rofimusic Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
music=$(mpc listall --format '%artist% : %title% ' | rofi -i -dmenu)
artist=$(echo "$music" | cut -d: -f1)
title=$(echo "$music" | cut -d: -f2)
echo title "$title" artist "$artist"
mpc searchplay title "$title"
#artist "$artist"

5
scripts/scrot-copy.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
scrot "Imagens/Screenshots/%Y-%m-%d_%H-%M-%S.$t" -e \
"xclip -selection clipboard -target image/png -i $f" \
-e "twmnc 'Captura de tela copiada e sava em $f' --ac 'feh $f'"

5
scripts/setwall.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
xfconf-query --channel xfce4-desktop \
--property /backdrop/screen0/monitorHDMI-2/workspace0/last-image \
--set $1
echo $1

3
scripts/volume Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
pactl set-sink-volume @DEFAULT_SINK@ $1

48
scripts/xfce4-panel-auto-opaque Executable file
View file

@ -0,0 +1,48 @@
#!/usr/bin/env bash
#-- CONFIGURATION
transparent_alpha=0
maximized_alpha=100
interval=0.5
#--
alpha_prop_list=()
for prop in $(xfconf-query -c xfce4-panel -p /panels -l); do
[[ "$prop" == *"background-alpha"* ]] && alpha_prop_list+=($prop)
done
on_maximized() {
for alpha_prop in "${alpha_prop_list[@]}"; do
xfconf-query -c xfce4-panel -p "$alpha_prop" -s "$maximized_alpha"
done
}
on_no_window_maximized() {
for alpha_prop in "${alpha_prop_list[@]}"; do
xfconf-query -c xfce4-panel -p "$alpha_prop" -s "$transparent_alpha"
done
}
echo $alpha_prop_list
while true; do
current_desktop=$(wmctrl -d | grep '*' | cut -d ' ' -f1)
is_any_window_maximized=false
for i in $(wmctrl -lG | awk -v d="$current_desktop" '$2==d {print $1}'); do
status=$(xprop -id $i _NET_WM_STATE)
if [[ "$status" == *"MAXIMIZED"* && "$status" != *"HIDDEN"* ]]; then
is_any_window_maximized=true
break
else
is_any_window_maximized=false
fi
done
if [[ $is_any_window_maximized == true ]]; then
on_maximized
else
on_no_window_maximized
fi
sleep $interval
done

234
sway/.config/sway/config Normal file
View file

@ -0,0 +1,234 @@
# LEL
#
# Variables
# # Logo key.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
set $term termite
set $menu swaymsg exec 'rofi -show drun -display-drun Iniciar:'
font pango:Roboto 14px
#
# Output configuration
#
output * bg ~/.config/sway/minimalistic_interjection.jpg fill
# output HDMI-A-1 resolution 720x576
#Disable laptop screen if closed, --reload is important
set $laptop eDP-1
bindswitch --reload lid:on output $laptop disable
bindswitch --reload lid:off output $laptop enable
# Backlight settings for laptops
exec sudo light -N 1
bindsym XF86MonBrightnessUp exec sudo light -A 5
bindsym XF86MonBrightnessDown exec sudo light -U 5
#
# Input configuration
#
input "1739:30966:Synaptics_TM3096-006" {
dwt enabled
natural_scroll enabled
tap enabled
}
input * {
xkb_layout br
xkb_numlock enabled
}
#
# Key bindings:
#
# Start a terminal
bindsym $mod+Return exec $term
#start web browser
bindsym $mod+q exec qutebrowser
# Kill focused window
bindsym $mod+x kill
# Start your launcher
bindsym $mod+d exec $menu
# Fill passwords
bindsym Control+$mod+p exec keepmenu
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
# Lock Sway
bindsym $mod+Control+s exec swaylock
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'Do you really want to exit sway?' -b 'Yes, exit sway' 'swaymsg exit'
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Resizing containers:
bindsym $mod+Control+$left resize shrink width 10px
bindsym $mod+Control+$down resize grow height 10px
bindsym $mod+Control+$up resize shrink height 10px
bindsym $mod+Control+$right resize grow width 10px
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# Assign programs to their workspace
assign [class=qutebrowser] workspace 2
assign [class=TelegramDesktop] workspace 10
assign [class=discord] workspace 10
#
# Layout stuff:
#
# Splits
bindsym $mod+b splith
bindsym $mod+v splitv
# Layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Floating
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window
bindsym $mod+minus scratchpad show
#
# Screenshots:
#
# Screens to file
bindsym Print exec grim $(xdg-user-dir PICTURES)/$(date +'%Y-%m-%d-%H%M%S_grim.png')
# Screen area to file
bindsym Shift+Print exec grim -g "$(slurp)" $(xdg-user-dir PICTURES)/$(date +'%Y-%m-%d-%H%M%S_grim-slurp.png')
# Screen area to clipboard
bindsym Control+Shift+Print exec grim -g "$(slurp)" - | wl-copy
# Focused monitor to clipboard
bindsym Control+Print exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy
#
# PulseAudio:
#
bindsym $mod+p exec ~/.config/scripts/pulse-sink
for_window [app_id="pavucontrol"] floating enable
# Volume controll
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
# Mute
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
# Media player controls
bindsym XF86AudioPlay exec mpc -q toggle
bindsym XF86AudioNext exec mpc -q next
bindsym XF86AudioPrev exec mpc -q prev
#
# Visual:
#
set $accent #CC575D
set $aclite #CC575D50
set $fg_color #ffffff
set $bg_color #202020
set $bg_darker #252525
set $alert #000000
# border background text indicator child_border
client.focused $accent $accent $fg_color $accent $accent
client.focused_inactive $bg_color $bg_color $fg_color $bg_color $bg_color
client.unfocused $bg_color $bg_color $fg_color $bg_color $bg_color
client.urgent $alert $alert $fg_color $alert $alert
bar swaybar_command waybar
default_border pixel 2px
gaps inner 5px
smart_gaps on
smart_borders on
#
# Daemons
#
#Notification Daemon
exec mako
# Block device Mounter to /run/media/<username>
exec udiskie
# Blue light filter
exec redshift
# lock screen after a period of inactivity execp for fullscreen
for_window [class=.*] inhibit_idle fullscreen
exec swayidle -w \
before-sleep 'swaylock -f' \
lock swaylock \
timeout 300 'swaylock -f' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on;reload"' \
include /etc/sway/config.d/*

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View file

@ -0,0 +1,3 @@
image=~/.config/sway/minimalistic_interjection.jpg
font=Roboto
#no-unlock-indicator

View file

@ -0,0 +1,95 @@
[options]
allow_bold = true
#audible_bell = false
bold_is_bright = true
#cell_height_scale = 1.0
#cell_width_scale = 1.0
#clickable_url = true
#dynamic_title = true
font = Roboto Mono 12
#fullscreen = true
#icon_name = terminal
#mouse_autohide = false
#scroll_on_output = false
#scroll_on_keystroke = true
# Length of the scrollback buffer, 0 disabled the scrollback buffer
# and setting it to a negative value means "infinite scrollback"
scrollback_lines = 10000
#search_wrap = true
#urgent_on_bell = true
#hyperlinks = false
# $BROWSER is used by default if set, with xdg-open as a fallback
#browser = xdg-open
# "system", "on" or "off"
cursor_blink = on
# "block", "underline" or "ibeam"
cursor_shape = block
# Hide links that are no longer valid in url select overlay mode
#filter_unmatched_urls = true
# Emit escape sequences for extra modified keys
#modify_other_keys = false
# set size hints for the window
#size_hints = false
# "off", "left" or "right"
#scrollbar = off
[colors]
# special
foreground = #aaaaaa
foreground_bold = #afafaf
cursor = #CC5757
background = rgba(30,30,30,0.95)
# 303030
# black
color0 = #555555
color8 = #888888
# red
color1 = #9c3528
color9 = #cc5757
# green
color2 = #61bc3b
color10 = #86df5d
# yellow
color3 = #f3b43a
color11 = #fdd75a
# blue
color4 = #0d68a8
color12 = #0f75bd
# magenta
color5 = #744560
color13 = #9e5e83
# cyan
color6 = #288e9c
color14 = #37c3d6
# white
color7 = #a2a2a2
color15 = #f9f9f9
[hints]
#font = Monospace 12
#foreground = #dcdccc
#background = #3f3f3f
#active_foreground = #e68080
#active_background = #3f3f3f
#padding = 2
#border = #3f3f3f
#border_width = 0.5
#roundness = 2.0
# vim: ft=dosini cms=#%s

View file

@ -0,0 +1,132 @@
{
"layer": "top", // Waybar at top layer
//"margin":"5 5 0 5",
//"margin-bottom":10,
//"position": "bottom", // Waybar position (top|bottom|left|right)
//"height": 28, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
"modules-center": ["clock"],
"modules-right": ["mpd", "pulseaudio", "network", "battery","custom/weather", "tray"],
//Modules configuration
"sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
"format": "{name}: {icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
// "4": "",
"10": "",
"urgent": "",
"focused": "",
"default": ""
}
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"sway/window":{
"tooltip":false,
"format": " {} "
},
"mpd": {
"format": " {stateIcon} {title} - {artist} 🎜 ",
"format-disconnected": " Disconnected 🎜 ",
"format-stopped": " Stopped 🎜 ",
"timeout":15,
"unknown-tag": " N/A ",
"tooltip":false,
"interval": 2,
"state-icons": {
"paused": "",
"playing": ""
}
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
"tooltip-format": "{:%Y-%m-%d | %H:%M}",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", ""]
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
"format-full": "",
"format-icons": ["", "", "", "", ""]
},
"network": {
"tooltip":false,
// "interface": "wlp2*", // (Optional) To force the use of this interface
"on-click": "termite -e nmtui",
"format-wifi": "{essid} ",
"format-ethernet": "{ifname}: {ipaddr}/{cidr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
"scroll-step": 10,
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/weather": {
"tooltip":false,
"exec": "$HOME/.config/waybar/custom/weather",
"interval": 1800
}
}

View file

@ -0,0 +1,54 @@
#!/bin/sh
case $BLOCK_BUTTON in
1)i3-msg 'termite -e curl wttr.in';;
esac
CITY=$(curl -s ipinfo.io/city)
APPID="fd68c0fe7951f5ab7e24a240eb0942b8"
OUTPUT=$(http get http://api.openweathermap.org/data/2.5/weather\?APPID\=${APPID}\&q\="${CITY}"\&units\=metric)
# echo $APPID
# echo $OUTPUT
TEMP=$(echo $OUTPUT | jq -r ".main.temp")
WEATHER=$(echo $OUTPUT | jq -r ".weather[0].main")
case $WEATHER in
"Clear"*)
WEATHER=""
;;
"Clouds"*)
WEATHER=""
;;
"Rain"*)
WEATHER=""
;;
"Snow"*)
WEATHER=""
;;
"Thunderstorm"*)
WEATHER=""
;;
esac
# case $WEATHER in
# "Clear"*)
# WEATHER="Limpo :)"
# ;;
# "Clouds"*)
# WEATHER="Nublado :/"
# ;;
# "Rain"*)
# WEATHER="Chuva °~°"
# ;;
# "Snow"*)
# WEATHER="Neve ºUº"
# ;;
# "Thunderstorm"*)
# WEATHER="Tempestade *-*"
# ;;
# esac
echo "$TEMP°C $WEATHER"
#echo "$TEMP°C"

View file

@ -0,0 +1,218 @@
* {
border: none;
border-radius: 0;
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 14px;
min-height: 0;
/*
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
*/
}
window#waybar {
background-color: rgba(30, 30, 30, 0.9);
color: #ffffff;
transition: background-color .3s;
}
window#waybar.hidden {
opacity: 0.2;
}
window#waybar.empty {
background-color: rgba(0,0,0,.2);
border:none;
}
window#waybar.solo{
background-color: #303030;
border: none;
}
window#waybar.termite {
background-color: rgba(30,30,30,0.95);
border: none;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
transition: .3s border-top-width;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
border-top: 1px solid white;
}
#workspaces button.focused {
background-color: rgba(255,255,255,.01);
border-top: 3px solid #cc5757;
}
#workspaces button.urgent {
border-top: 3px solid #eb4deb;
}
/*Window Title*/
#window{
color:#ccc;
margin:0 4px;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#temperature,
#mpd,
#backlight,
#network,
#pulseaudio,
#custom-media,
#custom-weather,
#tray,
#mode,
#idle_inhibitor {
padding: 0 10px;
margin: 0 4px;
color: #ffffff;
}
#clock {
/*border-top: 2px solid #64727D;*/
font:15px bold;
}
#battery {
border-top: 2px solid #ffffff;
/*background-color: #ffffff;*/
}
#battery.charging {
border-top: 2px solid #26A65B;
/*background-color: #26A65B;*/
color: #ffffff;
}
@keyframes blink {
to {
border-top: 2px solid #ffffff;
/*background-color: #ffffff;*/
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
border-top: 2px solid #000000;
background-color: #000000;
}
#network {
border-top: 2px solid #66cc99;
/*background-color: #66cc99;*/
/*color: #2a5c45;*/
}
#network.disconnected {
border-top: 2px solid #f53c3c;
/*background-color: #f53c3c;*/
}
#pulseaudio {
border-top: 2px solid #f1c40f;
/*background-color: #f1c40f;*/
/*color: #000000;*/
}
#pulseaudio.muted {
border-top: 2px solid #90b1b1;
/*background-color: #90b1b1;*/
/*color: #2a5c45;*/
}
#custom-weather {
border-top: 2px solid #2980b9;
/*background-color: #2980b9;*/
}
#tray {
border-top: 2px solid #2980b9;
/*background-color: #2980b9;*/
}
#mpd {
border-top: 2px solid #66cc99;
/*background-color: #66cc99;*/
/*color: #2a5c45;*/
}
#mpd.disconnected {
border-top: 2px solid #f53c3c;
/*background-color: #f53c3c;*/
}
#mpd.stopped {
border-top: 2px solid #90b1b1;
/*background-color: #90b1b1;*/
}
#mpd.paused {
font-size: 0;
border: none;
/*background-color: #51a37a;*/
}
/*
* UNUSED
*
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#backlight {
background-color: #90b1b1;
}
*/

151
zsh/.zshrc Normal file
View file

@ -0,0 +1,151 @@
export QT_QPA_PLATFORMTHEME=qt5ct
export QPA_PLATFORM=wayland
export MOZ_ENABLE_WAYLAND=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export XCURSOR_THEME=capitaine-cursors
export XDG_CURRENT_DESKTOP=Unity
export PATH=$PATH:~/.local/bin
export EDITOR=nvim
export VISUAL=nvim
export BROWSER=qutebrowser
export PAGER=less
if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]
then
clear
exec sway
fi
man() {
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
}
#
# Plugins
#
export ZPLUG_HOME=~/.local/share/zplug
if [ ! -d $ZPLUG_HOME ]
then
git clone https://github.com/zplug/zplug $ZPLUG_HOME
fi
source $ZPLUG_HOME/init.zsh
zplug 'zplug/zplug', hook-build:'zplug --self-manage'
zplug "zsh-users/zsh-completions"
zplug "scripts/dirhistory", from:oh-my-zsh
zplug "zsh-users/zsh-history-substring-search"
# sugestões automaticas
zplug "momo-lab/zsh-abbrev-alias"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=black"
ZSH_AUTOSUGGEST_STRATEGY=(completion history)
ZSH_AUTOSUGGEST_USE_ASYNC=true
zplug "zsh-users/zsh-autosuggestions"
#
# Promp config
#
bindkey -e
SPACESHIP_PROMPT_ADD_NEWLINE=false
zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
if ! zplug check
then
zplug install
fi
zplug load
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
abbrev-alias -g v=nvim
abbrev-alias -g rv="sudo nvim"
abbrev-alias es="nvim ~/.config/sway/config"
abbrev-alias ez="nvim ~/.config/zsh/.zshrc"
abbrev-alias ev="nvim ~/.config/nvim/init.vim"
abbrev-alias r=ranger
abbrev-alias rm=trash
abbrev-alias suspend="systemctl suspend"
abbrev-alias tlsave='telegram-cli -We "send_document @lelgenio "'
alias emacs='env TERM=xterm-256color /usr/bin/emacs -nw'
abbrev-alias em='emacs -nw'
abbrev-alias -i
alias ls='ls --color=auto --human-readable --group-directories-first --classify'
alias ll='ls --color=auto --human-readable --group-directories-first --classify -l'
alias lla='ls --color=auto --human-readable --group-directories-first --classify -la'
# Keys.
case $TERM in
rxvt*|xterm*)
bindkey "^[[H" beginning-of-line #Home key
bindkey "^[[F" end-of-line #End key
bindkey "^[[3~" delete-char #Del key
bindkey "^[[A" history-substring-search-up #Up Arrow
bindkey "^[[B" history-substring-search-down #Down Arrow
bindkey "^[Oc" forward-word # control + right arrow
bindkey "^[Od" backward-word # control + left arrow
bindkey "^H" backward-kill-word # control + backspace
bindkey "^[[3^" kill-word # control + delete
;;
linux)
bindkey "^[[1~" beginning-of-line #Home key
bindkey "^[[4~" end-of-line #End key
bindkey "^[[3~" delete-char #Del key
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
;;
screen|screen-*)
bindkey "^[[1~" beginning-of-line #Home key
bindkey "^[[4~" end-of-line #End key
bindkey "^[[3~" delete-char #Del key
bindkey "^[[A" history-beginning-search-backward #Up Arrow
bindkey "^[[B" history-beginning-search-forward #Down Arrow
bindkey "^[Oc" forward-word # control + right arrow
bindkey "^[OC" forward-word # control + right arrow
bindkey "^[Od" backward-word # control + left arrow
bindkey "^[OD" backward-word # control + left arrow
bindkey "^H" backward-kill-word # control + backspace
bindkey "^[[3^" kill-word # control + delete
;;
esac
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
source /usr/share/doc/pkgfile/command-not-found.zsh
HYPHEN_INSENSITIVE="true"
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
zstyle ':completion:*' completer _oldlist _expand _complete _ignored _match _correct _approximate _prefix
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' menu select=list select=0
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' use-compctl true
zstyle ':completion:*' verbose true
zstyle ':completion:*' rehash true
zstyle :compinstall filename '/home/lelgenio/.config//zsh//.zshrc'
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
autoload -Uz compinit
compinit