diff --git a/env/.config/hypr/hyprkeybinds.conf b/env/.config/hypr/hyprkeybinds.conf index 94f7ba7..676ad1b 100644 --- a/env/.config/hypr/hyprkeybinds.conf +++ b/env/.config/hypr/hyprkeybinds.conf @@ -43,7 +43,7 @@ bindd = $mainMod, B, New [b]rowser, exec, bindd = $mainMod SHIFT, B, New private [b]rowser, exec, $browser --incognito bindd = $mainMod, C, [C]alendar, exec, $pwa --or-focus "https://www.icloud.com/calendar" bindd = $mainMod SHIFT, C, [C]onfig folder in tmux session, exec, $terminal -e $tmuxSessionator ~/.config -bindd = $mainMod, D, [D]ispatch app - special workspace, exec, $pwa --special dispatch $housecallPro +bindd = $mainMod, D, [D]ispatch app - special workspace, togglespecialworkspace, dispatch bindd = $mainMod SHIFT, D, [D]ispatch app - new window, exec, $pwa --new $housecallPro bindd = $mainMod, E, [E]mail - personal, exec, $pwa --or-focus "https://mail.proton.me" bindd = $mainMod SHIFT, E, [E]mail - work, exec, $scripts/launch --or-focus thunderbird uwsm app -- thunderbird @@ -58,10 +58,10 @@ bindd = $mainMod, J, Focus window - down, movefo bindd = $mainMod, K, Focus window - up, movefocus, u # move window focus using vim keys bindd = $mainMod, L, Focus window - right, movefocus, r # move window focus using vim keys bindd = $mainMod SHIFT, L, Workspace - forward, workspace, +1 -bindd = $mainMod, M, [M]usic - apple, exec, $pwa --special music "https://music.apple.com" +bindd = $mainMod, M, [M]usic - jellyfin-tui, togglespecialworkspace, music bindd = $mainMod SHIFT, M, [M]enu bar - toggle visible, exec, $scripts/waybarctl --toggle bindd = $mainMod, O, Purchase [o]rders, exec, $pwa --special dispatch "https://po.housh.dev" -bindd = $mainMod, P, [P]assword manager, exec, $pwa --special pass "https://pass.proton.me" +bindd = $mainMod, P, [P]assword manager, togglespecialworkspace, pass bindd = $mainMod SHIFT, P, [P]hotos, exec, $pwa --or-focus "https://photos.housh.dev" bindd = $mainMod SHIFT, R, [R]estart menu bar, exec, $scripts/waybarctl --restart bindd = $mainMod, S, Toggle [s]pecial workspace, togglespecialworkspace, magic # use $windowMod S to send window to the special workspace diff --git a/env/.config/hypr/hyprland.conf b/env/.config/hypr/hyprland.conf index df632e9..005df33 100644 --- a/env/.config/hypr/hyprland.conf +++ b/env/.config/hypr/hyprland.conf @@ -9,6 +9,7 @@ source = ~/.config/hypr/hyprenv.conf source = ~/.config/hypr/hyprmonitors.conf source = ~/.config/hypr/hyprwindows.conf +source = ~/.config/hypr/hyprworkspaces.conf source = ~/.config/hypr/hyprkeybinds.conf source = ~/.config/hypr/hyprinput.conf source = ~/.config/hypr/hyprautostart.conf diff --git a/env/.config/hypr/hyprwindows.conf b/env/.config/hypr/hyprwindows.conf index d2b06f3..bffd70c 100644 --- a/env/.config/hypr/hyprwindows.conf +++ b/env/.config/hypr/hyprwindows.conf @@ -1,10 +1,8 @@ -############################## -### WINDOWS AND WORKSPACES ### -############################## +############### +### WINDOWS ### +############### # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more -# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules -# windowrule = float, tag:floating-window windowrule = center, tag:floating-window @@ -43,10 +41,6 @@ windowrule = opacity 1.0, class:.*youtube.com.* # Fix some dragging issues with XWayland windowrule = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 -workspace = special:hidden, invisible -workspace = special:pass, class:.*pass.proton.me.* -workspace = special:dispatch, class:.*pro.housecallpro.com.* - # To get more information about a window’s class, title, XWayland status or its size, you can use `hyprctl clients`. (From Hyprland Wiki) windowrulev2 = float,class:^(one.alynx.showmethekey)$ windowrulev2 = float,class:^(showmethekey-gtk)$ # make window floating diff --git a/env/.config/hypr/hyprworkspaces.conf b/env/.config/hypr/hyprworkspaces.conf new file mode 100644 index 0000000..7c4dba8 --- /dev/null +++ b/env/.config/hypr/hyprworkspaces.conf @@ -0,0 +1,14 @@ +################## +### WORKSPACES ### +################## + +# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules + +$scripts = ~/.local/scripts/hypr +$pwa = $scripts/webapp launch +$housecallPro = $pwa "https://pro.housecallpro.com/app/calendar_new" + +workspace = special:hidden, invisible +workspace = special:pass,on-created-empty: $pwa "https://pass.proton.me" +workspace = special:dispatch,on-created-empty: $housecallPro && $housecallPro +workspace = special:music,on-created-empty: ghostty --class=com.ghostty.music -e jellyfin-tui diff --git a/env/.local/scripts/hypr/launch b/env/.local/scripts/hypr/launch index a6d1fc2..fc1e646 100755 --- a/env/.local/scripts/hypr/launch +++ b/env/.local/scripts/hypr/launch @@ -11,7 +11,7 @@ THIS=$(basename "$THIS_FILE") LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"} usage() { - cat </dev/null 2>&1 + hyprctl dispatch "$@" >/dev/null 2>&1 } toggle_special() { - if [[ -z $special ]]; then - log --error " No name supplied for special workspace." - exit 1 - fi - hypr_dispatch togglespecialworkspace $special + if [[ -z $special ]]; then + log --error " No name supplied for special workspace." + exit 1 + fi + hypr_dispatch togglespecialworkspace $special } launch_application() { - log "Launching..." - log "'${launch_cmd[@]}'" - eval exec ${launch_cmd[@]} + log "Launching..." + log "'${launch_cmd[*]}'" + eval exec "${launch_cmd[*]}" } ################################################################################ @@ -123,11 +123,11 @@ source "$SCRIPTS/hypr/logging" setup-logging "$LOG_FILE" "$LOG_LABEL" if [[ -z $pattern ]]; then - log --error "Must supply a pattern to match the window class." - usage && exit 1 + log --error "Must supply a pattern to match the window class." + usage && exit 1 elif [[ -z $launch_cmd ]]; then - log --error "Must supply a launch command to match the window class." - usage && exit 1 + log --error "Must supply a launch command to match the window class." + usage && exit 1 fi log "Pattern: $pattern" @@ -135,13 +135,13 @@ addresses=$(hyprctl clients -j | jq ".[] | select(.class | contains(\"$pattern\" # If no addresses, then launch the application. if [[ -z $addresses ]] || [[ $new_instance_flag == "1" ]]; then - log "No addresses found or new instance flag set." - # Toggle special workspace if applicable. - if [[ $special_flag == "1" ]]; then - log "Toggling special workspace." - toggle_special - fi - launch_application && exit 0 + log "No addresses found or new instance flag set." + # Toggle special workspace if applicable. + if [[ $special_flag == "1" ]]; then + log "Toggling special workspace." + toggle_special + fi + launch_application && exit 0 fi active_window_workspace=$(hyprctl activewindow -j | jq -r '.workspace.name') @@ -150,45 +150,45 @@ active_window_workspace=$(hyprctl activewindow -j | jq -r '.workspace.name') # we just toggle the special workspace. This keeps "special" apps alive, but closes and / opens # the special workspace when invoked. if [[ $special_flag == "1" ]] && [[ $active_window_workspace =~ $special ]]; then - toggle_special && exit 0 + toggle_special && exit 0 fi # Check if both close and focus flags were passed, so we don't do the # wrong thing. if [[ $focus_flag == "1" ]] && [[ $close_flag == "1" ]]; then - log --error "Both focus and close flag were passed." - exit 1 + log --error "Both focus and close flag were passed." + exit 1 fi for address in ${addresses[@]}; do - # Clean the address of quotes. - address=${address//\"/} - log "Handling address: '$address'" + # Clean the address of quotes. + address=${address//\"/} + log "Handling address: '$address'" - if [[ $focus_active_only_flag == "1" ]] || [[ $close_active_only_flag == "1" ]]; then - # get the workspace name for the address. - workspace=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$address\") | .workspace.name") + if [[ $focus_active_only_flag == "1" ]] || [[ $close_active_only_flag == "1" ]]; then + # get the workspace name for the address. + workspace=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$address\") | .workspace.name") - # check that the window is on the active workspace. - if [[ $active_window_workspace == $workspace ]]; then - log "Performing action: '$action', on window: '$address'" - hypr_dispatch $action "address:$address" - # early out if focusing a window. - [[ $focus_active_only_flag ]] && exit 0 - else - # the window is not on the active workspace, so skip it. - log "Skipping window: $address" - fi - else - # We don't have the focus_active_only_flag or close_active_only_flag set, so we perform - # the action on the window. - log "Performing action: '$action', on window: '$address'" - hypr_dispatch $action "address:$address" - fi + # check that the window is on the active workspace. + if [[ $active_window_workspace == $workspace ]]; then + log "Performing action: '$action', on window: '$address'" + hypr_dispatch $action "address:$address" + # early out if focusing a window. + [[ $focus_active_only_flag ]] && exit 0 + else + # the window is not on the active workspace, so skip it. + log "Skipping window: $address" + fi + else + # We don't have the focus_active_only_flag or close_active_only_flag set, so we perform + # the action on the window. + log "Performing action: '$action', on window: '$address'" + hypr_dispatch $action "address:$address" + fi done # If we made it here and focus_active_only_flag was set, then we did not # find a window on the active workspace, so we launch a new window. if [[ $focus_active_only_flag == "1" ]]; then - launch_application + launch_application fi diff --git a/env/.local/scripts/hypr/music b/env/.local/scripts/hypr/music new file mode 100755 index 0000000..b78c58c --- /dev/null +++ b/env/.local/scripts/hypr/music @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Launches jellyfin-tui in a new ghostty terminal. +# USAGE: $ music + +SCRIPTS=${SCRIPTS:-"$HOME/.local/scripts"} + +"$SCRIPTS"/hypr/launch --special music \ + com.ghostty.music \ + uwsm app -- ghostty --class=com.ghostty.music -e jellyfin-tui diff --git a/runs/jellyfin-tui b/runs/jellyfin-tui index a747bb2..58b3a78 100755 --- a/runs/jellyfin-tui +++ b/runs/jellyfin-tui @@ -1,3 +1 @@ -#!/usr/bin/env bash - -yay ${1:-"-S --noconfirm"} jellyfin-tui +jellyfin-tui