mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 06:32:40 +00:00
fix: Fixes logging errors in launch-webapp.
This commit is contained in:
6
env/.local/scripts/hypr/launch-webapp
vendored
6
env/.local/scripts/hypr/launch-webapp
vendored
@@ -1,8 +1,11 @@
|
|||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
# Adapted from https://github.com/basecamp/omarchy/tree/master?tab=readme-ov-file
|
# Adapted from https://github.com/basecamp/omarchy/tree/master?tab=readme-ov-file
|
||||||
|
SCRIPTS="${SCRIPTS:-$HOME/.local/scripts}"
|
||||||
THIS_FILE=${BASH_SOURCE[0]}
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
THIS=$(basename "$THIS_FILE")
|
THIS=$(basename "$THIS_FILE")
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
@@ -45,7 +48,6 @@ browser="chromium.desktop"
|
|||||||
url=""
|
url=""
|
||||||
launch_args=()
|
launch_args=()
|
||||||
app_args=""
|
app_args=""
|
||||||
SCRIPTS="${SCRIPTS:-$HOME/.local/scripts}"
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
if [[ $1 =~ ^--special ]] || [[ $1 =~ ^-s ]]; then
|
if [[ $1 =~ ^--special ]] || [[ $1 =~ ^-s ]]; then
|
||||||
@@ -83,7 +85,7 @@ log() {
|
|||||||
|
|
||||||
# setup logging file and label
|
# setup logging file and label
|
||||||
source "$SCRIPTS/hypr/logging"
|
source "$SCRIPTS/hypr/logging"
|
||||||
setup-logging "/tmp/$THIS.log" "$THIS"
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
if [[ -z $url ]]; then
|
if [[ -z $url ]]; then
|
||||||
log --error "Must supply a url." && usage && exit 1
|
log --error "Must supply a url." && usage && exit 1
|
||||||
|
|||||||
37
env/.local/scripts/hypr/utils/windows/window-toggle-floating
vendored
Executable file
37
env/.local/scripts/hypr/utils/windows/window-toggle-floating
vendored
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
|
||||||
|
# Float's a window, setting it's height and width and centering.
|
||||||
|
|
||||||
|
# The percentage of the screen size for the floating window.
|
||||||
|
WIDTH_PERCENT=80
|
||||||
|
HEIGHT_PERCENT=40
|
||||||
|
|
||||||
|
floating=$(hyprctl activewindow -j | jq '.floating')
|
||||||
|
|
||||||
|
if [ "$floating" = "true" ]; then
|
||||||
|
hyprctl dispatch togglefloating
|
||||||
|
else
|
||||||
|
monitor=$(hyprctl monitors -j | jq '.[] | select(.focused == true)')
|
||||||
|
mw=$(echo "$monitor" | jq '.width')
|
||||||
|
mh=$(echo "$monitor" | jq '.height')
|
||||||
|
ms=$(echo "$monitor" | jq '.scale')
|
||||||
|
|
||||||
|
echo "scale: $ms"
|
||||||
|
|
||||||
|
neww=$(echo "scale=6; (($mw / $ms) * $WIDTH_PERCENT / 100)" | bc)
|
||||||
|
newh=$(echo "scale=6; (($mh / $ms) * $HEIGHT_PERCENT / 100)" | bc)
|
||||||
|
|
||||||
|
hyprctl dispatch togglefloating &&
|
||||||
|
hyprctl dispatch resizeactive exact $neww $newh &&
|
||||||
|
hyprctl dispatch centerwindow
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user