Merge branch 'main' of ssh://git.trivernis.net:22321/Trivernis/dotfiles-silo
commit
777b3743ab
@ -0,0 +1,50 @@
|
|||||||
|
Config(
|
||||||
|
// Position/size fields use an enum for the value, it can be either:
|
||||||
|
// Absolute(n): The absolute value in pixels
|
||||||
|
// Fraction(n): A fraction of the width or height of the full screen (depends on exclusive zones and the settings related to them) window respectively
|
||||||
|
|
||||||
|
// The horizontal position, adjusted so that Relative(0.5) always centers the runner
|
||||||
|
x: Fraction(0.5),
|
||||||
|
|
||||||
|
// The vertical position, works the same as `x`
|
||||||
|
y: Fraction(0.25),
|
||||||
|
|
||||||
|
// The width of the runner
|
||||||
|
width: Absolute(800),
|
||||||
|
|
||||||
|
// The minimum height of the runner, the runner will expand to fit all the entries
|
||||||
|
height: Absolute(0),
|
||||||
|
|
||||||
|
// Hide match and plugin info icons
|
||||||
|
hide_icons: false,
|
||||||
|
|
||||||
|
// ignore exclusive zones, f.e. Waybar
|
||||||
|
ignore_exclusive_zones: false,
|
||||||
|
|
||||||
|
// Layer shell layer: Background, Bottom, Top, Overlay
|
||||||
|
layer: Overlay,
|
||||||
|
|
||||||
|
// Hide the plugin info panel
|
||||||
|
hide_plugin_info: false,
|
||||||
|
|
||||||
|
// Close window when a click outside the main box is received
|
||||||
|
close_on_click: false,
|
||||||
|
|
||||||
|
// Show search results immediately when Anyrun starts
|
||||||
|
show_results_immediately: false,
|
||||||
|
|
||||||
|
// Limit amount of entries shown in total
|
||||||
|
max_entries: None,
|
||||||
|
|
||||||
|
// List of plugins to be loaded by default, can be specified with a relative path to be loaded from the
|
||||||
|
// `<anyrun config dir>/plugins` directory or with an absolute path to just load the file the path points to.
|
||||||
|
plugins: [
|
||||||
|
"libapplications.so",
|
||||||
|
"libsymbols.so",
|
||||||
|
"libshell.so",
|
||||||
|
"libtranslate.so",
|
||||||
|
"librink.so",
|
||||||
|
"libstdin.so",
|
||||||
|
"libshell.so",
|
||||||
|
],
|
||||||
|
)
|
@ -0,0 +1,54 @@
|
|||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
(tag_name) @constant
|
||||||
|
(
|
||||||
|
(tag_name) @constant.builtin
|
||||||
|
; https://www.script-example.com/html-tag-liste
|
||||||
|
(#any-of? @constant.builtin
|
||||||
|
"head" "title" "base" "link" "meta" "style"
|
||||||
|
"body" "article" "section" "nav" "aside" "h1" "h2" "h3" "h4" "h5" "h6" "hgroup" "header" "footer" "address"
|
||||||
|
"p" "hr" "pre" "blockquote" "ol" "ul" "menu" "li" "dl" "dt" "dd" "figure" "figcaption" "main" "div"
|
||||||
|
"a" "em" "strong" "small" "s" "cite" "q" "dfn" "abbr" "ruby" "rt" "rp" "data" "time" "code" "var" "samp" "kbd" "sub" "sup" "i" "b" "u" "mark" "bdi" "bdo" "span" "br" "wbr"
|
||||||
|
"ins" "del"
|
||||||
|
"picture" "source" "img" "iframe" "embed" "object" "param" "video" "audio" "track" "map" "area"
|
||||||
|
"table" "caption" "colgroup" "col" "tbody" "thead" "tfoot" "tr" "td" "th"
|
||||||
|
"form" "label" "input" "button" "select" "datalist" "optgroup" "option" "textarea" "output" "progress" "meter" "fieldset" "legend"
|
||||||
|
"details" "summary" "dialog"
|
||||||
|
"script" "noscript" "template" "slot" "canvas")
|
||||||
|
)
|
||||||
|
|
||||||
|
(content) @none
|
||||||
|
|
||||||
|
(id) @attribute
|
||||||
|
(class) @attribute
|
||||||
|
|
||||||
|
(quoted_attribute_value) @string
|
||||||
|
(attribute_name) @symbol
|
||||||
|
(
|
||||||
|
(attribute_name) @keyword
|
||||||
|
(#match? @keyword "^(\\(.*\\)|\\[.*\\]|\\*.*)$")
|
||||||
|
) @keyword
|
||||||
|
|
||||||
|
(attributes (attribute ("=")@operator))
|
||||||
|
(buffered_code ("=")@operator)
|
||||||
|
|
||||||
|
[
|
||||||
|
":"
|
||||||
|
"{{"
|
||||||
|
"}}"
|
||||||
|
"+"
|
||||||
|
"|"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
(keyword) @keyword
|
||||||
|
((keyword) @include (#eq? @include "include"))
|
||||||
|
((keyword) @repeat (#any-of? @repeat "for" "each" "of" "in" "while"))
|
||||||
|
((keyword) @conditional (#any-of? @conditional "if" "else" "else if" "unless"))
|
||||||
|
((keyword) @keyword.function (#any-of? @keyword.function "block" "mixin"))
|
||||||
|
(doctype) @keyword
|
||||||
|
(doctype_name) @variable.parameter
|
||||||
|
|
||||||
|
(filter_name) @method.call
|
||||||
|
|
||||||
|
(mixin_use (mixin_name) @method.call)
|
||||||
|
(mixin_definition (mixin_name) @function)
|
@ -0,0 +1,2 @@
|
|||||||
|
((javascript) @injection.content
|
||||||
|
(#set! injection.language "javascript"))
|
@ -0,0 +1,140 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Usage: ww -f "window class filter" -c "run if not found"
|
||||||
|
# Usage: ww -fa "window title filter" -c "run if not found"
|
||||||
|
|
||||||
|
TOGGLE="false"
|
||||||
|
POSITIONAL=()
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
|
case $key in
|
||||||
|
-c | --command)
|
||||||
|
COMMAND="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
-f | --filter)
|
||||||
|
FILTERBY="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
-fa | --filter-alternative)
|
||||||
|
FILTERALT="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
-t | --toggle)
|
||||||
|
TOGGLE="true"
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
-h | --help)
|
||||||
|
HELP="1"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
*) # unknown option
|
||||||
|
POSITIONAL+=("$1") # save it in an array for later
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
set -- "${POSITIONAL[@]}" # restore positional parameters
|
||||||
|
|
||||||
|
if [ -n "$HELP" ]; then
|
||||||
|
cat << EOF
|
||||||
|
ww. Utility to raise or jump an applications in KDE. It interacts with KWin using KWin scripts and it is compatible with X11 and Wayland
|
||||||
|
|
||||||
|
Paramaters:
|
||||||
|
|
||||||
|
-h --help show this help
|
||||||
|
-f --filter filter by window class
|
||||||
|
-fa --filter-alternative filter by window title (caption)
|
||||||
|
-t --toggle also minimize the window if it is already active
|
||||||
|
-c --command command to check if running and run if no process is found
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_TEMPLATE=$(
|
||||||
|
cat << EOF
|
||||||
|
function kwinactivateclient(clientClass, clientCaption, toggle) {
|
||||||
|
var clients = workspace.clientList();
|
||||||
|
var compareToCaption = new RegExp(clientCaption || '', 'i');
|
||||||
|
var compareToClass = clientClass;
|
||||||
|
var isCompareToClass = clientClass.length > 0
|
||||||
|
for (var i=0; i<clients.length; i++) {
|
||||||
|
var client = clients[i];
|
||||||
|
var classCompare = (isCompareToClass && client.resourceClass == compareToClass)
|
||||||
|
var captionCompare = (!isCompareToClass && compareToCaption.exec(client.caption))
|
||||||
|
if (classCompare || captionCompare) {
|
||||||
|
if (workspace.activeClient != client) {
|
||||||
|
workspace.activeClient = client;
|
||||||
|
} else if (toggle) {
|
||||||
|
client.minimized = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
kwinactivateclient('CLASS_NAME', 'CAPTION_NAME', TOGGLE);
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
CURRENT_SCRIPT_NAME=$(basename "$0")
|
||||||
|
|
||||||
|
# ensure the script file exists
|
||||||
|
function ensure_script {
|
||||||
|
if [ ! -f SCRIPT_PATH ]; then
|
||||||
|
if [ ! -d "$SCRIPT_FOLDER" ]; then
|
||||||
|
mkdir -p "$SCRIPT_FOLDER"
|
||||||
|
fi
|
||||||
|
SCRIPT_CONTENT=${SCRIPT_TEMPLATE/CLASS_NAME/$1}
|
||||||
|
SCRIPT_CONTENT=${SCRIPT_CONTENT/CAPTION_NAME/$2}
|
||||||
|
SCRIPT_CONTENT=${SCRIPT_CONTENT/TOGGLE/$3}
|
||||||
|
#if [ "$1" == "class" ]; then
|
||||||
|
#SCRIPT_CONTENT=${SCRIPT_CLASS_NAME/REPLACE_ME/$2}
|
||||||
|
#else
|
||||||
|
#SCRIPT_CONTENT=${SCRIPT_CAPTION/REPLACE_ME/$2}
|
||||||
|
#fi
|
||||||
|
echo "$SCRIPT_CONTENT" > "$SCRIPT_PATH"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$FILTERBY" ] && [ -z "$FILTERALT" ]; then
|
||||||
|
echo You need to specify a window filter. Either by class -f or by title -fa
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
IS_RUNNING=$(pgrep -o -a -f "$COMMAND" | grep -v "$CURRENT_SCRIPT_NAME")
|
||||||
|
|
||||||
|
if [ -n "$IS_RUNNING" ] || [ -n "$FILTERALT" ]; then
|
||||||
|
|
||||||
|
# trying for XDG_CONFIG_HOME first
|
||||||
|
SCRIPT_FOLDER_ROOT=$XDG_CONFIG_HOME
|
||||||
|
if [[ -z $SCRIPT_FOLDER_ROOT ]]; then
|
||||||
|
# fallback to the home folder
|
||||||
|
SCRIPT_FOLDER_ROOT=$HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_FOLDER="$SCRIPT_FOLDER_ROOT/.wwscripts/"
|
||||||
|
SCRIPT_NAME=$(echo "$FILTERBY$FILTERALT" | md5sum | head -c 32)
|
||||||
|
SCRIPT_PATH="$SCRIPT_FOLDER$SCRIPT_NAME"
|
||||||
|
ensure_script "$FILTERBY" "$FILTERALT" "$TOGGLE"
|
||||||
|
|
||||||
|
SCRIPT_NAME="ww$RANDOM"
|
||||||
|
#SCRIPT_NAME=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
||||||
|
|
||||||
|
# install the script
|
||||||
|
ID=$(dbus-send --session --dest=org.kde.KWin --print-reply=literal /Scripting org.kde.kwin.Scripting.loadScript "string:$SCRIPT_PATH" "string:$SCRIPT_NAME" | awk '{print $2}')
|
||||||
|
# run it - some KDEs version use Script.run others Scripting.run
|
||||||
|
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Scripting.run > /dev/null 2>&1
|
||||||
|
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Script.run > /dev/null 2>&1
|
||||||
|
# stop it - some KDEs version use Script.run others Scripting.run
|
||||||
|
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Scripting.stop > /dev/null 2>&1
|
||||||
|
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Script.stop > /dev/null 2>&1
|
||||||
|
# uninstall it
|
||||||
|
dbus-send --session --dest=org.kde.KWin --print-reply=literal /Scripting org.kde.kwin.Scripting.unloadScript "string:$SCRIPT_NAME" > /dev/null 2>&1
|
||||||
|
elif [ -n "$COMMAND" ]; then
|
||||||
|
$COMMAND &
|
||||||
|
fi
|
Loading…
Reference in New Issue