diff --git a/.config/fish/conf.d/fnm.fish b/.config/fish/conf.d/fnm.fish new file mode 100644 index 0000000..bf658c3 --- /dev/null +++ b/.config/fish/conf.d/fnm.fish @@ -0,0 +1,7 @@ + +# fnm +set FNM_PATH "/home/raj/.local/share/fnm" +if [ -d "$FNM_PATH" ] + set PATH "$FNM_PATH" $PATH + fnm env | source +end diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..44c894a --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1,4 @@ +if status is-interactive + # Commands to run in interactive sessions can go here + zoxide init fish | source +end diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables new file mode 100644 index 0000000..d418b7a --- /dev/null +++ b/.config/fish/fish_variables @@ -0,0 +1,31 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3800 +SETUVAR fish_color_autosuggestion:brblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:blue +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow\x1e\x2di +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/.config/hypr/env.conf b/.config/hypr/env.conf new file mode 100644 index 0000000..bca57cb --- /dev/null +++ b/.config/hypr/env.conf @@ -0,0 +1,30 @@ +# Default env vars. +env = XDG_CURRENT_DESKTOP,Hyprland +env = XDG_SESSION_TYPE,wayland +env = XDG_SESSION_DESKTOP,Hyprland + +env = GDK_BACKEND,wayland +env = QT_QPA_PLATFORM,wayland +env = QT_QPA_PLATFORMTHEME,qt6ct #env = QT_STYLE_OVERRIDE,kvantum +env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 +env = QT_AUTO_SCREEN_SCALE_FACTOR,1 +env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 + +env = SDL_VIDEODRIVER,wayland +env = _JAVA_AWT_WM_NONREPARENTING,1 +env = WLR_NO_HARDWARE_CURSORS,1 + +env = MOZ_DISABLE_RDD_SANDBOX,1 +env = MOZ_ENABLE_WAYLAND,1 + +env = OZONE_PLATFORM,wayland + +env = wallpaper_path,$HOME/.wallpapers #set wallpaper path + +env = LIBVA_DRIVER_NAME,nvidia +env = GBM_BACKEND,nvidia-drm +env = __GLX_VENDOR_LIBRARY_NAME,nvidia + +cursor { + no_hardware_cursors = true +} diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf new file mode 100644 index 0000000..750aede --- /dev/null +++ b/.config/hypr/hyprland.conf @@ -0,0 +1,144 @@ +# █▀▀ █▄░█ █░█   █░█ ▄▀█ █▀█ +# ██▄ █░▀█ ▀▄▀   ▀▄▀ █▀█ █▀▄ + +source = ~/.config/hypr/startup.conf +source = ~/.config/hypr/env.conf +source = ~/.config/hypr/windowrule.conf +source = ~/.config/hypr/keybinds.conf + + +# █▀▄▀█ █▀█ █▄░█ █ ▀█▀ █▀█ █▀█ +# █░▀░█ █▄█ █░▀█ █ ░█░ █▄█ █▀▄ + +# monitor = DP-1,1366x768@60,0x0,1 +monitor = ,highrr,auto,auto + + + +# █ █▄░█ █▀█ █░█ ▀█▀ +# █ █░▀█ █▀▀ █▄█ ░█░ + +input { + follow_mouse = 1 + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. + force_no_accel = 1 + # repeat_rate = 25 + # repeat_delay = 600 + # accel_profile = flat # flat, adaptive + # natural_scroll = true +} + + + +# █▀▀ █▀▀ █▄░█ █▀▀ █▀█ ▄▀█ █░░ +# █▄█ ██▄ █░▀█ ██▄ █▀▄ █▀█ █▄▄ + +general { + gaps_in = 3 + gaps_out = 6 + border_size = 2 + col.active_border = rgba(e5b9c6ff) rgba(c293a3ff) 45deg + col.inactive_border = 0xff382D2E + no_border_on_floating = false # enable border on float window + layout = dwindle + resize_on_border = true +} + + + +# █▀▄▀█ █ █▀ █▀▀ +# █░▀░█ █ ▄█ █▄▄ + +misc { + disable_hyprland_logo = true + disable_splash_rendering = true + mouse_move_enables_dpms = true + animate_manual_resizes = true + mouse_move_focuses_monitor = true + enable_swallow = true + swallow_regex = ^(alacritty)$ +} + + + +# █▀▄ █▀▀ █▀▀ █▀█ █▀█ ▄▀█ ▀█▀ █ █▀█ █▄░█ +# █▄▀ ██▄ █▄▄ █▄█ █▀▄ █▀█ ░█░ █ █▄█ █░▀█ + +decoration { + + # █▀█ █▀█ █░█ █▄░█ █▀▄   █▀▀ █▀█ █▀█ █▄░█ █▀▀ █▀█ + # █▀▄ █▄█ █▄█ █░▀█ █▄▀   █▄▄ █▄█ █▀▄ █░▀█ ██▄ █▀▄ + rounding = 4 + # multisample_edges = true + + # █▀█ █▀█ ▄▀█ █▀▀ █ ▀█▀ █▄█ + # █▄█ █▀▀ █▀█ █▄▄ █ ░█░ ░█░ + active_opacity = 1.0 + inactive_opacity = 1.0 + + # █▄▄ █░░ █░█ █▀█ + # █▄█ █▄▄ █▄█ █▀▄ + blur { + enabled = true + size = 6 + passes = 3 + new_optimizations = true + xray = true + ignore_opacity = true + } + + # █▀ █░█ ▄▀█ █▀▄ █▀█ █░█░█ + # ▄█ █▀█ █▀█ █▄▀ █▄█ ▀▄▀▄▀ + drop_shadow = false + shadow_ignore_window = true + shadow_offset = 1 2 + shadow_range = 10 + shadow_render_power = 5 + col.shadow = 0x66404040 + + #blurls = gtk-layer-shell + blurls = waybar + blurls = lockscreen +} + + + + +# ▄▀█ █▄░█ █ █▀▄▀█ ▄▀█ ▀█▀ █ █▀█ █▄░█ +# █▀█ █░▀█ █ █░▀░█ █▀█ ░█░ █ █▄█ █░▀█ +animations { + enabled = true + + # █▄▄ █▀▀ ▀█ █ █▀▀ █▀█   █▀▀ █░█ █▀█ █░█ █▀▀ + # █▄█ ██▄ █▄ █ ██▄ █▀▄   █▄▄ █▄█ █▀▄ ▀▄▀ ██▄ + bezier = wind, 0.05, 0.9, 0.1, 1.05 + bezier = winIn, 0.1, 1.1, 0.1, 1.1 + bezier = winOut, 0.3, -0.3, 0, 1 + bezier = liner, 1, 1, 1, 1 + + + #▄▀█ █▄░█ █ █▀▄▀█ ▄▀█ ▀█▀ █ █▀█ █▄░█ + #█▀█ █░▀█ █ █░▀░█ █▀█ ░█░ █ █▄█ █░▀█ + animation = windows, 1, 2, wind, slide + animation = windowsIn, 1, 2, winIn, slide + animation = windowsOut, 1, 2, winOut, slide + animation = windowsMove, 1, 2, wind, slide + animation = border, 1, 1, liner + animation = borderangle, 1, 30, liner, loop + animation = fade, 1, 3, default + animation = workspaces, 1, 2, wind +} + +# █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀ +# █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█ + +dwindle { + no_gaps_when_only = false + pseudotile = true # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + # new_is_master = true +} diff --git a/.config/hypr/keybinds.conf b/.config/hypr/keybinds.conf new file mode 100644 index 0000000..54ef31e --- /dev/null +++ b/.config/hypr/keybinds.conf @@ -0,0 +1,122 @@ +# █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ +# █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ + +$scriptsDir = $HOME/.config/hypr/scripts +$bg-dir = $HOME/.wallpapers +$notifycmd = notify-send -h string:x-canonical-private-synchronous:hypr-cfg -u low + +# IDK +$term = alacritty +$volume = $scriptsDir/volume +$screenshot = $scriptsDir/screensht +$colorpicker = $scriptsDir/colorpicker +$wallcmd = $scriptsDir/randwall.sh +$files = thunar +$browser = brave + +# █▀ █▀▀ █▀█ █▀▀ █▀▀ █▄░█ █▀ █░█ █▀█ ▀█▀ +# ▄█ █▄▄ █▀▄ ██▄ ██▄ █░▀█ ▄█ █▀█ █▄█ ░█░ + +bind = SUPER, v, exec, wf-recorder -f $(xdg-user-dir VIDEOS)/$(date +'%H:%M:%S_%d-%m-%Y.mp4') +bind = SUPER SHIFT, v, exec, killall -s SIGINT wf-recorder +bind = , Print, exec, $screenshot full +bind = SUPERSHIFT, S, exec, $screenshot area + +# █▀▄▀█ █ █▀ █▀▀ +# █░▀░█ █ ▄█ █▄▄ +bind = SUPER SHIFT, X, exec, $colorpicker +bind = CTRL ALT, R, exec, $wallcmd +bind = CTRL ALT, L, exec, swaylock +bind = SUPER, T, exec, $term +bind = SUPER, E, exec, $files +bind = SUPER, Space, exec, killall rofi || rofi -show drun -theme ~/.config/rofi/config.rasi +bind = SUPER, period, exec, killall rofi || rofi -show emoji -emoji-format "{emoji}" -modi emoji -theme ~/.config/rofi/global/emoji +bind = SUPER SHIFT, B, exec, killall -SIGUSR2 waybar # Reload waybar +bind = SUPER, B, exec, killall -SIGUSR1 waybar # Hide waybar + +# █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀▄▀█ ▄▀█ █▄░█ ▄▀█ █▀▀ █▀▄▀█ █▀▀ █▄░█ ▀█▀ +# ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀   █░▀░█ █▀█ █░▀█ █▀█ █▄█ █░▀░█ ██▄ █░▀█ ░█░ +bind = SUPER, Q, killactive, +bind = SUPER SHIFT, Q, exit, +bind = SUPER, F, fullscreen, +bind = SUPER, W, togglefloating, +bind = SUPER, P, pseudo, # dwindle +bind = SUPER, S, togglesplit, # dwindle + +# Change Workspace Mode +bind = SUPER SHIFT, Space, workspaceopt, allfloat +bind = SUPER SHIFT, Space, exec, $notifycmd 'Toggled All Float Mode' +bind = SUPER SHIFT, P, workspaceopt, allpseudo +bind = SUPER SHIFT, P, exec, $notifycmd 'Toggled All Pseudo Mode' + +bind = SUPER, Tab, cyclenext, +bind = SUPER, Tab, bringactivetotop, + +# █▀▀ █▀█ █▀▀ █░█ █▀ +# █▀░ █▄█ █▄▄ █▄█ ▄█ +bind = SUPER, h, movefocus, l +bind = SUPER, l, movefocus, r +bind = SUPER, k, movefocus, u +bind = SUPER, j, movefocus, d + +# █▀▄▀█ █▀█ █░█ █▀▀ +# █░▀░█ █▄█ ▀▄▀ ██▄ +bind = SUPER SHIFT, left, movewindow, l +bind = SUPER SHIFT, right, movewindow, r +bind = SUPER SHIFT, up, movewindow, u +bind = SUPER SHIFT, down, movewindow, d + +# █▀█ █▀▀ █▀ █ ▀█ █▀▀ +# █▀▄ ██▄ ▄█ █ █▄ ██▄ +bind = SUPER CTRL, left, resizeactive, -20 0 +bind = SUPER CTRL, right, resizeactive, 20 0 +bind = SUPER CTRL, up, resizeactive, 0 -20 +bind = SUPER CTRL, down, resizeactive, 0 20 + +# ▀█▀ ▄▀█ █▄▄ █▄▄ █▀▀ █▀▄ +# ░█░ █▀█ █▄█ █▄█ ██▄ █▄▀ +bind = SUPER, g, togglegroup +bind = SUPER, tab, changegroupactive +bind = SUPER, G, exec, $notifycmd 'Toggled Group Mode' + +# █▀ █▀█ █▀▀ █▀▀ █ ▄▀█ █░░ +# ▄█ █▀▀ ██▄ █▄▄ █ █▀█ █▄▄ +bind = SUPER, a, togglespecialworkspace +bind = SUPERSHIFT, a, movetoworkspace, special +bind = SUPER, a, exec, $notifycmd 'Toggled Special Workspace' +bind = SUPER, c, exec, hyprctl dispatch centerwindow + +# █▀ █░█░█ █ ▀█▀ █▀▀ █░█ +# ▄█ ▀▄▀▄▀ █ ░█░ █▄▄ █▀█ +bind = SUPER, 1, workspace, 1 +bind = SUPER, 2, workspace, 2 +bind = SUPER, 3, workspace, 3 +bind = SUPER, 4, workspace, 4 +bind = SUPER, 5, workspace, 5 +bind = SUPER, 6, workspace, 6 +bind = SUPER, 7, workspace, 7 +bind = SUPER, 8, workspace, 8 +bind = SUPER, 9, workspace, 9 +bind = SUPER, 0, workspace, 10 +bind = SUPER ALT, up, workspace, e+1 +bind = SUPER ALT, down, workspace, e-1 + +# █▀▄▀█ █▀█ █░█ █▀▀ +# █░▀░█ █▄█ ▀▄▀ ██▄ +bind = SUPER SHIFT, 1, movetoworkspace, 1 +bind = SUPER SHIFT, 2, movetoworkspace, 2 +bind = SUPER SHIFT, 3, movetoworkspace, 3 +bind = SUPER SHIFT, 4, movetoworkspace, 4 +bind = SUPER SHIFT, 5, movetoworkspace, 5 +bind = SUPER SHIFT, 6, movetoworkspace, 6 +bind = SUPER SHIFT, 7, movetoworkspace, 7 +bind = SUPER SHIFT, 8, movetoworkspace, 8 +bind = SUPER SHIFT, 9, movetoworkspace, 9 +bind = SUPER SHIFT, 0, movetoworkspace, 10 + +# █▀▄▀█ █▀█ █░█ █▀ █▀▀   █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ +# █░▀░█ █▄█ █▄█ ▄█ ██▄   █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ +bindm = SUPER, mouse:272, movewindow +bindm = SUPER, mouse:273, resizewindow +bind = SUPER, mouse_down, workspace, e+1 +bind = SUPER, mouse_up, workspace, e-1 diff --git a/.config/hypr/scripts/cliphist.sh b/.config/hypr/scripts/cliphist.sh new file mode 100755 index 0000000..bac529e --- /dev/null +++ b/.config/hypr/scripts/cliphist.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env sh +roconf="~/.config/rofi/clipboard.rasi" + +case $1 in + c) cliphist list | rofi -dmenu -theme-str 'entry { placeholder: "Copy...";}' -config $roconf | cliphist decode | wl-copy + ;; + d) cliphist list | rofi -dmenu -theme-str 'entry { placeholder: "Delete...";}' -config $roconf | cliphist delete + ;; + w) if [ `echo -e "Yes\nNo" | rofi -dmenu -theme-str 'entry { placeholder: "Clear Clipboard History?";}' -config $roconf` == "Yes" ] ; then + cliphist wipe + fi + ;; + t) echo "" + echo "󰅇 clipboard history" + ;; + *) echo "cliphist.sh [action]" + echo "c : cliphist list and copy selected" + echo "d : cliphist list and delete selected" + echo "w : cliphist wipe database" + echo "t : display tooltip" + ;; +esac + diff --git a/.config/hypr/scripts/colorpicker b/.config/hypr/scripts/colorpicker new file mode 100755 index 0000000..3f7c009 --- /dev/null +++ b/.config/hypr/scripts/colorpicker @@ -0,0 +1,29 @@ +#!/bin/bash + +TMPPCK=$(hyprpicker -a -n) +TMPPST=$(wl-paste) +CMD=$(echo "$TMPPST") +TMP=/tmp/xcolor_$CMD.png + +hyprpick() { + $TMPPCK +} + +check_dependencies() { + ! command -v hyprpicker &>/dev/null && + notify-send -u critical -a "Color Picker" xcolor-pick "gpick needs to be installed" && exit 1 + + ! command -v magick &>/dev/null && + notify-send -u critical -a "Color Picker" xcolor-pick "imagemagick needs to be installed" && exit 1 +} + +main() { + convert -size 120x120 xc:"$CMD" "$TMP" + printf %s "$CMD" | wl-paste + + notify-send -a "Color Picker" -i "$TMP" xcolor-pick "$CMD" +} + +check_dependencies +hyprpick +main diff --git a/.config/hypr/scripts/dontkillsteam.sh b/.config/hypr/scripts/dontkillsteam.sh new file mode 100755 index 0000000..d162ddc --- /dev/null +++ b/.config/hypr/scripts/dontkillsteam.sh @@ -0,0 +1,5 @@ +if [[ $(hyprctl activewindow -j | jq -r ".class") == "Steam" ]]; then + xdotool windowunmap $(xdotool getactivewindow) +else + hyprctl dispatch killactive "" +fi diff --git a/.config/hypr/scripts/gamemode.sh b/.config/hypr/scripts/gamemode.sh new file mode 100755 index 0000000..a07ac4a --- /dev/null +++ b/.config/hypr/scripts/gamemode.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +HYPRGAMEMODE=$(hyprctl getoption animations:enabled | sed -n '2p' | awk '{print $2}') +if [ $HYPRGAMEMODE = 1 ] ; then + hyprctl --batch "\ + keyword animations:enabled 0;\ + keyword decoration:drop_shadow 0;\ + keyword decoration:blur 0;\ + keyword general:gaps_in 0;\ + keyword general:gaps_out 0;\ + keyword general:border_size 1;\ + keyword decoration:rounding 0" + exit +fi +hyprctl reload diff --git a/.config/hypr/scripts/modeswitch.sh b/.config/hypr/scripts/modeswitch.sh new file mode 100755 index 0000000..86898ae --- /dev/null +++ b/.config/hypr/scripts/modeswitch.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env sh + +## main script ## +CFGDIR="$HOME/.config" +X_MODE=$1 + +## check mode ## +if [ "$X_MODE" == "dark" ] || [ "$X_MODE" == "light" ] ; then + S_MODE="$X_MODE" + +elif [ "$X_MODE" == "switch" ] ; then + X_MODE=`readlink $CFGDIR/swww/wall.set | awk -F "." '{print $NF}'` + + if [ "$X_MODE" == "dark" ] ; then + S_MODE="light" + flatpak --user override --env=GTK_THEME=Catppuccin-Latte + + elif [ "$X_MODE" == "light" ] ; then + S_MODE="dark" + flatpak --user override --env=GTK_THEME=Catppuccin-Mocha + + else + echo "ERROR: unable to fetch wallpaper mode." + fi + +else + echo "ERROR: unknown mode, use 'dark', 'light' or 'switch'." + exit 1 +fi + +### hyprland ### +ln -fs $CFGDIR/hypr/${S_MODE}.conf $CFGDIR/hypr/theme.conf +hyprctl reload + +### swwwallpaper ### +x=`echo $S_MODE | cut -c 1` +$CFGDIR/swww/swwwallpaper.sh -$x + +### qt5ct ### +ln -fs $CFGDIR/qt5ct/colors/${S_MODE}.conf $CFGDIR/qt5ct/colors/theme.conf + +### rofi ### +ln -fs $CFGDIR/rofi/${S_MODE}.rasi $CFGDIR/rofi/theme.rasi + +### kitty ### +ln -fs $CFGDIR/kitty/${S_MODE}.conf $CFGDIR/kitty/theme.conf +killall -SIGUSR1 kitty + +### waybar ### +ln -fs $CFGDIR/waybar/${S_MODE}.css $CFGDIR/waybar/style.css +sleep 1 +killall -SIGUSR2 waybar diff --git a/.config/hypr/scripts/randwall.sh b/.config/hypr/scripts/randwall.sh new file mode 100755 index 0000000..7110928 --- /dev/null +++ b/.config/hypr/scripts/randwall.sh @@ -0,0 +1,2 @@ +#/bin/bash +swww img `find -L $wallpaper_path -type f | shuf -n 1` --transition-type any --transition-fps 60 diff --git a/.config/hypr/scripts/resetxdgportal.sh b/.config/hypr/scripts/resetxdgportal.sh new file mode 100755 index 0000000..32983ec --- /dev/null +++ b/.config/hypr/scripts/resetxdgportal.sh @@ -0,0 +1,12 @@ +#!/bin/bash +sleep 1 +killall xdg-desktop-portal-hyprland +killall xdg-desktop-portal-gnome +killall xdg-desktop-portal-kde +killall xdg-desktop-portal-lxqt +killall xdg-desktop-portal-wlr +killall xdg-desktop-portal +sleep 1 +/usr/lib/xdg-desktop-portal-hyprland & +sleep 2 +/usr/lib/xdg-desktop-portal & diff --git a/.config/hypr/scripts/screensht b/.config/hypr/scripts/screensht new file mode 100755 index 0000000..561b1b4 --- /dev/null +++ b/.config/hypr/scripts/screensht @@ -0,0 +1,152 @@ +#!/bin/bash + +set -o pipefail + +# Directory +_SCREENSHOT_DIR_=$HOME/Pictures/Screenshots +_ORIGINAL_DIR_=$_SCREENSHOT_DIR_/Original +_LOG_FILE_="$_SCREENSHOT_DIR_/.screensht.log" +# Color +_FG_COLOR_='#cdd6f4' +_BG_COLOR_='#f5c2e7' +_BG_SIZE_=10 +# Border Size Applied when value greater than or equal 3 +_BORDER_SIZE_=0 +_SHADOW_SIZE_='100x40+0+16' # [ weight ] x [ radius ] + [ horizontal ] x [ vertical ] +_ROUNDED_CORNER_=8 +# Author Config +_AUTHOR_POST_=( 'South' '+0+15' ) +_AUTHOR_NAME_=" $USER" +_AUTHOR_COLOR_='#1e1e2e' +# Get Lists Font With "convert -list font | grep -iE 'font:.*' | nl" +_FONT_SIZE_=12 +_FONT_='JetBrainsMonoNL-NFM-Bold' + +function check() { + if [[ $? -eq 1 && ${PIPESTATUS[0]} -eq 1 ]]; then + _end_job_=$(date +%s) + summary $_start_job_ $_end_job_ 'failed' && dunstify -u critical -t 3000 -a "Screenshot Tool" "Screensht" >> $_LOG_FILE_ 2>&1 + exit 1 + fi +} + +# Check save directory +# Create it if it doesn't exist +function check_dir() { + if [[ ! -d "$_SCREENSHOT_DIR_" || ! -d "$_ORIGINAL_DIR_" ]]; then + mkdir -p "$_SCREENSHOT_DIR_" + mkdir -p "$_ORIGINAL_DIR_" + fi +} + +function get_latest_img() { + _LATEST_IMAGE_=$(/bin/ls -th $_SCREENSHOT_DIR_ | grep -vE '.screensht.png$' | grep -E '.png$' | head -n 1) + + if [[ $( echo "$_LATEST_IMAGE_" | wc -w ) -eq 0 ]]; then + exit 1 + else + _LATEST_IMAGE_="$_SCREENSHOT_DIR_/$_LATEST_IMAGE_" + fi +} + +function convert() { + _target_file_=$( echo "$_LATEST_IMAGE_" | sed 's/.png/.screensht.png/g' ) + + if [[ $_BORDER_SIZE_ -ge 3 ]]; then + magick convert "$_LATEST_IMAGE_" \ + -format 'roundrectangle 1,1 %[fx:w+4],%[fx:h+4] '"$_ROUNDED_CORNER_"','"$_ROUNDED_CORNER_"''\ + info: > $_SCREENSHOT_DIR_/_rounded_.mvg + check + + magick convert "$_LATEST_IMAGE_" -border $_BORDER_SIZE_ -alpha transparent \ + -background none -fill white -stroke none -strokewidth 0 \ + -draw "@"$_SCREENSHOT_DIR_"/_rounded_.mvg" $_SCREENSHOT_DIR_/_rounded_mask_.png >> $_LOG_FILE_ 2>&1 + check + + magick convert "$_LATEST_IMAGE_" -border $_BORDER_SIZE_ -alpha transparent \ + -background none -fill none -stroke $_FG_COLOR_ -strokewidth $_BORDER_SIZE_ \ + -draw "@"$_SCREENSHOT_DIR_"/_rounded_.mvg" $_SCREENSHOT_DIR_/_rounded_overlay_.png >> $_LOG_FILE_ 2>&1 + check + + magick convert "$_LATEST_IMAGE_" -alpha set -bordercolor none -border $_BORDER_SIZE_ \ + $_SCREENSHOT_DIR_/_rounded_mask_.png -compose DstIn -composite \ + $_SCREENSHOT_DIR_/_rounded_overlay_.png -compose Over -composite \ + "$_target_file_" >> $_LOG_FILE_ 2>&1 && \ + rm -f $_SCREENSHOT_DIR_/_rounded_* + check + else + magick convert "$_LATEST_IMAGE_" \( +clone -alpha extract -draw 'fill black polygon 0,0 0,'"$_ROUNDED_CORNER_"' '"$_ROUNDED_CORNER_"',0 fill white circle '"$_ROUNDED_CORNER_"','"$_ROUNDED_CORNER_"' '"$_ROUNDED_CORNER_"',0' \ + \( +clone -flip \) -compose Multiply -composite \ + \( +clone -flop \) -compose Multiply -composite \ + \) -alpha off -compose CopyOpacity -composite -compose over "$_target_file_" >> $_LOG_FILE_ 2>&1 + check + fi + + magick convert "$_target_file_" \( +clone -background black -shadow $_SHADOW_SIZE_ \) +swap -background none -layers merge +repage "$_target_file_" >> $_LOG_FILE_ 2>&1 \ + && magick convert "$_target_file_" -bordercolor $_BG_COLOR_ -border $_BG_SIZE_ "$_target_file_" >> $_LOG_FILE_ 2>&1 + check + + echo -en " $_AUTHOR_NAME_ " | magick convert "$_target_file_" -gravity ${_AUTHOR_POST_[0]} -pointsize $_FONT_SIZE_ -fill $_AUTHOR_COLOR_ -undercolor none -font $_FONT_ -annotate ${_AUTHOR_POST_[1]} @- "$_target_file_" \ + >> $_LOG_FILE_ 2>&1 && magick convert "$_target_file_" -gravity South -chop 0x$(( $_BG_SIZE_ / 2 )) "$_target_file_" >> $_LOG_FILE_ 2>&1 + check + + magick convert "$_target_file_" -gravity North -background $_BG_COLOR_ -splice 0x$(( $_BG_SIZE_ / 2 )) "$_target_file_" >> $_LOG_FILE_ 2>&1 + check + + magick convert "$_target_file_" -profile /usr/share/color/icc/colord/sRGB.icc "$_target_file_" >> $_LOG_FILE_ 2>&1 + check +} + +function summary() { + _runtime_job_=$(($2-$1)) + hours=$((_runtime_job_ / 3600)); minutes=$(( (_runtime_job_ % 3600) / 60 )); seconds=$(( (_runtime_job_ % 3600) % 60 )) + + if [[ $3 != "failed" ]]; then + wl-copy < "$_target_file_" >> $_LOG_FILE_ 2>&1 + + message="${_notif_message_} Runtime: $hours hours, $minutes minutes, $seconds seconds" + dunstify -i "$_target_file_" -t 10000 "Screenshot Tool" "$message" -a "Screenshot Tool" + fi +} + +function main() { + check_dir + + rm -f $_LOG_FILE_ + _start_job_=$(date +%s) + + _screenshot_command_="$1" + _notif_message_="$2" + + $_screenshot_command_ $_SCREENSHOT_DIR_\/$_start_job_.png> /dev/null 2>&1 + check + + get_latest_img + convert + + mv $_LATEST_IMAGE_ $_ORIGINAL_DIR_ + + _end_job_=$(date +%s) + summary $_start_job_ $_end_job_ +} + +# Check the args passed +if [ -z "$1" ] || ([ "$1" != 'full' ] && [ "$1" != 'area' ]); +then + echo " + Requires an argument: + area - Area screenshot + full - Fullscreen screenshot + Example: + ./screensht area + ./screensht full + " +elif [ "$1" = 'full' ]; +then + msg="Full screenshot saved and copied to clipboard!" + main 'grimblast copysave output' "${msg}" +elif [ "$1" = 'area' ]; +then + msg='Area screenshot saved and copied to clipboard!' + main 'grimblast copysave area' "${msg}" +fi diff --git a/.config/hypr/scripts/systemupdate.sh b/.config/hypr/scripts/systemupdate.sh new file mode 100755 index 0000000..0cfd857 --- /dev/null +++ b/.config/hypr/scripts/systemupdate.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Check release +if [ ! -f /etc/arch-release ] ; then + exit 0 +fi + +# Check for updates +aur=$(paru -Qua | wc -l) +ofc=$(pacman -Qu | wc -l) + +# Calculate total available updates +upd=$(( ofc + aur )) +echo "$upd" + +# Show tooltip +if [ $upd -eq 0 ] ; then + echo " Packages are up to date" +else + echo "󱓽 Official $ofc 󱓾 AUR $aur" +fi + +# Trigger upgrade +if [ "$1" == "up" ] ; then + kitty --title systemupdate sh -c 'yay -Syu' +fi + diff --git a/.config/hypr/scripts/themeselect.sh b/.config/hypr/scripts/themeselect.sh new file mode 100755 index 0000000..9d3ce9f --- /dev/null +++ b/.config/hypr/scripts/themeselect.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env sh + +## set variables ## +BaseDir=`dirname $(realpath $0)` +ConfDir="$HOME/.config" +ThemeCtl="$ConfDir/swww/wall.ctl" +ThumbDir="$ConfDir/swww/Themes-Ctl" +RofiConf="$ConfDir/rofi/themeselect.rasi" + + +## show and apply theme ## +if [ -z "$1" ] ; then + + ThemeSel=$(cat $ThemeCtl | while read line + do + thm=`echo $line | cut -d '|' -f 2` + wal=`echo $line | cut -d '|' -f 3` + echo -en "$thm\x00icon\x1f$ThumbDir/${thm}.png\n" + done | rofi -dmenu -config $RofiConf) + + if [ ! -z $ThemeSel ] ; then + ${BaseDir}/themeswitch.sh -s $ThemeSel + fi + +## regenerate thumbnails ## +elif [ "$1" == "T" ] ; then + + echo "refreshing thumbnails..." + cat $ThemeCtl | while read line + do + thm=`echo $line | cut -d '|' -f 2` + wal=`echo $line | cut -d '|' -f 3` + wal=`eval echo $wal` + + echo "croping image from wallpaper $ThumbDir/${thm}_tmp.png..." + convert $wal -gravity Center -crop 1080x1080+0+0 $ThumbDir/${thm}_tmp.png + echo "applying rounded corner mask and generating $ThumbDir/${thm}.png..." + #convert -size 1080x1080 xc:none -draw "roundrectangle 0,0,1080,1080,80,80" $ThumbDir/roundedmask.png + convert $ThumbDir/${thm}_tmp.png -matte $ThumbDir/roundedmask.png -compose DstIn -composite $ThumbDir/${thm}.png + rm $ThumbDir/${thm}_tmp.png + done + +fi + diff --git a/.config/hypr/scripts/themeswitch.sh b/.config/hypr/scripts/themeswitch.sh new file mode 100755 index 0000000..4e9b611 --- /dev/null +++ b/.config/hypr/scripts/themeswitch.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env sh + +## set variables ## +BaseDir=`dirname $(realpath $0)` +ConfDir="$HOME/.config" +ThemeCtl="$ConfDir/swww/wall.ctl" + +## evaluate options ## +while getopts "npst" option ; do + case $option in + + n ) # set next theme + ThemeSet=`head -1 $ThemeCtl | cut -d '|' -f 2` #default value + flg=0 + while read line + do + if [ $flg -eq 1 ] ; then + ThemeSet=`echo $line | cut -d '|' -f 2` + break + elif [ `echo $line | cut -d '|' -f 1` -eq 1 ] ; then + flg=1 + fi + done < $ThemeCtl + ;; + + p ) # set previous theme + ThemeSet=`tail -1 $ThemeCtl | cut -d '|' -f 2` #default value + flg=0 + while read line + do + if [ $flg -eq 1 ] ; then + ThemeSet=`echo $line | cut -d '|' -f 2` + break + elif [ `echo $line | cut -d '|' -f 1` -eq 1 ] ; then + flg=1 + fi + done < <( tac $ThemeCtl ) + export xtrans="outer" + ;; + + s ) # set selected theme + shift $((OPTIND -1)) + ThemeSet=$1 + ;; + + t ) # display tooltip + echo "" + echo "󰆊 Next/Previous Theme" + exit 0 ;; + + * ) # invalid option + echo "n : set next theme" + echo "p : set previous theme" + echo "s : set theme from parameter" + echo "t : display tooltip" + exit 1 ;; + esac +done + +## update theme control ## +if [ `cat $ThemeCtl | awk -F '|' -v thm=$ThemeSet '{if($2==thm) print$2}' | wc -w` -ne 1 ] ; then + echo "Unknown theme selected: $ThemeSet" + echo "Available themes are:" + cat $ThemeCtl | cut -d '|' -f 2 + exit 1 +else + echo "Selected theme: $ThemeSet" + sed -i "s/^1/0/g" $ThemeCtl + awk -F '|' -v thm=$ThemeSet '{OFS=FS} {if($2==thm) $1=1; print$0}' $ThemeCtl > $BaseDir/tmp && mv $BaseDir/tmp $ThemeCtl +fi + + +### swwwallpaper ### +getWall=`grep '^1|' $ThemeCtl | cut -d '|' -f 3` +getWall=`eval echo $getWall` +ln -fs $getWall $ConfDir/swww/wall.set +$ConfDir/swww/swwwallpaper.sh + +if [ $? -ne 0 ] ; then + echo "ERROR: Unable to set wallpaper" + exit 1 +fi + + +### kitty ### +ln -fs $ConfDir/kitty/themes/${ThemeSet}.conf $ConfDir/kitty/themes/theme.conf +killall -SIGUSR1 kitty + + +### qt5ct ### +sed -i "/^color_scheme_path=/c\color_scheme_path=$ConfDir/qt5ct/colors/${ThemeSet}.conf" $ConfDir/qt5ct/qt5ct.conf +IconSet=`awk -F "'" '$0 ~ /gsettings set org.gnome.desktop.interface icon-theme/{print $2}' $ConfDir/hypr/themes/${ThemeSet}.conf` +sed -i "/^icon_theme=/c\icon_theme=${IconSet}" $ConfDir/qt5ct/qt5ct.conf + + +### flatpak GTK ### +flatpak --user override --env=GTK_THEME="${ThemeSet}" +flatpak --user override --env=ICON_THEME="${IconSet}" + + +### rofi ### +ln -fs $ConfDir/rofi/themes/${ThemeSet}.rasi $ConfDir/rofi/themes/theme.rasi + + +### hyprland ### +ln -fs $ConfDir/hypr/themes/${ThemeSet}.conf $ConfDir/hypr/themes/theme.conf +hyprctl reload + + +### waybar ### +ln -fs $ConfDir/waybar/themes/${ThemeSet}.css $ConfDir/waybar/style.css +sleep 1 +killall -SIGUSR2 waybar + diff --git a/.config/hypr/scripts/volumecontrol.sh b/.config/hypr/scripts/volumecontrol.sh new file mode 100755 index 0000000..7826a30 --- /dev/null +++ b/.config/hypr/scripts/volumecontrol.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env sh + +tagVol="notifyvol" + +function notify_vol +{ + vol=`pamixer --get-volume | cat` + #bar=$(seq -s "─" $(($vol / 5)) | sed 's/[0-9]//g') + #dunstify "${vol}%" "$bar" -a "Volume" -r 91190 + + sink=`pamixer --get-default-sink | tail -1 | rev | cut -d '"' -f -2 | rev | sed 's/"//'` + mute=`pamixer --get-mute | cat` + + angle="$(( (($vol+2)/5) * 5 ))" + ico="~/.config/dunst/iconvol/vol-${angle}.svg" + + if [ "$mute" == true ] ; then + dunstify "Muted" -i $ico -a "$sink" -u low -r 91190 -t 800 + + elif [ $vol -ne 0 ] ; then + dunstify -i $ico -a "$sink" -u low -h string:x-dunst-stack-tag:$tagVol \ + -h int:value:"$vol" "Volume: ${vol}%" -r 91190 -t 800 + + else + dunstify -i $ico "Volume: ${vol}%" -a "$sink" -u low -r 91190 -t 800 + fi +} + +case $1 in + i) pamixer -i 5 + notify_vol + ;; + d) pamixer -d 5 + notify_vol + ;; + m) pamixer -t + notify_vol + ;; + *) echo "volumecontrol.sh [action]" + echo "i -- increase volume [+5]" + echo "d -- decrease volume [-5]" + echo "m -- mute [x]" + ;; +esac diff --git a/.config/hypr/startup.conf b/.config/hypr/startup.conf new file mode 100644 index 0000000..62aefd6 --- /dev/null +++ b/.config/hypr/startup.conf @@ -0,0 +1,14 @@ +# █▀▀ ▀▄▀ █▀▀ █▀▀ +# ██▄ █░█ ██▄ █▄▄ +exec-once = ~/.config/hypr/scripts/resetxdgportal.sh # reset XDPH for screenshare +exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH +exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH +exec-once = /usr/lib/polkit-kde-authentication-agent-1 # authentication dialogue for GUI apps +exec-once = wlsunset -t 5200 -S 9:00 -s 19:30 # NightLight from 7.30pm to 9am +exec-once = systemctl --user restart pipewire # Restart pipewire to avoid bugs +exec-once=hyprctl setcursor MacOS-Pixel-vr4 20 +exec-once = waybar # launch the system panel +exec-once = dunst # start notification demon +exec-once = wl-paste --type text --watch cliphist store # clipboard store text data +exec-once = wl-paste --type image --watch cliphist store # clipboard store image data +exec-once = swww init || swww img `find $wallpaper_path -type f | shuf -n 1` # Set wallpaper diff --git a/.config/hypr/windowrule.conf b/.config/hypr/windowrule.conf new file mode 100644 index 0000000..ea99505 --- /dev/null +++ b/.config/hypr/windowrule.conf @@ -0,0 +1,64 @@ +# █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀█ █░█ █░░ █▀▀ █▀ +# ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀   █▀▄ █▄█ █▄▄ ██▄ ▄█ + +# Opacity +windowrulev2 = opacity 0.90 0.90,class:^(Brave-browser)$ +windowrulev2 = opacity 0.80 0.80,class:^(Steam)$ +windowrulev2 = opacity 0.80 0.80,class:^(steam)$ +windowrulev2 = opacity 0.80 0.80,class:^(steamwebhelper)$ +# windowrulev2 = opacity 0.80 0.80,class:^(Spotify)$ +windowrulev2 = opacity 0.80 0.80,class:^(Code)$ +windowrulev2 = opacity 0.80 0.80,class:^(thunar)$ +windowrulev2 = opacity 0.80 0.80,class:^(file-roller)$ +windowrulev2 = opacity 0.80 0.80,class:^(nwg-look)$ +windowrulev2 = opacity 0.80 0.80,class:^(qt5ct)$ +windowrulev2 = opacity 0.80 0.80,class:^(discord)$ #Discord-Electron +windowrulev2 = opacity 0.80 0.80,class:^(WebCord)$ #WebCord-Electron +windowrulev2 = opacity 0.80 0.70,class:^(pavucontrol)$ +windowrulev2 = opacity 0.80 0.70,class:^(org.kde.polkit-kde-authentication-agent-1)$ +windowrulev2 = opacity 0.80 0.80,class:^(org.telegram.desktop)$ + +# Position +windowrulev2 = float,class:^(org.kde.polkit-kde-authentication-agent-1)$ +windowrulev2 = float,class:^(pavucontrol)$ +windowrulev2 = float,title:^(Media viewer)$ +windowrulev2 = float,title:^(Volume Control)$ +windowrulev2 = float,title:^(Picture-in-Picture)$ +windowrulev2 = float,class:^(Viewnior)$ +windowrulev2 = float,title:^(DevTools)$ +windowrulev2 = float,class:^(file_progress)$ +windowrulev2 = float,class:^(confirm)$ +windowrulev2 = float,class:^(dialog)$ +windowrulev2 = float,class:^(download)$ +windowrulev2 = float,class:^(notification)$ +windowrulev2 = float,class:^(error)$ +windowrulev2 = float,class:^(confirmreset)$ +windowrulev2 = float,title:^(Open File)$ +windowrulev2 = float,title:^(branchdialog)$ +windowrulev2 = float,title:^(Confirm to replace files) +windowrulev2 = float,title:^(File Operation Progress) + +windowrulev2 = move 75 44%,title:^(Volume Control)$ + +# Workspace +windowrulev2 = workspace 1, class:^(Brave-browser)$ +windowrulev2 = workspace 2, class:^(discord)$ +windowrulev2 = workspace 3, class:^(org.telegram.desktop)$ +windowrulev2 = workspace 4, class:^(Code)$ +windowrulev2 = workspace 4, class:^(code-url-handler)$ +# windowrulev2 = workspace 5, class:^(Spotify)$ + +# Size +windowrulev2 = size 800 600,class:^(download)$ +windowrulev2 = size 800 600,title:^(Open File)$ +windowrulev2 = size 800 600,title:^(Save File)$ +windowrulev2 = size 800 600,title:^(Volume Control)$ + +windowrulev2 = idleinhibit focus,class:^(mpv)$ +windowrulev2 = idleinhibit fullscreen,class:^(Brave-browser)$ + +# xwaylandvideobridge +windowrulev2 = opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$ +windowrulev2 = noanim,class:^(xwaylandvideobridge)$ +windowrulev2 = nofocus,class:^(xwaylandvideobridge)$ +windowrulev2 = noinitialfocus,class:^(xwaylandvideobridge)$ diff --git a/.config/nvim b/.config/nvim new file mode 160000 index 0000000..f83674b --- /dev/null +++ b/.config/nvim @@ -0,0 +1 @@ +Subproject commit f83674b6bde7868ad0467c1c7be2a39068fb278b diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc new file mode 100644 index 0000000..f3e090d --- /dev/null +++ b/.config/waybar/config.jsonc @@ -0,0 +1,76 @@ +{ + "position": "top", + "margin-top": 4, + "margin-bottom": 0, + "margin-left": 6, + "margin-right": 6, + "height": 24, + "modules-left": ["hyprland/workspaces", "tray"], + "modules-center": ["hyprland/window"], + "modules-right": ["pulseaudio", "network", "cpu", "memory", "clock"], + "hyprland/window": { + "format": "{}", + "max-length": 35, + "rewrite": { + "": "./raj", + }, + "separate-outputs": true, + }, + "hyprland/workspaces": { + "format": "{icon}", + "on-click": "activate", + "format-icons": { + "active": " ", + }, + "sort-by-number": true, + "persistent-workspaces": { + "*": 4, + // "HDMI-A-1": 3, // but only three on HDMI-A-1 + }, + }, + "clock": { + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%Y-%m-%d}", + }, + "tray": { + "icon-size": 16, + "spacing": 10, + "show-passive-items": true, + }, + "cpu": { + "format": "CPU {usage}%", + "tooltip": false, + }, + "memory": { + "format": "{}%  ", + }, + "temperature": { + "critical-threshold": 80, + "format": "{icon} {temperatureC}°C", + "format-icons": ["", "", ""], + }, + "network": { + "format-wifi": " {signalStrength}%", + "format-ethernet": "{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": " ⚠ ", + "format-alt": "{ifname}: {ipaddr}/{cidr}", + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""], + }, + "on-click": "pavucontrol", + }, +} diff --git a/.config/waybar/macchiato.css b/.config/waybar/macchiato.css new file mode 100644 index 0000000..112ee32 --- /dev/null +++ b/.config/waybar/macchiato.css @@ -0,0 +1,26 @@ +@define-color rosewater #f4dbd6; +@define-color flamingo #f0c6c6; +@define-color pink #f5bde6; +@define-color mauve #c6a0f6; +@define-color red #ed8796; +@define-color maroon #ee99a0; +@define-color peach #f5a97f; +@define-color yellow #eed49f; +@define-color green #a6da95; +@define-color teal #8bd5ca; +@define-color sky #91d7e3; +@define-color sapphire #7dc4e4; +@define-color blue #8aadf4; +@define-color lavender #b7bdf8; +@define-color text #cad3f5; +@define-color subtext1 #b8c0e0; +@define-color subtext0 #a5adcb; +@define-color overlay2 #939ab7; +@define-color overlay1 #8087a2; +@define-color overlay0 #6e738d; +@define-color surface2 #5b6078; +@define-color surface1 #494d64; +@define-color surface0 #363a4f; +@define-color base #24273a; +@define-color mantle #1e2030; +@define-color crust #181926; diff --git a/.config/waybar/mocha.css b/.config/waybar/mocha.css new file mode 100644 index 0000000..75cfb9d --- /dev/null +++ b/.config/waybar/mocha.css @@ -0,0 +1,26 @@ +@define-color rosewater #f5e0dc; +@define-color flamingo #f2cdcd; +@define-color pink #f5c2e7; +@define-color mauve #cba6f7; +@define-color red #f38ba8; +@define-color maroon #eba0ac; +@define-color peach #fab387; +@define-color yellow #f9e2af; +@define-color green #a6e3a1; +@define-color teal #94e2d5; +@define-color sky #89dceb; +@define-color sapphire #74c7ec; +@define-color blue #89b4fa; +@define-color lavender #b4befe; +@define-color text #cdd6f4; +@define-color subtext1 #bac2de; +@define-color subtext0 #a6adc8; +@define-color overlay2 #9399b2; +@define-color overlay1 #7f849c; +@define-color overlay0 #6c7086; +@define-color surface2 #585b70; +@define-color surface1 #45475a; +@define-color surface0 #313244; +@define-color base #1e1e2e; +@define-color mantle #181825; +@define-color crust #11111b; diff --git a/.config/waybar/scripts/mediaplayer.py b/.config/waybar/scripts/mediaplayer.py new file mode 100644 index 0000000..bd67f91 --- /dev/null +++ b/.config/waybar/scripts/mediaplayer.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 +from gi.repository import Playerctl, GLib +import argparse +import logging +import sys +import signal +import gi +import json +gi.require_version('Playerctl', '2.0') + +logger = logging.getLogger(__name__) + + +def write_output(text, player, mode): + logger.info('Writing output') + + if mode == 'paused': + output = {'text': text, + 'class': 'paused', + 'alt': player.props.player_name} + else: + output = {'text': text, + 'class': 'playing', + 'alt': player.props.player_name} + + sys.stdout.write(json.dumps(output) + '\n') + sys.stdout.flush() + + +def on_play(player, status, manager): + logger.info('Received new playback status') + on_metadata(player, player.props.metadata, manager) + + +def on_metadata(player, metadata, manager): + logger.info('Received new metadata') + track_info = '' + + if player.props.player_name == 'spotify' and \ + 'mpris:trackid' in metadata.keys() and \ + ':ad:' in player.props.metadata['mpris:trackid']: + track_info = 'AD PLAYING' + elif player.get_artist() != '' and player.get_title() != '': + track_info = '{title}'.format(title=player.get_title()) + else: + track_info = player.get_title() + + if player.props.status != 'Playing' and track_info: + write_output(track_info, player, 'paused') + else: + write_output(track_info, player, 'playing') + + +def on_player_appeared(manager, player, selected_player=None): + if player is not None and (selected_player is None or player.name == selected_player): + init_player(manager, player) + else: + logger.debug( + "New player appeared, but it's not the selected player, skipping") + + +def on_player_vanished(manager, player): + logger.info('Player has vanished') + sys.stdout.write('\n') + sys.stdout.flush() + + +def init_player(manager, name): + logger.debug('Initialize player: {player}'.format(player=name.name)) + player = Playerctl.Player.new_from_name(name) + player.connect('playback-status', on_play, manager) + player.connect('metadata', on_metadata, manager) + manager.manage_player(player) + on_metadata(player, player.props.metadata, manager) + + +def signal_handler(sig, frame): + logger.debug('Received signal to stop, exiting') + sys.stdout.write('\n') + sys.stdout.flush() + # loop.quit() + sys.exit(0) + + +def parse_arguments(): + parser = argparse.ArgumentParser() + + # Increase verbosity with every occurrence of -v + parser.add_argument('-v', '--verbose', action='count', default=0) + + # Define for which player we're listening + parser.add_argument('--player') + + return parser.parse_args() + + +def main(): + arguments = parse_arguments() + + # Initialize logging + logging.basicConfig(stream=sys.stderr, level=logging.DEBUG, + format='%(name)s %(levelname)s %(message)s') + + # Logging is set by default to WARN and higher. + # With every occurrence of -v it's lowered by one + logger.setLevel(max((3 - arguments.verbose) * 10, 0)) + + # Log the sent command line arguments + logger.debug('Arguments received {}'.format(vars(arguments))) + + manager = Playerctl.PlayerManager() + loop = GLib.MainLoop() + + manager.connect('name-appeared', + lambda *args: on_player_appeared(*args, arguments.player)) + manager.connect('player-vanished', on_player_vanished) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + + for player in manager.props.player_names: + if arguments.player is not None and arguments.player != player.name: + logger.debug('{player} is not the filtered player, skipping it' + .format(player=player.name) + ) + continue + + init_player(manager, player) + + loop.run() + + +if __name__ == '__main__': + main() diff --git a/.config/waybar/scripts/playerctl/playerctl.sh b/.config/waybar/scripts/playerctl/playerctl.sh new file mode 100644 index 0000000..5c3072d --- /dev/null +++ b/.config/waybar/scripts/playerctl/playerctl.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +playerctl_status=$(playerctl status 2>/dev/null) + +if [[ $playerctl_status == "Playing" ]]; then + title=$(playerctl metadata title 2>/dev/null) + echo '{"text":"󰎈 󰏤","class":"playing","title":"$title"}' +elif [[ $playerctl_status == "Paused" ]]; then + title=$(playerctl metadata title 2>/dev/null) + echo '{"text":"󰎈 󰐊","class":"paused","title":"$title"}' +else + echo '{"text":""}' +fi diff --git a/.config/waybar/scripts/wlrecord.sh b/.config/waybar/scripts/wlrecord.sh new file mode 100644 index 0000000..a003203 --- /dev/null +++ b/.config/waybar/scripts/wlrecord.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +active=$(pacmd list-sources | awk 'c&&!--c;/* index*/{c=1}' | awk '{gsub(/<|>/,"",$0); print $NF}') + +filename=$(date +%F_%T.mkv) + +echo active sink: $active +echo $filename + +if [ -z $(pgrep wf-recorder) ]; + then notify-send "Recording Started ($active)" + if [ "$1" == "-s" ] + then wf-recorder -f $HOME/Videos/wf-recorder/$filename -a "$active" -g "$(slurp -c "#FFFFFF")" >/dev/null 2>&1 & + sleep 2 + while [ ! -z $(pgrep -x slurp) ]; do wait; done + pkill -RTMIN+8 waybar + else if [ "$1" == "-w" ] + then wf-recorder -f $HOME/Videos/wf-recorder/$filename -a "$active" -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp -c "#FFFFFF" )" >/dev/null 2>&1 & + sleep 2 + while [ ! -z $(pgrep -x slurp) ]; do wait; done + pkill -RTMIN+8 waybar + else + wf-recorder -f $HOME/Videos/wf-recorder/$filename -a "$active" >/dev/null 2>&1 & + pkill -RTMIN+8 waybar + fi + fi +else + killall -s SIGINT wf-recorder + notify-send "Recording Complete" + while [ ! -z $(pgrep -x wf-recorder) ]; do wait; done + pkill -RTMIN+8 waybar + name="$(zenity --entry --text "enter a filename")" + perl-rename "s/\.(mkv|mp4)$/ $name $&/" $(ls -d $HOME/Videos/wf-recorder/* -t | head -n1) +fi + diff --git a/.config/waybar/style.css b/.config/waybar/style.css new file mode 100644 index 0000000..c5505bd --- /dev/null +++ b/.config/waybar/style.css @@ -0,0 +1,137 @@ +@import "mocha.css"; + +* { + font-family: "JetBrainsMono Nerd Font", Roboto, Helvetica, Arial, sans-serif; + font-size: 10px; +} + +window#waybar { + background-color: transparent; + transition-property: background-color; + transition-duration: 0.5s; +} + +button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +button:hover { + background: inherit; + box-shadow: inset 0 -3px #ffffff; +} + +/* you can set a style on hover for any module like this */ +#pulseaudio:hover { + background-color: @surface2; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused { + background-color: @lavender; + box-shadow: inset 0 -3px #ffffff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #64727d; + box-shadow: inset 0 -3px #ffffff; +} + +#clock, +#battery, +#cpu, +#memory, +#temperature, +#network, +#pulseaudio { + padding: 0 6px; +} + +#pulseaudio { + color: @maroon; +} + +#network { + color: @yellow; +} + +#temperature { + color: @sky; +} + +#battery { + color: @green; +} + +#clock { + color: @flamingo; +} + +#window { + color: @text; +} + +.modules-right, +.modules-left, +.modules-center { + background-color: @base; + border-radius: 15px; +} + +.modules-right { + padding: 0 10px; +} + +.modules-left { + padding: 0 20px; +} + +.modules-center { + padding: 0 10px; +} +#battery.charging, +#battery.plugged { + color: @sapphire; +} + +@keyframes blink { + to { + color: #000000; + } +} + +/* Using steps() instead of linear as a timing function to limit cpu usage */ +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: steps(12); + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#pulseaudio.muted { + color: @text; +} diff --git a/.config/wlogout/hibernate-hover.png b/.config/wlogout/hibernate-hover.png new file mode 100644 index 0000000..ef813d1 Binary files /dev/null and b/.config/wlogout/hibernate-hover.png differ diff --git a/.config/wlogout/hibernate.png b/.config/wlogout/hibernate.png new file mode 100644 index 0000000..a6322aa Binary files /dev/null and b/.config/wlogout/hibernate.png differ diff --git a/.config/wlogout/layout b/.config/wlogout/layout new file mode 100644 index 0000000..57155c2 --- /dev/null +++ b/.config/wlogout/layout @@ -0,0 +1,36 @@ +{ + "label" : "lock", + "action" : "~/.config/hypr/scripts/lock.sh", + "text" : "Lock", + "keybind" : "l" +} +{ + "label" : "reboot", + "action" : "systemctl reboot", + "text" : "Reboot", + "keybind" : "r" +} +{ + "label" : "shutdown", + "action" : "systemctl poweroff", + "text" : "Shutdown", + "keybind" : "s" +} +{ + "label" : "logout", + "action" : "hyprctl dispatch exit 0", + "text" : "Logout", + "keybind" : "e" +} +{ + "label" : "suspend", + "action" : "systemctl suspend", + "text" : "Suspend", + "keybind" : "u" +} +{ + "label" : "hibernate", + "action" : "systemctl hibernate", + "text" : "Hibernate", + "keybind" : "h" +} diff --git a/.config/wlogout/lock-hover.png b/.config/wlogout/lock-hover.png new file mode 100644 index 0000000..8fb86fe Binary files /dev/null and b/.config/wlogout/lock-hover.png differ diff --git a/.config/wlogout/lock.png b/.config/wlogout/lock.png new file mode 100644 index 0000000..430451c Binary files /dev/null and b/.config/wlogout/lock.png differ diff --git a/.config/wlogout/logout-hover.png b/.config/wlogout/logout-hover.png new file mode 100644 index 0000000..9e570a9 Binary files /dev/null and b/.config/wlogout/logout-hover.png differ diff --git a/.config/wlogout/logout.png b/.config/wlogout/logout.png new file mode 100644 index 0000000..128c995 Binary files /dev/null and b/.config/wlogout/logout.png differ diff --git a/.config/wlogout/power-hover.png b/.config/wlogout/power-hover.png new file mode 100644 index 0000000..122d331 Binary files /dev/null and b/.config/wlogout/power-hover.png differ diff --git a/.config/wlogout/power.png b/.config/wlogout/power.png new file mode 100644 index 0000000..ce56166 Binary files /dev/null and b/.config/wlogout/power.png differ diff --git a/.config/wlogout/restart-hover.png b/.config/wlogout/restart-hover.png new file mode 100644 index 0000000..3e18536 Binary files /dev/null and b/.config/wlogout/restart-hover.png differ diff --git a/.config/wlogout/restart.png b/.config/wlogout/restart.png new file mode 100644 index 0000000..7855d40 Binary files /dev/null and b/.config/wlogout/restart.png differ diff --git a/.config/wlogout/sleep-hover.png b/.config/wlogout/sleep-hover.png new file mode 100644 index 0000000..0fd3bad Binary files /dev/null and b/.config/wlogout/sleep-hover.png differ diff --git a/.config/wlogout/sleep.png b/.config/wlogout/sleep.png new file mode 100644 index 0000000..6a3d607 Binary files /dev/null and b/.config/wlogout/sleep.png differ diff --git a/.config/wlogout/style.css b/.config/wlogout/style.css new file mode 100644 index 0000000..9f11234 --- /dev/null +++ b/.config/wlogout/style.css @@ -0,0 +1,66 @@ +window { + font-family: monospace; + font-size: 14pt; + color: #cdd6f4; /* text */ + background-color: rgba(30, 30, 46, 0.5); +} + +button { + background-repeat: no-repeat; + background-position: center; + background-size: 25%; + border: none; + background-color: rgba(30, 30, 46, 0); + margin: 5px; + transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out; +} + +button:hover { + background-color: rgba(49, 50, 68, 0.1); +} + +button:focus { + background-color: #cba6f7; + color: #1e1e2e; +} + +#lock { + background-image: image(url("./lock.png")); +} +#lock:focus { + background-image: image(url("./lock-hover.png")); +} + +#logout { + background-image: image(url("./logout.png")); +} +#logout:focus { + background-image: image(url("./logout-hover.png")); +} + +#suspend { + background-image: image(url("./sleep.png")); +} +#suspend:focus { + background-image: image(url("./sleep-hover.png")); +} + +#shutdown { + background-image: image(url("./power.png")); +} +#shutdown:focus { + background-image: image(url("./power-hover.png")); +} + +#reboot { + background-image: image(url("./restart.png")); +} +#reboot:focus { + background-image: image(url("./restart-hover.png")); +} +#hibernate { + background-image: image(url("./hibernate.png")); +} +#hibernate:focus { + background-image: image(url("./hibernate-hover.png")); +} diff --git a/.gitignore b/.gitignore index 1a7c69d..6a087c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -* +.config/* !.config/nvim +!.config/fish !.config/hypr !.config/waybar !.config/wlogout