commit fb0d1d5754b5ee7c3f23f38ef52799f0c2940803 Author: Megnas Date: Thu Feb 19 20:27:50 2026 +0100 init commit diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf new file mode 100644 index 0000000..7385a77 --- /dev/null +++ b/.config/hypr/hyprland.conf @@ -0,0 +1,311 @@ +autogenerated = 0 + +# You can split this configuration into multiple files +# Create your files separately and then link them to this file like this: +# source = ~/.config/hypr/myColors.conf + +################ +### MONITORS ### +################ + +monitor=DP-2, 1920x1080@60, 0x0, 1 +monitor=DP-3, 1920x1080@60, 1920x0, 1 + +################### +### MY PROGRAMS ### +################### +$terminal = alacritty +$fileManager = thunar +$menu = pkill wofi || wofi --show drun -i -I --term=alacritty + + +################# +### AUTOSTART ### +################# + +exec-once = swaync & +exec-once = waybar & hyprpaper +exec-once = copyq --start-server +exec-once = discord --start-minimized +exec-once = steam -silent + +exec-once = thunar --daemon +#exec-once = hyprpm reload -n + +############################# +### ENVIRONMENT VARIABLES ### +############################# + +env = XCURSOR_SIZE,24 +env = HYPRCURSOR_SIZE,24 +env = TERMINAL,alacritty + +################### +### PERMISSIONS ### +################### + +ecosystem { + enforce_permissions = 1 +} + +permission = /usr/(bin|local/bin)/grim, screencopy, allow +permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow +permission = ${lib.escapeRegex (lib.getExe config.programs.hyprlock.package)}, screencopy, allow +permission = /usr/(bin|local/bin)/hyprpm, plugin, allow + + +##################### +### LOOK AND FEEL ### +##################### + +general { + gaps_in = 4 + gaps_out = 4 + + border_size = 1 + + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + resize_on_border = false + + allow_tearing = false + + layout = dwindle +} + +decoration { + rounding = 0 + rounding_power = 2 + + active_opacity = 1.0 + inactive_opacity = 1.0 + + shadow { + enabled = true + range = 4 + render_power = 3 + color = rgba(1a1a1aee) + } + + blur { + enabled = true + size = 3 + passes = 1 + + vibrancy = 0.1696 + } +} + +animations { + enabled = no +} + +dwindle { + 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 { + new_status = master +} + +misc { + force_default_wallpaper = 0 + disable_hyprland_logo = true +} + +############# +### INPUT ### +############# + +input { + kb_layout = us, cz + kb_variant = + kb_model = + kb_options = grp:win_space_toggle + kb_rules = + + follow_mouse = 1 + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. + + touchpad { + natural_scroll = false + } +} + +gesture = 3, horizontal, workspace + +################### +### KEYBINDINGS ### +################### + +$mainMod = SUPER # Sets "Windows" key as main modifier + +#Opens terminal (allacrity) +bind = $mainMod, RETURN, exec, $terminal +#Kills active window +bind = $mainMod, Q, killactive, +#Exits hyprland +bind = $mainMod SHIFT, E, exec, pkill wofi || ~/.scripts/power.sh +#Opens file manager (Thunar) +bind = $mainMod, N, exec, $fileManager +#Togle floating mode +bind = $mainMod, G, togglefloating, +#Opens app picker +bind = $mainMod, P, exec, $menu +#Shows help menu +bind = $mainMod, H, exec, pkill wofi || ~/.scripts/hypr-help.sh +#Changes wallpaper +bind = $mainMod, U, exec, pkill wofi || ~/.scripts/wallpaper-picker.sh +#Toggles split +bind = $mainMod, J, togglesplit, # dwindle +#Toggles pseudo +bind = $mainMod, K, pseudo, # dwindle +#Toggle fullscreen +bind = $mainMod, F, fullscreen +#Reloads waybar +bind = $mainMod, R, exec, ~/.scripts/reload_waybar.sh +#Takes screenshot +bind = , Print, exec, ~/.scripts/screenshot.sh +#Opens emoji picker +bind = $mainMod, I, exec, pkill wofi || rofimoji +#Opens copypasta picker +bind = $mainMod, O, exec, pkill wofi || ~/.scripts/copy_pasta.sh +#Lock screen +bind = $mainMod, L, exec, hyprlock + +# Move focus with mainMod + arrow keys +#Moves focus left +bind = $mainMod, left, movefocus, l +#Moves focus right +bind = $mainMod, right, movefocus, r +#Moves focus up +bind = $mainMod, up, movefocus, u +#Moves focus down +bind = $mainMod, down, movefocus, d + +# Switch workspaces with mainMod + [0-9] +#Toggles to workspace 1 (Left Monitor) +bind = $mainMod, 1, workspace, 1 +#Toggles to workspace 2 (Left Monitor) +bind = $mainMod, 2, workspace, 2 +#Toggles to workspace 3 (Left Monitor) +bind = $mainMod, 3, workspace, 3 +#Toggles to workspace 4 (Left Monitor) +bind = $mainMod, 4, workspace, 4 +#Toggles to workspace 5 (Left Monitor) +bind = $mainMod, 5, workspace, 5 +#Toggles to workspace 6 (Right Monitor) +bind = $mainMod, 6, workspace, 6 +#Toggles to workspace 7 (Right Monitor) +bind = $mainMod, 7, workspace, 7 +#Toggles to workspace 8 (Right Monitor) +bind = $mainMod, 8, workspace, 8 +#Toggles to workspace 9 (Right Monitor) +bind = $mainMod, 9, workspace, 9 +#Toggles to workspace 10 (Right Monitor) +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +#Moves focused window to workspace 1 (Left Monitor) +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +#Moves focused window to workspace 2 (Left Monitor) +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +#Moves focused window to workspace 3 (Left Monitor) +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +#Moves focused window to workspace 4 (Left Monitor) +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +#Moves focused window to workspace 5 (Left Monitor) +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +#Moves focused window to workspace 6 (Right Monitor) +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +#Moves focused window to workspace 7 (Right Monitor) +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +#Moves focused window to workspace 8 (Right Monitor) +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +#Moves focused window to workspace 9 (Right Monitor) +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +#Moves focused window to workspace 10 (Right Monitor) +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Example special workspace (scratchpad) +#Togles to special front window workspace +bind = $mainMod, S, togglespecialworkspace, magic +#MOves focused window to special front focused mode +bind = $mainMod SHIFT, S, movetoworkspace, special:magic + +# Scroll through existing workspaces with mainMod + scroll +#Scrolls trough workspaces with mouse (down) +bind = $mainMod, mouse_down, workspace, e+1 +#Scrolls trough workspaces with up (down) +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +#Drags window +bindm = $mainMod, mouse:272, movewindow +#Resizes window +bindm = $mainMod, mouse:273, resizewindow + +# Requires playerctl +bindl = , XF86AudioNext, exec, playerctl next +bindl = , XF86AudioPause, exec, playerctl play-pause +bindl = , XF86AudioPlay, exec, playerctl play-pause +bindl = , XF86AudioPrev, exec, playerctl previous + +############################## +### WINDOWS AND WORKSPACES ### +############################## + +# Ignore maximize requests from apps. You'll probably like this. +windowrule { + name = windowrule-1 + suppress_event = maximize + match:class = .* +} + + +# Fix some dragging issues with XWayland +windowrule { + name = windowrule-2 + no_focus = on + match:class = ^$ + match:title = ^$ + match:xwayland = 1 + match:float = 1 + match:fullscreen = 0 + match:pin = 0 +} + + +#Rules for specific windows +windowrule { + name = windowrule-3 + float = on + match:class = com.github.hluk.copyq +} + +windowrule { + name = windowrule-4 + float = on + match:class = org.pulseaudio.pavucontrol +} + +######## WORKSPACE BIND ######## +# Workspaces 1-5 on DP-2 +workspace=1,monitor:DP-2 +workspace=2,monitor:DP-2 +workspace=3,monitor:DP-2 +workspace=4,monitor:DP-2 +workspace=5,monitor:DP-2 + +# Workspaces 6-10 on DP-3 +workspace=6,monitor:DP-3 +workspace=7,monitor:DP-3 +workspace=8,monitor:DP-3 +workspace=9,monitor:DP-3 +workspace=10,monitor:DP-3 + +# Runs portal +exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP diff --git a/.config/hypr/hyprlock.conf b/.config/hypr/hyprlock.conf new file mode 100644 index 0000000..a1b47f6 --- /dev/null +++ b/.config/hypr/hyprlock.conf @@ -0,0 +1,106 @@ +# sample hyprlock.conf +# for more configuration options, refer https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock +# +# rendered text in all widgets supports pango markup (e.g. or tags) +# ref. https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/#general-remarks +# +# shortcuts to clear password buffer: ESC, Ctrl+U, Ctrl+Backspace +# +# you can get started by copying this config to ~/.config/hypr/hyprlock.conf +# + +$font = Monospace + +general { + hide_cursor = false +} + +# uncomment to enable fingerprint authentication +# auth { +# fingerprint { +# enabled = true +# ready_message = Scan fingerprint to unlock +# present_message = Scanning... +# retry_delay = 250 # in milliseconds +# } +# } + +animations { + enabled = true + bezier = linear, 1, 1, 0, 0 + animation = fadeIn, 1, 5, linear + animation = fadeOut, 1, 5, linear + animation = inputFieldDots, 1, 2, linear +} + +background { + monitor = + path = screenshot + blur_passes = 3 +} + +input-field { + monitor = + size = 20%, 5% + outline_thickness = 3 + inner_color = rgba(0, 0, 0, 0.0) # no fill + + outer_color = rgba(33ccffee) rgba(00ff99ee) 45deg + check_color = rgba(00ff99ee) rgba(ff6633ee) 120deg + fail_color = rgba(ff6633ee) rgba(ff0066ee) 40deg + + font_color = rgb(143, 143, 143) + fade_on_empty = false + rounding = 15 + + font_family = $font + placeholder_text = Input password... + fail_text = $PAMFAIL + + # uncomment to use a letter instead of a dot to indicate the typed password + # dots_text_format = * + # dots_size = 0.4 + dots_spacing = 0.3 + + # uncomment to use an input indicator that does not show the password length (similar to swaylock's input indicator) + # hide_input = true + + position = 0, -20 + halign = center + valign = center +} + +# TIME +label { + monitor = + text = $TIME # ref. https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/#variable-substitution + font_size = 90 + font_family = $font + + position = -30, 0 + halign = right + valign = top +} + +# DATE +label { + monitor = + text = cmd[update:60000] date +"%A, %d %B %Y" # update every 60 seconds + font_size = 25 + font_family = $font + + position = -30, -150 + halign = right + valign = top +} + +label { + monitor = + text = $LAYOUT[en,cz] + font_size = 24 + onclick = hyprctl switchxkblayout all next + + position = 250, -20 + halign = center + valign = center +} diff --git a/.config/hypr/hyprpaper.conf b/.config/hypr/hyprpaper.conf new file mode 100644 index 0000000..a531c13 --- /dev/null +++ b/.config/hypr/hyprpaper.conf @@ -0,0 +1,8 @@ +splash = false +ipc = true + +wallpaper { + monitor = + path = ~/Wallpapers/novosedly1.jpg + fit_mode = cover +} diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc new file mode 100644 index 0000000..7e49a28 --- /dev/null +++ b/.config/waybar/config.jsonc @@ -0,0 +1,117 @@ +// -*- mode: jsonc -*- +{ + // "layer": "top", // Waybar at top layer + // "position": "bottom", // Waybar position (top|bottom|left|right) + "height": 26, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + "spacing": 4, // Gaps between modules (4px) + + // Choose the order of the modules + "modules-left": [ + "hyprland/workspaces" + //"hyprland/submap" + //"wlr/taskbar" + ], + "modules-center": [ + "hyprland/window" + ], + "modules-right": [ + "tray", + "pulseaudio", + "hyprland/language", + "custom/notification", + "clock", + "custom/power" + ], + "tray": { + "icon-size": 18, + "spacing":14 + }, + "wlr/taskbar" : { + "current-output": true, + "all-outputs": false + }, + "clock": { + "timezone": "Europe/Prague", + "format": "{:%a %B %d %H:%M}", + "tooltip": false + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon}", + "format-bluetooth": "{volume}% {icon}  {format_source}", + "format-bluetooth-muted": " {icon}  {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": [" ", " ", " "] + }, + "on-click": "pavucontrol" + }, + "hyprland/window": { + "separate-outputs": true, + "max-length": 32, + "rewrite": { + "^$": "megnas@megnas" + } + }, + "custom/notification": { + "tooltip": true, + "format": "{icon}", + "format-icons": { + "notification": "󱅫", + "none": "󰂜", + "dnd-notification": "󰂠", + "dnd-none": "󰪓", + "inhibited-notification": "󰂛", + "inhibited-none": "󰪑", + "dnd-inhibited-notification": "󰂛", + "dnd-inhibited-none": "󰪑" + }, + "return-type": "json", + "exec-if": "which swaync-client", + "exec": "swaync-client -swb", + "on-click": "swaync-client -t -sw", + "on-click-right": "swaync-client -d -sw", + "escape": true + }, + "hyprland/workspaces": { + "format": "{icon}: {windows}", + "workspace-taskbar": { + // Enable the workspace taskbar. Default: false + "enable": true, + + // If true, the active/focused window will have an 'active' class. Could cause higher CPU usage due to more frequent redraws. Default: false + "update-active-window": true, + + // Format of the windows in the taskbar. Default: "{icon}". Allowed variables: {icon}, {title} + "format": "{icon}", + + // Icon size in pixels. Default: 16 + "icon-size": 20, + + // Either the name of an installed icon theme or an array of themes (ordered by priority). If not set, the default icon theme is used. + "icon-theme": "some_icon_theme", + + // Orientation of the taskbar ("horizontal" or "vertical"). Default: "horizontal". + "orientation": "horizontal" + } + }, + "hyprland/language": { + "format": "{}", + "format-en": "US", + "format-cs": "CZ" + }, + "custom/power": { + "format": "⏻ ", + "tooltip": false, + "on-click": "~/.scripts/power.sh" + } +} diff --git a/.config/waybar/style.css b/.config/waybar/style.css new file mode 100644 index 0000000..dab4f25 --- /dev/null +++ b/.config/waybar/style.css @@ -0,0 +1,87 @@ +/* Base font for Waybar, matching your Alacritty settings */ +* { + font-size: 14px; /* matches Alacritty font size */ + font-weight: normal; +} + +window#waybar { + background-color: rgba(80, 80, 80, 0.150); + /* border-bottom: 4px solid rgba(89, 100, 108, 0.367); */ + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +#window { + background-color: rgba(63, 63, 63, 0.6); + padding: 6px 16px; + margin: 4px 0px; + border-radius: 6px; +} + +#workspaces { + margin: 0 0px; +} + + +button { + box-shadow: inset 0 -3px transparent; + border: none; + border-radius: 0; +} + +button:hover { + background: inherit; + box-shadow: inset 0 -2px #ffffff; +} + +#workspaces button { + padding: 4px 10px; + margin: 4px 2px; + border-radius: 6px; + min-width: 40px; + background-color: rgba(63, 63, 63, 0.6); + color: #ffffff; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused { + background-color: #64727D; + /* box-shadow: inset 0 -1px #ffffff; */ +} + +#workspaces button.active { + background-color: #64727D; + box-shadow: inset 0 -2px #ffffff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#clock, +#pulseaudio, +#language, +#custom-notification, +#custom-power, +#tray { + background-color: rgba(63, 63, 63, 0.6); + padding: 4px 8px; + margin: 4px 0px; + border-radius: 6px; + min-width: 20px; + /* color: #000000; */ +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} diff --git a/.config/wofi/config b/.config/wofi/config new file mode 100644 index 0000000..2bd6882 --- /dev/null +++ b/.config/wofi/config @@ -0,0 +1,4 @@ +[wofi] +show-icons=true + +case-sensitive=false diff --git a/.config/wofi/shutdown.css b/.config/wofi/shutdown.css new file mode 100644 index 0000000..f7248d4 --- /dev/null +++ b/.config/wofi/shutdown.css @@ -0,0 +1,4 @@ +window, button, entry, label { + font-size: 32px; + font-family: Monospace, sans-serif; +} diff --git a/.config/wofi/style.css b/.config/wofi/style.css new file mode 100644 index 0000000..92a19c5 --- /dev/null +++ b/.config/wofi/style.css @@ -0,0 +1,4 @@ +window, button, entry, label { + font-size: 16px; /* adjust to your preference */ +} + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63fcd1f --- /dev/null +++ b/.gitignore @@ -0,0 +1,97 @@ +# -------------------------------------------------- +# Cache / state directories +# -------------------------------------------------- +*/cache/ +*/Cache/ +*/.cache/ +*/logs/ +*/log/ +*/tmp/ +*/temp/ +*/state/ +*/.state/ + +# -------------------------------------------------- +# Runtime / PID / socket files +# -------------------------------------------------- +*.pid +*.sock +*.lock +*.ipc + +# -------------------------------------------------- +# Logs / crash dumps +# -------------------------------------------------- +*.log +*.log.* +*.out +*.err +*.trace +*.core + +# -------------------------------------------------- +# Compiled / generated +# -------------------------------------------------- +*.pyc +__pycache__/ +*.pyo +*.so +*.o +*.a +*.class + +# -------------------------------------------------- +# Node / frontend +# -------------------------------------------------- +node_modules/ +dist/ +build/ +.next/ +.svelte-kit/ + +# -------------------------------------------------- +# Secrets / credentials +# -------------------------------------------------- +*.env +.env +.env.* +*.key +*.pem +*.crt +*.p12 +*.kdbx +secrets.* +auth.json +credentials.json + +# -------------------------------------------------- +# System-specific +# -------------------------------------------------- +.DS_Store +Thumbs.db + +# -------------------------------------------------- +# Editors +# -------------------------------------------------- +*~ +*.swp +*.swo +Session.vim +.netrwhist +.idea/ +.vscode/ + +# -------------------------------------------------- +# Wayland / desktop session artifacts +# -------------------------------------------------- +recently-used.xbel +*.sqlite-shm +*.sqlite-wal + +# -------------------------------------------------- +# KDE / GNOME volatile data +# -------------------------------------------------- +*/cache-*/ +*/metadata/ +*/activity/ + diff --git a/.scripts/cfg_load.sh b/.scripts/cfg_load.sh new file mode 100755 index 0000000..e69de29 diff --git a/.scripts/cfg_save.sh b/.scripts/cfg_save.sh new file mode 100755 index 0000000..a3f06c9 --- /dev/null +++ b/.scripts/cfg_save.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -euo pipefail + +TARGET="$HOME/.saved_cfg" +FOLDERS_FILE="$TARGET/folders" + +if [[ ! -f "$FOLDERS_FILE" ]]; then + echo "Error: $FOLDERS_FILE not found" + exit 1 +fi + +mkdir -p "$TARGET" + +while IFS= read -r line || [[ -n "$line" ]]; do + # Trim whitespace + folder="$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + + # Skip empty lines and comments + [[ -z "$folder" || "$folder" =~ ^# ]] && continue + + SRC_PATH="$HOME/$folder" + DEST_PATH="$TARGET/$folder" + + if [[ -d "$SRC_PATH" ]]; then + echo "Syncing $SRC_PATH -> $DEST_PATH" + mkdir -p "$(dirname "$DEST_PATH")" + + rsync -a --delete \ + --exclude='.git/' \ + "$SRC_PATH/" "$DEST_PATH/" + else + echo "Skipping $SRC_PATH (not found)" + fi +done < "$FOLDERS_FILE" + +echo "Sync complete." + diff --git a/.scripts/change-wallpaper.sh b/.scripts/change-wallpaper.sh new file mode 100755 index 0000000..03b004c --- /dev/null +++ b/.scripts/change-wallpaper.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# usage: ./change-wallpaper.sh /path/to/wallpaper.jpg + +WP="$1" + +if [ -z "$WP" ]; then + echo "Usage: $0 /path/to/file.png|jpg" + exit 1 +fi + +PTH="$(realpath "$WP")" + +# Set wallpaper on all monitors +hyprctl hyprpaper wallpaper ",$PTH,cover" diff --git a/.scripts/copy.sh b/.scripts/copy.sh new file mode 100755 index 0000000..c4543d0 --- /dev/null +++ b/.scripts/copy.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +# Check if exactly one argument is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +cat "$1" | wl-copy diff --git a/.scripts/copy_pasta.sh b/.scripts/copy_pasta.sh new file mode 100755 index 0000000..2762608 --- /dev/null +++ b/.scripts/copy_pasta.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +pasta_dir="$HOME/CopyPastas" + +file=$(ls "$pasta_dir" | wofi --dmenu -p "Copypastas" -i) + +wl-copy < "$pasta_dir/$file" diff --git a/.scripts/hypr-help.py b/.scripts/hypr-help.py new file mode 100755 index 0000000..4dd0297 --- /dev/null +++ b/.scripts/hypr-help.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +import re + +# Path to your Hyprland config +config_path = "/home/megnas/.config/hypr/hyprland.conf" # replace USERNAME + +variables = {} +bind_lines = [] + +# 1️⃣ Read config +with open(config_path) as f: + for line in f: + line = line.strip() + if not line or line.startswith("#"): + continue + # Parse variables + if line.startswith("$"): + m = re.match(r"(\$\w+)\s*=\s*(.*)", line) + if m: + var, val = m.groups() + val = val.split("#")[0].strip() # remove comment + variables[var] = val + # Parse binds + if line.startswith(("bind =","bindm =")): #"bindl =","bindel =" + bind_lines.append(line.split("=",1)[1].strip()) + +# 2️⃣ Map commands to readable actions +def command_to_text(parts): + cmd = " ".join(parts[2:]).strip() + # movefocus mapping + movefocus_map = {"l":"left","r":"right","u":"up","d":"down"} + if cmd.startswith("movefocus"): + dir_key = cmd.split()[-1] + dir_text = movefocus_map.get(dir_key, dir_key) + return f"Move focus {dir_text}" + if "split-workspace" in cmd: + return f"Changes workspace to {parts[-1]}" + if "exit" in cmd: + return "Exits Hyprland" + if "killactive" in cmd: + return "Closes active window" + if "exec" in cmd: + # handle known variables + cmd = cmd.replace("$fileManager", "Filemanager").replace("$menu", "Menu").replace("$terminal","Terminal") + # remove leading "exec " + if cmd.startswith("exec "): + cmd_body = cmd[5:] + else: + cmd_body = cmd + # Special case for screenshot script + if "~/.scripts/screenshot.sh" in cmd_body: + return "Takes screenshot" + if "~/.scripts/hypr-help.sh" in cmd_body: + return "Shows this help menu" + return f"Runs {cmd_body}" + if "togglefloating" in cmd: + return "Toggles floating for window" + if "fullscreen" in cmd: + return "Toggles fullscreen" + if "pseudo" in cmd: + return "Pseudotiles window (dwindle)" + if "togglesplit" in cmd: + return "Toggles split (dwindle)" + if "focusmonitor" in cmd: + return "Changes focused monitor" + if "split-changemonitor" in cmd: + return "Moves window to next monitor" + if "togglespecialworkspace" in cmd: + return f"Toggles special workspace {parts[-1]}" + if "movetoworkspace" in cmd: + return f"Moves window to {parts[-1]}" + if "split-cycleworkspacesnowrap" in cmd: + return f"Cycles workspace {parts[-1]}" + if "movewindow" in cmd: + return "Move window with mouse" + if "resizewindow" in cmd: + return "Resize window with mouse" + # fallback + return cmd + +# 3️⃣ Resolve variables in combos and rename mouse keys +def resolve_combo(combo): + combo = combo.replace("$mainMod", variables.get("$mainMod","")) + combo = combo.replace("#"," + ") # ALT#SUPER -> ALT + SUPER + # Mouse key mapping + mouse_map = { + "mouse:272": "Mouse (left click)", + "mouse:273": "Mouse (right click)", + "mouse_down": "Mouse (scroll down)", + "mouse_up": "Mouse (scroll up)", + "Print": "PrintScreen" + } + combo = mouse_map.get(combo, combo) + return combo.strip(" +") + +# 4️⃣ Format each bind +formatted = [] +for b in bind_lines: + parts = [p.strip() for p in b.split(",")] + if len(parts) < 2: + continue + combo = resolve_combo(parts[0]) + key = resolve_combo(parts[1]) + # combine combo + key + if combo and key: + combo_text = f"{combo} + {key}" + elif combo: + combo_text = combo + else: + combo_text = key + action = command_to_text(parts) + formatted.append(f"{combo_text} -> {action}") + +# 5️⃣ Print results +for line in formatted: + print(line) diff --git a/.scripts/hypr-help.sh b/.scripts/hypr-help.sh new file mode 100755 index 0000000..e89585b --- /dev/null +++ b/.scripts/hypr-help.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +/home/megnas/.scripts/hyprland-parse.py /home/megnas/.config/hypr/hyprland.conf | wofi --dmenu -p "Hyprland Keybinds" -i + diff --git a/.scripts/hyprland-parse.py b/.scripts/hyprland-parse.py new file mode 100755 index 0000000..02a00f7 --- /dev/null +++ b/.scripts/hyprland-parse.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 + +import sys +import re + + +KEY_TRANSLATIONS = { + "Print": "PrintScreen", + "mouse_up": "Mouse Up", + "mouse_down": "Mouse Down", + "mouse:272": "Left Click", + "mouse:273": "Right Click", + "left": "Left Arrow", + "right": "Right Arrow", + "up": "Up Arrow", + "down": "Down Arrow", +} + + +def normalize_key_name(key: str) -> str: + key = key.strip() + return KEY_TRANSLATIONS.get(key, key) + + +def extract_main_mod(lines): + """ + Extracts $mainMod value, e.g. + $mainMod = SUPER + """ + pattern = re.compile(r"^\s*\$mainMod\s*=\s*([A-Za-z0-9_]+)") + for line in lines: + match = pattern.match(line) + if match: + return match.group(1) + return None + + +def normalize_key(mods: str, key: str, main_mod_value: str) -> str: + mods = mods.strip() + key = normalize_key_name(key.strip()) + + if mods: + mod_parts = mods.split() + + resolved_mods = [] + for m in mod_parts: + if m == "$mainMod" and main_mod_value: + resolved_mods.append(main_mod_value) + else: + resolved_mods.append(m) + + return " + ".join(resolved_mods) + f" + {key}" + + return key + + +def parse_hyprland_config(path: str): + with open(path, "r", encoding="utf-8") as f: + lines = f.readlines() + + main_mod_value = extract_main_mod(lines) + + results = [] + last_comment = None + + bind_pattern = re.compile(r"^\s*(bindm?|bind)\s*=\s*(.+)$") + + for line in lines: + stripped = line.strip() + + if stripped.startswith("#"): + last_comment = stripped.lstrip("#").strip() + continue + + match = bind_pattern.match(line) + if match: + full_cmd = match.group(2) + parts = [p.strip() for p in full_cmd.split(",")] + + if len(parts) >= 2: + mods = parts[0] + key = parts[1] + + keybind = normalize_key(mods, key, main_mod_value) + comment = last_comment if last_comment else "(no comment)" + + results.append(f"{keybind} = {comment}") + + last_comment = None + else: + if stripped != "": + last_comment = None + + return results + + +def main(): + if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} ") + sys.exit(1) + + config_path = sys.argv[1] + keybinds = parse_hyprland_config(config_path) + + for line in keybinds: + print(line) + + +if __name__ == "__main__": + main() + diff --git a/.scripts/open b/.scripts/open new file mode 100755 index 0000000..d187ab6 --- /dev/null +++ b/.scripts/open @@ -0,0 +1,26 @@ +#!/bin/bash + +# Check if at least 2 arguments are passed +if [ $# -lt 1 ]; then + echo "Usage: open [file]" + exit 1 +fi + +FILE="$1" + +file_types=$(file -b "$FILE") + +if echo "$file_types" | grep -q "text"; then + + # Open .md file with glow + if [[ "$FILE" == *.md ]]; then + glow -t "$FILE" + exit $? + fi + + #Open other files with bat + bat "$FILE" + exit $? +fi + +echo "Opening this file type is not supported!" diff --git a/.scripts/paste.sh b/.scripts/paste.sh new file mode 100755 index 0000000..1b8f5c9 --- /dev/null +++ b/.scripts/paste.sh @@ -0,0 +1,10 @@ +#! /bin/bash + +# Check if exactly one argument is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Append the output of wl-paste to the provided file +wl-paste --type text/plain > "$1" diff --git a/.scripts/power.sh b/.scripts/power.sh new file mode 100755 index 0000000..3fa61b7 --- /dev/null +++ b/.scripts/power.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +if pkill wofi; then + # If successful, exit the script/app + exit 0 +fi + +# Define options as a single string, separated by newlines +OPTIONS="Shutdown\nReboot\nSuspend\nHibernate\nLogout" + +# Use wofi to present the options and get the user's choice +SELECTED=$(echo -e "$OPTIONS" | wofi -W 24% -H 26% -dmenu -s ~/.config/wofi/shutdown.css --prompt "Power Menu") + +# Act on the user's choice +case "$SELECTED" in + "Shutdown") + shutdown now + ;; + "Reboot") + reboot + ;; + "Suspend") + systemctl suspend + ;; + "Hibernate") + systemctl hibernate + ;; + "Logout") + # This command is for Hyprland. + # If you use a different compositor, change this line. + hyprctl dispatch exit + ;; +esac diff --git a/.scripts/reload_waybar.sh b/.scripts/reload_waybar.sh new file mode 100755 index 0000000..f098b27 --- /dev/null +++ b/.scripts/reload_waybar.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Kill existing Waybar instances +if pgrep -x waybar > /dev/null; then + pkill -x waybar + # Wait until all processes are fully stopped + while pgrep -x waybar > /dev/null; do + sleep 0.1 + done +fi + +# Start Waybar in background +waybar >/dev/null 2>&1 & +disown + +echo "Waybar reloaded." diff --git a/.scripts/screenshot.sh b/.scripts/screenshot.sh new file mode 100755 index 0000000..bbd62b5 --- /dev/null +++ b/.scripts/screenshot.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +dir="$HOME/Pictures/Screenshots" +file="$(date '+%F_%H-%M-%S').png" + +grim -g "$(slurp)" "$dir"/"$file" + +copyq write image/png - < "$dir/$file" +copyq select 0 diff --git a/.scripts/wallpaper-picker.sh b/.scripts/wallpaper-picker.sh new file mode 100755 index 0000000..fe2e001 --- /dev/null +++ b/.scripts/wallpaper-picker.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +DIR="$HOME/Wallpapers" + + +# Build list: filenamefullpath +file_list=$(find "$DIR" -type f 2>/dev/null | sort | while read -r f; do + printf "%s\t%s\n" "$(basename "$f")" "$f" +done) + +# Show only filename column in wofi +selected_name=$(printf "%s\n" "$file_list" | cut -f1 | \ + wofi --dmenu --prompt "Select file:") + +# Get full path matching selected filename (first match) +if [[ -n "$selected_name" ]]; then + selected_file=$(printf "%s\n" "$file_list" | \ + awk -F'\t' -v name="$selected_name" '$1 == name { print $2; exit }') + + notify-send "Selected File" "$selected_file" + hyprctl hyprpaper wallpaper ",$selected_file,cover" +fi diff --git a/README.md b/README.md new file mode 100644 index 0000000..c1746f6 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# This is config for 'megnas' diff --git a/folders b/folders new file mode 100644 index 0000000..12265d5 --- /dev/null +++ b/folders @@ -0,0 +1,4 @@ +.scripts +.config/hypr +.config/waybar +.config/wofi