Compare commits

..

6 Commits

5 changed files with 122 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ customCommands:
description: "Force push with lease." description: "Force push with lease."
key: "x" key: "x"
promptToReturnFromSubprocess: false # removes "press enter to return to lazygit" popup promptToReturnFromSubprocess: false # removes "press enter to return to lazygit" popup
notARepository: 'skip'
git: git:
autoForwardBranches: "none" autoForwardBranches: "none"
os: os:

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# Read the most recent items from CopyQ and present them in a rofi menu.
#
# Converted to bash from
# https://github.com/cjbassi/rofi-copyq/blob/master/rofi-copyq
# CopyQ script to get all clipboard items as JSON
copyq_script_getAll='
var result=[];
for ( var i = 0; i < size(); ++i ) {
var obj = {};
obj.row = i;
obj.mimetypes = str(read("?", i)).split("\n");
obj.mimetypes.pop();
obj.text = str(read(i));
result.push(obj);
}
JSON.stringify(result);
'
# Get clipboard items from CopyQ
json_arr=$(printf '%s' "$copyq_script_getAll" | copyq -)
# Parse JSON and format items for rofi
# Process each JSON object separately, replacing newlines within each item
items=$(printf '%s' "$json_arr" | jq -r '.[] | .text | gsub("\n"; " ") | gsub(" +"; " ")')
# Show rofi menu and get selected index
title='rofi-copyq'
selected_index=$(printf '%s' "$items" | rofi -dmenu -i -p "$title" -format i)
# If user selected an item, select it in CopyQ
if [ -n "$selected_index" ]; then
echo "Selected item: $selected_index"
copyq "select($selected_index);"
fi

View File

@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# https://github.com/onespaceman/menu-calc
# https://github.com/BarbUk/menu-qalc
# https://github.com/ClemaX/menu-qalc-wayland
#
# Calculator for use with rofi
# Copying to the clipboard requires wl-copy
usage() {
echo "$(tput bold)menu-calc$(tput sgr0)"
echo "A calculator for Rofi"
echo
echo "$(tput bold)Usage:$(tput sgr0)"
echo " = 4+2"
echo " = (4+2)/(4+3)"
echo " = 4^2"
echo " = sqrt(4)"
echo " = c(2)"
echo
echo "$(tput bold)Passing arguments to Rofi:$(tput sgr0)"
echo "Any parameters after ' -- ' will be passed to Rofi."
echo
echo " = -- <Rofi args>"
echo
echo "The answer can be copied to the clipboard and used for further calculations inside (or outside) Rofi."
echo
echo "If launched outside of Rofi the expression may need quotation marks."
exit
}
process_query() { # query
local query="$1"
qalc +u8 -color=never -terse <<<"$query" |
awk '!/^>/ && !/^$/ {gsub(/^[ \t]+|[ \t]+$/, "", $0); print}'
}
# Process CLI parameters
for var in "$@"; do
case $var in
-h | --help) usage ;;
--) break ;;
esac
done
# Path to menu application
if [[ -n $(command -v rofi) ]]; then
menu="$(command -v rofi)"
menu="$menu -dmenu -lines 3"
else
>&2 echo "Rofi not found"
exit
fi
# Determine args to pass to rofi
while [[ $# -gt 0 && $1 != "--" ]]; do
shift
done
[[ $1 == "--" ]] && shift
while true; do
action=$(echo -e "Copy\nClear\nClose" | ${menu} "$@" -p "= $answer")
case "$action" in
"Clear") answer= ;;
"Copy") wl-copy -- "$answer" ;;
"Close" | "") exit ;;
*) answer=$(process_query "$answer $action") ;;
esac
done

View File

@@ -76,6 +76,17 @@ input "2362:628:PIXA3854:00_093A:0274_Touchpad" {
# Window switching # Window switching
bindsym $mod+Tab exec rofi -show window -modes window bindsym $mod+Tab exec rofi -show window -modes window
# Clipboard history
bindsym $mod+Shift+v exec /home/tgrosinger/.config/rofi/scripts/copyq.sh
# Calculator
bindsym $mod+Equal exec /home/tgrosinger/.config/rofi/scripts/qalc.sh
# Lazygit
bindsym $mod+g exec alacritty --title Floating-Lazygit --command /home/linuxbrew/.linuxbrew/bin/lazygit; grab_focus; floating enable
for_window [title="Floating-Lazygit"] floating enable
for_window [title="Floating-Lazygit"] resize set 1800 1200
# Drag floating windows by holding down $mod and left mouse button. # Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod. # Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows. # Despite the name, also works for non-floating windows.

View File

@@ -55,7 +55,8 @@ sudo dnf install \
distrobox \ distrobox \
fuse-libs \ # For running appimages fuse-libs \ # For running appimages
gstreamer1-plugin-openh264 mozilla-openh264 \ # For twitch videos gstreamer1-plugin-openh264 mozilla-openh264 \ # For twitch videos
podman podman \
qalculate qalculate-gtk # Homebrew version installs x11 and waylany in brew.
# Install tailscale # Install tailscale
# https://tailscale.com/kb/1511/install-fedora-2 # https://tailscale.com/kb/1511/install-fedora-2