Switch to GNU stow

This commit is contained in:
Marty Oehme 2019-12-29 23:12:13 +01:00
parent a2605c4254
commit d34cecb27e
137 changed files with 39244 additions and 141 deletions

View File

@ -1,111 +0,0 @@
###############################################################################
# ceerious i3 status config
# see "man i3status" for documentation.
#
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
###############################################################################
general {
interval = 1
colors = true
color_good = '#88b090'
color_degraded = '#ccdc90'
color_bad = '#e89393'
}
order += "volume master"
order += "disk /"
#order += "disk /data"
#order += "disk /home"
#order += "run_watch DHCP"
#order += "ipv6"
#order += "run_watch VPN"
order += "wireless wlp4s0"
#order += "ethernet enp5s0"
order += "battery 0"
order += "cpu_temperature 0"
order += "cpu_usage 0"
order += "load"
order += "tztime local"
#wireless wlp4s0 {
# format_up = "%quality  %essid %ip"
# format_down = ""
#}
#ethernet enp5s0 {
# # if you use %speed, i3status requires root privileges
# format_up = "%ip (%speed)"
# format_down = ""
#}
battery 0 {
format = "%status %percentage %remaining"
format_down = ""
last_full_capacity = true
integer_battery_capacity = true
low_threshold = 11
threshold_type = percentage
hide_seconds = true
status_chr = " "
status_bat = " "
status_unk = " "
status_full = " "
}
run_watch DHCP {
pidfile = "/var/run/dhclient*.pid"
}
run_watch VPN {
pidfile = "/var/run/vpnc/pid"
}
#%Y-%m-%d %H:%M:%S'
tztime local {
format = " %d/%m/%Y  %H:%M"
}
load {
format = " %1min"
}
cpu_usage {
format = " %usage"
}
cpu_temperature 0 {
format = " %degrees°C"
}
disk "/" {
format = " %avail"
prefix_type = custom
low_threshold = 20
threshold_type = percentage_avail
}
#disk "/data" {
# format = " %avail"
# prefix_type = custom
# low_threshold = 20
# threshold_type = percentage_avail
#}
#disk "/data" {
# format = " %avail"
# prefix_type = custom
# low_threshold = 20
# threshold_type = percentage_avail
#}
volume master {
format = "%volume  "
format_muted = " "
device = "default"
mixer = "Master"
mixer_idx = 0
}

View File

@ -1,29 +0,0 @@
[settings]
default-library = academia
opentool = xdg-open
file-browser = vifm
ref-format = {doc[author_list][0][surname]}{doc[year]}
add-confirm = True
add-name = {doc[author]}-{doc[title]}
add-folder-name = {doc[author]}-{doc[title]}
file-name = {doc[author]}_{doc[year]}_{doc[title]}
add-file-name = {doc[author]}_{doc[year]}_{doc[title]}
mark-header-format = {mark[value]}: {mark[name]}
mark-opener-format = zathura --page {mark[value]}
notes-name = notes.Rmd
[tui]
editmode = vi
options_list.selected_margin_style = bg:ansiwhite fg:ansiblack
options_list.unselected_margin_style = bg:ansiblack
[test]
dir = ~/documents/library
[academia]
dir = ~/Nextcloud/Library/academia

View File

@ -1,6 +1,52 @@
# dotfiles Read-Me and Roadmap
__ **THE BELOW README IS OUT OF DATE DO NOT FOLLOW ITS INSTALL INSTRUCTIONS** __
## What's in these dotfiles
* [x] vim configuration for simple programming tasks (especially go/typescript/python/bash) and prose
* [x] academic workflow tools, to allow quick citation, pdf compilation, and preview
* [x] simple, efficient polybar with package update notification, and spotify integration
* [x] tmux session management through `tm` and `tl` tools
* [x] quick terminal-wide color management through `sd`/`sD`/`sl`/`sL` commands, allowing two light and dark color-schemes
* [x] many vim color-schemes with quick light/dark switching (`F8`) and theme switch (`<Space>+F8`)
* [x] quick directory jumping using z, with fzf integration
* [x] fzf integrations for bibtex citation, vim buffer management, most recently used switching, shell command history, and more
## Quick-Start
The dotfiles are based on a bare-repository residing in your home directory. To enable a faster usage of the dotfile git commands, a `dot` command is supplied which mirrors the usual `git` functionality, but solely applies it to your dotfiles.
To install you need git on your system; to effectively use the dotfiles you should be using zsh (`chsh -s /bin/zsh` to switch your current user to the shell).
Clone the bare repo, rename it and force a checkout with the following command - **NOTE** this WILL **OVERWRITE YOUR EXISTING FILES**, so have a look at what is contained beforehand.
`git clone https://gitlab.com/marty-oehme/dotfiles.git df && cp -rf df/.git ~/.dotfiles && rm -rf df && cd ~ && git --git-dir=$HOME/.dotfiles/ checkout -f master`
It will clone your dotfiles into the .dotfiles directory in your home directory and then force a checkout of the current master branch. Open a new terminal window and you should live in the dotfiles.
## What's in these dotfiles
* [x] vim configuration for simple programming tasks (especially go/typescript/python/bash) and prose
* [x] academic workflow tools, to allow quick citation, pdf compilation, and preview
* [x] simple, efficient polybar with package update notification, and spotify integration
* [x] tmux session management through `tm` and `tl` tools
* [x] quick terminal-wide color management through `sd`/`sD`/`sl`/`sL` commands, allowing two light and dark color-schemes
* [x] many vim color-schemes with quick light/dark switching (`F8`) and theme switch (`<Space>+F8`)
* [x] quick directory jumping using z, with fzf integration
* [x] fzf integrations for bibtex citation, vim buffer management, most recently used switching, shell command history, and more
## Notable Folders
* generally, most configuration for applications follows the XDG specifications, keeping configuration in .config directory and supplementary files in .local/share directory
* `.config/shell` contains all the general zsh/bash/sh configuration and environment variables usually contained in .zshrc/.zprofile/..; it is divided in login shell config (loginrc.d), general shell config (rc.d) and zsh specific (zsh.d)
* `.config/rofi` contains additional scripts and a simple theming framework for rofi and should probably be migrated into the correct directories at some point
* `.local/bin` contains most executable user scripts
* `.local/share/pandoc` contains configuration for academic latex (pandoc, really) writing and is of interest if you want to use this functionality
* `.xinitrc` is used for x initialization and program startup, customize to your needs
* `.gitlab-ci.yml` is only used for simple CI code linting and static analysis on gitlab, can be deleted on individual deployments
NOTE:
**THE BELOW README IS OUT OF DATE DO NOT FOLLOW ITS INSTALL INSTRUCTIONS**
At some point I will get around to updating it

View File

View File

@ -0,0 +1 @@
colo nord

View File

@ -0,0 +1,22 @@
function CompileDoc()
:execute(":w!")
:execute(":!compile \"%\"")
endfunction
function CompileDocNoOutput()
:execute(":w!")
:execute(":silent !compile \"%\"")
endfunction
function CompiledOpen()
:execute(":silent !open-compiled \"%\"")
endfunction
function CompileDocAndOpen()
call CompileDocNoOutput()
call CompiledOpen()
endfunction
command CompileDoc call CompileDoc()
command CompileOpen call CompiledOpen()
command CompileDocAndOpen call CompileDocAndOpen()

View File

@ -0,0 +1,16 @@
local w = vim.loop.new_fs_event()
local function on_change(err, fname, status)
-- Do work...
vim.api.nvim_command('checktime')
-- Debounce: stop/start.
w:stop()
watch_file(fname)
end
function watch_file(fname)
local fullpath = vim.api.nvim_call_function(
'fnamemodify', {fname, ':p'})
w:start(fullpath, {}, vim.schedule_wrap(function(...)
on_change(...) end))
end
vim.api.nvim_command(
"command! -nargs=1 Watch call luaeval('watch_file(_A)', expand('<args>'))")

View File

@ -0,0 +1,403 @@
[colors]
;background = ${xrdb:color0:#222}
background = #222
background-alt = #444
;foreground = ${xrdb:color7:#222}
foreground = #dfdfdf
foreground-alt = #555
primary = #ffb52a
secondary = #e60053
alert = #bd2c40
[bar/example]
;monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 27
;offset-x = 1%
;offset-y = 1%
radius = 6.0
fixed-center = false
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3
line-color = #f00
border-size = 0
border-color = #00000000
padding-left = 15
padding-right = 15
module-margin-left = 1
module-margin-right = 2
font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
modules-left = bspwm i3
modules-center = mpd
modules-right = filesystem xbacklight alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature powermenu date
tray-position = right
tray-padding = 2
tray-background = #0063ff
;wm-restack = bspwm
;wm-restack = i3
;override-redirect = true
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
scroll-up = i3wm-wsnext
scroll-down = i3wm-wsprev
cursor-click = pointer
cursor-scroll = ns-resize
[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}
label-layout = %layout%
label-layout-underline = ${colors.secondary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}
[module/bspwm]
type = internal/bspwm
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2
label-occupied = %index%
label-occupied-padding = 2
label-urgent = %index%!
label-urgent-background = ${colors.alert}
label-urgent-padding = 2
label-empty = %index%
label-empty-foreground = ${colors.foreground-alt}
label-empty-padding = 2
; Separator in between workspaces
; label-separator = |
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
; Only show workspaces on the same output as the bar
;pin-workspaces = true
label-mode-padding = 2
label-mode-foreground = #000
label-mode-background = ${colors.primary}
; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2
; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = 2
; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
label-visible-padding = ${self.label-focused-padding}
; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.alert}
label-urgent-padding = 2
; Separator in between workspaces
; label-separator = |
[module/mpd]
type = internal/mpd
format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
icon-prev = 
icon-stop = 
icon-play = 
icon-pause = 
icon-next = 
label-song-maxlen = 25
label-song-ellipsis = true
[module/xbacklight]
type = internal/xbacklight
format = <label> <bar>
label = BL
bar-width = 10
bar-indicator = |
bar-indicator-foreground = #fff
bar-indicator-font = 2
bar-fill = ─
bar-fill-font = 2
bar-fill-foreground = #9f78e1
bar-empty = ─
bar-empty-font = 2
bar-empty-foreground = ${colors.foreground-alt}
[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #f90000
label = %percentage:2%%
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #4bffdc
label = %percentage_used%%
[module/wlan]
type = internal/network
interface = wlp0s29u1u1
interval = 3.0
format-connected = <ramp-signal> <label-connected>
format-connected-underline = #9f78e1
label-connected = %essid%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-4 = 
ramp-signal-foreground = ${colors.foreground-alt}
[module/eth]
type = internal/network
interface = enp6s0
interval = 3.0
format-connected-underline = #55aa55
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.foreground-alt}
label-connected = %local_ip%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
[module/date]
type = internal/date
interval = 5
date =
date-alt = " %Y-%m-%d"
time = %H:%M
time-alt = %H:%M:%S
format-prefix = 
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #0a6cf5
label = %date% %time%
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <bar-volume>
label-volume = VOL %percentage%%
label-volume-foreground = ${root.foreground}
label-muted = 🔇 muted
label-muted-foreground = #666
bar-volume-width = 10
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = |
bar-volume-indicator-font = 2
bar-volume-fill = ─
bar-volume-fill-font = 2
bar-volume-empty = ─
bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground-alt}
[module/alsa]
type = internal/alsa
format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${root.foreground}
format-muted-prefix = " "
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted
bar-volume-width = 10
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = |
bar-volume-indicator-font = 2
bar-volume-fill = ─
bar-volume-fill-font = 2
bar-volume-empty = ─
bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground-alt}
[module/battery]
type = internal/battery
battery = BAT0
adapter = ADP1
full-at = 98
format-charging = <animation-charging> <label-charging>
format-charging-underline = #ffb52a
format-discharging = <animation-discharging> <label-discharging>
format-discharging-underline = ${self.format-charging-underline}
format-full-prefix = " "
format-full-prefix-foreground = ${colors.foreground-alt}
format-full-underline = ${self.format-charging-underline}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-foreground = ${colors.foreground-alt}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750
animation-discharging-0 = 
animation-discharging-1 = 
animation-discharging-2 = 
animation-discharging-foreground = ${colors.foreground-alt}
animation-discharging-framerate = 750
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
format = <ramp> <label>
format-underline = #f50a4d
format-warn = <ramp> <label-warn>
format-warn-underline = ${self.format-underline}
label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colors.secondary}
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-foreground = ${colors.foreground-alt}
[module/powermenu]
type = custom/menu
expand-right = true
format-spacing = 1
label-open = 
label-open-foreground = ${colors.secondary}
label-close =  cancel
label-close-foreground = ${colors.secondary}
label-separator = |
label-separator-foreground = ${colors.foreground-alt}
menu-0-0 = reboot
menu-0-0-exec = menu-open-1
menu-0-1 = power off
menu-0-1-exec = menu-open-2
menu-1-0 = cancel
menu-1-0-exec = menu-open-0
menu-1-1 = reboot
menu-1-1-exec = sudo reboot
menu-2-0 = power off
menu-2-0-exec = sudo poweroff
menu-2-1 = cancel
menu-2-1-exec = menu-open-0
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
;pseudo-transparency = false
[global/wm]
margin-top = 5
margin-bottom = 5

View File

@ -0,0 +1,9 @@
dot https://gitlab.com/marty-oehme/dotfiles
l https://links.martyoeh.me/
todo https://todoist.com/app?lang=de#start
mail https://mail.google.com/mail/u/0/#inbox
rss https://rss.martyoeh.me/
files http://files.martyoeh.me/
read https://read.martyoeh.me/
arch https://wiki.archlinux.org/
toggl https://toggl.com/app/timer

File diff suppressed because it is too large Load Diff

73
rofi/.config/rofi/modes/gopass Executable file
View File

@ -0,0 +1,73 @@
#!/usr/bin/env sh
# Custom key bindings do not work in script-mode, use a wrapper instead
# Script at .local/bin/rofi-gopass
OLD_GOPASS_GPG_OPTS="$GOPASS_GPG_OPTS"
break_out() {
if [ "$1" -eq 1 ]; then
exit
fi
}
has_xclip() {
if (type xclip >/dev/null 2>&1); then
printf "Your system does not appear to support pasting to clipboard via xclip."
exit 1
else
return 0
fi
}
to_clipboard() {
has_xclip
value="$(gopass show "$1" "$2")"
printf "%s" "$value" | xclip -selection clipboard
notify-send "Password" "Copied pass for $2 to clipboard.\n"
exit
}
show_secrets() {
printf "%s" "$(gopass ls -fo)"
}
# get_key() {
# return echo "$*" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch --export-secret-keys 2>&1
# }
# check_gpg_key() {
# check_keyphrase=$(echo "$*" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch --export-secret-keys 2>&1)
# if echo "$check_keyphrase" | grep -q -e '.*<.*@.*>'; then
# printf "\x00prompt\x1fLogin> \n"
# show_secrets
# elif echo "$check_keyphrase" | grep -q -e "can't get input" - || echo "$check_keyphrase" | grep -q -e "error receiving key" -; then
# printf "\x00prompt\x1fMaster Passphrase> \n"
# printf "%s" "$check_keyphrase"
# else
# echo "passphrase successfully input, $check_keyphrase"
# fi
# }
# has_selected_login() {
# echo "this is passed to ls: $*"
# echo "grep reveals: $(gopass ls -f | grep -e "$*" -)"
# if grep "$(gopass ls -f | grep -q -e "$*" -)"; then
# echo "ls found something"
# true
# else
# false
# fi
# }
# if [ -z "$*" ]; then
# check_gpg_key "$*"
# elif has_selected_login "$*"; then
# echo "has selected login $*"
# else
# check_gpg_key "$*"
# fi
main() {
show_secrets
}
main

View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
rofi_command="rofi"
original_args=("$@")
for ((i = 0; i <= "${#original_args[@]}"; i++)); do
if [ "${original_args[i]}" == "-color" ]; then
for ((j = 0; j <= "${#original_args[@]}"; j++)); do
if [ "${original_args[j]}" == "-theme" ]; then
echo "with theme: $i : ${original_args[i]} ${original_args[i + 1]}"
fi
done
fi
done
# for ((index = 0; index <= ${#lines_ary[@]}; index++)); do
# if [ "${lines_ary[index]}" == "Release:" ]; then
# echo "${lines_ary[index + 1]}"
# fi
# done
$rofi_command "${original_args[@]}"
# if [ -z "${color}" ]; then
# command rofi "${original_args[@]}"
# fi
# echo "color = ${color}"

View File

@ -0,0 +1,209 @@
#!/bin/bash
# rofi wrapper. Add custom settings here.
_rofi () {
rofi -dmenu -no-auto-select -i "$@"
}
# default settings
backend=ydotool
dotool_delay=200
daemon_wait=2
autotype_delay=2
key_autotype="Return"
key_usertype="Alt+2"
key_passtype="Alt+3"
key_actions="Alt+a"
key_clipboard="Alt+1"
key_fieldtype="Return"
# read config file
get_config_file () {
configs=("$ROFI_PASS_CONFIG"
"$HOME/.config/rofi-pass/rofi-gopass.conf"
"/etc/rofi-gopass.conf")
# return the first config file with a valid path
for config in "${configs[@]}"; do
# '! -z' is needed in case ROFI_PASS_CONFIG is not set
if [[ ! -z "${config}" && -f "${config}" ]]; then
printf "%s" "$config"
return
fi
done
}
# Make sure ESC will always end the programm.
# Call this function with "exit_check $?" after each rofi call.
exit_check () {
exit_value=$1
if [[ "${exit_value}" == "1" ]]; then
exit
fi
}
clipboard () {
local entry
local key
local value
entry="${1}"
key="${2}"
value="$(gopass show "${entry}" "${key}")"
printf '%s' "${value}" | xclip -sel clip
notify-send "rofi-gopass" "Copied ${key} to clipboard\nClearing in 45 seconds."
(sleep 45; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard | notify-send "rofi-gopass" "Clipboard cleared") &
exit
}
_ydotoold () {
if ! pgrep -x "ydotoold" >/dev/null; then
# ydotoold blocks the terminal, so we need to background it.
# Sadly this way we never know when the process finished starting up.
# Until ydotoold receives proper daemonizing we add a sleep value here.
ydotoold&
sleep "${daemon_wait}"
fi
}
_dotool () {
local mode
local key
mode="${1}"
key="${2:-null}"
case "${mode}" in
"type")
case "${backend}" in
"xdotool") xdotool type --delay "${dotool_delay}" --file - ;;
"ydotool") _ydotoold; ydotool type --delay "${dotool_delay}" --file - ;;
esac ;;
"key")
case "${backend}" in
"xdotool") xdotool key "${key}" ;;
"ydotool") _ydotoold; ydotool key "${key}" ;;
esac ;;
esac
}
list_passwords () {
gopass list --flat
}
autopass () {
local entry
local autotype
entry="${1}"
autotype="$(gopass show "${entry}" autotype)"
autotype="${autotype:-user :tab pass}"
for word in ${autotype}; do
case "$word" in
":tab") _dotool key Tab;;
":space") _dotool key " ";;
":delay") sleep "${autotype_delay}";;
":enter") _dotool key enter;;
"pass") printf '%s' "$(gopass show --password "${entry}")" | _dotool type ;;
*) printf '%s' "$(gopass show "${entry}" "${word}")" | _dotool type ;;
esac
done
}
list_keys () {
# gopass has no option to only list keys, so we need to build the list ourselves.
local entry
local keys
entry="${1}"
keys="$(gopass show "${entry}")"
printf '%s\n' "${keys}" | while read -r line; do
if [[ "${line}" == *": "* ]]; then
printf '%s\n' "${line%: *}"
fi
done
}
edit_key () {
local entry
local keys
entry="${1}"
keys="$(list_keys "${entry}")"
key_name=$(printf '%s\n' "${keys}" | _rofi -mesg "Enter new key or chose existing one")
exit_check $?
value_name=$(printf '%s' "" | _rofi -mesg "Enter Value for key \"${key_name}\"")
exit_check $?
if [[ -z "${key_name}" ]]; then
printf '%s' "${value_name}" | gopass insert -a "${entry}" "${key_name}"
else
printf '%s' "${value_name}" | gopass insert "${entry}" "${key_name}"
fi
}
# For dangerous operations call this function first. You can provide a message as argument.
# Example: confirm "Are you sure you want to delete entry?"
confirm () {
local message
message="${1}"
confirm_content=(
"Yes"
"No")
confirm_menu=$(printf '%s\n' "${confirm_content[@]}" | _rofi -mesg "${message}")
exit_check $?
case "${confirm_menu}" in
"Yes") : ;;
"No") exit ;;
esac
}
custom_type () {
local entry
local keys
entry="${1}"
keys="$(list_keys "${entry}")"
key_name=$(printf '%s\n' "${keys}" | _rofi -kb-accept-entry "" -no-custom -kb-custom-1 "${key_clipboard}" -kb-custom-2 "${key_fieldtype}" -mesg "${key_clipboard}: Copy to Clipboard | ${key_fieldtype}: Type Field")
local exit_value=$?
exit_check "${exit_value}"
case "${exit_value}" in
"10") clipboard "${entry}" "${key_name}" ;;
"11") printf '%s' "$(gopass show "${entry}" "${key_name}")" | _dotool type; exit ;;
esac
}
do_menu () {
local entry
entry="${1}"
action_menu_content=(
"< Go Back"
"---"
"Show Fields"
"Add/Edit Keys"
"Generate New Password"
"Delete Entry"
)
action_menu="$(printf '%s\n' "${action_menu_content[@]}" | _rofi -no-custom -mesg "Selected Entry: ${entry}" -p '> ')"
exit_value=$?
exit_check "${exit_value}"
case "${action_menu}" in
"< Go Back") main ;;
"Show Fields") custom_type "${entry}" ;;
"Add/Edit Keys") edit_key "${entry}" ;;
"Delete Entry") confirm "Delete ${entry}?"; gopass rm -f "${entry}" ;;
"Generate New Password") confirm "Generate a new password for ${entry}?"; gopass generate -f "${entry}" ;;
esac
}
main () {
entry="$(list_passwords | _rofi -kb-accept-entry "" -kb-custom-1 "${key_autotype}" -kb-custom-2 "${key_usertype}" -kb-custom-3 "${key_passtype}" -kb-custom-4 "${key_actions}" -mesg "${key_autotype}: Autotype | ${key_usertype}: Type User | ${key_passtype}: Type Pass | ${key_actions}: More Actions")"
exit_value=$?
exit_check "${exit_value}"
case "${exit_value}" in
"10") autopass "${entry}"; exit ;;
"11") printf '%s' "$(gopass show "${entry}" user)" | _dotool type; exit ;;
"12") printf '%s' "$(gopass show --password "${entry}")" | _dotool type; exit ;
esac
do_menu "${entry}"
}
main

99
rofi/.config/rofi/modes/test Executable file
View File

@ -0,0 +1,99 @@
#!/usr/bin/env sh
# POSIX COMPLIANT EXAMPLE ROFI MODE SCRIPT
#### Options ###
power_off_btn=""
reboot_btn=""
lock_btn=""
suspend_btn="鈴"
logout_btn=""
# find out what the user has input
# pad both values with a simple p in front
# if query is empty it tries to compare nothing with quit otherwise
# i.e. the [ operator, which will error out
if [ p"$*" = p"quit" ]; then
exit 0
fi
if [ x"$*" = x"noot" ]; then
rofi-powermenu
exit 0
fi
# another way to see what the user has input
# grep -a since it assumes with our nullcodes etc that this is a binary file
# grep -o to only leave the things we grep for
case $(echo "$*" | grep -a -o -e "Shutdown" -e "Reboot" -e "Lockscreen" -e "Logout" -e "Suspend") in
"Shutdown")
# do shutdown
;;
"Reboot")
# do shutdown
;;
"Lockscreen")
# do shutdown
;;
"Logout")
# do shutdown
;;
"Suspend")
# do shutdown
;;
esac
if [ "$@" ]; then
# Override the previously set prompt.
printf "\x00prompt\x1fChange prompt\n"
for a in 1 2 3 4 5 6 7 8 9 10; do
echo "$a"
done
echo "quit"
else
printf "\x00prompt\x1fPower> \n"
# we can use pango markup to hide text which we can then search. Neat!
printf "\0markup-rows\x1ftrue\n"
# echo -en "\0urgent\x1f0,2\n"
# echo -en "\0active\x1f1\n"
# echo -en "\0message\x1fSpecial <b>bold</b>message\n"
printf "aap\0icon\x1ffolder\n"
printf "<!-- Shutdown Poweroff --> %s\0icon\x1fstart-here\n" "$power_off_btn"
printf "<!-- Reboot Restart --> %s\n" "$reboot_btn"
printf "<!-- Lockscreen --> %s\n" "$lock_btn"
printf "<!-- Suspend Sleep --> %s\n" "$suspend_btn"
printf "<!-- Exit X Logout --> %s\n" "$logout_btn"
echo "<b>Bold</b>"
echo "quit"
fi
##!/usr/bin/env sh
#### Options ###
#power_off=""
#reboot=""
#lock=""
#suspend_btn="鈴"
#logout_btn=""
## Variable passed to rofi
#chosen="$(printf "%s\n%s\n%s\n%s\n%s" "$power_off" "$reboot" "$lock" "$suspend_btn" "$logout_btn" | $rofi_command -dmenu -selected-row 2)"
#case $chosen in
#$power_off)
# systemctl poweroff
# ;;
#$reboot)
# systemctl reboot
# ;;
#$lock)
# lockscreen
# ;;
#$suspend_btn)
# systemctl suspend
# ;;
#$logout_btn)
# i3-msg exit
# ;;
#esac

View File

Can't render this file because it contains an unexpected character in line 2 and column 33.

Some files were not shown because too many files have changed in this diff Show More