diff --git a/hypr/alacritty/alacritty.toml b/hypr/alacritty/alacritty.toml new file mode 100644 index 0000000..55669db --- /dev/null +++ b/hypr/alacritty/alacritty.toml @@ -0,0 +1,104 @@ +## Copyright (C) 2020-2024 Aditya Shakya +## +## Configuration for Alacritty, the GPU enhanced terminal emulator. +## It's a very basic and simple config file, for full configuration, Run `man 5 alacritty` + +## GENERAL -------------------------------------------------------- + +## Import additional configuration files. +import = ["~/.config/hypr/alacritty/colors.toml", "~/.config/hypr/alacritty/fonts.toml"] + +## You can set shell.program to the path of your favorite shell, e.g. /bin/zsh. +## Entries in shell.args are passed as arguments to the shell. +#shell = { program = "/bin/zsh", args = ["--login"] } + +## Directory the shell is started in. When this is unset, or "None", +## the working directory of the parent process will be used. +#working_directory = "None" + +## Live config reload +live_config_reload = true + +## Offer IPC using alacritty msg +ipc_socket = true + +## ENVIRONMENT ---------------------------------------------------- + +## All key-value pairs in the [env] section will be added as environment variables for any process spawned +## by Alacritty, including its shell. Some entries may override variables set by alacritty itself. +[env] +TERM = "alacritty" +WINIT_X11_SCALE_FACTOR = "1.0" + +## WINDOW --------------------------------------------------------- +[window] +position = "None" +dynamic_padding = true +decorations = "full" +opacity = 0.95 +blur = false +startup_mode = "Windowed" +dynamic_title = true +class = { instance = "Alacritty", general = "Alacritty" } +decorations_theme_variant = "None" + +## Number of lines/columns (not pixels) in the terminal. +[window.dimensions] +columns = 82 +lines = 24 + +## Blank space added around the window in pixels. +[window.padding] +x = 6 +y = 6 + +## SCROLLING ------------------------------------------------------ +[scrolling] +history = 100000 +multiplier = 3 + +## BELL ----------------------------------------------------------- +# [bell] +# animation = "Linear" +# duration = 20 +# command = { program = "paplay", args = ["/usr/share/sounds/freedesktop/stereo/dialog-error.oga"] } + +## SELECTION ------------------------------------------------------ +[selection] +save_to_clipboard = true + +## CURSOR --------------------------------------------------------- +[cursor] +vi_mode_style = "None" +blink_interval = 750 +blink_timeout = 5 +unfocused_hollow = false +thickness = 0.15 + +[cursor.style] +shape = "Block" +blinking = "On" + +## MOUSE ---------------------------------------------------------- +[mouse] +hide_when_typing = false + +## HINTS ---------------------------------------------------------- +[[hints.enabled]] +command = "xdg-open" +hyperlinks = true +post_processing = true +persist = false +mouse.enabled = true +binding = { key = "U", mods = "Control|Shift" } +regex = "(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file:|git://|ssh:|ftp://)[^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩‘]+" + +## DEBUG ---------------------------------------------------------- +[debug] +render_timer = false +persistent_logging = false +log_level = "Warn" +renderer = "None" +print_events = false +highlight_damage = false +prefer_egl = false diff --git a/hypr/alacritty/colors.toml b/hypr/alacritty/colors.toml new file mode 100644 index 0000000..80ba7ca --- /dev/null +++ b/hypr/alacritty/colors.toml @@ -0,0 +1,24 @@ +## Colors configuration +[colors.primary] +background = "#0F161C" +foreground = "#c0cbcb" + +[colors.normal] +black = "#0F161C" +red = "#50696F" +green = "#9D632C" +yellow = "#F59E0A" +blue = "#5B7C83" +magenta = "#5F8188" +cyan = "#68888D" +white = "#c0cbcb" + +[colors.bright] +black = "#868e8e" +red = "#50696F" +green = "#9D632C" +yellow = "#F59E0A" +blue = "#5B7C83" +magenta = "#5F8188" +cyan = "#68888D" +white = "#c0cbcb" diff --git a/hypr/alacritty/fonts.toml b/hypr/alacritty/fonts.toml new file mode 100644 index 0000000..c0939fd --- /dev/null +++ b/hypr/alacritty/fonts.toml @@ -0,0 +1,38 @@ +## Copyright (C) 2020-2024 Aditya Shakya +## +## Font configuration --------------------------------------- + +[font] +## Font size in points. +size = 9 + +## When true, Alacritty will use a custom built-in font for box drawing characters and powerline symbols. +builtin_box_drawing = true + +## Normal font family. +[font.normal] +family = "JetBrainsMono Nerd Font" + +## If the family is not specified, it will fall back to the value specified for the normal font. +[font.bold] +family = "JetBrainsMono Nerd Font" + +## If the family is not specified, it will fall back to the value specified for the normal font. +[font.italic] +family = "JetBrainsMono Nerd Font" + +## If the family is not specified, it will fall back to the value specified for the normal font. +[font.bold_italic] +family = "JetBrainsMono Nerd Font" + +## Offset is the extra space around each character. +## 'y' can be thought of as modifying the line spacing, and 'x' as modifying the letter spacing. +[font.offset] +x = 0 +y = 0 + +## Glyph offset determines the locations of the glyphs within their cells with the default being at the bottom. +## Increasing 'x' moves the glyph to the right, increasing 'y' moves the glyph upward. +[font.glyph_offset] +x = 0 +y = 0 diff --git a/hypr/foot/colors.ini b/hypr/foot/colors.ini new file mode 100644 index 0000000..175eecb --- /dev/null +++ b/hypr/foot/colors.ini @@ -0,0 +1,25 @@ +## Colors configuration +[colors] +alpha=1.0 +foreground=c0cbcb +background=0F161C + +## Normal/regular colors (color palette 0-7) +regular0=0F161C # black +regular1=50696F # red +regular2=9D632C # green +regular3=F59E0A # yellow +regular4=5B7C83 # blue +regular5=5F8188 # magenta +regular6=68888D # cyan +regular7=c0cbcb # white + +## Bright colors (color palette 8-15) +bright0=868e8e # bright black +bright1=50696F # bright red +bright2=9D632C # bright green +bright3=F59E0A # bright yellow +bright4=5B7C83 # bright blue +bright5=5F8188 # bright magenta +bright6=68888D # bright cyan +bright7=c0cbcb # bright white diff --git a/hypr/foot/fonts.ini b/hypr/foot/fonts.ini new file mode 100644 index 0000000..462c706 --- /dev/null +++ b/hypr/foot/fonts.ini @@ -0,0 +1,15 @@ +## Copyright (C) 2020-2024 Aditya Shakya +## +## Fonts + +font=JetBrainsMono Nerd Font:size=10 +#font-bold=JetBrainsMono Nerd Font:size=8 +#font-italic=JetBrainsMono Nerd Font:size=8 +#font-bold-italic=JetBrainsMono Nerd Font:size=8 +#line-height=10 +#letter-spacing=0 +#horizontal-letter-offset=0 +#vertical-letter-offset=0 +#underline-offset=0 +#box-drawings-uses-font-glyphs=no +dpi-aware=no diff --git a/hypr/foot/foot.ini b/hypr/foot/foot.ini new file mode 100644 index 0000000..8daa468 --- /dev/null +++ b/hypr/foot/foot.ini @@ -0,0 +1,131 @@ +## Copyright (C) 2020-2024 Aditya Shakya +## +## Configuration for Foot, Wayland terminal emulator. +## +## -------------------------------------------------- + +include=~/.config/hypr/foot/colors.ini +include=~/.config/hypr/foot/fonts.ini + +#shell=/bin/zsh +#term=foot +#login-shell=no + +#app-id=foot +#title=foot +#locked-title=no + +#initial-window-size-pixels=700x500 +initial-window-size-chars=82x24 +initial-window-mode=windowed +pad=15x15 +resize-delay-ms=100 + +#bold-text-in-bright=no +#word-delimiters=,│`|:"'()[]{}<> +#selection-target=primary +#workers= +#notify=notify-send -a ${app-id} -i ${app-id} ${title} ${body} + +[bell] +#urgent=no +#notify=no +#command= +#command-focused=no + +[scrollback] +lines=1000 +multiplier=3.0 +#indicator-position=relative +#indicator-format=line + +[url] +launch=xdg-open ${url} +# label-letters=sadfjklewcmpgh +# osc8-underline=url-mode +# protocols=http, https, ftp, ftps, file, gemini, gopher +# uri-characters=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="' + +[cursor] +style=block +# color=111111 dcdccc +blink=yes +# beam-thickness=1.5 +# underline-thickness= + +[mouse] +hide-when-typing=yes +alternate-scroll-mode=yes + +[csd] +# preferred=server +# size=26 +# font= +# color= +# border-width=0 +# border-color= +# button-width=26 +# button-color= +# button-minimize-color= +# button-maximize-color= +# button-close-color= + +[key-bindings] +# scrollback-up-page=Shift+Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# clipboard-copy=Control+Shift+c XF86Copy +# clipboard-paste=Control+Shift+v XF86Paste +# primary-paste=Shift+Insert +# search-start=Control+Shift+r +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+n +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-scrollback=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-selected=[xargs -r firefox] none +# show-urls-launch=Control+Shift+u +# show-urls-copy=none +# noop=none + +[search-bindings] +# cancel=Control+g Control+c Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-to-word-boundary=Control+w +# extend-to-next-whitespace=Control+Shift+w +# clipboard-paste=Control+v Control+y +# primary-paste=Shift+Insert + +[url-bindings] +# cancel=Control+g Control+c Control+d Escape +# toggle-url-visible=t + +[mouse-bindings] +# selection-override-modifiers=Shift +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-extend-character-wise=Control+BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-row=BTN_LEFT-3 diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf new file mode 100644 index 0000000..b5e5cdf --- /dev/null +++ b/hypr/hypridle.conf @@ -0,0 +1,39 @@ +#-- General ---------------------------------------------------- +general { + lock_cmd = pidof hyprlock || hyprlock + before_sleep_cmd = loginctl lock-session + after_sleep_cmd = hyprctl dispatch dpms on +} + +# set monitor backlight to minimum, avoid 0 on OLED monitor +listener { + timeout = 120 + on-timeout = light -O && light -S 5 + on-resume = light -I +} + +# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight. +#listener { +# timeout = 120 +# on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 +# on-resume = brightnessctl -rd rgb:kbd_backlight +#} + +# lock screen when timeout has passed +listener { + timeout = 240 + on-timeout = loginctl lock-session +} + +# screen off when timeout has passed +listener { + timeout = 360 + on-timeout = hyprctl dispatch dpms off + on-resume = hyprctl dispatch dpms on +} + +# suspend pc +# listener { +# timeout = 900 +# on-timeout = systemctl suspend +# } diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf new file mode 100644 index 0000000..95592d5 --- /dev/null +++ b/hypr/hyprland.conf @@ -0,0 +1,611 @@ +# Copyright (C) 2020-2024 Aditya Shakya +# +# Hyprland configuration file for Archcraft +# Hyprland Version: 0.41.2 + +#-- Source Files ----------------------------------------------- +source = ~/.config/hypr/hyprtheme.conf + +env = XDG_CURRENT_DESKTOP,sway +exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP +exec-once = systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + +#-- General ---------------------------------------------------- +general { + border_size = $hypr_border_size + no_border_on_floating = false + gaps_in = $hypr_gaps_in + gaps_out = $hypr_gaps_out + gaps_workspaces = $hypr_gaps_ws + col.active_border = $active_border_col_1 $active_border_col_2 $gradient_angle + col.inactive_border = $inactive_border_col_1 $inactive_border_col_2 $gradient_angle + col.nogroup_border = $group_border_col + col.nogroup_border_active = $group_border_active_col + layout = dwindle + no_focus_fallback = false + # apply_sens_to_raw = false + resize_on_border = true + extend_border_grab_area = 15 + hover_icon_on_border = true + allow_tearing = false + resize_corner = 0 +} + +#-- Decoration ------------------------------------------------- +decoration { + rounding = $hypr_rounding + active_opacity = 1.0 + inactive_opacity = 0.95 + fullscreen_opacity = 1.0 + drop_shadow = true + shadow_range = 25 + shadow_render_power = 3 + shadow_ignore_window = false + col.shadow = $active_shadow_col + col.shadow_inactive = $inactive_shadow_col + shadow_offset = 0 0 + shadow_scale = 1.0 + dim_inactive = false + dim_strength = 0.5 + dim_special = 0.2 + dim_around = 0.4 + #screen_shader = + blur { + enabled = false + size = 8 + passes = 1 + ignore_opacity = false + new_optimizations = true + xray = false + noise = 0.0117 + contrast = 0.8916 + brightness = 0.8172 + vibrancy = 0.1696 + vibrancy_darkness = 0.0 + special = true + popups = false + popups_ignorealpha = 0.2 + } +} + +#-- Animations ------------------------------------------------- +animations { + enabled = true + first_launch_animation = true + animation = windowsIn,1,5,default,popin 0% + animation = windowsOut,1,5,default,popin + animation = windowsMove,1,5,default,slide + animation = layersIn,1,4,default,slide + animation = layersOut,1,4,default,slide + animation = fadeIn,1,8,default + animation = fadeOut,1,8,default + animation = fadeSwitch,1,8,default + animation = fadeShadow,1,8,default + animation = fadeDim,1,8,default + animation = fadeLayersIn,1,8,default + animation = fadeLayersOut,1,8,default + animation = border,1,20,default + animation = borderangle,1,20,default,once + animation = workspaces, 1,5,default,slide + animation = specialWorkspace,1,5,default,fade +} + +#-- Input: Keyboard, Mouse, Touchpad --------------------------- +input { + kb_model = + kb_layout = + kb_variant = + kb_options = + kb_rules = + kb_file = + numlock_by_default = false + resolve_binds_by_sym = false + repeat_rate = 25 + repeat_delay = 600 + sensitivity = 1.0 + accel_profile = adaptive + force_no_accel = false + left_handed = false + scroll_points = + scroll_method = 2fg + scroll_button = 0 + scroll_button_lock = 0 + scroll_factor = 1.0 + natural_scroll = false + follow_mouse = 1 + mouse_refocus = true + float_switch_override_focus = 1 + special_fallthrough = false + off_window_axis_events = 1 + touchpad { + disable_while_typing = true + natural_scroll = false + scroll_factor = 1.0 + middle_button_emulation = false + tap_button_map = + clickfinger_behavior = false + tap-to-click = true + drag_lock = false + tap-and-drag = true + } + touchdevice { + enabled = true + transform = 0 + output = + } + tablet { + transform = 0 + output = + region_position = 0 0 + region_size = 0 0 + relative_input = false + left_handed = false + active_area_size = 0 0 + active_area_position = 0 0 + } +} + +#-- Workspace Gestures ----------------------------------------- +gestures { + workspace_swipe = true + workspace_swipe_fingers = 3 + workspace_swipe_min_fingers = false + workspace_swipe_distance = 300 + workspace_swipe_touch = false + workspace_swipe_invert = true + workspace_swipe_min_speed_to_force = 30 + workspace_swipe_cancel_ratio = 0.5 + workspace_swipe_create_new = true + workspace_swipe_direction_lock = true + workspace_swipe_direction_lock_threshold = 10 + workspace_swipe_forever = false + workspace_swipe_use_r = false +} + +#-- Group ------------------------------------------------------ +group { + insert_after_current = true + focus_removed_window = true + col.border_active = $group_border_active_col + col.border_inactive = $group_border_inactive_col + col.border_locked_active = $group_border_locked_active_col + col.border_locked_inactive = $group_border_locked_inactive_col + groupbar { + enabled = true + font_family = $groupbar_font_family + font_size = $groupbar_font_size + gradients = true + height = 14 + stacked = false + priority = 3 + render_titles = true + scrolling = true + text_color = $groupbar_text_color + col.active = $group_border_active_col + col.inactive = $group_border_inactive_col + col.locked_active = $group_border_locked_active_col + col.locked_inactive = $group_border_locked_inactive_col + } +} + +#-- Miscellaneous ---------------------------------------------- +misc { + disable_hyprland_logo = true + disable_splash_rendering = false + col.splash = $groupbar_text_color + font_family = $groupbar_font_family + splash_font_family = $groupbar_font_family + force_default_wallpaper = 0 + vfr = true + vrr = 0 + mouse_move_enables_dpms = false + key_press_enables_dpms = false + always_follow_on_dnd = true + layers_hog_keyboard_focus = true + animate_manual_resizes = false + animate_mouse_windowdragging = false + disable_autoreload = false + enable_swallow = false + swallow_regex = + swallow_exception_regex = + focus_on_activate = true + # no_direct_scanout = false + mouse_move_focuses_monitor = true + render_ahead_of_time = false + render_ahead_safezone = 1 + allow_session_lock_restore = false + background_color = 0x000000 + close_special_on_empty = true + new_window_takes_over_fullscreen = 0 + initial_workspace_tracking = 1 + middle_click_paste = true +} + +#-- Binds ------------------------------------------------------ +binds { + pass_mouse_when_bound = false + scroll_event_delay = 300 + workspace_back_and_forth = false + allow_workspace_cycles = false + workspace_center_on = 0 + focus_preferred_method = 0 + ignore_group_lock = false + movefocus_cycles_fullscreen = true + disable_keybind_grabbing = false + window_direction_monitor_fallback = true +} + +#-- Xwayland --------------------------------------------------- +xwayland { + use_nearest_neighbor = true + force_zero_scaling = false +} + +#-- OpenGL ----------------------------------------------------- +opengl { + nvidia_anti_flicker = true + force_introspection = 2 +} + +#-- Cursor ----------------------------------------------------- +cursor { + no_hardware_cursors = false + no_break_fs_vrr = false + min_refresh_rate = 24 + hotspot_padding = 1 + inactive_timeout = 0 + no_warps = false + persistent_warps = false + warp_on_change_workspace = false + default_monitor = + zoom_factor = 1.0 + zoom_rigid = false + enable_hyprcursor = true + hide_on_key_press = false + hide_on_touch = false +} + +#-- Hyprcursor ------------------------------------------------- +# +# You will need to obtain themes yourself. If you are on the hyprland Discord server, see #hyprcursor-themes. +# Put your theme(s) in ~/.local/share/icons or ~/.icons +# Then, uncomment these two lines and replace `MyCursor` with the name of your theme. +# +#env = HYPRCURSOR_THEME,MyCursor +#env = HYPRCURSOR_SIZE,24 + +#-- Debug (Only for developers) -------------------------------- +debug { + overlay = false + damage_blink = false + disable_logs = false + disable_time = true + damage_tracking = 2 + enable_stdout_logs = false + manual_crash = 0 + suppress_errors = false + watchdog_timeout = 5 + disable_scale_checks = false + error_limit = 5 + error_position = 0 + colored_stdout_logs = true +} + +#-- Multi GPUs ------------------------------------------------- +# +# If your host machine uses multiple GPUs, you may want to primarily use one GPU +# for rendering all the elements for Hyprland including windows, animations, and +# another for hardware acceleration for certain applications, etc. +# +# Run : `lspci | grep -E 'VGA|3D'` to list all the video devices available +# Then Run : `ls -l /dev/dri/by-path` to match the bus IDs and determine your integrated and dedicated GPUs +# +# After determining which “card” belongs to which GPU, we now have to tell Hyprland the GPU we want to use primarily. +# We can do so by using the WLR_DRM_DEVICES variable. +# +# env = WLR_DRM_DEVICES,/dev/dri/cardN + +# Example : +# Here, we tell Hyprland to set priorities. If card1 isn’t available for whatever reason, use card0. +# The colon is for setting priorities, essentially. +#env = WLR_DRM_DEVICES,/dev/dri/card1:/dev/dri/card0 + +#-- Blurring Layer Surfaces ------------------------------------ +#layerrule = blur,waybar + +#-- Output ----------------------------------------------------- +monitor = DP-1,2560x1440@60,2560x0,1 +monitor = HDMI-A-1,2560x1440@60,0x0,1 + +# Example : +#~ Laptop screen, mode: 1920x1080, scale: 1, gaps of 10 each side +#monitor = eDP-1,1920x1080@60,0x0,1 +#monitor = eDP-1,addreserved,10,10,10,10 +#monitor = eDP-1,transform,0 +#workspace = eDP-1,1 +#~ External monitor, mode: 1920x1080, position: right of laptop, scale: 1.5, gaps of 20 each side, rotated 90d +#monitor = HDMI-A-1,addreserved,20,20,20,20 +#monitor = HDMI-A-1,transform,1 +#workspace = HDMI-A-1,2 +workspace = HDMI-A-1,1 +workspace = HDMI-A-1,2 +workspace = DP-1,3 + +# Workspace Rules +#workspace = 3, rounding:false, decorate:false +#workspace = name:coding, rounding:false, decorate:false, gapsin:0, gapsout:0, border:false, decorate:false, monitor:DP-1 +#workspace = 8,bordersize:8 +#workspace = name:Hello, monitor:DP-1, default:true + +#-- Layout : Dwindle ------------------------------------------- +dwindle { + pseudotile = false + force_split = 0 + preserve_split = false + smart_split = false + smart_resizing = true + permanent_direction_override = false + special_scale_factor = 0.8 + split_width_multiplier = 1.0 + no_gaps_when_only = false + use_active_for_splits = true + default_split_ratio = 1.0 +} + +$notifycmd = notify-send -h string:x-canonical-private-synchronous:hypr-cfg -u low +bind = SUPER, G, togglegroup +bind = SUPER, E, moveoutofgroup +bind = SUPER, G, exec, $notifycmd 'Toggled Group Mode' +bind = SUPER, H, changegroupactive, b +bind = SUPER, L, changegroupactive, f +# bind = SUPER, A, changegroupactive, b +# bind = SUPER, D, changegroupactive, f +bind = SUPER_SHIFT, L, lockactivegroup, toggle +bind = SUPER_SHIFT, L, exec, $notifycmd 'Toggled Group Lock' + +#-- Layout : Master -------------------------------------------- +master { + allow_small_split = false + special_scale_factor = 0.8 + mfact = 0.55 + new_status = slave + new_on_top = false + new_on_active = none + no_gaps_when_only = false + orientation = left + inherit_fullscreen = true + always_center_master = false + smart_resizing = true + drop_at_cursor = true +} + +#-- Window Rules ----------------------------------------------- +windowrule = float, foot-float|alacritty-float +windowrule = float, yad|nm-connection-editor|pavucontrolk +windowrule = float, xfce-polkit|kvantummanager|qt5ct +windowrule = float, feh|Viewnior|Gpicview|Gimp|MPlayer +windowrule = float, VirtualBox Manager|qemu|Qemu-system-x86_64 +windowrule = float, title:File Operation Progress +windowrule = float, title:Confirm to replace files + +windowrule = float, Yad|yad +windowrule = size 60% 64%, Yad|yad + +windowrule = float, io.calamares.calamares +windowrule = center, io.calamares.calamares + +windowrule = float,title:^(Archcraft Installer)(.*)$ + +windowrule = size 60% 64%, Viewnior +windowrule = center, Viewnior + +windowrule = animation slide down,foot-full +windowrule = animation slide up,wlogout + +#windowrule = float,WINDOW +#windowrule = tile,WINDOW +#windowrule = fullscreen,WINDOW +#windowrule = nofullscreenrequest,WINDOW +#windowrule = move 69 420,WINDOW +#windowrule = size 420 69,WINDOW +#windowrule = minsize 420 69,WINDOW +#windowrule = maxsize 420 69,WINDOW +#windowrule = center,WINDOW +#windowrule = pseudo,WINDOW +#windowrule = monitor 0,WINDOW +#windowrule = workspace 12,WINDOW +#windowrule = opacity 1.0,WINDOW +#windowrule = opaque 1.0,WINDOW +#windowrule = animation slide left,WINDOW +#windowrule = rounding 10,WINDOW +#windowrule = noblur,WINDOW +#windowrule = nofocus,WINDOW +#windowrule = noborder,WINDOW +#windowrule = noshadow,WINDOW +#windowrule = forceinput,WINDOW +#windowrule = windowdance,WINDOW +#windowrule = pin,WINDOW +#windowrule = noanim,WINDOW +#windowrule = bordercolor color color,WINDOW +#windowrule = idleinhibit none,WINDOW +#windowrule = unset,WINDOW +#windowrule = nomaxsize,WINDOW + +#-- Keybindings ------------------------------------------------ +$alacritty = ~/.config/hypr/scripts/alacritty +$foot = ~/.config/hypr/scripts/foot +$volume = ~/.config/hypr/scripts/volume +$backlight = ~/.config/hypr/scripts/brightness +$screenshot = ~/.config/hypr/scripts/screenshot +$lockscreen = ~/.config/hypr/scripts/lockscreen +$wlogout = ~/.config/hypr/scripts/wlogout +$colorpicker = ~/.config/hypr/scripts/colorpicker +$files = thunar +$editor = geany +$browser = firefox + +$rofi_launcher = ~/.config/hypr/scripts/rofi_launcher +$rofi_runner = ~/.config/hypr/scripts/rofi_runner +$rofi_windows = ~/.config/hypr/scripts/rofi_windows +$rofi_music = ~/.config/hypr/scripts/rofi_music +$rofi_network = ~/.config/hypr/scripts/rofi_network +$rofi_ssh = ~/.config/hypr/scripts/rofi_ssh +$rofi_powermenu = ~/.config/hypr/scripts/rofi_powermenu +$rofi_screenshot = ~/.config/hypr/scripts/rofi_screenshot +$rofi_asroot = ~/.config/hypr/scripts/rofi_asroot + +$wofi_menu = ~/.config/hypr/scripts/wofi_menu +$wofi_powermenu = ~/.config/hypr/scripts/wofi_powermenu + +# -- Terminal : alacritty -- +bind = SUPER, Return, exec, $alacritty +bind = SUPER_SHIFT, Return, exec, $alacritty -f +bind = SUPER, T, exec, $alacritty -F + +# -- Terminal : foot -- +#bind = SUPER, Return, exec, $foot +#bind = SUPER_SHIFT, Return, exec, $foot -f +#bind = SUPER_ALT, Return, exec, $foot -s +#bind = SUPER, T, exec, $foot -F + +# -- Apps -- +bind = SUPER_SHIFT, F, exec, $files +bind = SUPER_SHIFT, E, exec, $editor +bind = SUPER_SHIFT, W, exec, $browser + +# -- Rofi -- +bind = SUPER, P, exec, $rofi_launcher +bind = SUPER, Q, exec, $rofi_windows +# bind = ALT, F1, exec, $rofi_launcher +# bind = ALT, F2, exec, $rofi_runner +# bind = SUPER, R, exec, $rofi_asroot +bind = SUPER, M, exec, $rofi_music +bind = SUPER, N, exec, $rofi_network +bind = SUPER, B, exec, $rofi_ssh +bind = SUPER, R, exec, $rofi_powermenu +# bind = SUPER, A, exec, $rofi_screenshot + +# -- Wofi -- +#bindr = SUPER, SUPER_L, exec, $wofi_menu +#bind = SUPER, D, exec, $wofi_menu +#bind = SUPER, X, exec, $wofi_powermenu + +# -- Misc -- +#bind = SUPER, N, exec, nm-connection-editor +#bind = SUPER, X, exec, $wlogout +# bind = SUPER, P, exec, $colorpicker +#bind = CTRL_ALT, L, exec, $lockscreen +bind = SUPER, L, exec, hyprlock + +# -- Function keys -- +bind = ,XF86MonBrightnessUp, exec, $backlight --inc +bind = ,XF86MonBrightnessDown, exec, $backlight --dec +bind = ,XF86AudioRaiseVolume, exec, $volume --inc +bind = ,XF86AudioLowerVolume, exec, $volume --dec +bind = ,XF86AudioMute, exec, $volume --toggle +bind = ,XF86AudioMicMute, exec, $volume --toggle-mic +bind = ,XF86AudioNext, exec, mpc next +bind = ,XF86AudioPrev, exec, mpc prev +bind = ,XF86AudioPlay, exec, mpc toggle +bind = ,XF86AudioStop, exec, mpc stop + +# -- Screenshots -- +bind = , Print, exec, $screenshot --now +bind = ALT, Print, exec, $screenshot --in5 +bind = SHIFT, Print, exec, $screenshot --in10 +bind = CTRL, Print, exec, $screenshot --win +bind = SUPER, Print, exec, $screenshot --area + +# -- Hyprland -- +bind = SUPER, W, killactive, +# bind = SUPER, C, killactive, +bind = CTRL_ALT, Delete, exit, +bind = SUPER, F, fullscreen, 0 +bind = SUPER, F, exec, $notifycmd 'Fullscreen Mode' +bind = SUPER, S, pseudo, +bind = SUPER, S, exec, $notifycmd 'Pseudo Mode' +bind = SUPER, Space, togglefloating, +bind = SUPER, Space, centerwindow, + +# Change Focus +bind = SUPER, A, movefocus, l +bind = SUPER, D, movefocus, l +# bind = SUPER, left, movefocus, l +# bind = SUPER, right, movefocus, r +bind = SUPER, up, movefocus, u +bind = SUPER, down, movefocus, d + +# Move Active +bind = SUPER_SHIFT, left, movewindow, l +bind = SUPER_SHIFT, right, movewindow, r +bind = SUPER_SHIFT, up, movewindow, u +bind = SUPER_SHIFT, down, movewindow, d + +# Resize Active +binde = SUPER_CTRL, left, resizeactive, -20 0 +binde = SUPER_CTRL, right, resizeactive, 20 0 +binde = SUPER_CTRL, up, resizeactive, 0 -20 +binde = SUPER_CTRL, down, resizeactive, 0 20 + +# Move Active (Floating Only) +binde = SUPER_ALT, left, moveactive, -20 0 +binde = SUPER_ALT, right, moveactive, 20 0 +binde = SUPER_ALT, up, moveactive, 0 -20 +binde = SUPER_ALT, down, moveactive, 0 20 + +# Switch between windows +bind = SUPER,Tab,cyclenext, +bind = SUPER,Tab,bringactivetotop, + +# Workspaces +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, MINUS, togglespecialworkspace, special + +# Send to Workspaces +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 +bind = SUPER_SHIFT, MINUS, movetoworkspace, special + +# Seamless Workspace Switching +bind = CTRL_ALT, left, workspace, e-1 +bind = CTRL_ALT, right, workspace, e+1 +bind = CTRL_ALT_SHIFT, left, movetoworkspace, e-1 +bind = CTRL_ALT_SHIFT, right, movetoworkspace, e+1 + +# Change Workspace Mode +bind = SUPER_CTRL, F, workspaceopt, allfloat +bind = SUPER_CTRL, F, exec, $notifycmd 'Toggled All Float Mode' +bind = SUPER_CTRL, S, workspaceopt, allpseudo +bind = SUPER_CTRL, S, exec, $notifycmd 'Toggled All Pseudo Mode' + +# Misc +bind = SUPER_SHIFT, P, pin, +bind = SUPER_SHIFT, P, exec, $notifycmd 'Toggled Pin' +bind = SUPER_SHIFT, S, swapnext +# bind = SUPER_SHIFT, O, toggleopaque +bindl = ,switch:Lid Switch, exec, $lockscreen + +#-- Mouse Buttons ---------------------------------------------- +bindm=SUPER, mouse:272, movewindow +bindm=SUPER, mouse:273, resizewindow + +#-- Startup ---------------------------------------------------- +exec-once = hypridle +exec-once=~/.config/hypr/scripts/startup diff --git a/hypr/hyprlock.conf b/hypr/hyprlock.conf new file mode 100644 index 0000000..03ab2c8 --- /dev/null +++ b/hypr/hyprlock.conf @@ -0,0 +1,125 @@ +#-- General ---------------------------------------------------- +general { + disable_loading_bar = false + hide_cursor = true + grace = 0 + no_fade_in = false + no_fade_out = false + ignore_empty_input = false +} + +#-- Background ------------------------------------------------- +background { + monitor = + path = ~/.config/hypr/wallpapers/lockscreen.png + color = rgba(32, 38, 44, 1.0) + blur_passes = 0 + blur_size = 6 + noise = 0.0115 + contrast = 0.9000 + brightness = 0.8500 + vibrancy = 0.1500 + vibrancy_darkness = 0.0 +} + +#-- Image ------------------------------------------------------ +#image { +# monitor = +# path = ~/.config/hypr/wallpapers/images/pochita.png +# size = 128 +# rounding = -1 +# border_size = 4 +# border_color = rgb(221, 221, 221) +# +# position = 0, 200 +# halign = center +# valign = center +#} + +#-- Input ------------------------------------------------------ +input-field { + monitor = + size = 250, 50 + outline_thickness = 4 + dots_size = 0.35 + dots_spacing = 0.25 + dots_center = false + dots_rounding = -2 + outer_color = rgb(70, 84, 99) + inner_color = rgb(70, 84, 99) + font_color = rgb(241, 252, 249) + fade_on_empty = true + fade_timeout = 1000 + placeholder_text = Enter Password + hide_input = false + rounding = 24 + check_color = rgb(180, 161, 219) + fail_color = rgb(219, 134, 186) + fail_text = $FAIL ($ATTEMPTS) + fail_transition = 300 + capslock_color = -1 + numlock_color = -1 + bothlock_color = -1 + invert_numlock = false + swap_font_color = false + + position = 0, -50 + halign = center + valign = center + + shadow_passes = 3 + shadow_size = 6 + shadow_color = rgb(0, 0, 0) + shadow_boost = 0.50 +} + +#-- Label ------------------------------------------------------ +# +# Time +label { + monitor = + text = $TIME + color = rgb(241, 252, 249) + font_size = 48 + font_family = Iosevka Bold + + position = 0, 300 + halign = center + valign = center + + shadow_passes = 3 + shadow_size = 6 + shadow_color = rgb(0, 0, 0) + shadow_boost = 1.0 +} + +# User +label { + monitor = + text = Hi $USER  + color = rgb(241, 252, 249) + font_size = 24 + font_family = Iosevka + + position = 0, 50 + halign = center + valign = center + + shadow_passes = 3 + shadow_size = 6 + shadow_color = rgb(0, 0, 0) + shadow_boost = 0.50 +} + +# Icon +label { + monitor = + text = + color = rgb(241, 252, 249) + font_size = 64 + font_family = Iosevka + + position = 0, -450 + halign = center + valign = center +} diff --git a/hypr/hyprtheme.conf b/hypr/hyprtheme.conf new file mode 100644 index 0000000..1f80c98 --- /dev/null +++ b/hypr/hyprtheme.conf @@ -0,0 +1,26 @@ +# Copyright (C) 2020-2024 Aditya Shakya +# +# Theme Elements & Colors for Hyprland. + +# Elements +$hypr_border_size = 2 +$hypr_gaps_in = 5 +$hypr_gaps_out = 10 +$hypr_gaps_ws = -10 +$hypr_rounding = 0 +$groupbar_font_family = Iosevka +$groupbar_font_size = 10 + +# Colors +$gradient_angle = 45deg +$active_border_col_1 = 0xFF5B7C83 +$active_border_col_2 = 0xFF50696F +$inactive_border_col_1 = 0xFF18232c +$inactive_border_col_2 = 0xFF21303d +$active_shadow_col = 0x66000000 +$inactive_shadow_col = 0x66000000 +$group_border_active_col = 0xFF9D632C +$group_border_inactive_col = 0xFFF59E0A +$group_border_locked_active_col = 0xFF50696F +$group_border_locked_inactive_col = 0xFF5B7C83 +$groupbar_text_color = 0xFFc0cbcb diff --git a/hypr/mako/config b/hypr/mako/config new file mode 100644 index 0000000..c0028b1 --- /dev/null +++ b/hypr/mako/config @@ -0,0 +1,55 @@ +## Copyright (C) 2020-2024 Aditya Shakya +## +## Mako configuration file + +# GLOBAL CONFIGURATION OPTIONS +max-history=100 +sort=-time + +# BINDING OPTIONS +on-button-left=dismiss +on-button-middle=none +on-button-right=dismiss-all +on-touch=dismiss +# Annoying sounds on notifications +# on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga + +# STYLE OPTIONS +font=JetBrains Mono 10 +width=300 +height=100 +margin=10 +padding=15 +border-size=2 +border-radius=0 +icons=1 +max-icon-size=48 +icon-location=left +markup=1 +actions=1 +history=1 +text-alignment=left +default-timeout=5000 +ignore-timeout=0 +max-visible=5 +layer=overlay +anchor=top-right + +# Mako_Colors +background-color=#0F161C +text-color=#c0cbcb +border-color=#18232c +progress-color=over #5B7C83 + +[urgency=low] +border-color=#18232c +default-timeout=2000 + +[urgency=normal] +border-color=#18232c +default-timeout=5000 + +[urgency=high] +border-color=#50696F +text-color=#50696F +default-timeout=0 diff --git a/hypr/mako/icons/brightness-100.png b/hypr/mako/icons/brightness-100.png new file mode 100644 index 0000000..6656c80 Binary files /dev/null and b/hypr/mako/icons/brightness-100.png differ diff --git a/hypr/mako/icons/brightness-20.png b/hypr/mako/icons/brightness-20.png new file mode 100644 index 0000000..4907992 Binary files /dev/null and b/hypr/mako/icons/brightness-20.png differ diff --git a/hypr/mako/icons/brightness-40.png b/hypr/mako/icons/brightness-40.png new file mode 100644 index 0000000..41b0584 Binary files /dev/null and b/hypr/mako/icons/brightness-40.png differ diff --git a/hypr/mako/icons/brightness-60.png b/hypr/mako/icons/brightness-60.png new file mode 100644 index 0000000..66596fa Binary files /dev/null and b/hypr/mako/icons/brightness-60.png differ diff --git a/hypr/mako/icons/brightness-80.png b/hypr/mako/icons/brightness-80.png new file mode 100644 index 0000000..4952211 Binary files /dev/null and b/hypr/mako/icons/brightness-80.png differ diff --git a/hypr/mako/icons/dropper.png b/hypr/mako/icons/dropper.png new file mode 100644 index 0000000..a2c0288 Binary files /dev/null and b/hypr/mako/icons/dropper.png differ diff --git a/hypr/mako/icons/microphone-mute.png b/hypr/mako/icons/microphone-mute.png new file mode 100644 index 0000000..1780e33 Binary files /dev/null and b/hypr/mako/icons/microphone-mute.png differ diff --git a/hypr/mako/icons/microphone.png b/hypr/mako/icons/microphone.png new file mode 100644 index 0000000..d1b6d76 Binary files /dev/null and b/hypr/mako/icons/microphone.png differ diff --git a/hypr/mako/icons/music.png b/hypr/mako/icons/music.png new file mode 100644 index 0000000..648bcdc Binary files /dev/null and b/hypr/mako/icons/music.png differ diff --git a/hypr/mako/icons/palette.png b/hypr/mako/icons/palette.png new file mode 100644 index 0000000..0e65534 Binary files /dev/null and b/hypr/mako/icons/palette.png differ diff --git a/hypr/mako/icons/picture.png b/hypr/mako/icons/picture.png new file mode 100644 index 0000000..233d9db Binary files /dev/null and b/hypr/mako/icons/picture.png differ diff --git a/hypr/mako/icons/timer.png b/hypr/mako/icons/timer.png new file mode 100644 index 0000000..f37ae53 Binary files /dev/null and b/hypr/mako/icons/timer.png differ diff --git a/hypr/mako/icons/volume-high.png b/hypr/mako/icons/volume-high.png new file mode 100644 index 0000000..26f83cb Binary files /dev/null and b/hypr/mako/icons/volume-high.png differ diff --git a/hypr/mako/icons/volume-low.png b/hypr/mako/icons/volume-low.png new file mode 100644 index 0000000..2a81d5e Binary files /dev/null and b/hypr/mako/icons/volume-low.png differ diff --git a/hypr/mako/icons/volume-mid.png b/hypr/mako/icons/volume-mid.png new file mode 100644 index 0000000..01790b8 Binary files /dev/null and b/hypr/mako/icons/volume-mid.png differ diff --git a/hypr/mako/icons/volume-mute.png b/hypr/mako/icons/volume-mute.png new file mode 100644 index 0000000..a5d32e0 Binary files /dev/null and b/hypr/mako/icons/volume-mute.png differ diff --git a/hypr/rofi/askpass.rasi b/hypr/rofi/askpass.rasi new file mode 100644 index 0000000..c3c2ab2 --- /dev/null +++ b/hypr/rofi/askpass.rasi @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/*****----- Main Window -----*****/ +window { + location: center; + anchor: center; + fullscreen: false; + width: 350px; + x-offset: 0px; + y-offset: 0px; + margin: 0px; + padding: 30px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + background-color: @background; + cursor: "default"; + children: [ "inputbar", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 0px; + border: 0px; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt", "entry" ]; +} + +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 10px 12px; + border-radius: 0px; +/* background-image: linear-gradient(to right, #E06B74, #C778DD); */ + background-color: var(urgent); + text-color: @background; +} +prompt { + enabled: true; + padding: 10px 12px; + border-radius: 0px; +/* background-image: linear-gradient(to right, #E06B74, #C778DD); */ + background-color: var(active); + text-color: @background; +} +entry { + enabled: true; + padding: 10px 12px; + border: 0px 0px 0px 0px; + border-radius: 0px; + border-color: @selected; + background-color: @background-alt; + text-color: inherit; + cursor: text; + placeholder: "Password"; + placeholder-color: inherit; +} + +/*****----- Listview -----*****/ +listview { + enabled: false; +} + diff --git a/hypr/rofi/asroot.rasi b/hypr/rofi/asroot.rasi new file mode 100644 index 0000000..2fa00e0 --- /dev/null +++ b/hypr/rofi/asroot.rasi @@ -0,0 +1,148 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + show-icons: false; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/* +USE_ICON=YES +*/ + +/*****----- Main Window -----*****/ +window { + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 440px; + x-offset: 0px; + y-offset: 0px; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "message", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + padding: 0px; + border: 0px; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt"]; +} + +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 10px 12px; + border-radius: 0px; + background-color: var(urgent); + text-color: @background; +} +prompt { + enabled: true; + padding: 10px; + border-radius: 0px; + background-color: var(active); + text-color: @background; +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 10px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: inherit; + text-color: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 6; + lines: 1; + cycle: true; + scrollbar: false; + layout: vertical; + + spacing: 10px; + background-color: transparent; + cursor: "default"; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + padding: 15px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element-text { + font: "feather 20"; + background-color: transparent; + text-color: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.5; +} + +element normal.normal, +element alternate.normal { + background-color: var(background-alt); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} diff --git a/hypr/rofi/bluetooth.rasi b/hypr/rofi/bluetooth.rasi new file mode 100644 index 0000000..4d99e1e --- /dev/null +++ b/hypr/rofi/bluetooth.rasi @@ -0,0 +1,205 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + modi: "drun,run,filebrowser"; + show-icons: false; + display-drun: ""; + display-run: ""; + display-filebrowser: ""; + drun-display-format: "{name}"; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/*****----- Main Window -----*****/ +window { + /* properties for window widget */ + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 500px; + x-offset: 0px; + y-offset: 0px; + + /* properties for all widgets */ + enabled: true; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 0px; + border-radius: 0px; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt" ]; +} + +prompt { + enabled: true; + padding: 8px; + border-radius: 0px; + background-color: var(active); + text-color: @background; +} +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 8px 11px; + border-radius: 0px; + background-color: var(urgent); + text-color: @background; +} +entry { + enabled: true; + padding: 8px 0px; + background-color: inherit; + text-color: inherit; + cursor: text; + placeholder: ""; + placeholder-color: inherit; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 1; + lines: 7; + cycle: true; + dynamic: true; + scrollbar: false; + layout: vertical; + reverse: false; + fixed-height: true; + fixed-columns: true; + + spacing: 5px; + background-color: transparent; + text-color: @foreground; + cursor: "default"; +} +scrollbar { + handle-width: 5px ; + handle-color: @selected; + border-radius: 10px; + background-color: @background-alt; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 8px; + border-radius: 0px; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element normal.normal, +element alternate.normal { + background-color: var(background); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} +element-icon { + background-color: transparent; + text-color: inherit; + size: 24px; + cursor: inherit; +} +element-text { + background-color: transparent; + text-color: inherit; + highlight: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Mode Switcher -----*****/ +mode-switcher{ + enabled: true; + spacing: 10px; + margin: 0px; + padding: 0px; + background-color: transparent; + text-color: @foreground; +} +button { + padding: 8px 12px; + border-radius: 12px; + background-color: @background-alt; + text-color: inherit; + cursor: pointer; +} +button selected { + background-image: linear-gradient(to right, #E06B74, #C778DD); + text-color: var(background); +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 8px 12px; + border-radius: 12px; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: transparent; + text-color: @foreground; + vertical-align: 0.5; + horizontal-align: 0.0; + highlight: none; + placeholder-color: @foreground; + blink: true; + markup: true; +} +error-message { + padding: 30px; + background-color: @background; + text-color: @foreground; +} diff --git a/hypr/rofi/confirm.rasi b/hypr/rofi/confirm.rasi new file mode 100644 index 0000000..5daacd0 --- /dev/null +++ b/hypr/rofi/confirm.rasi @@ -0,0 +1,148 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + show-icons: false; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/* +USE_ICON=YES +*/ + +/*****----- Main Window -----*****/ +window { + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 300px; + x-offset: 0px; + y-offset: 0px; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "message", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + padding: 0px; + border: 0px; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt"]; +} + +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 10px 14px; + border-radius: 0px; + background-color: var(urgent); + text-color: @background; +} +prompt { + enabled: true; + padding: 10px; + border-radius: 0px; + background-color: var(active); + text-color: @background; +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 10px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: inherit; + text-color: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 6; + lines: 1; + cycle: true; + scrollbar: false; + layout: vertical; + + spacing: 10px; + background-color: transparent; + cursor: "default"; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + padding: 2px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element-text { + font: "feather 20"; + background-color: transparent; + text-color: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.5; +} + +element normal.normal, +element alternate.normal { + background-color: var(background-alt); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} diff --git a/hypr/rofi/launcher.rasi b/hypr/rofi/launcher.rasi new file mode 100644 index 0000000..45049b8 --- /dev/null +++ b/hypr/rofi/launcher.rasi @@ -0,0 +1,202 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + modi: "drun,run,filebrowser"; + show-icons: true; + display-drun: ""; + display-run: ""; + display-filebrowser: ""; + drun-display-format: "{name}"; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/*****----- Main Window -----*****/ +window { + /* properties for window widget */ + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 800px; + x-offset: 0px; + y-offset: 0px; + + /* properties for all widgets */ + enabled: true; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "message", "listview", "mode-switcher" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 10px; + border-radius: 0px; + background-color: @background-alt; + text-color: @foreground; + children: [ "textbox-prompt-colon", "entry" ]; +} + +prompt { + enabled: true; + background-color: inherit; + text-color: inherit; +} +textbox-prompt-colon { + enabled: true; + padding: 0px; + expand: false; + str: ""; + background-color: inherit; + text-color: inherit; +} +entry { + enabled: true; + padding: 0px; + background-color: inherit; + text-color: inherit; + cursor: text; + placeholder: "Search..."; + placeholder-color: inherit; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 2; + lines: 7; + cycle: true; + dynamic: true; + scrollbar: false; + layout: vertical; + reverse: false; + fixed-height: true; + fixed-columns: true; + + spacing: 5px; + background-color: transparent; + text-color: @foreground; + cursor: "default"; +} +scrollbar { + handle-width: 5px ; + handle-color: @selected; + border-radius: 10px; + background-color: @background-alt; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 6px; + border-radius: 0px; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element normal.normal, +element alternate.normal { + background-color: var(background); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} +element-icon { + background-color: transparent; + text-color: inherit; + size: 24px; + cursor: inherit; +} +element-text { + background-color: transparent; + text-color: inherit; + highlight: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Mode Switcher -----*****/ +mode-switcher{ + enabled: true; + spacing: 10px; + margin: 0px; + padding: 0px 250px; + background-color: transparent; + text-color: @foreground; +} +button { + padding: 10px; + border-radius: 0px; + background-color: @background-alt; + text-color: inherit; + cursor: pointer; +} +button selected { + background-color: var(urgent); + text-color: var(background); +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 10px; + border-radius: 0px; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: transparent; + text-color: @foreground; + vertical-align: 0.5; + horizontal-align: 0.0; + highlight: none; + placeholder-color: @foreground; + blink: true; + markup: true; +} +error-message { + padding: 30px; + background-color: @background; + text-color: @foreground; +} diff --git a/hypr/rofi/music.rasi b/hypr/rofi/music.rasi new file mode 100644 index 0000000..fe8a54c --- /dev/null +++ b/hypr/rofi/music.rasi @@ -0,0 +1,148 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + show-icons: false; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/* +USE_ICON=YES +*/ + +/*****----- Main Window -----*****/ +window { + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 510px; + x-offset: 0px; + y-offset: 0px; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "message", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + padding: 0px; + border: 0px; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt"]; +} + +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 10px 14px; + border-radius: 0px; + background-color: var(urgent); + text-color: @background; +} +prompt { + enabled: true; + padding: 10px; + border-radius: 0px; + background-color: var(active); + text-color: @background; +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 10px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: inherit; + text-color: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 6; + lines: 1; + cycle: true; + scrollbar: false; + layout: vertical; + + spacing: 10px; + background-color: transparent; + cursor: "default"; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + padding: 15px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element-text { + font: "feather 20"; + background-color: transparent; + text-color: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.5; +} + +element normal.normal, +element alternate.normal { + background-color: var(background-alt); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} diff --git a/hypr/rofi/networkmenu.rasi b/hypr/rofi/networkmenu.rasi new file mode 100644 index 0000000..57189d7 --- /dev/null +++ b/hypr/rofi/networkmenu.rasi @@ -0,0 +1,206 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + modi: "drun,run,filebrowser"; + show-icons: false; + display-drun: ""; + display-run: ""; + display-filebrowser: ""; + drun-display-format: "{name}"; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/*****----- Main Window -----*****/ +window { + /* properties for window widget */ + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 500px; + height: 495px; + x-offset: 0px; + y-offset: 0px; + + /* properties for all widgets */ + enabled: true; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 0px; + border-radius: 0px; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt", "entry" ]; +} + +prompt { + enabled: true; + padding: 8px; + border-radius: 0px; + background-color: var(active); + text-color: @background; +} +textbox-prompt-colon { + enabled: true; + expand: false; + str: "直"; + padding: 8px 11px; + border-radius: 0px; + background-color: var(urgent); + text-color: @background; +} +entry { + enabled: true; + padding: 8px 0px; + background-color: inherit; + text-color: inherit; + cursor: text; + placeholder: ""; + placeholder-color: inherit; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 1; + lines: 8; + cycle: true; + dynamic: true; + scrollbar: false; + layout: vertical; + reverse: false; + fixed-height: true; + fixed-columns: true; + + spacing: 5px; + background-color: transparent; + text-color: @foreground; + cursor: "default"; +} +scrollbar { + handle-width: 5px ; + handle-color: @selected; + border-radius: 10px; + background-color: @background-alt; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 8px; + border-radius: 0px; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element normal.normal, +element alternate.normal { + background-color: var(background); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} +element-icon { + background-color: transparent; + text-color: inherit; + size: 24px; + cursor: inherit; +} +element-text { + background-color: transparent; + text-color: inherit; + highlight: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Mode Switcher -----*****/ +mode-switcher{ + enabled: true; + spacing: 10px; + margin: 0px; + padding: 0px; + background-color: transparent; + text-color: @foreground; +} +button { + padding: 8px 12px; + border-radius: 12px; + background-color: @background-alt; + text-color: inherit; + cursor: pointer; +} +button selected { + background-image: linear-gradient(to right, #E06B74, #C778DD); + text-color: var(background); +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 8px 12px; + border-radius: 12px; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: transparent; + text-color: @foreground; + vertical-align: 0.5; + horizontal-align: 0.0; + highlight: none; + placeholder-color: @foreground; + blink: true; + markup: true; +} +error-message { + padding: 30px; + background-color: @background; + text-color: @foreground; +} diff --git a/hypr/rofi/networkmenu_config.ini b/hypr/rofi/networkmenu_config.ini new file mode 100644 index 0000000..f28c112 --- /dev/null +++ b/hypr/rofi/networkmenu_config.ini @@ -0,0 +1,30 @@ +## Copyright (C) 2020-2024 Aditya Shakya + +[dmenu] +dmenu_command = rofi -dmenu -theme ~/.config/hypr/rofi/networkmenu.rasi +# # Note that dmenu_command can contain arguments as well like `rofi -width 30` +# # Rofi and dmenu are set to case insensitive by default `-i` +# l = number of lines to display, defaults to number of total network options +# fn = font string +# nb = normal background (name, #RGB, or #RRGGBB) +# nf = normal foreground +# sb = selected background +# sf = selected foreground +# b = (just set to empty value and menu will appear at the bottom +# m = number of monitor to display on +# p = Custom Prompt for the networks menu +# pinentry = Pinentry command +# rofi_highlight = # (Default: False) use rofi highlighting instead of '**' + +# # override normal foreground and background colors (dmenu) or use the +# # -password option (rofi) to obscure passphrase entry +# [dmenu_passphrase] +# nf = #222222 +# nb = #222222 +# rofi_obscure = True + +[editor] +terminal = alacritty +gui_if_available = True +# terminal = +# gui_if_available = diff --git a/hypr/rofi/powermenu.rasi b/hypr/rofi/powermenu.rasi new file mode 100644 index 0000000..3b0d167 --- /dev/null +++ b/hypr/rofi/powermenu.rasi @@ -0,0 +1,148 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + show-icons: false; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/* +USE_ICON=YES +*/ + +/*****----- Main Window -----*****/ +window { + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 510px; + x-offset: 0px; + y-offset: 0px; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "message", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + padding: 0px; + border: 0px; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt"]; +} + +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 10px 14px; + border-radius: 0px; + background-color: var(urgent); + text-color: @background; +} +prompt { + enabled: true; + padding: 10px; + border-radius: 0px; + background-color: var(active); + text-color: @background; +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 10px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: inherit; + text-color: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 6; + lines: 1; + cycle: true; + scrollbar: false; + layout: vertical; + + spacing: 10px; + background-color: transparent; + cursor: "default"; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + padding: 15px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element-text { + font: "feather 20"; + background-color: transparent; + text-color: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.5; +} + +element normal.normal, +element alternate.normal { + background-color: var(background-alt); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} diff --git a/hypr/rofi/runner.rasi b/hypr/rofi/runner.rasi new file mode 100644 index 0000000..7975343 --- /dev/null +++ b/hypr/rofi/runner.rasi @@ -0,0 +1,202 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + modi: "run"; + show-icons: true; + display-drun: ""; + display-run: ""; + display-filebrowser: ""; + drun-display-format: "{name}"; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/*****----- Main Window -----*****/ +window { + /* properties for window widget */ + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 600px; + x-offset: 0px; + y-offset: 0px; + + /* properties for all widgets */ + enabled: true; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 10px; + border-radius: 0px; + background-color: @background-alt; + text-color: @foreground; + children: [ "textbox-prompt-colon", "entry" ]; +} + +prompt { + enabled: true; + background-color: inherit; + text-color: inherit; +} +textbox-prompt-colon { + enabled: true; + padding: 0px; + expand: false; + str: ""; + background-color: inherit; + text-color: inherit; +} +entry { + enabled: true; + padding: 0px; + background-color: inherit; + text-color: inherit; + cursor: text; + placeholder: "Run..."; + placeholder-color: inherit; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 2; + lines: 6; + cycle: true; + dynamic: true; + scrollbar: false; + layout: vertical; + reverse: false; + fixed-height: true; + fixed-columns: true; + + spacing: 5px; + background-color: transparent; + text-color: @foreground; + cursor: "default"; +} +scrollbar { + handle-width: 5px ; + handle-color: @selected; + border-radius: 10px; + background-color: @background-alt; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 6px; + border-radius: 0px; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element normal.normal, +element alternate.normal { + background-color: var(background); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} +element-icon { + background-color: transparent; + text-color: inherit; + size: 24px; + cursor: inherit; +} +element-text { + background-color: transparent; + text-color: inherit; + highlight: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Mode Switcher -----*****/ +mode-switcher{ + enabled: true; + spacing: 10px; + margin: 0px; + padding: 0px 250px; + background-color: transparent; + text-color: @foreground; +} +button { + padding: 10px; + border-radius: 0px; + background-color: @background-alt; + text-color: inherit; + cursor: pointer; +} +button selected { + background-color: var(urgent); + text-color: var(background); +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 10px; + border-radius: 0px; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: transparent; + text-color: @foreground; + vertical-align: 0.5; + horizontal-align: 0.0; + highlight: none; + placeholder-color: @foreground; + blink: true; + markup: true; +} +error-message { + padding: 30px; + background-color: @background; + text-color: @foreground; +} diff --git a/hypr/rofi/screenshot.rasi b/hypr/rofi/screenshot.rasi new file mode 100644 index 0000000..1032f15 --- /dev/null +++ b/hypr/rofi/screenshot.rasi @@ -0,0 +1,148 @@ +/** + * Copyright (C) 2020-2024 Aditya Shakya + **/ + +/*****----- Configuration -----*****/ +configuration { + show-icons: false; +} + +/*****----- Global Properties -----*****/ +@import "shared/colors.rasi" +@import "shared/fonts.rasi" + +/* +USE_ICON=YES +*/ + +/*****----- Main Window -----*****/ +window { + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 440px; + x-offset: 0px; + y-offset: 0px; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 0px; + border-color: @background-alt; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 10px; + margin: 0px; + padding: 30px; + background-color: transparent; + children: [ "inputbar", "message", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + padding: 0px; + border: 0px; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + children: [ "textbox-prompt-colon", "prompt"]; +} + +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 10px 12px; + border-radius: 0px; + background-color: var(urgent); + text-color: @background; +} +prompt { + enabled: true; + padding: 10px; + border-radius: 0px; + background-color: var(active); + text-color: @background; +} + +/*****----- Message -----*****/ +message { + enabled: true; + margin: 0px; + padding: 10px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: @background-alt; + text-color: @foreground; +} +textbox { + background-color: inherit; + text-color: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 6; + lines: 1; + cycle: true; + scrollbar: false; + layout: vertical; + + spacing: 10px; + background-color: transparent; + cursor: "default"; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + padding: 15px; + border: 0px solid; + border-radius: 0px; + border-color: @selected; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element-text { + font: "feather 20"; + background-color: transparent; + text-color: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.5; +} + +element normal.normal, +element alternate.normal { + background-color: var(background-alt); + text-color: var(foreground); +} +element normal.urgent, +element alternate.urgent, +element selected.active { + background-color: var(urgent); + text-color: var(background); +} +element normal.active, +element alternate.active, +element selected.urgent { + background-color: var(active); + text-color: var(background); +} +element selected.normal { + background-color: var(selected); + text-color: var(background); +} diff --git a/hypr/rofi/shared/colors.rasi b/hypr/rofi/shared/colors.rasi new file mode 100644 index 0000000..736c010 --- /dev/null +++ b/hypr/rofi/shared/colors.rasi @@ -0,0 +1,8 @@ +* { + background: #0F161C; + background-alt: #18232c; + foreground: #c0cbcb; + selected: #5B7C83; + active: #9D632C; + urgent: #50696F; +} diff --git a/hypr/rofi/shared/fonts.rasi b/hypr/rofi/shared/fonts.rasi new file mode 100644 index 0000000..e4f0510 --- /dev/null +++ b/hypr/rofi/shared/fonts.rasi @@ -0,0 +1,7 @@ +/* Copyright (C) 2020-2024 Aditya Shakya */ + +/* Text Font */ + +* { + font: "Iosevka Nerd Font 10"; +} diff --git a/hypr/scripts/alacritty b/hypr/scripts/alacritty new file mode 100755 index 0000000..41101f7 --- /dev/null +++ b/hypr/scripts/alacritty @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## launch alacritty with alt config + +CONFIG="$HOME/.config/hypr/alacritty/alacritty.toml" + +if [ "$1" == "-f" ]; then + shift 1 + alacritty --class 'alacritty-float,alacritty-float' --config-file "$CONFIG" $@ +elif [ "$1" == "-F" ]; then + shift 1 + alacritty --class 'alacritty-fullscreen,alacritty-fullscreen' --config-file "$CONFIG" \ + -o window.startup_mode="'Fullscreen'" \ + window.padding.x=30 window.padding.y=30 \ + window.opacity=0.95 font.size=14 $@ +else + alacritty --config-file "$CONFIG" $@ +fi diff --git a/hypr/scripts/asroot b/hypr/scripts/asroot new file mode 100755 index 0000000..3a10a82 --- /dev/null +++ b/hypr/scripts/asroot @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# hypr directory +DIR="$HOME/.config/hypr" + +# rofi sudo askpass helper +export SUDO_ASKPASS="$DIR"/scripts/rofi_askpass + +# execute the application +sudo -E -A $1 diff --git a/hypr/scripts/brightness b/hypr/scripts/brightness new file mode 100755 index 0000000..e3fdae5 --- /dev/null +++ b/hypr/scripts/brightness @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Script To Manage Brightness For Archcraft (in Wayland). + +iDIR="$HOME/.config/hypr/mako/icons" + +# Get brightness +get_backlight() { + LIGHT=$(printf "%.0f\n" `light -G`) + echo "${LIGHT}%" +} + +# Get icons +get_icon() { + backlight="$(get_backlight)" + current="${backlight%%%}" + if [[ ("$current" -ge "0") && ("$current" -le "20") ]]; then + icon="$iDIR"/brightness-20.png + elif [[ ("$current" -ge "20") && ("$current" -le "40") ]]; then + icon="$iDIR"/brightness-40.png + elif [[ ("$current" -ge "40") && ("$current" -le "60") ]]; then + icon="$iDIR"/brightness-60.png + elif [[ ("$current" -ge "60") && ("$current" -le "80") ]]; then + icon="$iDIR"/brightness-80.png + elif [[ ("$current" -ge "80") && ("$current" -le "100") ]]; then + icon="$iDIR"/brightness-100.png + fi +} + +# Notify +notify_user() { + notify-send -h string:x-canonical-private-synchronous:sys-notify-backlight -u low -i "$icon" "Brightness : $(get_backlight)" +} + +# Increase brightness +inc_backlight() { + light -A 5 && get_icon && notify_user +} + +# Decrease brightness +dec_backlight() { + light -U 5 && get_icon && notify_user +} + +# Execute accordingly +if [[ "$1" == "--get" ]]; then + get_backlight +elif [[ "$1" == "--inc" ]]; then + inc_backlight +elif [[ "$1" == "--dec" ]]; then + dec_backlight +else + get_backlight +fi diff --git a/hypr/scripts/colorpicker b/hypr/scripts/colorpicker new file mode 100755 index 0000000..d6c462d --- /dev/null +++ b/hypr/scripts/colorpicker @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Simple Script To Pick Color Quickly. + +#color=$(grim -g "`slurp -b 00000000 -p`" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4) +color=`$HOME/.config/hypr/scripts/hyprpicker` +image=/tmp/${color}.png + +main() { + if [[ "$color" ]]; then + # copy color code to clipboard + echo $color | tr -d "\n" | wl-copy + # generate preview + convert -size 48x48 xc:"$color" ${image} + # notify about it + notify-send -h string:x-canonical-private-synchronous:sys-notify-picker -u low -i ${image} "$color, copied to clipboard." + fi +} + +# Run the script +main diff --git a/hypr/scripts/foot b/hypr/scripts/foot new file mode 100755 index 0000000..a17a1c6 --- /dev/null +++ b/hypr/scripts/foot @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## launch terminal with alt config + +# Get Colors +DIR="$HOME/.config/hypr" +background="`cat $DIR/rofi/shared/colors.rasi | grep 'background:' | cut -d':' -f2 | tr -d ' '\;`" +accent="`cat $DIR/rofi/shared/colors.rasi | grep 'selected:' | cut -d':' -f2 | tr -d ' '\;`" + +CONFIG="$HOME/.config/hypr/foot/foot.ini" + +if [ "$1" == "-f" ]; then + foot --app-id='foot-float' --config="$CONFIG" +elif [ "$1" == "-F" ]; then + foot --fullscreen --app-id='foot-full' --font="Iosevka Nerd Font:size=14" --override=pad=35x35 --config="$CONFIG" +elif [ "$1" == "-s" ]; then + foot --app-id='foot-float' --config="$CONFIG" \ + --window-size-pixels=$(slurp -b ${background:1}CC -c ${accent:1}ff -s ${accent:1}0D -w 2 -f "%wx%h") +else + foot --config="$CONFIG" +fi diff --git a/hypr/scripts/gtkthemes b/hypr/scripts/gtkthemes new file mode 100755 index 0000000..b1bf5db --- /dev/null +++ b/hypr/scripts/gtkthemes @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Set GTK Themes, Icons, Cursor and Fonts + +THEME='Manhattan' +ICONS='Luv-Folders-Dark' +FONT='Noto Sans 9' +CURSOR='Qogirr-Dark' + +SCHEMA='gsettings set org.gnome.desktop.interface' + +apply_themes () { + ${SCHEMA} gtk-theme "$THEME" + ${SCHEMA} icon-theme "$ICONS" + ${SCHEMA} cursor-theme "$CURSOR" + ${SCHEMA} font-name "$FONT" +} + +apply_themes diff --git a/hypr/scripts/hyprpicker b/hypr/scripts/hyprpicker new file mode 100755 index 0000000..5df6ebc Binary files /dev/null and b/hypr/scripts/hyprpicker differ diff --git a/hypr/scripts/lockscreen b/hypr/scripts/lockscreen new file mode 100755 index 0000000..9b4a7c4 --- /dev/null +++ b/hypr/scripts/lockscreen @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya + +# Source Theme file +DIR="$HOME/.config/hypr" +source "$DIR"/theme/current.bash + +# Colors +bg=${background:1} fg=${foreground:1} +red=${color1:1} green=${color2:1} yellow=${color3:1} +blue=${color4:1} magenta=${color5:1} cyan=${color6:1} +alpha='00000000' + +# CMD +swaylock -f \ + \ + `# General` \ + --ignore-empty-password \ + --show-failed-attempts \ + --hide-keyboard-layout \ + --indicator-caps-lock \ + \ + `# Appearance` \ + --color ${bg}E6 \ + --font 'JetBrainsMono Nerd Font' --font-size 18 \ + \ + `# Backspace Key` \ + --key-hl-color ${green} \ + --caps-lock-key-hl-color ${blue} \ + --bs-hl-color ${red} \ + --caps-lock-bs-hl-color ${red} \ + \ + `# Indicator` \ + --indicator-radius 120 \ + --indicator-thickness 10 \ + \ + `# Inside Circle Colors` \ + --inside-color ${alpha} \ + --inside-clear-color ${alpha} \ + --inside-caps-lock-color ${alpha} \ + --inside-ver-color ${blue} \ + --inside-wrong-color ${red} \ + \ + `# Layout Colors` \ + --layout-bg-color ${cyan} \ + --layout-border-color ${cyan} \ + --layout-text-color ${bg} \ + \ + `# Line Colors` \ + --line-color ${bg} \ + --line-clear-color ${red} \ + --line-caps-lock-color ${bg} \ + --line-ver-color ${bg} \ + --line-wrong-color ${bg} \ + \ + `# Ring Colors` \ + --ring-color ${cyan} \ + --ring-clear-color ${bg} \ + --ring-caps-lock-color ${magenta} \ + --ring-ver-color ${blue} \ + --ring-wrong-color ${red} \ + \ + `# Separator Color` \ + --separator-color ${bg} \ + \ + `# Text Colors` \ + --text-color ${fg} \ + --text-clear-color ${fg} \ + --text-caps-lock-color ${fg} \ + --text-ver-color ${bg} \ + --text-wrong-color ${bg} diff --git a/hypr/scripts/notifications b/hypr/scripts/notifications new file mode 100755 index 0000000..2daa47b --- /dev/null +++ b/hypr/scripts/notifications @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## launch mako with alt config + +CONFIG="$HOME/.config/hypr/mako/config" + +if [[ ! `pidof mako` ]]; then + mako --config ${CONFIG} +fi diff --git a/hypr/scripts/rofi_askpass b/hypr/scripts/rofi_askpass new file mode 100755 index 0000000..be89150 --- /dev/null +++ b/hypr/scripts/rofi_askpass @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/askpass.rasi" + +# Rofi text dialog to get password +rofi -dmenu \ + -password \ + -i \ + -p "Root" \ + -theme ${RASI} diff --git a/hypr/scripts/rofi_asroot b/hypr/scripts/rofi_asroot new file mode 100755 index 0000000..5a91cc7 --- /dev/null +++ b/hypr/scripts/rofi_asroot @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/asroot.rasi" +ASROOT="$DIR/scripts/asroot" +USER=`whoami` + +# Theme Elements +prompt='Root' +mesg="Run Applications As Root" +term="alacritty --class alacritty-float,alacritty-float --config-file /home/$USER/.config/hypr/alacritty/alacritty.toml" + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + option_1=" Alacritty" + option_2=" Thunar" + option_3=" Geany" + option_4=" Ranger" + option_5=" Vim" +else + option_1="" + option_2="" + option_3="" + option_4="" + option_5="" +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5" | rofi_cmd +} + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + ${ASROOT} "$term" + elif [[ "$1" == '--opt2' ]]; then + ${ASROOT} 'dbus-run-session thunar' + elif [[ "$1" == '--opt3' ]]; then + ${ASROOT} geany + elif [[ "$1" == '--opt4' ]]; then + ${ASROOT} "$term -e ranger" + elif [[ "$1" == '--opt5' ]]; then + ${ASROOT} "$term -e vim" + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; +esac diff --git a/hypr/scripts/rofi_bluetooth b/hypr/scripts/rofi_bluetooth new file mode 100755 index 0000000..23fe42e --- /dev/null +++ b/hypr/scripts/rofi_bluetooth @@ -0,0 +1,321 @@ +#!/usr/bin/env bash +# __ _ _ _ _ _ _ +# _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__ +# | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \ +# | | | (_) | _| |_____| |_) | | |_| | __/ || (_) | (_) | |_| | | | +# |_| \___/|_| |_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__|_| |_| +# +# Author: Nick Clyde (clydedroid) +# +# A script that generates a rofi menu that uses bluetoothctl to +# connect to bluetooth devices and display status info. +# +# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu) +# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl) +# +# Depends on: +# Arch repositories: rofi, bluez-utils (contains bluetoothctl) + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/bluetooth.rasi" + +# Constants +divider="---------" +goback="Back" + +# Checks if bluetooth controller is powered on +power_on() { + if bluetoothctl show | grep -q "Powered: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles power state +toggle_power() { + if power_on; then + bluetoothctl power off + show_menu + else + if rfkill list bluetooth | grep -q 'blocked: yes'; then + rfkill unblock bluetooth && sleep 3 + fi + bluetoothctl power on + show_menu + fi +} + +# Checks if controller is scanning for new devices +scan_on() { + if bluetoothctl show | grep -q "Discovering: yes"; then + echo "Scan: on" + return 0 + else + echo "Scan: off" + return 1 + fi +} + +# Toggles scanning state +toggle_scan() { + if scan_on; then + kill $(pgrep -f "bluetoothctl scan on") + bluetoothctl scan off + show_menu + else + bluetoothctl scan on & + echo "Scanning..." + sleep 5 + show_menu + fi +} + +# Checks if controller is able to pair to devices +pairable_on() { + if bluetoothctl show | grep -q "Pairable: yes"; then + echo "Pairable: on" + return 0 + else + echo "Pairable: off" + return 1 + fi +} + +# Toggles pairable state +toggle_pairable() { + if pairable_on; then + bluetoothctl pairable off + show_menu + else + bluetoothctl pairable on + show_menu + fi +} + +# Checks if controller is discoverable by other devices +discoverable_on() { + if bluetoothctl show | grep -q "Discoverable: yes"; then + echo "Discoverable: on" + return 0 + else + echo "Discoverable: off" + return 1 + fi +} + +# Toggles discoverable state +toggle_discoverable() { + if discoverable_on; then + bluetoothctl discoverable off + show_menu + else + bluetoothctl discoverable on + show_menu + fi +} + +# Checks if a device is connected +device_connected() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -q "Connected: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles device connection +toggle_connection() { + if device_connected "$1"; then + bluetoothctl disconnect "$1" + device_menu "$device" + else + bluetoothctl connect "$1" + device_menu "$device" + fi +} + +# Checks if a device is paired +device_paired() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -q "Paired: yes"; then + echo "Paired: yes" + return 0 + else + echo "Paired: no" + return 1 + fi +} + +# Toggles device paired state +toggle_paired() { + if device_paired "$1"; then + bluetoothctl remove "$1" + device_menu "$device" + else + bluetoothctl pair "$1" + device_menu "$device" + fi +} + +# Checks if a device is trusted +device_trusted() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -q "Trusted: yes"; then + echo "Trusted: yes" + return 0 + else + echo "Trusted: no" + return 1 + fi +} + +# Toggles device connection +toggle_trust() { + if device_trusted "$1"; then + bluetoothctl untrust "$1" + device_menu "$device" + else + bluetoothctl trust "$1" + device_menu "$device" + fi +} + +# Prints a short string with the current bluetooth status +# Useful for status bars like polybar, etc. +print_status() { + if power_on; then + printf '󰂯' + + paired_devices_cmd="devices Paired" + # Check if an outdated version of bluetoothctl is used to preserve backwards compatibility + if (( $(echo "$(bluetoothctl version | cut -d ' ' -f 2) < 5.65" | bc -l) )); then + paired_devices_cmd="paired-devices" + fi + + mapfile -t paired_devices < <(bluetoothctl $paired_devices_cmd | grep Device | cut -d ' ' -f 2) + counter=0 + + for device in "${paired_devices[@]}"; do + if device_connected "$device"; then + device_alias=$(bluetoothctl info "$device" | grep "Alias" | cut -d ' ' -f 2-) + + if [ $counter -gt 0 ]; then + printf ", %s" "$device_alias" + else + printf " %s" "$device_alias" + fi + + ((counter++)) + fi + done + printf "\n" + else + echo "󰂲" + fi +} + +# A submenu for a specific device that allows connecting, pairing, and trusting +device_menu() { + device=$1 + + # Get device name and mac address + device_name=$(echo "$device" | cut -d ' ' -f 3-) + mac=$(echo "$device" | cut -d ' ' -f 2) + + # Build options + if device_connected "$mac"; then + connected="Connected: yes" + else + connected="Connected: no" + fi + paired=$(device_paired "$mac") + trusted=$(device_trusted "$mac") + options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit" + + # Open rofi menu, read chosen option + chosen="$(echo -e "$options" | $rofi_command "$device_name")" + + # Match chosen option to command + case "$chosen" in + "" | "$divider") + echo "No option chosen." + ;; + "$connected") + toggle_connection "$mac" + ;; + "$paired") + toggle_paired "$mac" + ;; + "$trusted") + toggle_trust "$mac" + ;; + "$goback") + show_menu + ;; + esac +} + +# Opens a rofi menu with current bluetooth status and options to connect +show_menu() { + # Get menu options + if power_on; then + power="Power: on" + + # Human-readable names of devices, one per line + # If scan is off, will only list paired devices + devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-) + + # Get controller flags + scan=$(scan_on) + pairable=$(pairable_on) + discoverable=$(discoverable_on) + + # Options passed to rofi + options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit" + else + power="Power: off" + options="$power\nExit" + fi + + # Open rofi menu, read chosen option + chosen="$(echo -e "$options" | $rofi_command "Bluetooth")" + + # Match chosen option to command + case "$chosen" in + "" | "$divider") + echo "No option chosen." + ;; + "$power") + toggle_power + ;; + "$scan") + toggle_scan + ;; + "$discoverable") + toggle_discoverable + ;; + "$pairable") + toggle_pairable + ;; + *) + device=$(bluetoothctl devices | grep "$chosen") + # Open a submenu if a device is selected + if [[ $device ]]; then device_menu "$device"; fi + ;; + esac +} + +# Rofi command to pipe into, can add any options here +rofi_command="rofi -theme ${RASI} -dmenu $* -p" + +case "$1" in + --status) + print_status + ;; + *) + show_menu + ;; +esac diff --git a/hypr/scripts/rofi_launcher b/hypr/scripts/rofi_launcher new file mode 100755 index 0000000..e1be4a8 --- /dev/null +++ b/hypr/scripts/rofi_launcher @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/launcher.rasi" + +# Run +rofi \ + -show drun \ + -theme ${RASI} diff --git a/hypr/scripts/rofi_music b/hypr/scripts/rofi_music new file mode 100755 index 0000000..50a70ec --- /dev/null +++ b/hypr/scripts/rofi_music @@ -0,0 +1,120 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/music.rasi" + +# Theme Elements +status="`mpc status`" +if [[ -z "$status" ]]; then + prompt='Offline' + mesg="MPD is Offline" +else + prompt="`mpc -f "%artist%" current`" + mesg="`mpc -f "%title%" current` :: `mpc status | grep "#" | awk '{print $3}'`" +fi + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + if [[ ${status} == *"[playing]"* ]]; then + option_1=" Pause" + else + option_1=" Play" + fi + option_2=" Stop" + option_3=" Previous" + option_4=" Next" + option_5=" Repeat" + option_6=" Random" +else + if [[ ${status} == *"[playing]"* ]]; then + option_1="" + else + option_1="" + fi + option_2="" + option_3="" + option_4="" + option_5="" + option_6="" +fi + +# Toggle Actions +active='' +urgent='' +# Repeat +if [[ ${status} == *"repeat: on"* ]]; then + active="-a 4" +elif [[ ${status} == *"repeat: off"* ]]; then + urgent="-u 4" +else + option_5=" Parsing Error" +fi +# Random +if [[ ${status} == *"random: on"* ]]; then + [ -n "$active" ] && active+=",5" || active="-a 5" +elif [[ ${status} == *"random: off"* ]]; then + [ -n "$urgent" ] && urgent+=",5" || urgent="-u 5" +else + option_6=" Parsing Error" +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + ${active} ${urgent} \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd +} + +# Execute Command +iDIR="$HOME/.config/hypr/mako/icons" +notify_song="notify-send -h string:x-canonical-private-synchronous:sys-notify-song -u low -i ${iDIR}/music.png" +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + mpc -q toggle && ${notify_song} "`mpc -f "%artist%" current`" + elif [[ "$1" == '--opt2' ]]; then + mpc -q stop + elif [[ "$1" == '--opt3' ]]; then + mpc -q prev && ${notify_song} "`mpc -f "%artist%" current`" + elif [[ "$1" == '--opt4' ]]; then + mpc -q next && ${notify_song} "`mpc -f "%artist%" current`" + elif [[ "$1" == '--opt5' ]]; then + mpc -q repeat + elif [[ "$1" == '--opt6' ]]; then + mpc -q random + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; + $option_6) + run_cmd --opt6 + ;; +esac diff --git a/hypr/scripts/rofi_network b/hypr/scripts/rofi_network new file mode 100755 index 0000000..2d88777 --- /dev/null +++ b/hypr/scripts/rofi_network @@ -0,0 +1,924 @@ +#!/usr/bin/env python3 +# encoding:utf8 +"""NetworkManager command line dmenu script. + +To add new connections or enable/disable networking requires policykit +permissions setup per: +https://wiki.archlinux.org/index.php/NetworkManager#Set_up_PolicyKit_permissions + +OR running the script as root + +Add dmenu options and default terminal if desired to +~/.config/hypr/rofi/networkmenu_config.ini + +""" +import pathlib +import struct +import configparser +import locale +import os +from os.path import expanduser +import shlex +from shutil import which +import sys +from time import sleep +import uuid +import subprocess + +# pylint: disable=import-error +import gi +gi.require_version('NM', '1.0') +from gi.repository import GLib, NM # noqa pylint: disable=wrong-import-position +# pylint: enable=import-error + +ENV = os.environ.copy() +ENV['LC_ALL'] = 'C' +ENC = locale.getpreferredencoding() + +CONF = configparser.ConfigParser() +CONF.read(expanduser("~/.config/hypr/rofi/networkmenu_config.ini")) + + +def cli_args(): + """ Don't override dmenu_cmd function arguments with CLI args. Removes -l + and -p if those are passed on the command line. + + Exception: if -l is passed and dmenu_command is not defined, assume that the + user wants to switch dmenu to the vertical layout and include -l. + + Returns: List of additional CLI arguments + + """ + args = sys.argv[1:] + cmd = CONF.get('dmenu', 'dmenu_command', fallback=False) + if "-l" in args or "-p" in args: + for nope in ['-l', '-p'] if cmd is not False else ['-p']: + try: + nope_idx = args.index(nope) + del args[nope_idx] + del args[nope_idx] + except ValueError: + pass + return args + + +def dmenu_pass(command, color): + """Check if dmenu passphrase patch is applied and return the correct command + line arg list + + Args: command - string + color - obscure color string + Returns: list or None + + """ + if command != 'dmenu': + return None + try: + # Check for dmenu password patch + dm_patch = b'P' in subprocess.run(["dmenu", "-h"], + capture_output=True, + check=False).stderr + except FileNotFoundError: + dm_patch = False + return ["-P"] if dm_patch else ["-nb", color, "-nf", color] + + +def dmenu_cmd(num_lines, prompt="Networks", active_lines=None): + """Parse nmd.ini for menu options + + Args: args - num_lines: number of lines to display + prompt: prompt to show + active_lines: list of line numbers to tag as active + Returns: command invocation (as a list of strings) for example + ["dmenu", "-l", "", "-p", "", "-i"] + + """ + # Create command string + commands = {"dmenu": ["-p", str(prompt)], + "rofi": ["-dmenu", "-p", str(prompt), "-l", str(num_lines)], + "bemenu": ["-p", str(prompt)], + "wofi": ["-p", str(prompt)]} + command = shlex.split(CONF.get('dmenu', 'dmenu_command', fallback="dmenu")) + command.extend(cli_args()) + command.extend(commands.get(command[0], [])) + # Rofi Highlighting + rofi_highlight = CONF.getboolean('dmenu', 'rofi_highlight', fallback=False) + if rofi_highlight is True and command[0] == "rofi" and active_lines: + command.extend(["-a", ",".join([str(num) for num in active_lines])]) + # Passphrase prompts + obscure = CONF.getboolean('dmenu_passphrase', 'obscure', fallback=False) + if prompt == "Passphrase" and obscure is True: + obscure_color = CONF.get('dmenu_passphrase', 'obscure_color', fallback='#222222') + pass_prompts = {"dmenu": dmenu_pass(command[0], obscure_color), + "rofi": ['-password'], + "bemenu": ['-x'], + "wofi": ['-P']} + command.extend(pass_prompts.get(command[0], [])) + return command + + +def choose_adapter(client): + """If there is more than one wifi adapter installed, ask which one to use + + """ + devices = client.get_devices() + devices = [i for i in devices if i.get_device_type() == NM.DeviceType.WIFI] + if not devices: + return None + if len(devices) == 1: + return devices[0] + device_names = "\n".join([d.get_iface() for d in devices]) + sel = subprocess.run(dmenu_cmd(len(devices), "CHOOSE ADAPTER:"), + capture_output=True, + check=False, + env=ENV, + input=device_names, + encoding=ENC).stdout + if not sel.strip(): + sys.exit() + devices = [i for i in devices if i.get_iface() == sel.strip()] + assert len(devices) == 1 + return devices[0] + + +def is_installed(cmd): + """Check if a utility is installed""" + return which(cmd) is not None + + +def bluetooth_get_enabled(): + """Check if bluetooth is enabled via rfkill. + + Returns None if no bluetooth device was found. + """ + # See https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-class-rfkill + for path in pathlib.Path('/sys/class/rfkill/').glob('rfkill*'): + if (path / 'type').read_text().strip() == 'bluetooth': + return (path / 'soft').read_text().strip() == '0' + return None + + +def create_other_actions(client): + """Return list of other actions that can be taken + + """ + networking_enabled = client.networking_get_enabled() + networking_action = "Disable" if networking_enabled else "Enable" + + wifi_enabled = client.wireless_get_enabled() + wifi_action = "Disable" if wifi_enabled else "Enable" + + bluetooth_enabled = bluetooth_get_enabled() + bluetooth_action = "Disable" if bluetooth_enabled else "Enable" + + actions = [Action(f"{wifi_action} Wifi", toggle_wifi, + not wifi_enabled), + Action(f"{networking_action} Networking", + toggle_networking, not networking_enabled)] + if bluetooth_enabled is not None: + actions.append(Action(f"{bluetooth_action} Bluetooth", + toggle_bluetooth, not bluetooth_enabled)) + actions += [Action("Launch Connection Manager", launch_connection_editor), + Action("Delete a Connection", delete_connection)] + if wifi_enabled: + actions.append(Action("Rescan Wifi Networks", rescan_wifi)) + return actions + + +def rescan_wifi(): + """ + Rescan Wifi Access Points + """ + delay = CONF.getint('nmdm', 'rescan_delay', fallback=5) + for dev in CLIENT.get_devices(): + if gi.repository.NM.DeviceWifi == type(dev): + try: + dev.request_scan_async(None, rescan_cb, None) + LOOP.run() + sleep(delay) + notify("Wifi scan complete") + main() + except gi.repository.GLib.Error as err: + # Too frequent rescan error + notify("Wifi rescan failed", urgency="critical") + if not err.code == 6: # pylint: disable=no-member + raise err + + +def rescan_cb(dev, res, data): + """Callback for rescan_wifi. Just for notifications + + """ + if dev.request_scan_finish(res) is True: + notify("Wifi scan running...") + else: + notify("Wifi scan failed", urgency="critical") + LOOP.quit() + + +def ssid_to_utf8(nm_ap): + """ Convert binary ssid to utf-8 """ + ssid = nm_ap.get_ssid() + if not ssid: + return "" + ret = NM.utils_ssid_to_utf8(ssid.get_data()) + return ret + + +def prompt_saved(saved_cons): + """Prompt for a saved connection.""" + actions = create_saved_actions(saved_cons) + sel = get_selection(actions) + sel() + + +def ap_security(nm_ap): + """Parse the security flags to return a string with 'WPA2', etc. """ + flags = nm_ap.get_flags() + wpa_flags = nm_ap.get_wpa_flags() + rsn_flags = nm_ap.get_rsn_flags() + sec_str = "" + if ((flags & getattr(NM, '80211ApFlags').PRIVACY) and + (wpa_flags == 0) and (rsn_flags == 0)): + sec_str = " WEP" + if wpa_flags: + sec_str = " WPA1" + if rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_PSK: + sec_str += " WPA2" + if rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_SAE: + sec_str += " WPA3" + if ((wpa_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_802_1X) or + (rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_802_1X)): + sec_str += " 802.1X" + if ((wpa_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_OWE) or + (rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_OWE)): + sec_str += " OWE" + + # If there is no security use "--" + if sec_str == "": + sec_str = "--" + return sec_str.lstrip() + + +class Action(): # pylint: disable=too-few-public-methods + """Helper class to execute functions from a string variable""" + def __init__(self, + name, + func, + args=None, + active=False): + self.name = name + self.func = func + self.is_active = active + if args is None: + self.args = None + elif isinstance(args, list): + self.args = args + else: + self.args = [args] + + def __str__(self): + return self.name + + def __call__(self): + if self.args is None: + self.func() + else: + self.func(*self.args) + + +def conn_matches_adapter(conn, adapter): + """Return True if the connection is applicable for the given adapter. + + There seem to be two ways for a connection specify what interface it belongs + to: + + - By setting 'mac-address' in [wifi] to the adapter's MAC + - By setting 'interface-name` in [connection] to the adapter's name. + + Depending on how the connection was added, it seems like either + 'mac-address', 'interface-name' or neither of both is set. + """ + # [wifi] mac-address + setting_wireless = conn.get_setting_wireless() + mac = setting_wireless.get_mac_address() + if mac is not None: + return mac == adapter.get_permanent_hw_address() + + # [connection] interface-name + setting_connection = conn.get_setting_connection() + interface = setting_connection.get_interface_name() + if interface is not None: + return interface == adapter.get_iface() + + # Neither is set, let's assume this connection is for multiple/all adapters. + return True + + +def process_ap(nm_ap, is_active, adapter): + """Activate/Deactivate a connection and get password if required""" + if is_active: + CLIENT.deactivate_connection_async(nm_ap, None, deactivate_cb, nm_ap) + LOOP.run() + else: + conns_cur = [i for i in CONNS if + i.get_setting_wireless() is not None and + conn_matches_adapter(i, adapter)] + con = nm_ap.filter_connections(conns_cur) + if len(con) > 1: + raise ValueError("There are multiple connections possible") + + if len(con) == 1: + CLIENT.activate_connection_async(con[0], adapter, nm_ap.get_path(), + None, activate_cb, nm_ap) + LOOP.run() + else: + if ap_security(nm_ap) != "--": + password = get_passphrase() + else: + password = "" + set_new_connection(nm_ap, password, adapter) + + +def activate_cb(dev, res, data): + """Notification if activate connection completed successfully + + """ + try: + conn = dev.activate_connection_finish(res) + except GLib.Error: + conn = None + if conn is not None: + notify(f"Activated {conn.get_id()}") + else: + notify(f"Problem activating {data.get_id()}", urgency="critical") + LOOP.quit() + + +def deactivate_cb(dev, res, data): + """Notification if deactivate connection completed successfully + + """ + if dev.deactivate_connection_finish(res) is True: + notify(f"Deactivated {data.get_id()}") + else: + notify(f"Problem deactivating {data.get_id()}", urgency="critical") + LOOP.quit() + + +def process_vpngsm(con, activate): + """Activate/deactive VPN or GSM connections""" + if activate: + CLIENT.activate_connection_async(con, None, None, + None, activate_cb, con) + else: + CLIENT.deactivate_connection_async(con, None, deactivate_cb, con) + LOOP.run() + + +def create_ap_actions(aps, active_ap, active_connection, adapter): # noqa pylint: disable=too-many-locals,line-too-long + """For each AP in a list, create the string and its attached function + (activate/deactivate) + + """ + active_ap_bssid = active_ap.get_bssid() if active_ap is not None else "" + + names = [ssid_to_utf8(ap) for ap in aps] + max_len_name = max([len(name) for name in names]) if names else 0 + secs = [ap_security(ap) for ap in aps] + max_len_sec = max([len(sec) for sec in secs]) if secs else 0 + + ap_actions = [] + + for nm_ap, name, sec in zip(aps, names, secs): + bars = NM.utils_wifi_strength_bars(nm_ap.get_strength()) + wifi_chars = CONF.get("dmenu", "wifi_chars", fallback=False) + if wifi_chars: + bars = "".join([wifi_chars[i] for i, j in enumerate(bars) if j == '*']) + is_active = nm_ap.get_bssid() == active_ap_bssid + compact = CONF.getboolean("dmenu", "compact", fallback=False) + if compact: + action_name = f"{name} {sec} {bars}" + else: + action_name = f"{name:<{max_len_name}s} {sec:<{max_len_sec}s} {bars:>4}" + if is_active: + ap_actions.append(Action(action_name, process_ap, + [active_connection, True, adapter], + active=True)) + else: + ap_actions.append(Action(action_name, process_ap, + [nm_ap, False, adapter])) + return ap_actions + + +def create_vpn_actions(vpns, active): + """Create the list of strings to display with associated function + (activate/deactivate) for VPN connections. + + """ + active_vpns = [i for i in active if i.get_vpn()] + return _create_vpngsm_actions(vpns, active_vpns, "VPN") + + +def create_wireguard_actions(wgs, active): + """Create the list of strings to display with associated function + (activate/deactivate) for Wireguard connections. + + """ + active_wgs = [i for i in active if i.get_connection_type() == "wireguard"] + return _create_vpngsm_actions(wgs, active_wgs, "Wireguard") + + +def create_eth_actions(eths, active): + """Create the list of strings to display with associated function + (activate/deactivate) for Ethernet connections. + + """ + active_eths = [i for i in active if 'ethernet' in i.get_connection_type()] + return _create_vpngsm_actions(eths, active_eths, "Eth") + + +def create_gsm_actions(gsms, active): + """Create the list of strings to display with associated function + (activate/deactivate) GSM connections.""" + active_gsms = [i for i in active if + i.get_connection() is not None and + i.get_connection().is_type(NM.SETTING_GSM_SETTING_NAME)] + return _create_vpngsm_actions(gsms, active_gsms, "GSM") + + +def create_blue_actions(blues, active): + """Create the list of strings to display with associated function + (activate/deactivate) Bluetooth connections.""" + active_blues = [i for i in active if + i.get_connection() is not None and + i.get_connection().is_type(NM.SETTING_BLUETOOTH_SETTING_NAME)] + return _create_vpngsm_actions(blues, active_blues, "Bluetooth") + + +def create_saved_actions(saved): + """Create the list of strings to display with associated function + (activate/deactivate) for VPN connections. + + """ + return _create_vpngsm_actions(saved, [], "SAVED") + + +def _create_vpngsm_actions(cons, active_cons, label): + active_con_ids = [a.get_id() for a in active_cons] + actions = [] + for con in cons: + is_active = con.get_id() in active_con_ids + action_name = f"{con.get_id()}:{label}" + if is_active: + active_connection = [a for a in active_cons + if a.get_id() == con.get_id()] + if len(active_connection) != 1: + raise ValueError(f"Multiple active connections match {con.get_id()}") + active_connection = active_connection[0] + + actions.append(Action(action_name, process_vpngsm, + [active_connection, False], active=True)) + else: + actions.append(Action(action_name, process_vpngsm, + [con, True])) + return actions + + +def create_wwan_actions(client): + """Create WWWAN actions + + """ + wwan_enabled = client.wwan_get_enabled() + wwan_action = "Disable" if wwan_enabled else "Enable" + return [Action(f"{wwan_action} WWAN", toggle_wwan, not wwan_enabled)] + + +def combine_actions(eths, aps, vpns, wgs, gsms, blues, wwan, others, saved): + # pylint: disable=too-many-arguments + """Combine all given actions into a list of actions. + + Args: args - eths: list of Actions + aps: list of Actions + vpns: list of Actions + gsms: list of Actions + blues: list of Actions + wwan: list of Actions + others: list of Actions + """ + compact = CONF.getboolean("dmenu", "compact", fallback=False) + empty_action = [Action('', None)] if not compact else [] + all_actions = [] + all_actions += eths + empty_action if eths else [] + all_actions += aps + empty_action if aps else [] + all_actions += vpns + empty_action if vpns else [] + all_actions += wgs + empty_action if wgs else [] + all_actions += gsms + empty_action if (gsms and wwan) else [] + all_actions += blues + empty_action if blues else [] + all_actions += wwan + empty_action if wwan else [] + all_actions += others + empty_action if others else [] + all_actions += saved + empty_action if saved else [] + return all_actions + + +def get_selection(all_actions): + """Spawn dmenu for selection and execute the associated action.""" + rofi_highlight = CONF.getboolean('dmenu', 'rofi_highlight', fallback=False) + inp = [] + + if rofi_highlight is True: + inp = [str(action) for action in all_actions] + else: + inp = [('== ' if action.is_active else ' ') + str(action) + for action in all_actions] + active_lines = [index for index, action in enumerate(all_actions) + if action.is_active] + + command = dmenu_cmd(len(inp), active_lines=active_lines) + sel = subprocess.run(command, + capture_output=True, + check=False, + input="\n".join(inp), + encoding=ENC, + env=ENV).stdout + + if not sel.rstrip(): + sys.exit() + + if rofi_highlight is False: + action = [i for i in all_actions + if ((str(i).strip() == str(sel.strip()) + and not i.is_active) or + ('== ' + str(i) == str(sel.rstrip('\n')) + and i.is_active))] + else: + action = [i for i in all_actions if str(i).strip() == sel.strip()] + assert len(action) == 1, f"Selection was ambiguous: '{str(sel.strip())}'" + return action[0] + + +def toggle_networking(enable): + """Enable/disable networking + + Args: enable - boolean + + """ + toggle = GLib.Variant.new_tuple(GLib.Variant.new_boolean(enable)) + try: + CLIENT.dbus_call(NM.DBUS_PATH, NM.DBUS_INTERFACE, "Enable", toggle, + None, -1, None, None, None) + except AttributeError: + # Workaround for older versions of python-gobject + CLIENT.networking_set_enabled(enable) + notify(f"Networking {'enabled' if enable is True else 'disabled'}") + + +def toggle_wifi(enable): + """Enable/disable Wifi + + Args: enable - boolean + + """ + toggle = GLib.Variant.new_boolean(enable) + try: + CLIENT.dbus_set_property(NM.DBUS_PATH, NM.DBUS_INTERFACE, "WirelessEnabled", toggle, + -1, None, None, None) + except AttributeError: + # Workaround for older versions of python-gobject + CLIENT.wireless_set_enabled(enable) + notify(f"Wifi {'enabled' if enable is True else 'disabled'}") + + +def toggle_wwan(enable): + """Enable/disable WWAN + + Args: enable - boolean + + """ + toggle = GLib.Variant.new_boolean(enable) + try: + CLIENT.dbus_set_property(NM.DBUS_PATH, NM.DBUS_INTERFACE, "WwanEnabled", toggle, + -1, None, None, None) + except AttributeError: + # Workaround for older versions of python-gobject + CLIENT.wwan_set_enabled(enable) + notify(f"Wwan {'enabled' if enable is True else 'disabled'}") + + +def toggle_bluetooth(enable): + """Enable/disable Bluetooth + + Args: enable - boolean + + References: + https://github.com/blueman-project/blueman/blob/master/blueman/plugins/mechanism/RfKill.py + https://www.kernel.org/doc/html/latest/driver-api/rfkill.html + https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/uapi/linux/rfkill.h?h=v5.8.9 + + """ + type_bluetooth = 2 + op_change_all = 3 + idx = 0 + soft_state = 0 if enable else 1 + hard_state = 0 + + data = struct.pack("IBBBB", idx, type_bluetooth, op_change_all, + soft_state, hard_state) + + try: + with open('/dev/rfkill', 'r+b', buffering=0) as rff: + rff.write(data) + except PermissionError: + notify("Lacking permission to write to /dev/rfkill.", + "Check README for configuration options.", + urgency="critical") + else: + notify(f"Bluetooth {'enabled' if enable else 'disabled'}") + + +def launch_connection_editor(): + """Launch nmtui or the gui nm-connection-editor + + """ + terminal = CONF.get("editor", "terminal", fallback="xterm") + gui_if_available = CONF.getboolean("editor", "gui_if_available", fallback=True) + guis = ["gnome-control-center", "nm-connection-editor"] + if gui_if_available is True: + for gui in guis: + if is_installed(gui): + subprocess.run(gui, check=False) + return + if is_installed("nmtui"): + subprocess.run([terminal, "-e", "nmtui"], check=False) + return + notify("No network connection editor installed", urgency="critical") + + +def get_passphrase(): + """Get a password + + Returns: string + + """ + pinentry = CONF.get("dmenu", "pinentry", fallback=None) + if pinentry: + pin = "" + out = subprocess.run(pinentry, + capture_output=True, + check=False, + encoding=ENC, + input='setdesc Get network password\ngetpin\n').stdout + if out: + res = out.split("\n")[2] + if res.startswith("D "): + pin = res.split("D ")[1] + return pin + return subprocess.run(dmenu_cmd(0, "Passphrase"), + stdin=subprocess.DEVNULL, + capture_output=True, + check=False, + encoding=ENC).stdout + + +def delete_connection(): + """Display list of NM connections and delete the selected one + + """ + conn_acts = [Action(i.get_id(), i.delete_async, args=[None, delete_cb, None]) for i in CONNS] + conn_names = "\n".join([str(i) for i in conn_acts]) + sel = subprocess.run(dmenu_cmd(len(conn_acts), "CHOOSE CONNECTION TO DELETE:"), + capture_output=True, + check=False, + input=conn_names, + encoding=ENC, + env=ENV).stdout + if not sel.strip(): + sys.exit() + action = [i for i in conn_acts if str(i) == sel.rstrip("\n")] + assert len(action) == 1, f"Selection was ambiguous: {str(sel)}" + action[0]() + LOOP.run() + + +def delete_cb(dev, res, data): + """Notification if delete completed successfully + + """ + if dev.delete_finish(res) is True: + notify(f"Deleted {dev.get_id()}") + else: + notify(f"Problem deleting {dev.get_id()}", urgency="critical") + LOOP.quit() + + +def set_new_connection(nm_ap, nm_pw, adapter): + """Setup a new NetworkManager connection + + Args: ap - NM.AccessPoint + pw - string + + """ + nm_pw = str(nm_pw).strip() + profile = create_wifi_profile(nm_ap, nm_pw, adapter) + CLIENT.add_and_activate_connection_async(profile, adapter, nm_ap.get_path(), + None, verify_conn, profile) + LOOP.run() + + +def create_wifi_profile(nm_ap, password, adapter): + # pylint: disable=line-too-long + # noqa From https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/gi/add_connection.py + # noqa and https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-wifi-psk-connection.py + # pylint: enable=line-too-long + """Create the NM profile given the AP and passphrase""" + ap_sec = ap_security(nm_ap) + profile = NM.SimpleConnection.new() + + s_con = NM.SettingConnection.new() + s_con.set_property(NM.SETTING_CONNECTION_ID, ssid_to_utf8(nm_ap)) + s_con.set_property(NM.SETTING_CONNECTION_UUID, str(uuid.uuid4())) + s_con.set_property(NM.SETTING_CONNECTION_TYPE, "802-11-wireless") + profile.add_setting(s_con) + + s_wifi = NM.SettingWireless.new() + s_wifi.set_property(NM.SETTING_WIRELESS_SSID, nm_ap.get_ssid()) + s_wifi.set_property(NM.SETTING_WIRELESS_MODE, 'infrastructure') + s_wifi.set_property(NM.SETTING_WIRELESS_MAC_ADDRESS, adapter.get_permanent_hw_address()) + profile.add_setting(s_wifi) + + s_ip4 = NM.SettingIP4Config.new() + s_ip4.set_property(NM.SETTING_IP_CONFIG_METHOD, "auto") + profile.add_setting(s_ip4) + + s_ip6 = NM.SettingIP6Config.new() + s_ip6.set_property(NM.SETTING_IP_CONFIG_METHOD, "auto") + profile.add_setting(s_ip6) + + if ap_sec != "--": + s_wifi_sec = NM.SettingWirelessSecurity.new() + if "WPA" in ap_sec: + if "WPA3" in ap_sec: + s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_KEY_MGMT, + "sae") + else: + s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_KEY_MGMT, + "wpa-psk") + s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_AUTH_ALG, + "open") + s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_PSK, password) + elif "WEP" in ap_sec: + s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_KEY_MGMT, + "None") + s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, + NM.WepKeyType.PASSPHRASE) + s_wifi_sec.set_wep_key(0, password) + profile.add_setting(s_wifi_sec) + + return profile + + +def verify_conn(client, result, data): + """Callback function for add_and_activate_connection_async + + Check if connection completes successfully. Delete the connection if there + is an error. + + """ + try: + act_conn = client.add_and_activate_connection_finish(result) + conn = act_conn.get_connection() + if not all([conn.verify(), + conn.verify_secrets(), + data.verify(), + data.verify_secrets()]): + raise GLib.Error + notify(f"Added {conn.get_id()}") + except GLib.Error: + try: + notify(f"Connection to {conn.get_id()} failed", + urgency="critical") + conn.delete_async(None, None, None) + except UnboundLocalError: + pass + finally: + LOOP.quit() + + +def create_ap_list(adapter, active_connections): + """Generate list of access points. Remove duplicate APs , keeping strongest + ones and the active AP + + Args: adapter + active_connections - list of all active connections + Returns: aps - list of access points + active_ap - active AP + active_ap_con - active Connection + adapter + + """ + aps = [] + ap_names = [] + active_ap = adapter.get_active_access_point() + aps_all = sorted(adapter.get_access_points(), + key=lambda a: a.get_strength(), reverse=True) + conns_cur = [i for i in CONNS if + i.get_setting_wireless() is not None and + conn_matches_adapter(i, adapter)] + try: + ap_conns = active_ap.filter_connections(conns_cur) + active_ap_name = ssid_to_utf8(active_ap) + active_ap_con = [active_conn for active_conn in active_connections + if active_conn.get_connection() in ap_conns] + except AttributeError: + active_ap_name = None + active_ap_con = [] + if len(active_ap_con) > 1: + raise ValueError("Multiple connection profiles match" + " the wireless AP") + active_ap_con = active_ap_con[0] if active_ap_con else None + for nm_ap in aps_all: + ap_name = ssid_to_utf8(nm_ap) + if nm_ap != active_ap and ap_name == active_ap_name: + # Skip adding AP if it's not active but same name as active AP + continue + if ap_name not in ap_names: + ap_names.append(ap_name) + aps.append(nm_ap) + return aps, active_ap, active_ap_con, adapter + + +def notify(message, details=None, urgency="low"): + """Use notify-send if available for notifications + + """ + delay = CONF.getint('nmdm', 'rescan_delay', fallback=5) + args = ["-u", urgency, "-a", "networkmanager-dmenu", + "-t", str(delay * 1000), message] + if details is not None: + args.append(details) + if is_installed("notify-send"): + subprocess.run(["notify-send"] + args, check=False) + + +def run(): # pylint: disable=too-many-locals + """Main script entrypoint""" + active = CLIENT.get_active_connections() + adapter = choose_adapter(CLIENT) + if adapter: + ap_actions = create_ap_actions(*create_ap_list(adapter, active)) + else: + ap_actions = [] + + vpns = [i for i in CONNS if i.is_type(NM.SETTING_VPN_SETTING_NAME)] + try: + wgs = [i for i in CONNS if i.is_type(NM.SETTING_WIREGUARD_SETTING_NAME)] + except AttributeError: + # Workaround for older versions of python-gobject with no wireguard support + wgs = [] + eths = [i for i in CONNS if i.is_type(NM.SETTING_WIRED_SETTING_NAME)] + blues = [i for i in CONNS if i.is_type(NM.SETTING_BLUETOOTH_SETTING_NAME)] + + vpn_actions = create_vpn_actions(vpns, active) + wg_actions = create_wireguard_actions(wgs, active) + eth_actions = create_eth_actions(eths, active) + blue_actions = create_blue_actions(blues, active) + other_actions = create_other_actions(CLIENT) + wwan_installed = is_installed("ModemManager") + if wwan_installed: + gsms = [i for i in CONNS if i.is_type(NM.SETTING_GSM_SETTING_NAME)] + gsm_actions = create_gsm_actions(gsms, active) + wwan_actions = create_wwan_actions(CLIENT) + else: + gsm_actions = [] + wwan_actions = [] + + list_saved = CONF.getboolean('dmenu', 'list_saved', fallback=False) + saved_cons = [i for i in CONNS if i not in vpns + wgs + eths + blues] + if list_saved: + saved_actions = create_saved_actions(saved_cons) + else: + saved_actions = [Action("Saved connections", prompt_saved, [saved_cons])] + + actions = combine_actions(eth_actions, ap_actions, vpn_actions, wg_actions, + gsm_actions, blue_actions, wwan_actions, + other_actions, saved_actions) + sel = get_selection(actions) + sel() + + +def main(): + """Main. Enables script to be re-run after a wifi rescan + + """ + global CLIENT, CONNS, LOOP # noqa pylint: disable=global-variable-undefined + CLIENT = NM.Client.new(None) + LOOP = GLib.MainLoop() + CONNS = CLIENT.get_connections() + + run() + + +if __name__ == '__main__': + main() + +# vim: set et ts=4 sw=4 : diff --git a/hypr/scripts/rofi_powermenu b/hypr/scripts/rofi_powermenu new file mode 100755 index 0000000..2582cdf --- /dev/null +++ b/hypr/scripts/rofi_powermenu @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/powermenu.rasi" +CNFR="$DIR/rofi/confirm.rasi" + +# Theme Elements +prompt="`hostname` (`echo $DESKTOP_SESSION`)" +mesg="Uptime : `uptime -p | sed -e 's/up //g'`" + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + option_1=" Lock" + option_2=" Logout" + option_3=" Suspend" + option_4=" Hibernate" + option_5=" Reboot" + option_6=" Shutdown" +else + option_1="" + option_2="" + option_3="" + option_4="" + option_5="" + option_6="" +fi +cnflayout=`cat ${CNFR} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$cnflayout" == 'NO' ]]; then + yes=' Yes' + no=' No' +else + yes='' + no='' +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd +} + +# Confirmation CMD +confirm_cmd() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg 'Are you Sure?' \ + -theme ${CNFR} +} + +# Ask for confirmation +confirm_exit() { + echo -e "$yes\n$no" | confirm_cmd +} + +# Confirm and execute +confirm_run () { + selected="$(confirm_exit)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} && ${4} + else + exit + fi +} + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + hyprlock + elif [[ "$1" == '--opt2' ]]; then + confirm_run 'hyprctl dispatch exit 0' + elif [[ "$1" == '--opt3' ]]; then + confirm_run 'mpc -q pause' 'pulsemixer --mute' 'systemctl suspend' + elif [[ "$1" == '--opt4' ]]; then + confirm_run 'systemctl hibernate' + elif [[ "$1" == '--opt5' ]]; then + confirm_run 'systemctl reboot' + elif [[ "$1" == '--opt6' ]]; then + confirm_run 'systemctl poweroff' + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; + $option_6) + run_cmd --opt6 + ;; +esac diff --git a/hypr/scripts/rofi_runner b/hypr/scripts/rofi_runner new file mode 100755 index 0000000..4f33550 --- /dev/null +++ b/hypr/scripts/rofi_runner @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/runner.rasi" + +# Run +rofi \ + -show run \ + -theme ${RASI} diff --git a/hypr/scripts/rofi_screenshot b/hypr/scripts/rofi_screenshot new file mode 100755 index 0000000..f3370b2 --- /dev/null +++ b/hypr/scripts/rofi_screenshot @@ -0,0 +1,143 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya + +# Get Colors +DIR="$HOME/.config/hypr" +background="`cat $DIR/rofi/shared/colors.rasi | grep 'background:' | cut -d':' -f2 | tr -d ' '\;`" +accent="`cat $DIR/rofi/shared/colors.rasi | grep 'selected:' | cut -d':' -f2 | tr -d ' '\;`" + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/screenshot.rasi" + +# Theme Elements +prompt='Screenshot' +mesg="Directory :: `xdg-user-dir PICTURES`/Screenshots" + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + option_1=" Capture Desktop" + option_2=" Capture Area" + option_3=" Capture Window" + option_4=" Capture in 5s" + option_5=" Capture in 10s" +else + option_1="" + option_2="" + option_3="" + option_4="" + option_5="" +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5" | rofi_cmd +} + +# Screenshot +time=`date +%Y-%m-%d-%H-%M-%S` +dir="`xdg-user-dir PICTURES`/Screenshots" +file="Screenshot_${time}_${geometry}.png" + +# Directory +if [[ ! -d "$dir" ]]; then + mkdir -p "$dir" +fi + +# notify and view screenshot +iDIR="$HOME/.config/hypr/mako/icons" +notify_view() { + notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:sys-notify-shot -u low -i ${iDIR}/picture.png" + ${notify_cmd_shot} "Copied to clipboard." + paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null & + viewnior ${dir}/"$file" + if [[ -e "$dir/$file" ]]; then + ${notify_cmd_shot} "Screenshot Saved." + else + ${notify_cmd_shot} "Screenshot Deleted." + fi +} + +# countdown +countdown () { + for sec in `seq $1 -1 1`; do + notify-send -h string:x-canonical-private-synchronous:sys-notify-count -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec" + sleep 1 + done +} + +# take shots +shotnow () { + cd ${dir} && sleep 0.5 && grim - | tee "$file" | wl-copy + notify_view +} + +shot5 () { + countdown '5' + sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy + notify_view +} + +shot10 () { + countdown '10' + sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy + notify_view +} + +shotwin () { + w_pos=`hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1` + w_size=`hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g` + cd ${dir} && sleep 0.3 && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy + notify_view +} + +shotarea () { + cd ${dir} && grim -g "$(slurp -b ${background:1}CC -c ${accent:1}ff -s ${accent:1}0D -w 2 && sleep 0.3)" - | tee "$file" | wl-copy + notify_view +} + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + shotnow + elif [[ "$1" == '--opt2' ]]; then + shotarea + elif [[ "$1" == '--opt3' ]]; then + shotwin + elif [[ "$1" == '--opt4' ]]; then + shot5 + elif [[ "$1" == '--opt5' ]]; then + shot10 + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; +esac diff --git a/hypr/scripts/rofi_ssh b/hypr/scripts/rofi_ssh new file mode 100755 index 0000000..180c11e --- /dev/null +++ b/hypr/scripts/rofi_ssh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/runner.rasi" +TERMINAL="$DIR/scripts/alacritty" + +# Run +rofi \ + -show ssh \ + -terminal ${TERMINAL} \ + -theme ${RASI} diff --git a/hypr/scripts/rofi_windows b/hypr/scripts/rofi_windows new file mode 100755 index 0000000..f541478 --- /dev/null +++ b/hypr/scripts/rofi_windows @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/hypr" +RASI="$DIR/rofi/runner.rasi" + +# Run +rofi \ + -show window \ + -theme ${RASI} diff --git a/hypr/scripts/screenshot b/hypr/scripts/screenshot new file mode 100755 index 0000000..3c5eca2 --- /dev/null +++ b/hypr/scripts/screenshot @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Script to take screenshots with grim, slurp (in Wayland) + +# Get Colors +DIR="$HOME/.config/hypr" +background="`cat $DIR/rofi/shared/colors.rasi | grep 'background:' | cut -d':' -f2 | tr -d ' '\;`" +accent="`cat $DIR/rofi/shared/colors.rasi | grep 'selected:' | cut -d':' -f2 | tr -d ' '\;`" + +iDIR="$HOME/.config/hypr/mako/icons" + +time=`date +%Y-%m-%d-%H-%M-%S` +dir="`xdg-user-dir PICTURES`/Screenshots" +file="Screenshot_${time}_${RANDOM}.png" + +# notify and view screenshot +notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:sys-notify-shot -u low -i ${iDIR}/picture.png" +notify_view () { + ${notify_cmd_shot} "Copied to clipboard." + paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null & + viewnior ${dir}/"$file" + if [[ -e "$dir/$file" ]]; then + ${notify_cmd_shot} "Screenshot Saved." + else + ${notify_cmd_shot} "Screenshot Deleted." + fi +} + +# countdown +countdown () { + for sec in `seq $1 -1 1`; do + notify-send -h string:x-canonical-private-synchronous:sys-notify-count -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec" + sleep 1 + done +} + +# take shots +shotnow () { + cd ${dir} && sleep 0.5 && grim - | tee "$file" | wl-copy + notify_view +} + +shot5 () { + countdown '5' + sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy + notify_view +} + +shot10 () { + countdown '10' + sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy + notify_view +} + +shotwin () { + w_pos=`hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1` + w_size=`hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g` + cd ${dir} && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy + notify_view +} + +shotarea () { + cd ${dir} && grim -g "$(slurp -b ${background:1}CC -c ${accent:1}ff -s ${accent:1}0D -w 2 && sleep 0.3)" - | tee "$file" | wl-copy + notify_view +} + +if [[ ! -d "$dir" ]]; then + mkdir -p "$dir" +fi + +if [[ "$1" == "--now" ]]; then + shotnow +elif [[ "$1" == "--in5" ]]; then + shot5 +elif [[ "$1" == "--in10" ]]; then + shot10 +elif [[ "$1" == "--win" ]]; then + shotwin +elif [[ "$1" == "--area" ]]; then + shotarea +else + echo -e "Available Options : --now --in5 --in10 --win --area" +fi + +exit 0 diff --git a/hypr/scripts/startup b/hypr/scripts/startup new file mode 100755 index 0000000..4205c28 --- /dev/null +++ b/hypr/scripts/startup @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Autostart Programs + +# Kill already running process +_ps=(waybar mako) +for _prs in "${_ps[@]}"; do + if [[ `pidof ${_prs}` ]]; then + killall -9 ${_prs} + fi +done + +# Polkit agent +if [[ ! `pidof xfce-polkit` ]]; then + /usr/lib/xfce-polkit/xfce-polkit & +fi + +# Set wallpaper +~/.config/hypr/scripts/wallpaper & + +# Apply themes +~/.config/hypr/scripts/gtkthemes & + +# Lauch notification daemon (mako) +~/.config/hypr/scripts/notifications & + +# Lauch statusbar (waybar) +~/.config/hypr/scripts/statusbar & + +# Start network manager applet +nm-applet --indicator & + +# Start mpd +exec mpd & diff --git a/hypr/scripts/statusbar b/hypr/scripts/statusbar new file mode 100755 index 0000000..747d7db --- /dev/null +++ b/hypr/scripts/statusbar @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## launch waybar with alt config + +CONFIG="$HOME/.config/hypr/waybar/config" +STYLE="$HOME/.config/hypr/waybar/style.css" + +if [[ ! `pidof waybar` ]]; then + waybar --bar main-bar --log-level error --config ${CONFIG} --style ${STYLE} +fi diff --git a/hypr/scripts/volume b/hypr/scripts/volume new file mode 100755 index 0000000..4f26a43 --- /dev/null +++ b/hypr/scripts/volume @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Script To Manage Speaker Volume For Archcraft (in Wayland). + +iDIR="$HOME/.config/hypr/mako/icons" +notify_cmd='notify-send -h string:x-canonical-private-synchronous:sys-notify-volume -u low' + +# Get Volume +get_volume() { + echo "`pulsemixer --get-volume | cut -d' ' -f1`" +} + +# Get icons +get_icon() { + current="$(get_volume)" + if [[ "$current" -eq "0" ]]; then + icon="$iDIR/volume-mute.png" + elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then + icon="$iDIR/volume-low.png" + elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then + icon="$iDIR/volume-mid.png" + elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then + icon="$iDIR/volume-high.png" + fi +} + +# Notify +notify_user() { + ${notify_cmd} -i "$icon" "Volume : $(get_volume)%" +} + +# Increase Volume +inc_volume() { + [[ `pulsemixer --get-mute` == 1 ]] && pulsemixer --unmute + pulsemixer --max-volume 100 --change-volume +5 && get_icon && notify_user +} + +# Decrease Volume +dec_volume() { + [[ `pulsemixer --get-mute` == 1 ]] && pulsemixer --unmute + pulsemixer --max-volume 100 --change-volume -5 && get_icon && notify_user +} + +# Toggle Mute +toggle_mute() { + if [[ `pulsemixer --get-mute` == 0 ]]; then + pulsemixer --toggle-mute && ${notify_cmd} -i "$iDIR/volume-mute.png" "Mute" + else + pulsemixer --toggle-mute && get_icon && ${notify_cmd} -i "$icon" "Unmute" + fi +} + +# Toggle Mic +toggle_mic() { + ID="`pulsemixer --list-sources | grep 'Default' | cut -d',' -f1 | cut -d' ' -f3`" + if [[ `pulsemixer --id $ID --get-mute` == 0 ]]; then + pulsemixer --id ${ID} --toggle-mute && ${notify_cmd} -i "$iDIR/microphone-mute.png" "Microphone Switched OFF" + else + pulsemixer --id ${ID} --toggle-mute && ${notify_cmd} -i "$iDIR/microphone.png" "Microphone Switched ON" + fi +} + +# Execute accordingly +if [[ -x `which pulsemixer` ]]; then + if [[ "$1" == "--get" ]]; then + get_volume + elif [[ "$1" == "--inc" ]]; then + inc_volume + elif [[ "$1" == "--dec" ]]; then + dec_volume + elif [[ "$1" == "--toggle" ]]; then + toggle_mute + elif [[ "$1" == "--toggle-mic" ]]; then + toggle_mic + else + echo $(get_volume)% + fi +else + ${notify_cmd} "'pulsemixer' is not installed." +fi diff --git a/hypr/scripts/wallpaper b/hypr/scripts/wallpaper new file mode 100755 index 0000000..f5d9941 --- /dev/null +++ b/hypr/scripts/wallpaper @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Set Wallpaper in Hyprland + +# WALLPAPER='/home/legrems/Pictures/wallpapers/wallpaper_3.jpg' +WALLPAPER='/home/legrems/Pictures/wallpapers/wallpaper_3.jpg' + +swaybg --output '*' --mode fill --image "$WALLPAPER" diff --git a/hypr/scripts/wlogout b/hypr/scripts/wlogout new file mode 100755 index 0000000..3c67580 --- /dev/null +++ b/hypr/scripts/wlogout @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## wlogout with alt layout and style file + +LAYOUT="$HOME/.config/hypr/wlogout/layout" +STYLE="$HOME/.config/hypr/wlogout/style.css" + +if [[ ! `pidof wlogout` ]]; then + wlogout --layout ${LAYOUT} --css ${STYLE} \ + --buttons-per-row 5 \ + --column-spacing 50 \ + --row-spacing 50 \ + --margin-top 390 \ + --margin-bottom 390 \ + --margin-left 150 \ + --margin-right 150 +else + pkill wlogout +fi diff --git a/hypr/scripts/wofi_menu b/hypr/scripts/wofi_menu new file mode 100755 index 0000000..b632081 --- /dev/null +++ b/hypr/scripts/wofi_menu @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## launch wofi with alt config + +CONFIG="$HOME/.config/hypr/wofi/config" +STYLE="$HOME/.config/hypr/wofi/style.css" + +if [[ ! `pidof wofi` ]]; then + wofi --show drun --prompt 'Search...' --conf ${CONFIG} --style ${STYLE} +else + pkill wofi +fi diff --git a/hypr/scripts/wofi_powermenu b/hypr/scripts/wofi_powermenu new file mode 100755 index 0000000..6d7f855 --- /dev/null +++ b/hypr/scripts/wofi_powermenu @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Wofi Powermenu + +## Files +CONFIG="$HOME/.config/hypr/wofi/config" +STYLE="$HOME/.config/hypr/wofi/style.css" + +## Wofi Command +wofi_command="wofi --show dmenu \ + --conf ${CONFIG} --style ${STYLE} \ + --width=300 --height=215 \ + --cache-file=/dev/null \ + --hide-scroll --no-actions \ + --define=matching=fuzzy" + +uptime=$(uptime -p | sed -e 's/up //g') + +## Entries +shutdown=" Shutdown" +reboot=" Restart" +lock=" Lock" +suspend=" Sleep" +logout=" Logout" + +# Ask for confirmation +cdialog () { + yad --title='Confirm?' --borders=15 --center --fixed --undecorated --button=Yes:0 --button=No:1 --text="Are you sure?" --text-align=center +} + +# Variable passed to rofi +open_menu () { + options="$lock\n$suspend\n$logout\n$reboot\n$shutdown" + + chosen="$(echo -e "$options" | $wofi_command --prompt "UP - $uptime")" + case $chosen in + $shutdown) + cdialog + if [[ "$?" == 0 ]]; then + systemctl poweroff + else + exit + fi + ;; + $reboot) + cdialog + if [[ "$?" == 0 ]]; then + systemctl reboot + else + exit + fi + ;; + $lock) + ~/.config/hypr/scripts/lockscreen + ;; + $suspend) + cdialog + if [[ "$?" == 0 ]]; then + mpc -q pause + pulsemixer --mute + ~/.config/hypr/scripts/lockscreen + systemctl suspend + else + exit + fi + ;; + $logout) + cdialog + if [[ "$?" == 0 ]]; then + hyprctl dispatch exit 0 + else + exit + fi + ;; + esac +} + +if [[ ! `pidof wofi` ]]; then + open_menu +else + pkill wofi +fi + diff --git a/hypr/theme/current.bash b/hypr/theme/current.bash new file mode 100644 index 0000000..000c850 --- /dev/null +++ b/hypr/theme/current.bash @@ -0,0 +1,36 @@ +# Shell variables +# Generated by 'wal' +wallpaper='/home/legrems/Pictures/wallpapers/wallpaper_3.jpg' + +# Special +background='#0F161C' +foreground='#c0cbcb' +cursor='#c0cbcb' + +# Colors +color0='#0F161C' +color1='#50696F' +color2='#9D632C' +color3='#F59E0A' +color4='#5B7C83' +color5='#5F8188' +color6='#68888D' +color7='#c0cbcb' +color8='#868e8e' +color9='#50696F' +color10='#9D632C' +color11='#F59E0A' +color12='#5B7C83' +color13='#5F8188' +color14='#68888D' +color15='#c0cbcb' + +# FZF colors +export FZF_DEFAULT_OPTS=" + $FZF_DEFAULT_OPTS + --color fg:7,bg:0,hl:1,fg+:232,bg+:1,hl+:255 + --color info:7,prompt:2,spinner:1,pointer:232,marker:1 +" + +# Fix LS_COLORS being unreadable. +export LS_COLORS="${LS_COLORS}:su=30;41:ow=30;42:st=30;44:" diff --git a/hypr/theme/default.bash b/hypr/theme/default.bash new file mode 100644 index 0000000..ec71905 --- /dev/null +++ b/hypr/theme/default.bash @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------------------ +# Copyright (C) 2020-2024 Aditya Shakya +# +# Default Theme +# ------------------------------------------------------------------------------ + +# Colors +background='#20262C' +foreground='#f1fcf9' +color0='#20262c' +color1='#db86ba' +color2='#74dd91' +color3='#e49186' +color4='#75dbe1' +color5='#b4a1db' +color6='#9ee9ea' +color7='#f1fcf9' +color8='#465463' +color9='#d04e9d' +color10='#4bc66d' +color11='#db695b' +color12='#3dbac2' +color13='#825ece' +color14='#62cdcd' +color15='#e0e5e5' + +# Wallpaper +wallpaper="$HOME/.config/hypr/wallpapers/wallpaper.png" diff --git a/hypr/theme/theme.sh b/hypr/theme/theme.sh new file mode 100755 index 0000000..13c2e25 --- /dev/null +++ b/hypr/theme/theme.sh @@ -0,0 +1,294 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Script To Apply Themes + +## Theme ------------------------------------ +DIR="$HOME/.config/hypr" + +## Directories ------------------------------ +PATH_ALAC="$DIR/alacritty" +PATH_FOOT="$DIR/foot" +PATH_MAKO="$DIR/mako" +PATH_ROFI="$DIR/rofi" +PATH_WAYB="$DIR/waybar" +PATH_WLOG="$DIR/wlogout" +PATH_WOFI="$DIR/wofi" + +## Source Theme File ------------------------ +CURRENT_THEME="$DIR/theme/current.bash" +DEFAULT_THEME="$DIR/theme/default.bash" +PYWAL_THEME="$HOME/.cache/wal/colors.sh" + +## Check if current file exist +if [[ ! -e "$CURRENT_THEME" ]]; then + touch "$CURRENT_THEME" +fi + +## Default Theme +source_default() { + cat ${DEFAULT_THEME} > ${CURRENT_THEME} + source ${CURRENT_THEME} + altbackground="`pastel color $background | pastel lighten 0.10 | pastel format hex`" + altforeground="`pastel color $foreground | pastel darken 0.30 | pastel format hex`" + modbackground=(`pastel gradient -n 3 $background $altbackground | pastel format hex`) + accent="$color5" + notify-send -h string:x-canonical-private-synchronous:sys-notify-dtheme -u normal -i ${PATH_MAKO}/icons/palette.png "Applying Default Theme..." +} + +## Random Theme +source_pywal() { + # Set you wallpaper directory here. + WALLDIR="`xdg-user-dir PICTURES`/wallpapers" + + # Check for wallpapers + check_wallpaper() { + if [[ -d "$WALLDIR" ]]; then + WFILES="`ls --format=single-column $WALLDIR | wc -l`" + if [[ "$WFILES" == 0 ]]; then + notify-send -h string:x-canonical-private-synchronous:sys-notify-noimg -u low -i ${PATH_MAKO}/icons/picture.png "There are no wallpapers in : $WALLDIR" + exit + fi + else + mkdir -p "$WALLDIR" + notify-send -h string:x-canonical-private-synchronous:sys-notify-noimg -u low -i ${PATH_MAKO}/icons/picture.png "Put some wallpapers in : $WALLDIR" + exit + fi + } + + # Run `pywal` to generate colors + generate_colors() { + check_wallpaper + if [[ `which wal` ]]; then + notify-send -t 50000 -h string:x-canonical-private-synchronous:sys-notify-runpywal -i ${PATH_MAKO}/icons/timer.png "Generating Colorscheme. Please wait..." + wal -q -n -s -t -e -i "$WALLDIR" + if [[ "$?" != 0 ]]; then + notify-send -h string:x-canonical-private-synchronous:sys-notify-runpywal -u normal -i ${PATH_MAKO}/icons/palette.png "Failed to generate colorscheme." + exit + fi + else + notify-send -h string:x-canonical-private-synchronous:sys-notify-runpywal -u normal -i ${PATH_MAKO}/icons/palette.png "'pywal' is not installed." + exit + fi + } + + generate_colors + cat ${PYWAL_THEME} > ${CURRENT_THEME} + source ${CURRENT_THEME} + altbackground="`pastel color $background | pastel lighten 0.10 | pastel format hex`" + altforeground="`pastel color $foreground | pastel darken 0.30 | pastel format hex`" + modbackground=(`pastel gradient -n 3 $background $altbackground | pastel format hex`) + accent="$color4" +} + +## Wallpaper --------------------------------- +apply_wallpaper() { + sed -i -e "s#WALLPAPER=.*#WALLPAPER='$wallpaper'#g" ${DIR}/scripts/wallpaper + bash ${DIR}/scripts/wallpaper & +} + +## Alacritty --------------------------------- +apply_alacritty() { + # alacritty : colors + cat > ${PATH_ALAC}/colors.toml <<- _EOF_ + ## Colors configuration + [colors.primary] + background = "${background}" + foreground = "${foreground}" + + [colors.normal] + black = "${color0}" + red = "${color1}" + green = "${color2}" + yellow = "${color3}" + blue = "${color4}" + magenta = "${color5}" + cyan = "${color6}" + white = "${color7}" + + [colors.bright] + black = "${color8}" + red = "${color9}" + green = "${color10}" + yellow = "${color11}" + blue = "${color12}" + magenta = "${color13}" + cyan = "${color14}" + white = "${color15}" + _EOF_ +} + +## Foot -------------------------------------- +apply_foot() { + # foot : colors + cat > ${PATH_FOOT}/colors.ini <<- _EOF_ + ## Colors configuration + [colors] + alpha=1.0 + foreground=${foreground:1} + background=${background:1} + + ## Normal/regular colors (color palette 0-7) + regular0=${color0:1} # black + regular1=${color1:1} # red + regular2=${color2:1} # green + regular3=${color3:1} # yellow + regular4=${color4:1} # blue + regular5=${color5:1} # magenta + regular6=${color6:1} # cyan + regular7=${color7:1} # white + + ## Bright colors (color palette 8-15) + bright0=${color8:1} # bright black + bright1=${color9:1} # bright red + bright2=${color10:1} # bright green + bright3=${color11:1} # bright yellow + bright4=${color12:1} # bright blue + bright5=${color13:1} # bright magenta + bright6=${color14:1} # bright cyan + bright7=${color15:1} # bright white + _EOF_ +} + +## Mako -------------------------------------- +apply_mako() { + # mako : config + sed -i '/# Mako_Colors/Q' ${PATH_MAKO}/config + cat >> ${PATH_MAKO}/config <<- _EOF_ + # Mako_Colors + background-color=${background} + text-color=${foreground} + border-color=${modbackground[1]} + progress-color=over ${accent} + + [urgency=low] + border-color=${modbackground[1]} + default-timeout=2000 + + [urgency=normal] + border-color=${modbackground[1]} + default-timeout=5000 + + [urgency=high] + border-color=${color1} + text-color=${color1} + default-timeout=0 + _EOF_ + + pkill mako && bash ${DIR}/scripts/notifications & +} + +## Rofi -------------------------------------- +apply_rofi() { + # rofi : colors + cat > ${PATH_ROFI}/shared/colors.rasi <<- EOF + * { + background: ${background}; + background-alt: ${modbackground[1]}; + foreground: ${foreground}; + selected: ${accent}; + active: ${color2}; + urgent: ${color1}; + } + EOF +} + +## Waybar ------------------------------------ +apply_waybar() { + # waybar : colors + cat > ${PATH_WAYB}/colors.css <<- EOF + /** ********** Colors ********** **/ + @define-color background ${background}; + @define-color background-alt1 ${modbackground[1]}; + @define-color background-alt2 ${modbackground[2]}; + @define-color foreground ${foreground}; + @define-color selected ${accent}; + @define-color black ${color0}; + @define-color red ${color1}; + @define-color green ${color2}; + @define-color yellow ${color3}; + @define-color blue ${color4}; + @define-color magenta ${color5}; + @define-color cyan ${color6}; + @define-color white ${color7}; + EOF + + pkill waybar && bash ${DIR}/scripts/statusbar & +} + +## Wlogout ----------------------------------- +apply_wlogout() { + # wlogout : colors + cat > ${PATH_WLOG}/colors.css <<- EOF + /** ********** Colors ********** **/ + @define-color background ${background}; + @define-color background-alt1 ${modbackground[1]}; + @define-color background-alt2 ${modbackground[2]}; + @define-color foreground ${foreground}; + @define-color selected ${accent}; + @define-color black ${color0}; + @define-color red ${color1}; + @define-color green ${color2}; + @define-color yellow ${color3}; + @define-color blue ${color4}; + @define-color magenta ${color5}; + @define-color cyan ${color6}; + @define-color white ${color7}; + EOF +} + +## Wofi -------------------------------------- +apply_wofi() { + # wofi : colors + sed -i ${PATH_WOFI}/style.css \ + -e "s/@define-color background .*/@define-color background ${background};/g" \ + -e "s/@define-color background-alt1 .*/@define-color background-alt1 ${modbackground[1]};/g" \ + -e "s/@define-color background-alt2 .*/@define-color background-alt2 ${modbackground[2]};/g" \ + -e "s/@define-color foreground .*/@define-color foreground ${foreground};/g" \ + -e "s/@define-color selected .*/@define-color selected ${accent};/g" \ + -e "s/@define-color black .*/@define-color black ${color0};/g" \ + -e "s/@define-color red .*/@define-color red ${color1};/g" \ + -e "s/@define-color green .*/@define-color green ${color2};/g" \ + -e "s/@define-color yellow .*/@define-color yellow ${color3};/g" \ + -e "s/@define-color blue .*/@define-color blue ${color4};/g" \ + -e "s/@define-color magenta .*/@define-color magenta ${color5};/g" \ + -e "s/@define-color cyan .*/@define-color cyan ${color6};/g" \ + -e "s/@define-color white .*/@define-color white ${color7};/g" +} + +## Hyprland -------------------------------------- +apply_hypr() { + # hyprland : theme + sed -i ${DIR}/hyprtheme.conf \ + -e "s/\$active_border_col_1 =.*/\$active_border_col_1 = 0xFF${accent:1}/g" \ + -e "s/\$active_border_col_2 =.*/\$active_border_col_2 = 0xFF${color1:1}/g" \ + -e "s/\$inactive_border_col_1 =.*/\$inactive_border_col_1 = 0xFF${modbackground[1]:1}/g" \ + -e "s/\$inactive_border_col_2 =.*/\$inactive_border_col_2 = 0xFF${modbackground[2]:1}/g" \ + -e "s/\$group_border_active_col =.*/\$group_border_active_col = 0xFF${color2:1}/g" \ + -e "s/\$group_border_inactive_col =.*/\$group_border_inactive_col = 0xFF${color3:1}/g" \ + -e "s/\$group_border_locked_active_col =.*/\$group_border_locked_active_col = 0xFF${color1:1}/g" \ + -e "s/\$group_border_locked_inactive_col =.*/\$group_border_locked_inactive_col = 0xFF${color4:1}/g" \ + -e "s/\$groupbar_text_color =.*/\$groupbar_text_color = 0xFF${foreground:1}/g" +} + +## Source Theme Accordingly ----------------- +if [[ "$1" == '--default' ]]; then + source_default +elif [[ "$1" == '--pywal' ]]; then + source_pywal +else + echo "Available Options: --default --pywal" + exit 1 +fi + +## Execute Script --------------------------- +apply_wallpaper +apply_alacritty +apply_foot +apply_mako +apply_rofi +apply_waybar +apply_wlogout +apply_wofi +apply_hypr diff --git a/hypr/wallpapers/lockscreen.png b/hypr/wallpapers/lockscreen.png new file mode 120000 index 0000000..cf6a2cb --- /dev/null +++ b/hypr/wallpapers/lockscreen.png @@ -0,0 +1 @@ +wallpaper.png \ No newline at end of file diff --git a/hypr/wallpapers/wallpaper-alt.png b/hypr/wallpapers/wallpaper-alt.png new file mode 100644 index 0000000..06d4c57 Binary files /dev/null and b/hypr/wallpapers/wallpaper-alt.png differ diff --git a/hypr/wallpapers/wallpaper.png b/hypr/wallpapers/wallpaper.png new file mode 100644 index 0000000..80a3372 Binary files /dev/null and b/hypr/wallpapers/wallpaper.png differ diff --git a/hypr/waybar/colors.css b/hypr/waybar/colors.css new file mode 100644 index 0000000..f110fb2 --- /dev/null +++ b/hypr/waybar/colors.css @@ -0,0 +1,14 @@ +/** ********** Colors ********** **/ +@define-color background #0F161C; +@define-color background-alt1 #18232c; +@define-color background-alt2 #21303d; +@define-color foreground #c0cbcb; +@define-color selected #5B7C83; +@define-color black #0F161C; +@define-color red #50696F; +@define-color green #9D632C; +@define-color yellow #F59E0A; +@define-color blue #5B7C83; +@define-color magenta #5F8188; +@define-color cyan #68888D; +@define-color white #c0cbcb; diff --git a/hypr/waybar/config b/hypr/waybar/config new file mode 100644 index 0000000..b464940 --- /dev/null +++ b/hypr/waybar/config @@ -0,0 +1,28 @@ +// Copyright (C) 2020-2024 Aditya Shakya +// +// Waybar config file +{ + "include": "~/.config/hypr/waybar/modules", + "name": "main-bar", // Waybar name + "id": "main-bar", // Waybar id + "layer": "top", // Waybar at top layer + //"mode": "dock", // Display mode (dock|hide|invisible|overlay) + "exclusive": true, // Request an exclusive zone from the compositor + "passthrough": false, // Pass any pointer events to the window under the bar + "position": "top", // Waybar position (top|bottom|left|right) + "height": 34, // Waybar height (to be removed for auto height) + "width": "", // Waybar width (empty for auto width) + "spacing": 0, // Gaps between modules + "margin": 0, // Space around the bar + "margin-top": 0, // Space above the bar + "margin-bottom": 0, // Space below the bar + "margin-left": 0, // Space to the left of the bar + "margin-right": 0, // Space to the right of the bar + "fixed-center": true, // Center modules position + "ipc": true, // Control waybar with `swaymsg bar` commands + // Choose the order of the modules + //"modules-left": ["custom/menu", "hyprland/workspaces", "idle_inhibitor", "tray", "mpd#2", "mpd#3", "mpd#4", "mpd" ], + "modules-left": ["custom/menu", "hyprland/workspaces", "idle_inhibitor", "tray", "custom/spotify" ], + "modules-center": [ "cpu", "cpu#2", "memory", "memory#2", "disk", "disk#2" ], + "modules-right": ["custom/themes", "pulseaudio", "pulseaudio#2", "backlight", "backlight#2", "battery", "battery#2", "bluetooth", "bluetooth#2", "network", "network#2", "clock", "clock#2", "custom/power"], +} diff --git a/hypr/waybar/modules b/hypr/waybar/modules new file mode 100644 index 0000000..ed6c06e --- /dev/null +++ b/hypr/waybar/modules @@ -0,0 +1,327 @@ +// Copyright (C) 2020-2024 Aditya Shakya +// +// Waybar modules configuration +{ + // waybar-backlight + "backlight": { + "interval": 2, + //"device": "amdgpu_bl0", + "format": "{icon}", + "format-icons": ["", "", "", "", "", "", ""], + // Commands to execute on events + "on-scroll-up": "light -A 5%", + "on-scroll-down": "light -U 5%", + "smooth-scrolling-threshold": 1, + }, + "backlight#2": { + "interval": 2, + //"device": "amdgpu_bl0", + "format": "{percent}%", + // Commands to execute on events + "on-scroll-up": "light -A 5%", + "on-scroll-down": "light -U 5%", + "smooth-scrolling-threshold": 1, + }, + + // waybar-battery + "battery": { + "interval": 60, + //"bat": "BAT1", + //"adapter": "ACAD", + "full-at": 100, + "design-capacity": false, + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon}", + "format-charging": "", + "format-plugged": "ﮣ", + "format-full": "", + "format-icons": ["", "", "", "", "", "", "", "", ""], + "format-time": "{H}h {M}min", + "tooltip": true, + }, + "battery#2": { + "interval": 60, + //"bat": "BAT1", + //"adapter": "ACAD", + "full-at": 100, + "design-capacity": false, + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}%", + "format-charging": "{capacity}%", + "format-plugged": "{capacity}%", + "format-full": "Full", + "format-alt": "{time}", + "format-time": "{H}h {M}min", + "tooltip": true, + }, + + // waybar-bluetooth + "bluetooth": { + //"controller": "controller1", + //"format-device-preference": "", + "format": "", + "format-on": "", + "format-off": "", + "format-disabled": "", + "format-connected": "", + "format-connected-battery": "", + "tooltip": true, + "tooltip-format": "{controller_alias}\t{controller_address}", + "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", + "on-click": "~/.config/hypr/scripts/rofi_bluetooth", + "on-click-right": "blueman-manager", + }, + "bluetooth#2": { + //"controller": "controller1", + //"format-device-preference": "", + "format": "{status}", + "format-on": "{status}", + "format-off": "{status}", + "format-disabled": "{status}", + "format-connected": "{device_alias}", + "format-connected-battery": "{device_alias}, {device_battery_percentage}%", + "tooltip": true, + "tooltip-format": "{controller_alias}\t{controller_address}", + "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", + "on-click": "~/.config/hypr/scripts/rofi_bluetooth", + "on-click-right": "blueman-manager", + }, + + // waybar-clock + "clock": { + "tooltip-format": "{:%B %Y}\n{calendar}", + "format": "", + }, + "clock#2": { + "interval": 60, + "tooltip-format": "{:%B %Y}\n{calendar}", + "format": "{:%I:%M %p}", + "format-alt": "{:%a %b %d, %G}" + }, + + // waybar-cpu + "cpu": { + "interval": 5, + "format": "", + }, + "cpu#2": { + "interval": 5, + "format": "{usage}%", + }, + + // waybar-custom + "custom/themes": { + "format": "", + "tooltip": false, + "on-click": "$HOME/.config/hypr/theme/theme.sh --pywal", + "on-click-right": "$HOME/.config/hypr/theme/theme.sh --default", + }, + + "custom/menu": { + "format": "", + "tooltip": false, + //"on-click": "$HOME/.config/hypr/scripts/wofi_menu", + "on-click": "$HOME/.config/hypr/scripts/rofi_launcher", + "on-click-right": "$HOME/.config/hypr/scripts/rofi_runner", + }, + + "custom/power": { + "format": "襤", + "tooltip": false, + //"on-click": "$HOME/.config/hypr/scripts/wlogout", + "on-click": "$HOME/.config/hypr/scripts/rofi_powermenu", + }, + + // waybar-disk + "disk": { + "interval": 30, + "format": "", + }, + "disk#2": { + "interval": 30, + "format": "{free}", + }, + + // waybar-memory + "memory": { + "interval": 10, + "format": "", + }, + "memory#2": { + "interval": 10, + "format": "{used:0.1f}G", + }, + + // waybar-spotify + "custom/spotify": { + "exec": "$HOME/.config/hypr/waybar/spotify", + "interval": 1, + "format": "{}", + "tooltip": true, + "max-length": 40, + "on-click": "playerctl play-pause", + "on-click-middle": "playerctl previous", + "on-click-right": "playerctl next", + "on-scroll-up": "playerctl position 05+", + "on-scroll-down": "playerctl position 05-", + "smooth-scrolling-threshold": 1, + }, + + // waybar-mpd + "mpd": { + "interval": 2, + "unknown-tag": "N/A", + "format": "{artist} - {title} | 祥 {elapsedTime:%M:%S}", + "format-disconnected": "Disconnected", + "format-paused": "{artist} - {title}", + "format-stopped": "Stopped", + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)", + // Commands to execute on events + "on-click": "mpc toggle", + "on-scroll-up": "mpc seek +00:00:01", + "on-scroll-down": "mpc seek -00:00:01", + "smooth-scrolling-threshold": 1, + }, + "mpd#2": { + "format": "玲", + "format-disconnected": "玲", + "format-paused": "玲", + "format-stopped": "玲", + // Commands to execute on events + "on-click": "mpc prev", + }, + "mpd#3": { + "interval": 1, + "format": "{stateIcon}", + "format-disconnected": "", + "format-paused": "{stateIcon}", + "format-stopped": "", + "state-icons": { + "paused": "", + "playing": "" + }, + // Commands to execute on events + "on-click": "mpc toggle", + }, + "mpd#4": { + "format": "怜", + "format-disconnected": "怜", + "format-paused": "怜", + "format-stopped": "怜", + // Commands to execute on events + "on-click": "mpc next", + }, + + // waybar-network + "network": { + "interval": 5, + //"interface": "wlan*", // (Optional) To force the use of this interface, set it for netspeed to work + "format-wifi": "直", + "format-ethernet": "", + "format-linked": "", + "format-disconnected": "睊", + "format-disabled": "睊", + "tooltip-format": " {ifname} via {gwaddr}", + //"on-click": "[[ ! `pidof nm-connection-editor` ]] && nm-connection-editor || pkill nm-connection-e", + "on-click": "~/.config/hypr/scripts/rofi_network", + }, + "network#2": { + "interval": 5, + //"interface": "wlan*", // (Optional) To force the use of this interface, set it for netspeed to work + "format-wifi": "{essid}", + "format-ethernet": "{ipaddr}/{cidr}", + "format-linked": "{ifname} (No IP)", + "format-disconnected": "Disconnected", + "format-disabled": "Disabled", + "format-alt": " {bandwidthUpBits} |  {bandwidthDownBits}", + "tooltip-format": " {ifname} via {gwaddr}", + }, + + // waybar-pulseaudio + "pulseaudio": { + //"format": "{volume}% {icon} {format_source}", + "format": "{icon}", + "format-muted": "", + "format-bluetooth": "", + "format-bluetooth-muted": "", + "format-source": "", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "ﳌ", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "scroll-step": 5.0, + // Commands to execute on events + "on-click": "pulsemixer --toggle-mute", + "on-click-right": "pulsemixer --toggle-mute", + "smooth-scrolling-threshold": 1, + }, + "pulseaudio#2": { + //"format": "{volume}% {icon} {format_source}", + "format": "{volume}%", + "format-muted": "Mute", + "format-bluetooth": "{volume}%", + "format-bluetooth-muted": "Mute", + "format-source": "{volume}%", + "scroll-step": 5.0, + // Commands to execute on events + "on-click": "pulsemixer --toggle-mute", + "on-click-right": "pulsemixer --toggle-mute", + "smooth-scrolling-threshold": 1, + }, + + // waybar-idle-inhibitor + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + }, + "timeout": 30 + }, + + // waybar-wlr-workspaces + "hyprland/workspaces": { + "format": "{icon}", + "sort-by-number": true, + "active-only": false, + "format-icons": { + "1": "", + "2": "", + "3": "", + "4": "", + "5": "", + "6": "漣", + "7": "", + "8": "", + "9": "", + "10": "ﳴ", + "urgent": "", + "focused": "", + "default": "" + }, + "on-click": "activate", + }, + + // waybar-tray + "tray": { + "icon-size": 16, + "spacing": 10 + } +} diff --git a/hypr/waybar/spotify b/hypr/waybar/spotify new file mode 100755 index 0000000..089cc90 --- /dev/null +++ b/hypr/waybar/spotify @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya +## +## Script for spotify for waybar + +player_status=$(playerctl status 2> /dev/null) + +if [ "$player_status" = "Playing" ]; then + echo -e " $(playerctl metadata artist) - $(playerctl metadata title)\nPlaying: $(playerctl metadata artist) - $(playerctl metadata title)\nplaying" +elif [ "$player_status" = "Paused" ]; then + echo -e " $(playerctl metadata artist) - $(playerctl metadata title)\nPaused: $(playerctl metadata artist) - $(playerctl metadata title)\npaused" +else + echo -e " Spotify Offline!\nSpotify Offline.\noffline" +fi diff --git a/hypr/waybar/style.css b/hypr/waybar/style.css new file mode 100644 index 0000000..8e00068 --- /dev/null +++ b/hypr/waybar/style.css @@ -0,0 +1,314 @@ +/* + * Copyright (C) 2020-2024 Aditya Shakya +*/ + +/** ********** Import Colors ********** **/ +@import "./colors.css"; + +/** ********** Fonts ********** **/ +* { + font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif; + font-size: 14px; +} + +/** ********** Waybar Window ********** **/ +window#waybar { + background-color: @background; + color: @foreground; + border-bottom: 2px solid @background-alt1; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.5; +} + +/** ********** Custom ********** **/ + +#custom-menu { + background-color: @background-alt1; + color: @magenta; + font-size: 18px; + border-radius: 0px 14px 0px 0px; + margin: 0px 0px 0px 0px; + padding: 2px 8px 2px 8px; +} + +#custom-themes { + background-color: @selected; +} + +#custom-power { + background-color: @red; + font-size: 16px; +} + +#custom-power, #custom-themes { + color: @background; + border-radius: 10px; + margin: 6px 6px 6px 0px; + padding: 2px 8px 2px 8px; +} + +/** ********** Idle Inhibitor ********** **/ +#idle_inhibitor { + background-color: @green; + color: @background; + border-radius: 10px; + margin: 6px 0px 6px 6px ; + padding: 4px 6px; +} +#idle_inhibitor.deactivated { + background-color: @red; +} + +/** ********** Tray ********** **/ +#tray { + background-color: @background-alt1; + border-radius: 10px; + margin: 6px 0px 6px 6px ; + padding: 4px 6px; +} +#tray > .passive { + -gtk-icon-effect: dim; +} +#tray > .needs-attention { + -gtk-icon-effect: highlight; +} +#tray > .active { +} + +/** ********** MPD ********** **/ +@keyframes gradient { + 0% { + background-position: 0% 50%; + } + 50% { + background-position: 100% 50%; + } + 100% { + background-position: 0% 50%; + } +} + +#mpd { + color: @foreground; + font-size: 12px; + font-weight: bold; +} +#mpd.disconnected { + color: @red; +} +#mpd.stopped { + color: @red; +} +#mpd.playing { + color: @cyan; +} +#mpd.paused { +} + +#mpd.2 { + border-radius: 10px 0px 0px 10px; + margin: 6px 0px 6px 6px ; + padding: 4px 6px 4px 10px; +} +#mpd.3 { + margin: 6px 0px 6px 0px ; + padding: 4px; +} +#mpd.4 { + border-radius: 0px 10px 10px 0px; + margin: 6px 6px 6px 0px ; + padding: 4px 10px 4px 6px; +} +#mpd.2,#mpd.3,#mpd.4 { + background-color: @background-alt1; + font-size: 14px; +} + +/** ********** Spotify ********** **/ +#custom-spotify { + background-color: @background-alt1; + color: @foreground; + border-radius: 10px; + margin: 6px 0px 6px 6px ; + padding: 4px 8px; + font-size: 12px; + font-weight: bold; +} + +#custom-spotify.paused { + color: @foreground; +} + +#custom-spotify.playing { + background: linear-gradient(90deg, @magenta 25%, @red 50%, @yellow 75%, @cyan 100%); + background-size: 300% 300%; + animation: gradient 10s ease infinite; + color: @background; +} + +#custom-spotify.offline { + color: @red; +} + +/** ********** CPU ********** **/ +#cpu { + color: @red; +} + +/** ********** Memory ********** **/ +#memory { + color: @green; +} + +/** ********** Disk ********** **/ +#disk { + color: @yellow; +} + +/** ********** Pulseaudio ********** **/ +#pulseaudio { + color: @blue; +} +#pulseaudio.bluetooth { + color: @cyan; +} +#pulseaudio.muted { + color: @red; +} + +#pulseaudio.2 { +} +#pulseaudio.2.bluetooth { +} +#pulseaudio.2.muted { +} + +/** ********** Backlight ********** **/ +#backlight { + color: @magenta; +} + +/** ********** Battery ********** **/ +#battery { + color: @cyan; +} +#battery.charging { +} +#battery.plugged { +} +@keyframes blink { + to { + color: @foreground; + } +} +#battery.critical:not(.charging) { + background-color: @background-alt2; +} +#battery.2.critical:not(.charging) { + background-color: @background-alt1; + color: @red; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +/** ********** Network ********** **/ +#network { + color: @yellow; +} +#network.disconnected,#network.disabled { + color: @red; +} +#network.linked { +} +#network.ethernet { +} +#network.wifi { +} + +/** ********** Bluetooth ********** **/ +#bluetooth { + color: @green; +} +#bluetooth.disabled{ + color: @red; +} +#bluetooth.off{ + color: @red; +} +#bluetooth.on{ +} +#bluetooth.connected{ +} +#bluetooth.discoverable{ +} +#bluetooth.discovering{ +} +#bluetooth.pairable{ +} + +/** ********** Clock ********** **/ +#clock { + color: @blue; +} + +/** ********** WLR Desktop ********** **/ +#workspaces { + background-color: @background; + border-radius: 10px; + margin-left: 6px ; + margin-bottom: 2px ; + padding: 0px; +} +#workspaces button{ + color: @foreground; +} +#workspaces button.active{ + color: @red; +} +#workspaces button.urgent{ + color: @green; +} +#workspaces button.hidden{ + color: @yellow; +} + +/** ********** Common style ********** **/ +#backlight, +#battery, +#clock, +#cpu, +#disk, +#memory, +#pulseaudio, +#network, +#bluetooth { + background-color: @background-alt2; + border-radius: 10px 0px 0px 10px; + margin: 6px 0px 6px 0px ; + padding: 4px 6px; +} + +#backlight.2, +#battery.2, +#clock.2, +#cpu.2, +#disk.2, +#memory.2, +#pulseaudio.2, +#network.2, +#bluetooth.2 { + background-color: @background-alt1; + color: @foreground; + font-size: 12px; + font-weight: bold; + border-radius: 0px 10px 10px 0px; + margin: 6px 6px 6px 0px ; + padding: 5px 6px 4px 6px; +} diff --git a/hypr/wlogout/actions b/hypr/wlogout/actions new file mode 100755 index 0000000..1eff8cd --- /dev/null +++ b/hypr/wlogout/actions @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +## Copyright (C) 2020-2024 Aditya Shakya + +## wlogout actions + +# Ask for confirmation +cdialog () { + yad --title='Confirm?' --borders=15 --center --fixed --undecorated --button=Yes:0 --button=No:1 --text="Are you sure?" --text-align=center +} + +if [[ "$1" == '--shutdown' ]]; then + cdialog + if [[ "$?" == 0 ]]; then + systemctl poweroff + else + exit + fi +elif [[ "$1" == '--reboot' ]]; then + cdialog + if [[ "$?" == 0 ]]; then + systemctl reboot + else + exit + fi +elif [[ "$1" == '--hibernate' ]]; then + cdialog + if [[ "$?" == 0 ]]; then + systemctl hibernate + else + exit + fi +elif [[ "$1" == '--lock' ]]; then + ~/.config/hypr/scripts/lockscreen +elif [[ "$1" == '--suspend' ]]; then + cdialog + if [[ "$?" == 0 ]]; then + mpc -q pause + pulsemixer --mute + ~/.config/hypr/scripts/lockscreen + systemctl suspend + else + exit + fi +elif [[ "$1" == '--logout' ]]; then + cdialog + if [[ "$?" == 0 ]]; then + hyprctl dispatch exit 0 + else + exit + fi +fi diff --git a/hypr/wlogout/colors.css b/hypr/wlogout/colors.css new file mode 100644 index 0000000..f110fb2 --- /dev/null +++ b/hypr/wlogout/colors.css @@ -0,0 +1,14 @@ +/** ********** Colors ********** **/ +@define-color background #0F161C; +@define-color background-alt1 #18232c; +@define-color background-alt2 #21303d; +@define-color foreground #c0cbcb; +@define-color selected #5B7C83; +@define-color black #0F161C; +@define-color red #50696F; +@define-color green #9D632C; +@define-color yellow #F59E0A; +@define-color blue #5B7C83; +@define-color magenta #5F8188; +@define-color cyan #68888D; +@define-color white #c0cbcb; diff --git a/hypr/wlogout/icons/hibernate.png b/hypr/wlogout/icons/hibernate.png new file mode 100644 index 0000000..6e3ba13 Binary files /dev/null and b/hypr/wlogout/icons/hibernate.png differ diff --git a/hypr/wlogout/icons/lock.png b/hypr/wlogout/icons/lock.png new file mode 100644 index 0000000..72530d6 Binary files /dev/null and b/hypr/wlogout/icons/lock.png differ diff --git a/hypr/wlogout/icons/logout.png b/hypr/wlogout/icons/logout.png new file mode 100644 index 0000000..cf1ab31 Binary files /dev/null and b/hypr/wlogout/icons/logout.png differ diff --git a/hypr/wlogout/icons/reboot.png b/hypr/wlogout/icons/reboot.png new file mode 100644 index 0000000..b433e24 Binary files /dev/null and b/hypr/wlogout/icons/reboot.png differ diff --git a/hypr/wlogout/icons/shutdown.png b/hypr/wlogout/icons/shutdown.png new file mode 100644 index 0000000..80e89d1 Binary files /dev/null and b/hypr/wlogout/icons/shutdown.png differ diff --git a/hypr/wlogout/icons/suspend.png b/hypr/wlogout/icons/suspend.png new file mode 100644 index 0000000..a425d19 Binary files /dev/null and b/hypr/wlogout/icons/suspend.png differ diff --git a/hypr/wlogout/layout b/hypr/wlogout/layout new file mode 100644 index 0000000..c0afb9a --- /dev/null +++ b/hypr/wlogout/layout @@ -0,0 +1,30 @@ +{ + "label" : "suspend", + "text" : "Suspend", + "action" : "~/.config/hypr/wlogout/actions --suspend", + "keybind" : "u" +} +{ + "label" : "logout", + "text" : "Logout", + "action" : "~/.config/hypr/wlogout/actions --logout", + "keybind" : "e" +} +{ + "label" : "lock", + "text" : "Lock", + "action" : "~/.config/hypr/wlogout/actions --lock", + "keybind" : "l" +} +{ + "label" : "reboot", + "text" : "Reboot", + "action" : "~/.config/hypr/wlogout/actions --reboot", + "keybind" : "r" +} +{ + "label" : "shutdown", + "text" : "Shutdown", + "action" : "~/.config/hypr/wlogout/actions --shutdown", + "keybind" : "s" +} diff --git a/hypr/wlogout/style.css b/hypr/wlogout/style.css new file mode 100644 index 0000000..7f08780 --- /dev/null +++ b/hypr/wlogout/style.css @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2020-2024 Aditya Shakya +*/ + +/** ********** Import Colors ********** **/ +@import "./colors.css"; + +/** ********** Fonts ********** **/ +* { + font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif; + font-size: 14px; + font-weight: bold; +} + +/** ********** Main Window ********** **/ +window { + background-color: @background; +} + +/** ********** Buttons ********** **/ +button { + background-color: @background-alt1; + color: @foreground; + border: 1px solid @background-alt2; + border-radius: 10px; + background-repeat: no-repeat; + background-position: center; + background-size: 30%; +} + +button:focus, button:active, button:hover { + background-color: @selected; + color: @background; + outline-style: none; +} + +/** ********** Icons ********** **/ +#lock { + background-image: image(url("icons/lock.png"), url("/usr/share/wlogout/icons/lock.png")); +} + +#logout { + background-image: image(url("icons/logout.png"), url("/usr/share/wlogout/icons/logout.png")); +} + +#suspend { + background-image: image(url("icons/suspend.png"), url("/usr/share/wlogout/icons/suspend.png")); +} + +#hibernate { + background-image: image(url("icons/hibernate.png"), url("/usr/share/wlogout/icons/hibernate.png")); +} + +#shutdown { + background-image: image(url("icons/shutdown.png"), url("/usr/share/wlogout/icons/shutdown.png")); +} + +#reboot { + background-image: image(url("icons/reboot.png"), url("/usr/share/wlogout/icons/reboot.png")); +} diff --git a/hypr/wofi/config b/hypr/wofi/config new file mode 100644 index 0000000..0008e1f --- /dev/null +++ b/hypr/wofi/config @@ -0,0 +1,41 @@ +## Copyright (C) 2020-2024 Aditya Shakya +## +## Wofi Config + +## General +show=drun +prompt=Apps +normal_window=true +layer=top +term=foot + +## Geometry +width=400px +height=320px +location=0 +orientation=vertical +halign=fill +line_wrap=off +dynamic_lines=false + +## Images +allow_markup=true +allow_images=true +image_size=24 + +## Search +exec_search=false +hide_search=false +parse_search=false +insensitive=false + +## Other +hide_scroll=true +no_actions=true +sort_order=default +gtk_dark=true +filter_rate=100 + +## Keys +key_expand=Tab +key_exit=Escape diff --git a/hypr/wofi/style.css b/hypr/wofi/style.css new file mode 100644 index 0000000..12646f8 --- /dev/null +++ b/hypr/wofi/style.css @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2020-2024 Aditya Shakya +*/ + +/** ********** Colors ********** **/ +@define-color background #0F161C; +@define-color background-alt1 #18232c; +@define-color background-alt2 #21303d; +@define-color foreground #c0cbcb; +@define-color selected #5B7C83; +@define-color black #0F161C; +@define-color red #50696F; +@define-color green #9D632C; +@define-color yellow #F59E0A; +@define-color blue #5B7C83; +@define-color magenta #5F8188; +@define-color cyan #68888D; +@define-color white #c0cbcb; + +/** ********** Fonts ********** **/ +* { + font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif; + font-size: 12px; +} + +#window { + background-color: @background; + color: @foreground; + border: 0px solid @background-alt1; + border-radius: 0px; +} + +#outer-box { + padding: 10px; +} + +#input { + background-color: @background-alt1; + border: 0px solid @background-alt2; + padding: 4px 12px; +} + +#scroll { + margin-top: 10px; +} + +#inner-box { +} + +#img { + padding-right: 8px; +} + +#text { + color: @foreground; +} + +#text:selected { + color: @background; +} + +#entry { + padding: 6px; +} + +#entry:selected { + background-color: @selected; + color: @background; +} + +#unselected { +} + +#selected { +} + +#input, #entry:selected { + border-radius: 0px; +}