diff --git a/home/yashraj/shared/shell/bash.nix b/home/yashraj/shared/shell/bash.nix index 7cf3cdb..90bd7e3 100644 --- a/home/yashraj/shared/shell/bash.nix +++ b/home/yashraj/shared/shell/bash.nix @@ -68,7 +68,7 @@ in { cat = "${lib.getExe bat} --style=plain"; l = "${lib.getExe exa} -lF --time-style=long-iso --icons"; la = "${lib.getExe exa} -lah --tree"; - ls = "${lib.getExe exa} -h --git --icons --color=auto --group-directories-first -s extension"; + ls = "${lib.getExe exa} -ah --git --icons --color=auto --group-directories-first -s extension"; tree = "${lib.getExe exa} --tree --icons --tree"; ytmp3 = '' ${lib.getExe yt-dlp} -x --continue --add-metadata --embed-thumbnail --audio-format mp3 --audio-quality 0 --metadata-from-title="%(artist)s - %(title)s" --prefer-ffmpeg -o "%(title)s.%(ext)s" diff --git a/home/yashraj/yuki/desktop/wm/awesome/default.nix b/home/yashraj/yuki/X/default.nix similarity index 53% rename from home/yashraj/yuki/desktop/wm/awesome/default.nix rename to home/yashraj/yuki/X/default.nix index f92e15c..1c946dc 100644 --- a/home/yashraj/yuki/desktop/wm/awesome/default.nix +++ b/home/yashraj/yuki/X/default.nix @@ -1,11 +1,5 @@ -{ - config, - pkgs, - inputs, - ... -}: let +{config, ...}: let inherit (config.colorscheme) colors; - theme = "gruva"; in { xresources.extraConfig = '' Xft.antialias: true @@ -51,33 +45,4 @@ in { *color7: #${colors.base06} *color15: #${colors.base07} ''; - - home = { - sessionVariables = { - EDITOR = "nvim"; - BROWSER = "vivaldi"; - }; - - file = { - # Setup - ".config/awesome/configuration".source = ./. + "/${theme}"; - ".config/awesome/rc.lua".source = ./rc.lua; - ".config/awesome/helpers.lua".source = ./helpers.lua; - ".config/awesome/keys.lua".source = ./keys.lua; - - # Modules - ".config/awesome/module/json.lua".source = ./module/json.lua; - ".config/awesome/module/lockscreen".source = ./module/lockscreen; - ".config/awesome/module/window_switcher.lua".source = ./module/window_switcher.lua; - }; - }; - - imports = [ - ../../gtk.nix - ../../picom.nix - ../../rofi.nix - ../../flameshot.nix - ../../clipmenu.nix - ../../nm-applet.nix - ]; } diff --git a/home/yashraj/yuki/default.nix b/home/yashraj/yuki/default.nix index 3acecc4..54a70ef 100644 --- a/home/yashraj/yuki/default.nix +++ b/home/yashraj/yuki/default.nix @@ -14,6 +14,8 @@ ../shared/programs/neofetch.nix # Specific configuration - ./desktop/wm/awesome + ./desktop + ./services + ./X ]; } diff --git a/home/yashraj/yuki/desktop/clipmenu.nix b/home/yashraj/yuki/desktop/clipmenu.nix deleted file mode 100644 index 93f4b9b..0000000 --- a/home/yashraj/yuki/desktop/clipmenu.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - services.clipmenu.enable = true; -} diff --git a/home/yashraj/yuki/desktop/gtk.nix b/home/yashraj/yuki/desktop/default.nix similarity index 100% rename from home/yashraj/yuki/desktop/gtk.nix rename to home/yashraj/yuki/desktop/default.nix diff --git a/home/yashraj/yuki/desktop/flameshot.nix b/home/yashraj/yuki/desktop/flameshot.nix deleted file mode 100644 index d2f8e67..0000000 --- a/home/yashraj/yuki/desktop/flameshot.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - services.flameshot = { - enable = true; - - settings = { - General = { - disabledTrayIcon = true; - showStartupLaunchMessage = false; - }; - }; - }; -} diff --git a/home/yashraj/yuki/desktop/nm-applet.nix b/home/yashraj/yuki/desktop/nm-applet.nix deleted file mode 100644 index d2280d2..0000000 --- a/home/yashraj/yuki/desktop/nm-applet.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - services.network-manager-applet.enable = true; -} diff --git a/home/yashraj/yuki/desktop/picom.nix b/home/yashraj/yuki/desktop/picom.nix deleted file mode 100644 index ea90908..0000000 --- a/home/yashraj/yuki/desktop/picom.nix +++ /dev/null @@ -1,131 +0,0 @@ -{ - services.picom = { - enable = true; - backend = "glx"; - vSync = true; - shadow = true; - shadowOffsets = [(-40) (-20)]; - shadowOpacity = 0.55; - shadowExclude = [ - "_GTK_FRAME_EXTENTS@:c" - "_PICOM_SHADOW@:32c = 0" - "_NET_WM_WINDOW_TYPE:a = '_NET_WM_WINDOW_TYPE_NOTIFICATION'" - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" - "class_g = 'Conky'" - "class_g = 'slop'" - "window_type = 'combo'" - "window_type = 'desktop'" - "window_type = 'dnd'" - "window_type = 'dock'" - "window_type = 'dropdown_menu'" - "window_type = 'menu'" - "window_type = 'notification'" - "window_type = 'popup_menu'" - "window_type = 'splash'" - "window_type = 'toolbar'" - "window_type = 'utility'" - ]; - fade = true; - fadeDelta = 10; - fadeSteps = [0.03 0.03]; - fadeExclude = [ - "window_type = 'combo'" - "window_type = 'desktop'" - "window_type = 'dock'" - "window_type = 'dnd'" - "window_type = 'notification'" - "window_type = 'toolbar'" - "window_type = 'unknown'" - "window_type = 'utility'" - "_PICOM_FADE@:32c = 0" - ]; - activeOpacity = 1.0; - inactiveOpacity = 1.0; - menuOpacity = 1.0; - opacityRules = [ - "70:class_g = 'splash'" - "100:class_i = 'tray'" - "90:class_g = 'XTerm'" - "90:class_g = 'Alacritty'" - "90:class_g = 'kitty'" - ]; - wintypes = { - tooltip = { - fade = true; - shadow = true; - focus = true; - full-shadow = true; - }; - dock = {shadow = false;}; - dnd = {shadow = false;}; - popup_menu = {opacity = 1;}; - dropdown_menu = {opacity = 1;}; - desktop = {full-shadow = false;}; - normal = {full-shadow = false;}; - }; - settings = { - shadow-radius = 40; - shadow-color = "#000000"; - shadow-ignore-shaped = false; - frame-opacity = 1.0; - inactive-opacity-override = false; - focus-exclude = [ - "class_g = 'Cairo-clock'" - "class_g = 'Peek'" - "window_type = 'notification'" - "window_type = 'combo'" - "window_type = 'desktop'" - "window_type = 'dialog'" - "window_type = 'dnd'" - "window_type = 'dock'" - "window_type = 'dropdown_menu'" - "window_type = 'menu'" - "window_type = 'tooltip'" - "window_type = 'unknown'" - "window_type = 'utility'" - ]; - corner-radius = 15; - rounded-corners-exclude = [ - "_PICOM_SHADOW@:32c = 0" - "window_type = 'dock'" - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_MAXIMIZED_VERT'" - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_MAXIMIZED_HORZ'" - "class_g = 'Rofi'" - ]; - experimental-backends = true; - blur = { - method = "dual_kawase"; - kernel = "11x11gaussian"; - deviation = 1.0; - strength = 10; - background = true; - background-frame = true; - background-fixed = true; - }; - blur-background-exclude = [ - "_GTK_FRAME_EXTENTS@:c" - "window_type = 'combo'" - "window_type = 'desktop'" - "window_type = 'dnd'" - "window_type = 'menu'" - "window_type = 'toolbar'" - "window_type = 'tooltip'" - "window_type = 'utility'" - "window_type = 'unknown'" - "class_g = 'firefox' && window_type != 'normal'" - "class_g = 'slop'" - ]; - mark-wmwin-focused = true; - mark-ovredir-focused = true; - detect-rounded-corners = true; - detect-client-opacity = true; - detect-transient = true; - detect-client-leader = true; - glx-no-stencil = true; - use-damage = true; - transparent-clipping = false; - unredir-if-possible = false; - log-level = "warn"; - }; - }; -} diff --git a/home/yashraj/yuki/desktop/rofi.nix b/home/yashraj/yuki/desktop/rofi.nix deleted file mode 100644 index 4d1193f..0000000 --- a/home/yashraj/yuki/desktop/rofi.nix +++ /dev/null @@ -1,346 +0,0 @@ -{ - config, - pkgs, - ... -}: let - inherit (config.colorscheme) colors; -in { - programs.rofi = { - enable = true; - package = pkgs.rofi.override { - plugins = [pkgs.rofi-emoji]; - }; - - extraConfig = { - modi = "drun,run"; - show-icons = false; - display-drun = ""; - display-run = ""; - display-filebrowser = ""; - display-window = ""; - drun-display-format = "{name}"; - window-format = "{w} · {c} · {t}"; - }; - - theme = "custom"; - }; - - home.file.".local/share/rofi/themes/custom.rasi".text = '' - /** - * - * Author : Aditya Shakya (adi1090x) - * Github : @adi1090x - * - * Rofi Theme File - * Rofi Version: 1.7.3 - **/ - - /*****----- Global Properties -----*****/ - * { - font: "monospace bold 8"; - background: #${colors.base00}ff; - background-alt: #${colors.base01}ff; - foreground: #${colors.base06}ff; - selected: #${colors.base0D}ff; - active: #${colors.base0B}ff; - urgent: #${colors.base08}ff; - - border-colour: var(selected); - handle-colour: var(foreground); - background-colour: var(background); - foreground-colour: var(foreground); - alternate-background: var(background-alt); - normal-background: var(background); - normal-foreground: var(foreground); - urgent-background: var(urgent); - urgent-foreground: var(background); - active-background: var(active); - active-foreground: var(background); - selected-normal-background: var(selected); - selected-normal-foreground: var(background); - selected-urgent-background: var(active); - selected-urgent-foreground: var(background); - selected-active-background: var(urgent); - selected-active-foreground: var(background); - alternate-normal-background: var(background); - alternate-normal-foreground: var(foreground); - alternate-urgent-background: var(urgent); - alternate-urgent-foreground: var(background); - alternate-active-background: var(active); - alternate-active-foreground: var(background); - } - - /*****----- Main Window -----*****/ - window { - /* properties for window widget */ - transparency: "real"; - location: north; - anchor: north; - fullscreen: false; - width: 100%; - x-offset: 0px; - y-offset: 0px; - - children: [ horibox ]; - - /* properties for all widgets */ - enabled: true; - margin: 0px; - padding: 0px; - border: 0px solid; - border-radius: 0px; - border-color: @border-colour; - cursor: "default"; - /* Backgroud Colors */ - background-color: @background-colour; - /* Backgroud Image */ - //background-image: url("/path/to/image.png", none); - /* Simple Linear Gradient */ - //background-image: linear-gradient(red, orange, pink, purple); - /* Directional Linear Gradient */ - //background-image: linear-gradient(to bottom, pink, yellow, magenta); - /* Angle Linear Gradient */ - //background-image: linear-gradient(45, cyan, purple, indigo); - } - - /*****----- Horizontal Box -----*****/ - horibox { - spacing: 0px; - background-color: @background-colour; - text-color: @foreground-colour; - orientation: horizontal; - children: [ "prompt", "textbox-prompt-colon","entry", "listview" ]; - } - - /*****----- Main Box -----*****/ - mainbox { - enabled: true; - spacing: 2px; - margin: 0px; - padding: 2px; - border: 0px solid; - border-radius: 0px 0px 0px 0px; - border-color: @border-colour; - background-color: transparent; - children: [ "inputbar", "message", "listview", "mode-switcher" ]; - } - - /*****----- Inputbar -----*****/ - inputbar { - enabled: true; - spacing: 10px; - margin: 0px; - padding: 2px; - border: 0px solid; - border-radius: 4px; - border-color: @border-colour; - background-color: @alternate-background; - text-color: @foreground-colour; - children: [ "prompt", "entry" ]; - } - - prompt { - enabled: true; - padding: 4px; - background-color: inherit; - text-color: inherit; - } - textbox-prompt-colon { - enabled: true; - padding: 2px 0px 2px 0px; - expand: false; - str: "::"; - background-color: inherit; - text-color: inherit; - } - entry { - enabled: true; - padding: 4px; - expand: false; - width: 20em; - background-color: inherit; - text-color: inherit; - cursor: text; - placeholder: "search..."; - placeholder-color: inherit; - } - num-filtered-rows { - enabled: true; - expand: false; - background-color: inherit; - text-color: inherit; - } - textbox-num-sep { - enabled: true; - expand: false; - str: "/"; - background-color: inherit; - text-color: inherit; - } - num-rows { - enabled: true; - expand: false; - background-color: inherit; - text-color: inherit; - } - case-indicator { - enabled: true; - background-color: inherit; - text-color: inherit; - } - - /*****----- Listview -----*****/ - listview { - enabled: true; - columns: 1; - lines: 100; - cycle: true; - dynamic: true; - scrollbar: false; - layout: horizontal; - reverse: false; - fixed-height: true; - fixed-columns: true; - - spacing: 2px; - margin: 0px; - padding: 0px; - border: 0px solid; - border-radius: 0px; - border-color: @border-colour; - background-color: transparent; - text-color: @foreground-colour; - cursor: "default"; - } - scrollbar { - handle-width: 5px ; - handle-color: @handle-colour; - border-radius: 8px; - background-color: @alternate-background; - } - - /*****----- Elements -----*****/ - element { - enabled: true; - spacing: 2px; - margin: 0px; - padding: 4px 2px; - border: 0px solid; - border-radius: 0px; - border-color: @border-colour; - background-color: transparent; - text-color: @foreground-colour; - cursor: pointer; - } - element normal.normal { - background-color: var(normal-background); - text-color: var(normal-foreground); - } - element normal.urgent { - background-color: var(urgent-background); - text-color: var(urgent-foreground); - } - element normal.active { - background-color: var(active-background); - text-color: var(active-foreground); - } - element selected.normal { - background-color: var(selected-normal-background); - text-color: var(selected-normal-foreground); - } - element selected.urgent { - background-color: var(selected-urgent-background); - text-color: var(selected-urgent-foreground); - } - element selected.active { - background-color: var(selected-active-background); - text-color: var(selected-active-foreground); - } - element alternate.normal { - background-color: var(alternate-normal-background); - text-color: var(alternate-normal-foreground); - } - element alternate.urgent { - background-color: var(alternate-urgent-background); - text-color: var(alternate-urgent-foreground); - } - element alternate.active { - background-color: var(alternate-active-background); - text-color: var(alternate-active-foreground); - } - 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: 2px; - margin: 0px; - padding: 0px; - border: 0px solid; - border-radius: 4px; - border-color: @border-colour; - background-color: @alternate-background; - text-color: @foreground-colour; - } - button { - padding: 2px; - border: 0px solid; - border-radius: 4px; - border-color: @border-colour; - background-color: transparent; - text-color: inherit; - cursor: pointer; - } - button selected { - background-color: var(normal-foreground); - text-color: var(normal-background); - } - - /*****----- Message -----*****/ - message { - enabled: true; - margin: 0px; - padding: 0px; - border: 0px solid; - border-radius: 0px 0px 0px 0px; - border-color: @border-colour; - background-color: transparent; - text-color: @foreground-colour; - } - textbox { - padding: 2px; - border: 0px solid; - border-radius: 0px; - border-color: @border-colour; - background-color: @alternate-background; - text-color: @foreground-colour; - vertical-align: 0.5; - horizontal-align: 0.0; - highlight: none; - placeholder-color: @foreground-colour; - blink: true; - markup: true; - } - error-message { - padding: 0px; - border: 0px solid; - border-radius: 0px; - border-color: @border-colour; - background-color: @background-colour; - text-color: @foreground-colour; - } - ''; -} diff --git a/home/yashraj/yuki/desktop/wm/awesome/gruva/init.lua b/home/yashraj/yuki/desktop/wm/awesome/gruva/init.lua deleted file mode 100644 index 0b44e9a..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/gruva/init.lua +++ /dev/null @@ -1,641 +0,0 @@ --- ░█▀▀░█▀█░█▀█░█▀▀░▀█▀░█▀▀░█░█░█▀▄░█▀█░▀█▀░▀█▀░█▀█░█▀█ --- ░█░░░█░█░█░█░█▀▀░░█░░█░█░█░█░█▀▄░█▀█░░█░░░█░░█░█░█░█ --- ░▀▀▀░▀▀▀░▀░▀░▀░░░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀░▀░░▀░░▀▀▀░▀▀▀░▀░▀ - -local gears = require("gears") -local awful = require("awful") -local wibox = require("wibox") -local beautiful = require("beautiful") -local naughty = require("naughty") -local ruled = require("ruled") -local menubar = require("menubar") -local json = require("module.json") -local keys = require("keys") -local helpers = require("helpers") - --- ░█░█░▀█▀░█▀▄░█▀▀░█▀▀░▀█▀░█▀▀ --- ░█▄█░░█░░█░█░█░█░█▀▀░░█░░▀▀█ --- ░▀░▀░▀▀▀░▀▀░░▀▀▀░▀▀▀░░▀░░▀▀▀ - --- Memory widget --- ============================================= -local memory_widget = wibox.widget({ - { - { - { - id = "icon", - text = "  ", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textbox, - }, - bg = beautiful.color14, - fg = beautiful.darker_bg, - widget = wibox.widget.background, - }, - { - id = "text", - text = "", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textbox, - }, - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - }, - fg = beautiful.darker_bg, - bg = beautiful.color6, - widget = wibox.container.background, -}) - -local update_interval = 20 -local ram_script = [[ - sh -c " - free -m | grep 'Mem:' | awk '{printf \"%d@@%d@\", $7, $2}' - "]] - --- Periodically get ram info -awful.widget.watch(ram_script, update_interval, function(widget, stdout) - local available = stdout:match("(.*)@@") - local total = stdout:match("@@(.*)@") - local used = tonumber(total) - tonumber(available) - -- weather_widget attach - local usage = memory_widget:get_children_by_id("text")[1] - memory_widget:emit_signal("widget::redraw_needed") - usage:set_text(used .. " MB ") -end) - --- Clock widget --- ============================================= -local clock_widget = wibox.widget({ - { - { - { - id = "icon", - text = " 󰃰 ", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textbox, - }, - bg = beautiful.color12, - fg = beautiful.darker_bg, - widget = wibox.widget.background, - }, - { - id = "text", - format = "%a %b %d - %I:%M %p ", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textclock, - }, - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - }, - fg = "#ffffff", - bg = beautiful.color4, - widget = wibox.container.background, -}) - --- CPU widget --- ============================================= -local cpu_widget = wibox.widget({ - { - { - { - id = "icon", - text = " 󰍛 ", - font = beautiful.icon_font .. "12", - widget = wibox.widget.textbox, - }, - bg = beautiful.color11, - fg = beautiful.darker_bg, - widget = wibox.widget.background, - }, - { - id = "text", - text = "", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textbox, - }, - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - }, - fg = beautiful.color3, - bg = beautiful.lighter_bg, - widget = wibox.container.background, -}) - -local update_interval = 5 -local cpu_idle_script = [[ - sh -c " - vmstat 1 2 | tail -1 | awk '{printf \"%d\", $15}' - "]] - --- Periodically get cpu info -awful.widget.watch(cpu_idle_script, update_interval, function(widget, stdout) - local cpu_idle = stdout - cpu_idle = string.gsub(cpu_idle, "^%s*(.-)%s*$", "%1") - local used = 100 - tonumber(cpu_idle) - -- cpu_widget attach - local usage = cpu_widget:get_children_by_id("text")[1] - cpu_widget:emit_signal("widget::redraw_needed") - usage:set_text(used .. "% ") -end) - --- Weather widget --- ============================================= -local GET_FORECAST_CMD = [[bash -c "curl -s --show-error -X GET '%s'"]] - -local current_weather_widget = wibox.widget({ - { - { - { - id = "icon", - text = "  ", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textbox, - }, - bg = beautiful.color10, - fg = beautiful.darker_bg, - widget = wibox.widget.background, - }, - { - id = "description", - text = "Mostly cloudy,", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textbox, - }, - nil, - { - id = "tempareture_current", - markup = "20°C ", - align = "right", - font = beautiful.icon_font .. "10", - widget = wibox.widget.textbox, - }, - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - }, - fg = beautiful.color2, - bg = beautiful.lighter_bg, - widget = wibox.container.background, -}) - -local api_key = user.openweathermap_key -local coordinates = user.openweathermap_city_id -local units = user.openweathermap_weather_units - -local url = ( - "https://api.openweathermap.org/data/2.5/onecall" - .. "?lat=" - .. coordinates[1] - .. "&lon=" - .. coordinates[2] - .. "&appid=" - .. api_key - .. "&units=" - .. units - .. "&exclude=minutely" -) - -awful.widget.watch(string.format(GET_FORECAST_CMD, url), 600, function(_, stdout, stderr) - if stderr == "" then - local result = json.decode(stdout) - -- Current weather setup - local description = current_weather_widget:get_children_by_id("description")[1] - local temp_current = current_weather_widget:get_children_by_id("tempareture_current")[1] - current_weather_widget:emit_signal("widget::redraw_needed") - description:set_text(result.current.weather[1].description:gsub("^%l", string.upper) .. ",") - temp_current:set_markup(math.floor(result.current.temp) .. "°C ") - end -end) - --- Playerctl widget --- ============================================= -local playerctl_widget = wibox.widget({ - { - { - { - id = "icon", - text = " 󰎈 ", - font = beautiful.icon_font .. "11", - widget = wibox.widget.textbox, - }, - bg = beautiful.color13, - fg = beautiful.darker_bg, - widget = wibox.widget.background, - }, - { - id = "text", - text = "---", - font = beautiful.icon_font .. "10", - align = "center", - forced_width = dpi(100), - widget = wibox.widget.textbox, - }, - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - }, - fg = beautiful.color13, - bg = beautiful.lighter_bg, - widget = wibox.container.background, -}) - --- Get playerctl output -local function emit_info(playerctl_output) - local artist = playerctl_output:match('artist_start(.*)title_start') - local title = playerctl_output:match('title_start(.*)status_start') - -- Use the lower case of status - local status = playerctl_output:match('status_start(.*)'):lower() - status = string.gsub(status, '^%s*(.-)%s*$', '%1') - -- playerctl_widget attach - local song = playerctl_widget:get_children_by_id("text")[1] - if status == "stopped" then - song:set_text("---") - else - song:set_text(title .. " ") - end -end - --- Sleeps until spotify changes state (pause/play/next/prev) -local spotify_script = [[ - sh -c ' - playerctl metadata --format 'artist_start{{artist}}title_start{{title}}status_start{{status}}' --follow - ']] - --- Kill old playerctl process -awful.spawn.easy_async_with_shell("ps x | grep \"playerctl metadata\" | grep -v grep | awk '{print $1}' | xargs kill", - function() - -- Emit song info with each line printed - awful.spawn.with_line_callback(spotify_script, { - stdout = function(line) - emit_info(line) - end - }) - end) - --- Volume osd --- needs pamixer installed --- ============================================= -local volume_old = -1 -local muted_old = -1 -local function emit_volume_info() - -- Get volume info of the currently active sink - awful.spawn.easy_async_with_shell('echo -n $(pamixer --get-mute); echo "_$(pamixer --get-volume)"', function(stdout) - local bool = string.match(stdout, "(.-)_") - local volume = string.match(stdout, "%d+") - local muted_int = -1 - if bool == "true" then - muted_int = 1 - else - muted_int = 0 - end - local volume_int = tonumber(volume) - - -- Only send signal if there was a change - -- We need this since we use `pactl subscribe` to detect - -- volume events. These are not only triggered when the - -- user adjusts the volume through a keybind, but also - -- through `pavucontrol` or even without user intervention, - -- when a media file starts playing. - if volume_int ~= volume_old or muted_int ~= muted_old then - awesome.emit_signal("signal::volume", volume_int, muted_int) - volume_old = volume_int - muted_old = muted_int - end - end) -end - --- Run once to initialize widgets -emit_volume_info() - --- Sleeps until pactl detects an event (volume up/down/toggle mute) -local volume_script = [[ - bash -c " - LANG=C pactl subscribe 2> /dev/null | grep --line-buffered \"Event 'change' on sink #\" - "]] - --- Kill old pactl subscribe processes -awful.spawn.easy_async({ - "pkill", - "--full", - "--uid", - os.getenv("USER"), - "^pactl subscribe", -}, function() - -- Run emit_volume_info() with each line printed - awful.spawn.with_line_callback(volume_script, { - stdout = function(line) - emit_volume_info() - end, - }) -end) - -local volume_icon = wibox.widget({ - markup = "󰋋", - align = "center", - valign = "center", - font = beautiful.font_name .. "20", - widget = wibox.widget.textbox, -}) - -local volume_adjust = awful.popup({ - type = "notification", - maximum_width = dpi(50), - maximum_height = dpi(300), - visible = false, - ontop = true, - widget = wibox.container.background, - bg = beautiful.transparent, - placement = function(c) - awful.placement.right(c, { margins = { right = 10 } }) - end, -}) - -local volume_bar = wibox.widget({ - bar_shape = gears.shape.rounded_rect, - shape = gears.shape.rounded_rect, - background_color = beautiful.lighter_bg, - color = beautiful.color4, - max_value = 100, - value = 0, - widget = wibox.widget.progressbar, -}) - -local volume_ratio = wibox.widget({ - layout = wibox.layout.ratio.vertical, - { - { volume_bar, direction = "east", widget = wibox.container.rotate }, - top = dpi(20), - left = dpi(20), - right = dpi(20), - widget = wibox.container.margin, - }, - volume_icon, - nil, -}) - -volume_ratio:adjust_ratio(2, 0.72, 0.28, 0) - -volume_adjust.widget = wibox.widget({ - volume_ratio, - shape = helpers.rrect(beautiful.border_radius / 2), - border_width = beautiful.widget_border_width, - border_color = beautiful.widget_border_color, - bg = beautiful.background, - widget = wibox.container.background, -}) - --- create a 3 second timer to hide the volume adjust --- component whenever the timer is started -local hide_volume_adjust = gears.timer({ - timeout = 3, - autostart = true, - callback = function() - volume_adjust.visible = false - volume_bar.mouse_enter = false - end, -}) - -awesome.connect_signal("signal::volume", function(vol, muted) - volume_bar.value = vol - - if muted == 1 or vol == 0 then - volume_icon.markup = "󰟎" - else - volume_icon.markup = "󰋋" - end - - if volume_adjust.visible then - hide_volume_adjust:again() - else - volume_adjust.visible = true - hide_volume_adjust:start() - end -end) - --- ░█░█░▀█▀░█▀▄░█▀█░█▀▄ --- ░█▄█░░█░░█▀▄░█▀█░█▀▄ --- ░▀░▀░▀▀▀░▀▀░░▀░▀░▀░▀ - --- Create a wibox for each screen and add it -awful.screen.connect_for_each_screen(function(s) - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt({ prompt = " Run: ", fg = beautiful.prompt_fg }) - -- Create an imagebox widget which will contain an icon indicating which layout we're using. - -- We need one layoutbox per screen. - s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(gears.table.join( - awful.button({}, 1, function() - awful.layout.inc(1) - end), - awful.button({}, 3, function() - awful.layout.inc(-1) - end), - awful.button({}, 4, function() - awful.layout.inc(1) - end), - awful.button({}, 5, function() - awful.layout.inc(-1) - end) - )) - -- Create a taglist widget - s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, keys.taglist_buttons) - s.mytaglist.font = beautiful.font - - s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, keys.tasklist_buttons) - s.mytasklist.font = beautiful.font - - -- Create a system tray widget - s.systray = wibox.widget.systray() - s.systray.visible = true -- can be toggled by a keybind - - -- Create the wibox - s.mywibox = awful.wibar({ - position = beautiful.wibar_position, - screen = s, - width = beautiful.wibar_width, - height = beautiful.wibar_height, - shape = helpers.rrect(beautiful.border_radius), - }) - - s.mywibox:setup({ - { - layout = wibox.layout.align.horizontal, - expand = "none", - { - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - s.mytaglist, - s.mypromptbox, - s.mytasklist, - }, - { - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - playerctl_widget, - }, - { - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - current_weather_widget, - memory_widget, - cpu_widget, - clock_widget, - s.systray, - }, - }, - top = dpi(3), - bottom = dpi(3), - left = dpi(3), - right = dpi(3), - layout = wibox.container.margin, - }) - - -- Place bar at the bottom and add margins - awful.placement.top(s.mywibox, { margins = beautiful.screen_margin * 0 }) -- I don't want margin so I added "*0" -end) - --- ░█▀█░█▀█░▀█▀░▀█▀░█▀█░█▀█░█▀▀ --- ░█░█░█▀▀░░█░░░█░░█░█░█░█░▀▀█ --- ░▀▀▀░▀░░░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀ - --- Notification settings --- ============================================= -naughty.config.defaults.title = "System Notification" - --- Timeouts -naughty.config.defaults.timeout = 5 -naughty.config.presets.low.timeout = 2 -naughty.config.presets.critical.timeout = 12 - --- Notification layout -if beautiful.notification_border_radius > 0 then - beautiful.notification_shape = helpers.rrect(beautiful.notification_border_radius) -end - -naughty.connect_signal("request::display", function(n) - local actions = wibox.widget({ - notification = n, - base_layout = wibox.widget({ - spacing = dpi(5), - layout = wibox.layout.flex.horizontal - }), - widget_template = { - { - { - { - font = beautiful.font_name .. "Bold 11", - markup = "" .. " " .. "", - widget = wibox.widget.textbox - }, - { - id = 'text_role', - font = beautiful.notification_font, - widget = wibox.widget.textbox - }, - forced_height = dpi(35), - layout = wibox.layout.fixed.horizontal - }, - widget = wibox.container.place - }, - strategy = "min", - width = dpi(60), - widget = wibox.container.constraint, - }, - style = { - underline_normal = false, - underline_selected = true - }, - widget = naughty.list.actions - }) - - naughty.layout.box { - notification = n, - type = "notification", - cursor = "hand2", - shape = helpers.rrect(beautiful.notification_border_radius), - border_width = beautiful.notification_border_width, - border_color = beautiful.notification_border_color, - position = beautiful.notification_position, - widget_template = { - { - { - { - { - naughty.widget.icon, - { - { - nil, - { - { - align = "left", - font = beautiful.notification_font, - markup = "" .. n.title .. "", - widget = wibox.widget.textbox, - }, - { - align = "left", - font = beautiful.notification_font, - text = n.message, - widget = wibox.widget.textbox, - }, - layout = wibox.layout.fixed.vertical - }, - expand = "none", - layout = wibox.layout.align.vertical - }, - left = n.icon and beautiful.notification_padding or 0, - widget = wibox.container.margin, - }, - layout = wibox.layout.align.horizontal - }, - { - wibox.widget({ - forced_height = dpi(10), - layout = wibox.layout.fixed.vertical - }), - { - nil, - actions, - expand = "none", - layout = wibox.layout.align.horizontal - }, - visible = n.actions and #n.actions > 0, - layout = wibox.layout.fixed.vertical - }, - layout = wibox.layout.fixed.vertical - }, - margins = beautiful.notification_padding, - widget = wibox.container.margin, - }, - strategy = "min", - width = beautiful.notification_min_width or dpi(150), - widget = wibox.container.constraint, - }, - strategy = "max", - width = beautiful.notification_max_width or dpi(300), - height = beautiful.notification_max_height or dpi(150), - widget = wibox.container.constraint, - } - } -end) - --- Handle notification icon -naughty.connect_signal("request::icon", function(n, context, hints) - -- Handle other contexts here - if context ~= "app_icon" then return end - - -- Use XDG icon - local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower()) - - if path then - n.icon = path - end -end) - --- Use XDG icon -naughty.connect_signal("request::action_icon", function(a, context, hints) - a.icon = menubar.utils.lookup_icon(hints.id) -end) - --- Autostart applications --- ============================================= --- awful.spawn.once({},false) --- EOF ------------------------------------------------------------------------ diff --git a/home/yashraj/yuki/desktop/wm/awesome/gruva/theme.lua b/home/yashraj/yuki/desktop/wm/awesome/gruva/theme.lua deleted file mode 100644 index 36c259a..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/gruva/theme.lua +++ /dev/null @@ -1,196 +0,0 @@ --- ░▀█▀░█░█░█▀▀░█▄█░█▀▀ --- ░░█░░█▀█░█▀▀░█░█░█▀▀ --- ░░▀░░▀░▀░▀▀▀░▀░▀░▀▀▀ - -local theme_assets = require("beautiful.theme_assets") -local xresources = require("beautiful.xresources") -local dpi = xresources.apply_dpi -local xrdb = xresources.get_current_theme() -local gears = require("gears") -local gfs = require("gears.filesystem") -local themes_path = gfs.get_themes_dir() - --- Inherit default theme -local theme = dofile(themes_path .. "default/theme.lua") -theme.wallpaper = "/home/yashraj/Pictures/wall.png" - --- ░█▀▀░█▀█░█▀█░▀█▀░█▀▀ --- ░█▀▀░█░█░█░█░░█░░▀▀█ --- ░▀░░░▀▀▀░▀░▀░░▀░░▀▀▀ - -theme.font_name = "JetBrainsMono Nerd Font " -theme.font = theme.font_name .. "Bold 9" -theme.icon_font = theme.font_name .. "Bold " - --- ░█▀▀░█▀█░█░░░█▀█░█▀▄░█▀▀ --- ░█░░░█░█░█░░░█░█░█▀▄░▀▀█ --- ░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀ - -theme.background = xrdb.background or "#" -theme.foreground = xrdb.foreground or "#" --- Black -theme.color0 = xrdb.color0 or "#" -theme.color8 = xrdb.color8 or "#" --- Red -theme.color1 = xrdb.color1 or "#" -theme.color9 = xrdb.color9 or "#" --- Green -theme.color2 = xrdb.color2 or "#" -theme.color10 = xrdb.color10 or "#" --- Yellow -theme.color3 = xrdb.color3 or "#" -theme.color11 = xrdb.color11 or "#" --- Blue -theme.color4 = xrdb.color4 or "#" -theme.color12 = xrdb.color12 or "#" --- Magenta -theme.color5 = xrdb.color5 or "#" -theme.color13 = xrdb.color13 or "#" --- Cyan -theme.color6 = xrdb.color6 or "#" -theme.color14 = xrdb.color14 or "#" --- White -theme.color7 = xrdb.color7 or "#" -theme.color15 = xrdb.color15 or "#" - --- Special -theme.transparent = "#00000000" -theme.lighter_bg = "#3c3836" -theme.darker_bg = "#1d2021" -theme.orange = "#d65d0e" - --- Background Colors -theme.bg_normal = theme.background -theme.bg_focus = theme.color4 .. 70 -theme.bg_urgent = theme.color3 -theme.bg_minimize = theme.background .. 55 - --- Foreground Colors -theme.fg_normal = theme.foreground -theme.fg_focus = theme.color7 -theme.fg_urgent = theme.color1 -theme.fg_minimize = theme.foreground .. 55 - ---- ░█░█░▀█▀░░░█▀▀░█░░░█▀▀░█▄█░█▀▀░█▀█░▀█▀░█▀▀ ---- ░█░█░░█░░░░█▀▀░█░░░█▀▀░█░█░█▀▀░█░█░░█░░▀▀█ ---- ░▀▀▀░▀▀▀░░░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀░▀░░▀░░▀▀▀ - --- Borders --- =================================================================== -theme.border_width = dpi(3) -theme.border_normal = theme.lighter_bg -theme.border_focus = theme.color2 -theme.border_radius = dpi(0) --picom should be used for round corners -theme.widget_border_width = dpi(2) -theme.widget_border_color = theme.color8 - --- Taglist --- =================================================================== -local taglist_square_size = dpi(0) -theme.taglist_font = theme.font_taglist -theme.taglist_bg = theme.wibar_bg -theme.taglist_bg_focus = theme.orange -theme.taglist_fg_focus = theme.darker_bg -theme.taglist_bg_occupied = theme.wibar_bg -theme.taglist_fg_occupied = theme.fg_normal -theme.taglist_bg_empty = theme.wibar_bg -theme.taglist_fg_empty = theme.lighter_bg -theme.taglist_bg_urgent = theme.color1 .. "55" -theme.taglist_fg_urgent = theme.color1 -theme.taglist_disable_icon = true -theme.taglist_spacing = dpi(0) -theme.taglist_squares_sel = theme_assets.taglist_squares_sel(taglist_square_size, theme.fg_normal) -theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(taglist_square_size, theme.fg_normal) - --- Tasklist --- =================================================================== -theme.tasklist_font = theme.font -theme.tasklist_disable_icon = true -theme.tasklist_plain_task_name = true -theme.tasklist_bg_focus = theme.color0 -theme.tasklist_fg_focus = theme.color2 -theme.tasklist_bg_normal = theme.color0 -theme.tasklist_fg_normal = theme.foreground -theme.tasklist_bg_minimize = theme.bg_minimize -theme.tasklist_fg_minimize = theme.fg_minimize -theme.tasklist_disable_task_name = false -theme.tasklist_bg_urgent = theme.bg_urgent -theme.tasklist_fg_urgent = theme.fg_urgent -theme.tasklist_align = "center" - ---- Titlebar --- =================================================================== -theme.titlebar_enabled = false - --- Menu --- Variables set for theming the menu: --- =================================================================== -theme.menu_height = dpi(30) -theme.menu_width = dpi(150) -theme.menu_bg_normal = theme.bg_normal -theme.menu_fg_normal = theme.fg_normal -theme.menu_bg_focus = theme.bg_focus -theme.menu_fg_focus = theme.fg_focus --- theme.menu_font = theme.font -theme.menu_border_width = theme.border_width / 2 -theme.menu_border_color = theme.color8 -theme.menu_submenu = "> " -theme.menu_submenu_icon = nil - --- Gaps --- =================================================================== -theme.useless_gap = dpi(8) -theme.screen_margin = dpi(3) - --- Wibar --- =================================================================== -theme.wibar_position = "top" -theme.wibar_height = dpi(25) -theme.wibar_bg = theme.color0 --- theme.wibar_fg = theme.color7 ---theme.wibar_opacity = 0.7 -theme.wibar_border_color = theme.color0 -theme.wibar_border_width = dpi(0) -theme.wibar_border_radius = dpi(0) --- theme.wibar_width = dpi(565) - --- Systray --- =================================================================== -theme.bg_systray = theme.wibar_bg - --- Notifications --- =================================================================== -theme.notification_font = theme.font -theme.notification_bg = theme.background -theme.notification_fg = theme.foreground -theme.notification_border_width = dpi(2) -theme.notification_border_color = theme.color8 -theme.notification_opacity = 1 -theme.notification_margin = dpi(15) --- theme.notification_width = dpi(300) --- theme.notification_height = dpi(80) -theme.notification_icon_size = dpi(50) -theme.notification_position = "top_right" -theme.notification_border_radius = theme.border_radius --- theme.notification_crit_bg = theme.color1 --- theme.notification_crit_fg = theme.color0 -theme.notification_padding = theme.screen_margin * 2 -theme.notification_spacing = theme.screen_margin * 2 - --- Misc --- =================================================================== --- Recolor Layout icons -theme = theme_assets.recolor_layout(theme, theme.foreground) -theme.layoutlist_shape_selected = gears.shape.rounded_rect -theme.layoutlist_bg_selected = theme.color3 - --- Edge snap -theme.snap_shape = gears.shape.rounded_rect -theme.snap_bg = theme.lighter_bg -theme.snap_border_width = theme.border_width - --- Hotkeys popup -theme.hotkeys_modifiers_fg = theme.color12 - -return theme --- EOF ------------------------------------------------------------------------ diff --git a/home/yashraj/yuki/desktop/wm/awesome/helpers.lua b/home/yashraj/yuki/desktop/wm/awesome/helpers.lua deleted file mode 100644 index 4698b91..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/helpers.lua +++ /dev/null @@ -1,86 +0,0 @@ -local beautiful = require("beautiful") -local xresources = require("beautiful.xresources") -local dpi = xresources.apply_dpi -local awful = require("awful") -local gears = require("gears") -local helpers = {} - --- Mouse hover --- ============================================= -function helpers.add_hover_cursor(w, hover_cursor) - local original_cursor = "left_ptr" - - w:connect_signal("mouse::enter", function() - local w = _G.mouse.current_wibox - if w then - w.cursor = hover_cursor - end - end) - - w:connect_signal("mouse::leave", function() - local w = _G.mouse.current_wibox - if w then - w.cursor = original_cursor - end - end) -end - --- Create rounded rectangle shape (in one line) --- ============================================= -helpers.rrect = function(radius) - return function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, radius) - end -end - --- Raise or spawn --- ============================================= -function helpers.run_or_raise(match, move, spawn_cmd, spawn_args) - local matcher = function(c) - return awful.rules.match(c, match) - end - - -- Find and raise - local found = false - for c in awful.client.iterate(matcher) do - found = true - c.minimized = false - if move then - c:move_to_tag(mouse.screen.selected_tag) - client.focus = c - else - c:jump_to() - end - break - end - - -- Spawn if not found - if not found then - awful.spawn(spawn_cmd, spawn_args) - end -end - --- Run raise or minimize a client (scratchpad style) --- ============================================= -function helpers.scratchpad(match, spawn_cmd, spawn_args) - local cf = client.focus - if cf and awful.rules.match(cf, match) then - cf.minimized = true - else - helpers.run_or_raise(match, true, spawn_cmd, spawn_args) - end -end - -function helpers.volume_control(step) - local cmd - if step == 0 then - cmd = "pactl set-sink-mute @DEFAULT_SINK@ toggle" - else - sign = step > 0 and "+" or "" - cmd = "pactl set-sink-mute @DEFAULT_SINK@ 0 && pactl set-sink-volume @DEFAULT_SINK@ " .. - sign .. tostring(step) .. "%" - end - awful.spawn.with_shell(cmd) -end - -return helpers diff --git a/home/yashraj/yuki/desktop/wm/awesome/keys.lua b/home/yashraj/yuki/desktop/wm/awesome/keys.lua deleted file mode 100644 index 2e8cf0f..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/keys.lua +++ /dev/null @@ -1,516 +0,0 @@ --- -- ░█░█░█▀▀░█░█░█▀▄░▀█▀░█▀█░█▀▄░█▀▀ --- -- ░█▀▄░█▀▀░░█░░█▀▄░░█░░█░█░█░█░▀▀█ --- -- ░▀░▀░▀▀▀░░▀░░▀▀░░▀▀▀░▀░▀░▀▀░░▀▀▀ - -local gears = require("gears") -local beautiful = require("beautiful") -local awful = require("awful") -local hotkeys_popup = require("awful.hotkeys_popup") -local naughty = require("naughty") -local helpers = require("helpers") - -local keys = {} -mod = "Mod4" -alt = "Mod1" -ctrl = "Control" -shift = "Shift" - --- Menu --- ============================================= -local menu = {} -menu.awesome = { - { "Hotkeys", function() return false, hotkeys_popup.show_help end }, - { "Manual", user.terminal .. " -e man awesome" }, - { "Edit config", string.format("%s -e %s %s", user.terminal, user.terminal .. " -e " .. user.editor, awesome.conffile) }, - { "Restart", function() awesome.restart() end }, - { "Quit", function() awesome.quit() end }, -} - -menu.mainmenu = awful.menu({ - items = { - { " Terminal", user.terminal }, - { " Explorer", user.file_manager }, - { " Browser", user.browser }, - { " Editor", user.terminal .. " -e " .. user.editor }, - { "󰨞 GUI Editor", user.visual_editor }, - { " AwesomeWM", menu.awesome }, - }, -}) --- ============================================= - --- Mouse bindings on desktop --- ============================================= -keys.desktopbuttons = gears.table.join( - awful.button({}, 1, function() - -- Single tap - -- awesome.emit_signal("elemental::dismiss") - naughty.destroy_all_notifications() - if menu.mainmenu then - menu.mainmenu:hide() - end - -- if sidebar_hide then - -- sidebar_hide() - -- end - end), - - -- Right click - Show app drawer - awful.button({}, 3, function() - menu.mainmenu:toggle() - end), - - -- Middle button - Toggle dashboard - -- awful.button({ }, 2, function() - -- if dashboard_show then - -- dashboard_show() - -- end - -- end), - - -- Scrolling - Switch tags - -- awful.button({ }, 4, awful.tag.viewprev), - -- awful.button({ }, 5, awful.tag.viewnext), - - -- Side buttons - Control volume - awful.button({}, 8, function() helpers.volume_control(-5) end), - awful.button({}, 9, function() helpers.volume_control(5) end) - --- Side buttons - Minimize and restore minimized client --- awful.button({}, 8, function() --- if client.focus ~= nil then --- client.focus.minimized = true --- end --- end), --- awful.button({}, 9, function() --- local c = awful.client.restore() --- -- Focus restored client --- if c then --- client.focus = c --- end --- end) -) - --- Global bindings --- ============================================= -keys.globalkeys = gears.table.join( - awful.key({ - modifiers = { mod }, - keygroup = "numrow", - description = "only view tag", - group = "tag", - on_press = function(index) - local screen = awful.screen.focused() - local tag = screen.tags[index] - if tag then - tag:view_only() - end - end, - }), - awful.key({ - modifiers = { mod, ctrl }, - keygroup = "numrow", - description = "toggle tag", - group = "tag", - on_press = function(index) - local screen = awful.screen.focused() - local tag = screen.tags[index] - if tag then - awful.tag.viewtoggle(tag) - end - end, - }), - awful.key({ - modifiers = { mod, shift }, - keygroup = "numrow", - description = "move focused client to tag", - group = "tag", - on_press = function(index) - if client.focus then - local tag = client.focus.screen.tags[index] - if tag then - client.focus:move_to_tag(tag) - end - end - end, - }), - awful.key({ mod }, "space", function() - awful.layout.inc(1) - end, { description = "next layout", group = "tag" }), - awful.key({ mod, shift }, "space", function() - awful.layout.inc(-1) - end, { description = "previous layout", group = "tag" } - ), - - -- Tag switcher - awful.key({ mod }, "Tab", function() - awful.tag.viewnext() - end, { description = "next tag", group = "client" }), - awful.key({ mod, shift }, "Tab", function() - awful.tag.viewprev() - end, { description = "prev tag", group = "client" }), - - -- Focus client by direction (hjkl keys) - awful.key({ mod }, "j", function() - awful.client.focus.bydirection("down") - end, { description = "focus down", group = "client" }), - awful.key({ mod }, "k", function() - awful.client.focus.bydirection("up") - end, { description = "focus up", group = "client" }), - awful.key({ mod }, "h", function() - awful.client.focus.bydirection("left") - end, { description = "focus left", group = "client" }), - awful.key({ mod }, "l", function() - awful.client.focus.bydirection("right") - end, { description = "focus right", group = "client" }), - - -- Focus client by index (cycle through clients) - awful.key({ mod }, "z", function() - awful.client.focus.byidx(1) - end, { description = "focus next by index", group = "client" }), - awful.key({ mod, shift }, "z", function() - awful.client.focus.byidx(-1) - end, { description = "focus next by index", group = "client" }), - - -- Focus client by direction (arrow keys) - awful.key({ mod }, "Down", function() - awful.client.focus.bydirection("down") - end, { description = "focus down", group = "client" }), - awful.key({ mod }, "Up", function() - awful.client.focus.bydirection("up") - end, { description = "focus up", group = "client" }), - awful.key({ mod }, "Left", function() - awful.client.focus.bydirection("left") - end, { description = "focus left", group = "client" }), - awful.key({ mod }, "Right", function() - awful.client.focus.bydirection("right") - end, { description = "focus right", group = "client" }), - - -- Urgent or Undo: - -- Jump to urgent client or (if there is no such client) go back - -- to the last tag - awful.key({ mod }, "u", function() - uc = awful.client.urgent.get() - -- If there is no urgent client, go back to last tag - if uc == nil then - awful.tag.history.restore() - else - awful.client.urgent.jumpto() - end - end, { description = "jump to urgent client", group = "client" }), - - awful.key({ mod }, "x", function() - awful.tag.history.restore() - end, { description = "go back", group = "tag" }), - - -- Spawn terminal - awful.key({ mod }, "Return", function() - awful.spawn(user.terminal) - end, { description = "open a terminal", group = "launcher" }), - - -- Spawn floating terminal - awful.key({ mod, shift }, "Return", function() - awful.spawn(user.floating_terminal, { floating = true }) - end, { description = "spawn floating terminal", group = "launcher" }), - - -- Reload Awesome - awful.key({ mod, shift }, "r", function() awesome.restart() end, { description = "reload awesome", group = "awesome" }), - - -- Quit Awesome - awful.key({ mod, shift }, "q", function() - awesome.quit() - end, { description = "quit awesome", group = "awesome" }), - awful.key({ mod, shift }, "x", function() - awesome.quit() - -- exit_screen_show() - end, { description = "quit awesome", group = "awesome" }), - awful.key({}, "XF86PowerOff", function() - awesome.quit() - -- exit_screen_show() - end, { description = "quit awesome", group = "awesome" }), - - -- Resize focused client or layout factor - awful.key({ mod, ctrl }, "j", function() - awful.client.incwfact(-0.05) - end), - awful.key({ mod, ctrl }, "k", function() - awful.client.incwfact(0.05) - end), - awful.key({ mod, ctrl }, "h", function() - awful.tag.incmwfact(-0.05) - end), - awful.key({ mod, ctrl }, "l", function() - awful.tag.incmwfact(0.05) - end), - - -- Focus restored client - awful.key({ mod, shift }, "n", function() - local c = awful.client.restore() - if c then - client.focus = c - end - end, { description = "restore minimized", group = "client" }), - - -- Dismiss notifications and elements that connect to the dismiss signal - awful.key({ ctrl }, "space", function() - -- awesome.emit_signal("elemental::dismiss") - naughty.destroy_all_notifications() - end, { description = "dismiss notification", group = "notifications" }), - - -- Scratchpad terminal with tmux - awful.key({ mod }, "s", function() - helpers.scratchpad({ instance = "scratchpad" }, user.scratchpad_terminal, nil) - end, { description = "scratchpad", group = "launcher" }), - - -- Screen Shots/Vids - awful.key({}, "Print", function() - awful.spawn("flameshot gui") - end, { description = "flameshot gui", group = "awesome" }), - awful.key({ shift }, "Print", function() - awful.spawn("flameshot gui -d 2000") - end, { description = "flameshot gui with 2 second delay", group = "awesome" }), - - -- Prompt - awful.key({ mod }, "d", function() - awful.spawn("rofi -matching fuzzy -show combi") - end, { description = "rofi launcher", group = "app" }), - --- App launcher - awful.key({ mod }, "a", function() - awful.spawn("rofi -matching fuzzy -show drun") - end, { description = "app launcher", group = "app" }), - --- Emoji picker - awful.key({ mod }, "e", function() - awful.spawn("rofi -matching normal -show emoji") - end, { description = "emoji picker", group = "app" }), - --- Clipboard - awful.key({ mod, shift }, "c", function() - awful.spawn("clipmenu") - end, { description = "clipboard", group = "app" }), - -- Hotkeys list - awful.key({ mod }, "F1", function() hotkeys_popup.show_help() end, - { description = "show help", group = "awesome" }), - - -- Volume Control with volume keys - awful.key({}, "XF86AudioMute", - function() - helpers.volume_control(0) - end, - { description = "(un)mute volume", group = "volume" }), - awful.key({}, "XF86AudioLowerVolume", - function() - helpers.volume_control(-5) - end, - { description = "lower volume", group = "volume" }), - awful.key({}, "XF86AudioRaiseVolume", - function() - helpers.volume_control(5) - end, - { description = "raise volume", group = "volume" }), - - -- Lockscreen - awful.key({ mod, alt }, "l", function() - lock_screen_show() - end, { description = "lock screen", group = "hotkeys" }), - - -- Apps - -- Spawn browser - awful.key({ mod }, "F2", apps.browser, { description = "web browser", group = "launcher" }), - -- Spawn gui file manager - awful.key({ mod }, "F3", apps.file_manager, { description = "file manager", group = "launcher" }), - -- Terminal file manager - awful.key({ mod }, "F4", apps.term_filemanager, { description = "term filemanager", group = "launcher" }), - -- Primary editor - awful.key({ mod }, "F5", apps.editor, { description = "editor", group = "launcher" }), - -- Gui editor - awful.key({ mod }, "F6", apps.visual_editor, { description = "visual editor", group = "launcher" }), - -- Add more - awful.key({ mod }, "F7", apps.file_manager, { description = "file manager", group = "launcher" }), - awful.key({ mod }, "F8", apps.file_manager, { description = "file manager", group = "launcher" }), - awful.key({ mod }, "F9", apps.file_manager, { description = "file manager", group = "launcher" }), - awful.key({ mod }, "F10", apps.file_manager, { description = "file manager", group = "launcher" }), - -- Volume control - awful.key({ mod }, "F11", apps.volume, { description = "volume control", group = "launcher" }), - -- Process monitor - awful.key({ mod }, "F12", apps.process_monitor, { description = "process monitor", group = "launcher" }) -) - --- Client related bindings --- ============================================= -keys.clientkeys = gears.table.join( --- Swap by direction - awful.key({ mod, shift }, "j", function() - awful.client.swap.bydirection("down") - end), - awful.key({ mod, shift }, "k", function() - awful.client.swap.bydirection("up") - end), - awful.key({ mod, shift }, "h", function() - awful.client.swap.bydirection("left") - end), - awful.key({ mod, shift }, "l", function() - awful.client.swap.bydirection("right") - end), - - -- Toggle fullscreen - awful.key({ mod }, "f", function(c) - c.fullscreen = not c.fullscreen - c:raise() - end, { description = "toggle fullscreen", group = "client" }), - - -- Close client - awful.key({ mod }, "q", function(c) - c:kill() - end, { description = "close", group = "client" }), - awful.key({ alt }, "F4", function(c) - c:kill() - end, { description = "close", group = "client" }), - - --- Center client - awful.key({ mod }, "c", function() - awful.placement.centered(c, { honor_workarea = true, honor_padding = true }) - end), - - -- Switch clients - awful.key({ alt }, "Tab", function() - awesome.emit_signal("window_switcher::turn_on") - -- awful.client.focus.byidx(1) - end, { description = "focus next by index", group = "client" }), - - -- Toggle floating - awful.key({ mod, ctrl }, "space", function(c) - local layout_is_floating = (awful.layout.get(mouse.screen) == awful.layout.suit.floating) - if not layout_is_floating then - awful.client.floating.toggle() - end - end, { description = "toggle floating", group = "client" }), - - -- Set master - awful.key({ mod, ctrl }, "Return", function(c) c:swap(awful.client.getmaster()) end, - { description = "move to master", group = "client" }), - - -- P for pin: keep on top OR sticky - -- On top - awful.key({ mod, shift }, "p", function(c) c.ontop = not c.ontop end, - { description = "toggle keep on top", group = "client" }), - -- Sticky - awful.key({ mod, ctrl }, "p", function(c) c.sticky = not c.sticky end, - { description = "toggle sticky", group = "client" }), - - -- Minimize - awful.key({ mod }, "n", function(c) - c.minimized = true - end, { description = "minimize", group = "client" }), - - -- Maximize - awful.key({ mod }, "m", function(c) - c.maximized = not c.maximized - end, { description = "(un)maximize", group = "client" }), - awful.key({ mod, ctrl }, "m", function(c) - c.maximized_vertical = not c.maximized_vertical - c:raise() - end, { description = "(un)maximize vertically", group = "client" }), - awful.key({ mod, shift }, "m", function(c) - c.maximized_horizontal = not c.maximized_horizontal - c:raise() - end, { description = "(un)maximize horizontally", group = "client" }) -) - --- Mouse buttons on the client (whole window, not just titlebar) --- ============================================= -keys.clientbuttons = gears.table.join( - awful.button({}, 1, function(c) - client.focus = c - end), - awful.button({ mod }, 1, awful.mouse.client.move), - -- awful.button({ mod }, 2, function(c) c:kill() end), - awful.button({ mod }, 3, function(c) - client.focus = c - awful.mouse.client.resize(c) - -- awful.mouse.resize(c, nil, {jump_to_corner=true}) - end), - - -- Super + scroll = Change client opacity - awful.button({ mod }, 4, function(c) - c.opacity = c.opacity + 0.1 - end), - awful.button({ mod }, 5, function(c) - c.opacity = c.opacity - 0.1 - end) -) - --- Mouse buttons on the tasklist --- Use 'Any' modifier so that the same buttons can be used in the floating --- tasklist displayed by the window switcher while the mod is pressed --- ============================================= -keys.tasklist_buttons = gears.table.join( - awful.button({ "Any" }, 1, function(c) - if c == client.focus then - c.minimized = true - else - -- Without this, the following - -- :isvisible() makes no sense - c.minimized = false - if not c:isvisible() and c.first_tag then - c.first_tag:view_only() - end - -- This will also un-minimize - -- the client, if needed - client.focus = c - end - end), - -- Middle mouse button closes the window (on release) - awful.button({ "Any" }, 2, nil, function(c) - c:kill() - end), - awful.button({ "Any" }, 3, function(c) - c.minimized = true - end), - awful.button({ "Any" }, 4, function() - awful.client.focus.byidx(-1) - end), - awful.button({ "Any" }, 5, function() - awful.client.focus.byidx(1) - end), - - -- Side button up - toggle floating - awful.button({ "Any" }, 9, function(c) - c.floating = not c.floating - end), - -- Side button down - toggle ontop - awful.button({ "Any" }, 8, function(c) - c.ontop = not c.ontop - end) -) - --- Mouse buttons on a tag of the taglist widget --- ============================================= -keys.taglist_buttons = gears.table.join( - awful.button({}, 1, function(t) - t:view_only() - end), - awful.button({ mod }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - -- awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({}, 3, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({ mod }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({}, 4, function(t) - awful.tag.viewprev(t.screen) - end), - awful.button({}, 5, function(t) - awful.tag.viewnext(t.screen) - end) -) - -root.keys(keys.globalkeys) -root.buttons(keys.desktopbuttons) - -return keys --- EOF ------------------------------------------------------------------------ diff --git a/home/yashraj/yuki/desktop/wm/awesome/module/json.lua b/home/yashraj/yuki/desktop/wm/awesome/module/json.lua deleted file mode 100644 index 711ef78..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/module/json.lua +++ /dev/null @@ -1,388 +0,0 @@ --- --- json.lua --- --- Copyright (c) 2020 rxi --- --- Permission is hereby granted, free of charge, to any person obtaining a copy of --- this software and associated documentation files (the "Software"), to deal in --- the Software without restriction, including without limitation the rights to --- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies --- of the Software, and to permit persons to whom the Software is furnished to do --- so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in all --- copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --- SOFTWARE. --- - -local json = { _version = "0.1.2" } - -------------------------------------------------------------------------------- --- Encode -------------------------------------------------------------------------------- - -local encode - -local escape_char_map = { - [ "\\" ] = "\\", - [ "\"" ] = "\"", - [ "\b" ] = "b", - [ "\f" ] = "f", - [ "\n" ] = "n", - [ "\r" ] = "r", - [ "\t" ] = "t", -} - -local escape_char_map_inv = { [ "/" ] = "/" } -for k, v in pairs(escape_char_map) do - escape_char_map_inv[v] = k -end - - -local function escape_char(c) - return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte())) -end - - -local function encode_nil(val) - return "null" -end - - -local function encode_table(val, stack) - local res = {} - stack = stack or {} - - -- Circular reference? - if stack[val] then error("circular reference") end - - stack[val] = true - - if rawget(val, 1) ~= nil or next(val) == nil then - -- Treat as array -- check keys are valid and it is not sparse - local n = 0 - for k in pairs(val) do - if type(k) ~= "number" then - error("invalid table: mixed or invalid key types") - end - n = n + 1 - end - if n ~= #val then - error("invalid table: sparse array") - end - -- Encode - for i, v in ipairs(val) do - table.insert(res, encode(v, stack)) - end - stack[val] = nil - return "[" .. table.concat(res, ",") .. "]" - - else - -- Treat as an object - for k, v in pairs(val) do - if type(k) ~= "string" then - error("invalid table: mixed or invalid key types") - end - table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) - end - stack[val] = nil - return "{" .. table.concat(res, ",") .. "}" - end -end - - -local function encode_string(val) - return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"' -end - - -local function encode_number(val) - -- Check for NaN, -inf and inf - if val ~= val or val <= -math.huge or val >= math.huge then - error("unexpected number value '" .. tostring(val) .. "'") - end - return string.format("%.14g", val) -end - - -local type_func_map = { - [ "nil" ] = encode_nil, - [ "table" ] = encode_table, - [ "string" ] = encode_string, - [ "number" ] = encode_number, - [ "boolean" ] = tostring, -} - - -encode = function(val, stack) - local t = type(val) - local f = type_func_map[t] - if f then - return f(val, stack) - end - error("unexpected type '" .. t .. "'") -end - - -function json.encode(val) - return ( encode(val) ) -end - - -------------------------------------------------------------------------------- --- Decode -------------------------------------------------------------------------------- - -local parse - -local function create_set(...) - local res = {} - for i = 1, select("#", ...) do - res[ select(i, ...) ] = true - end - return res -end - -local space_chars = create_set(" ", "\t", "\r", "\n") -local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",") -local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u") -local literals = create_set("true", "false", "null") - -local literal_map = { - [ "true" ] = true, - [ "false" ] = false, - [ "null" ] = nil, -} - - -local function next_char(str, idx, set, negate) - for i = idx, #str do - if set[str:sub(i, i)] ~= negate then - return i - end - end - return #str + 1 -end - - -local function decode_error(str, idx, msg) - local line_count = 1 - local col_count = 1 - for i = 1, idx - 1 do - col_count = col_count + 1 - if str:sub(i, i) == "\n" then - line_count = line_count + 1 - col_count = 1 - end - end - error( string.format("%s at line %d col %d", msg, line_count, col_count) ) -end - - -local function codepoint_to_utf8(n) - -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa - local f = math.floor - if n <= 0x7f then - return string.char(n) - elseif n <= 0x7ff then - return string.char(f(n / 64) + 192, n % 64 + 128) - elseif n <= 0xffff then - return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128) - elseif n <= 0x10ffff then - return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, - f(n % 4096 / 64) + 128, n % 64 + 128) - end - error( string.format("invalid unicode codepoint '%x'", n) ) -end - - -local function parse_unicode_escape(s) - local n1 = tonumber( s:sub(1, 4), 16 ) - local n2 = tonumber( s:sub(7, 10), 16 ) - -- Surrogate pair? - if n2 then - return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000) - else - return codepoint_to_utf8(n1) - end -end - - -local function parse_string(str, i) - local res = "" - local j = i + 1 - local k = j - - while j <= #str do - local x = str:byte(j) - - if x < 32 then - decode_error(str, j, "control character in string") - - elseif x == 92 then -- `\`: Escape - res = res .. str:sub(k, j - 1) - j = j + 1 - local c = str:sub(j, j) - if c == "u" then - local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1) - or str:match("^%x%x%x%x", j + 1) - or decode_error(str, j - 1, "invalid unicode escape in string") - res = res .. parse_unicode_escape(hex) - j = j + #hex - else - if not escape_chars[c] then - decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string") - end - res = res .. escape_char_map_inv[c] - end - k = j + 1 - - elseif x == 34 then -- `"`: End of string - res = res .. str:sub(k, j - 1) - return res, j + 1 - end - - j = j + 1 - end - - decode_error(str, i, "expected closing quote for string") -end - - -local function parse_number(str, i) - local x = next_char(str, i, delim_chars) - local s = str:sub(i, x - 1) - local n = tonumber(s) - if not n then - decode_error(str, i, "invalid number '" .. s .. "'") - end - return n, x -end - - -local function parse_literal(str, i) - local x = next_char(str, i, delim_chars) - local word = str:sub(i, x - 1) - if not literals[word] then - decode_error(str, i, "invalid literal '" .. word .. "'") - end - return literal_map[word], x -end - - -local function parse_array(str, i) - local res = {} - local n = 1 - i = i + 1 - while 1 do - local x - i = next_char(str, i, space_chars, true) - -- Empty / end of array? - if str:sub(i, i) == "]" then - i = i + 1 - break - end - -- Read token - x, i = parse(str, i) - res[n] = x - n = n + 1 - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "]" then break end - if chr ~= "," then decode_error(str, i, "expected ']' or ','") end - end - return res, i -end - - -local function parse_object(str, i) - local res = {} - i = i + 1 - while 1 do - local key, val - i = next_char(str, i, space_chars, true) - -- Empty / end of object? - if str:sub(i, i) == "}" then - i = i + 1 - break - end - -- Read key - if str:sub(i, i) ~= '"' then - decode_error(str, i, "expected string for key") - end - key, i = parse(str, i) - -- Read ':' delimiter - i = next_char(str, i, space_chars, true) - if str:sub(i, i) ~= ":" then - decode_error(str, i, "expected ':' after key") - end - i = next_char(str, i + 1, space_chars, true) - -- Read value - val, i = parse(str, i) - -- Set - res[key] = val - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "}" then break end - if chr ~= "," then decode_error(str, i, "expected '}' or ','") end - end - return res, i -end - - -local char_func_map = { - [ '"' ] = parse_string, - [ "0" ] = parse_number, - [ "1" ] = parse_number, - [ "2" ] = parse_number, - [ "3" ] = parse_number, - [ "4" ] = parse_number, - [ "5" ] = parse_number, - [ "6" ] = parse_number, - [ "7" ] = parse_number, - [ "8" ] = parse_number, - [ "9" ] = parse_number, - [ "-" ] = parse_number, - [ "t" ] = parse_literal, - [ "f" ] = parse_literal, - [ "n" ] = parse_literal, - [ "[" ] = parse_array, - [ "{" ] = parse_object, -} - - -parse = function(str, idx) - local chr = str:sub(idx, idx) - local f = char_func_map[chr] - if f then - return f(str, idx) - end - decode_error(str, idx, "unexpected character '" .. chr .. "'") -end - - -function json.decode(str) - if type(str) ~= "string" then - error("expected argument of type string, got " .. type(str)) - end - local res, idx = parse(str, next_char(str, 1, space_chars, true)) - idx = next_char(str, idx, space_chars, true) - if idx <= #str then - decode_error(str, idx, "trailing garbage") - end - return res -end - - -return json diff --git a/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/init.lua b/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/init.lua deleted file mode 100644 index 4368460..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/init.lua +++ /dev/null @@ -1,33 +0,0 @@ -local awful = require("awful") -local gfs = require("gears.filesystem") - -local lock_screen = {} - -local lua_pam_path = gfs.get_configuration_dir() .. "module/lockscren/lib/liblua_pam.so" - -lock_screen.init = function() - -- Initialize authentication method based on whether lua-pam has been - -- installed or not - awful.spawn.easy_async_with_shell("stat " .. lua_pam_path .. " >/dev/null 2>&1", function(_, __, ___, exitcode) - if exitcode == 0 then - local pam = require("liblua_pam") - -- lua-pam was installed. - -- Authenticate with PAM - lock_screen.authenticate = function(password) - return pam.auth_current_user(password) - end - else - -- lua-pam was NOT installed. - -- Authenticate with user.lock_screen_custom_password - lock_screen.authenticate = function(password) - return password == user.lock_screen_custom_password - end - end - - -- Load the lock_screen element - require("module.lockscreen.lockscreen") - end) -end - -return lock_screen --- Note: Wait for sometime after unlocking after sleep diff --git a/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/lib/liblua_pam.so b/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/lib/liblua_pam.so deleted file mode 100644 index fb05778..0000000 Binary files a/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/lib/liblua_pam.so and /dev/null differ diff --git a/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/lockscreen.lua b/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/lockscreen.lua deleted file mode 100644 index e234f49..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/module/lockscreen/lockscreen.lua +++ /dev/null @@ -1,398 +0,0 @@ -local gears = require("gears") -local awful = require("awful") -local beautiful = require("beautiful") -local xresources = require("beautiful.xresources") -local dpi = xresources.apply_dpi -local wibox = require("wibox") -local lock_screen = require("module.lockscreen") - ---- Word Clock Lock Screen ---- ~~~~~~~~~~~~~~~~~~~~~~ - -local lock_screen_symbol = "" -local lock_screen_fail_symbol = "" -local lock_animation_icon = wibox.widget({ - --- Set forced size to prevent flickering when the icon rotates - forced_height = dpi(80), - forced_width = dpi(80), - font = beautiful.icon_font .. "Outlined 40", - align = "center", - valign = "center", - widget = wibox.widget.textbox(lock_screen_symbol), -}) - -local some_textbox = wibox.widget.textbox() - -lock_screen_box = wibox({ visible = false, ontop = true, type = "splash", screen = screen.primary }) -awful.placement.maximize(lock_screen_box) - -lock_screen_box.bg = beautiful.transparent -lock_screen_box.fg = beautiful.color15 - ---- Add lockscreen to each screen -awful.screen.connect_for_each_screen(function(s) - if s == screen.primary then - s.mylockscreen = lock_screen_box - else - s.mylockscreen = wibox({ - visible = false, - ontop = true, - type = "splash", - screen = s, - }) - awful.placement.maximize(s.mylockscreen) - s.mylockscreen.bg = beautiful.background - end -end) - -local function set_visibility(v) - for s in screen do - s.mylockscreen.visible = v - end -end - ---- Word Clock ---- ~~~~~~~~~ -local char = -"I T L I S A S A M P M A C Q U A R T E R D C T W E N T Y F I V E X H A L F S T E N F T O P A S T E R U N I N E O N E S I X T H R E E F O U R F I V E T W O E I G H T E L E V E N S E V E N T W E L V E T E N S E O C L O C K" - -local pos_map = { - ["it"] = { 1, 2 }, - ["is"] = { 4, 5 }, - ["a"] = { 12, 12 }, - ["quarter"] = { 14, 20 }, - ["twenty"] = { 23, 28 }, - ["five"] = { 29, 32 }, - ["half"] = { 34, 37 }, - ["ten"] = { 39, 41 }, - ["past"] = { 45, 48 }, - ["to"] = { 43, 44 }, - ["1"] = { 56, 58 }, - ["2"] = { 75, 77 }, - ["3"] = { 62, 66 }, - ["4"] = { 67, 70 }, - ["5"] = { 71, 74 }, - ["6"] = { 59, 61 }, - ["7"] = { 89, 93 }, - ["8"] = { 78, 82 }, - ["9"] = { 52, 55 }, - ["10"] = { 100, 102 }, - ["11"] = { 83, 88 }, - ["12"] = { 94, 99 }, - ["oclock"] = { 105, 110 }, -} - -local char_map = { - ["it"] = {}, - ["is"] = {}, - ["a"] = {}, - ["quarter"] = {}, - ["twenty"] = {}, - ["five"] = {}, - ["half"] = {}, - ["ten"] = {}, - ["past"] = {}, - ["to"] = {}, - ["1"] = {}, - ["2"] = {}, - ["3"] = {}, - ["4"] = {}, - ["5"] = {}, - ["6"] = {}, - ["7"] = {}, - ["8"] = {}, - ["9"] = {}, - ["10"] = {}, - ["11"] = {}, - ["12"] = {}, - ["oclock"] = {}, -} - -local reset_map = { 4, 12, 14, 23, 29, 34, 39, 43, 45, 52, 56, 59, 62, 67, 71, 75, 78, 83, 89, 94, 100, 105 } - -function split_str(s, delimiter) - result = {} - for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do - table.insert(result, match) - end - - return result -end - -local time_char = split_str(char, " ") - -local time = wibox.widget({ - forced_num_cols = 11, - spacing = dpi(6), - layout = wibox.layout.grid, -}) - -local function create_text_widget(index, w) - local text_widget = wibox.widget({ - id = "t" .. index, - markup = w, - font = beautiful.font_name .. "Bold 24", - align = "center", - valign = "center", - forced_width = dpi(36), - forced_height = dpi(36), - widget = wibox.widget.textbox, - }) - - time:add(text_widget) - - return text_widget -end - -local var_count = 0 -for i, m in pairs(time_char) do - local text = "" .. m .. "" - - var_count = var_count + 1 - local create_dummy_text = true - - for j, k in pairs(pos_map) do - if i >= pos_map[j][1] and i <= pos_map[j][2] then - char_map[j][var_count] = create_text_widget(i, text) - create_dummy_text = false - end - - for _, n in pairs(reset_map) do - if i == n then - var_count = 1 - end - end - end - - if create_dummy_text then - create_text_widget(i, text) - end -end - -local function activate_word(w) - for i, m in pairs(char_map[w]) do - local text = m.text - m.markup = "" .. text .. "" - end -end - -local function deactivate_word(w) - for i, m in pairs(char_map[w]) do - local text = m.text - m.markup = "" .. text .. "" - end -end - -local function reset_time() - for j, k in pairs(char_map) do - deactivate_word(j) - end - - activate_word("it") - activate_word("is") -end - -gears.timer({ - timeout = 1, - call_now = true, - autostart = true, - callback = function() - local time = os.date("%I" .. ":%M") - local h, m = time:match("(%d+):(%d+)") - local min = tonumber(m) - local hour = tonumber(h) - - reset_time() - - if min >= 0 and min <= 2 or min >= 58 and min <= 59 then - activate_word("oclock") - elseif min >= 3 and min <= 7 or min >= 53 and min <= 57 then - activate_word("five") - elseif min >= 8 and min <= 12 or min >= 48 and min <= 52 then - activate_word("ten") - elseif min >= 13 and min <= 17 or min >= 43 and min <= 47 then - activate_word("a") - activate_word("quarter") - elseif min >= 18 and min <= 22 or min >= 38 and min <= 42 then - activate_word("twenty") - elseif min >= 23 and min <= 27 or min >= 33 and min <= 37 then - activate_word("twenty") - activate_word("five") - elseif min >= 28 and min <= 32 then - activate_word("half") - end - - if min >= 3 and min <= 32 then - activate_word("past") - elseif min >= 33 and min <= 57 then - activate_word("to") - end - - local hh - - if min >= 0 and min <= 30 then - hh = hour - else - hh = hour + 1 - end - - if hh > 12 then - hh = hh - 12 - end - - activate_word(tostring(hh)) - end, -}) - ---- Lock animation -local lock_animation_widget_rotate = wibox.container.rotate() - -local arc = function() - return function(cr, width, height) - gears.shape.arc(cr, width, height, 5, 0, math.pi / 2, true, true) - end -end - -local lock_animation_arc = wibox.widget({ - shape = arc(), - bg = "#00000000", - forced_width = dpi(100), - forced_height = dpi(100), - widget = wibox.container.background, -}) - -local lock_animation = { - { - lock_animation_arc, - widget = lock_animation_widget_rotate, - }, - lock_animation_icon, - layout = wibox.layout.stack, -} - ---- Lock helper functions -local characters_entered = 0 -local function reset() - characters_entered = 0 - lock_animation_icon.markup = lock_screen_symbol - lock_animation_widget_rotate.direction = "north" - lock_animation_arc.bg = "#00000000" -end - -local function fail() - characters_entered = 0 - lock_animation_icon.markup = lock_screen_fail_symbol - lock_animation_widget_rotate.direction = "north" - lock_animation_arc.bg = "#00000000" -end - -local animation_colors = { - --- Rainbow sequence - beautiful.color1, - beautiful.color5, - beautiful.color4, - beautiful.color6, - beautiful.color2, - beautiful.color3, -} - -local animation_directions = { "north", "west", "south", "east" } - ---- Function that "animates" every key press -local function key_animation(char_inserted) - local color - local direction = animation_directions[(characters_entered % 4) + 1] - if char_inserted then - color = animation_colors[(characters_entered % 6) + 1] - lock_animation_icon.markup = lock_screen_symbol - else - if characters_entered == 0 then - reset() - else - color = beautiful.color7 .. "55" - end - end - - lock_animation_arc.bg = color - lock_animation_widget_rotate.direction = direction -end - ---- Get input from user -local function grab_password() - awful.prompt.run({ - hooks = { - --- Custom escape behaviour: Do not cancel input with Escape - --- Instead, this will just clear any input received so far. - { - {}, - "Escape", - function(_) - reset() - grab_password() - end, - }, - --- Fix for Control+Delete crashing the keygrabber - { - { "Control" }, - "Delete", - function() - reset() - grab_password() - end, - }, - }, - keypressed_callback = function(mod, key, cmd) - --- Only count single character keys (thus preventing "Shift", "Escape", etc from triggering the animation) - if #key == 1 then - characters_entered = characters_entered + 1 - key_animation(true) - elseif key == "BackSpace" then - if characters_entered > 0 then - characters_entered = characters_entered - 1 - end - key_animation(false) - end - end, - exe_callback = function(input) - --- Check input - if lock_screen.authenticate(input) then - --- YAY - reset() - set_visibility(false) - else - --- NAY - fail() - grab_password() - end - end, - textbox = some_textbox, - }) -end - -function lock_screen_show() - set_visibility(true) - grab_password() -end - -lock_screen_box:setup({ - --- Horizontal centering - nil, - { - --- Vertical centering - nil, - { - wibox.widget({ - forced_height = dpi(20), - layout = wibox.layout.fixed.vertical, - }), - time, - lock_animation, - spacing = dpi(60), - layout = wibox.layout.fixed.vertical, - }, - expand = "none", - layout = wibox.layout.align.vertical, - }, - expand = "none", - layout = wibox.layout.align.horizontal, -}) diff --git a/home/yashraj/yuki/desktop/wm/awesome/module/window_switcher.lua b/home/yashraj/yuki/desktop/wm/awesome/module/window_switcher.lua deleted file mode 100644 index b1ddf1c..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/module/window_switcher.lua +++ /dev/null @@ -1,285 +0,0 @@ -local awful = require("awful") -local gears = require("gears") -local wibox = require("wibox") -local beautiful = require("beautiful") -local dpi = beautiful.xresources.apply_dpi - -local window_switcher_first_client -- The client that was focused when the window_switcher was activated -local window_switcher_minimized_clients = {} -- The clients that were minimized when the window switcher was activated -local window_switcher_grabber - -local get_num_clients = function() - local minimized_clients_in_tag = 0 - local matcher = function(c) - return awful.rules.match(c, { - minimized = true, - skip_taskbar = false, - hidden = false, - first_tag = awful.screen.focused().selected_tag, - }) - end - for c in awful.client.iterate(matcher) do - minimized_clients_in_tag = minimized_clients_in_tag + 1 - end - return minimized_clients_in_tag + #awful.screen.focused().clients -end - -local window_switcher_hide = function(window_switcher_box) - -- Add currently focused client to history - if client.focus then - local window_switcher_last_client = client.focus - awful.client.focus.history.add(window_switcher_last_client) - -- Raise client that was focused originally - -- Then raise last focused client - if window_switcher_first_client and window_switcher_first_client.valid then - window_switcher_first_client:raise() - window_switcher_last_client:raise() - end - end - - -- Minimize originally minimized clients - local s = awful.screen.focused() - for _, c in pairs(window_switcher_minimized_clients) do - if c and c.valid and not (client.focus and client.focus == c) then - c.minimized = true - end - end - -- Reset helper table - window_switcher_minimized_clients = {} - - -- Resume recording focus history - awful.client.focus.history.enable_tracking() - -- Stop and hide window_switcher - awful.keygrabber.stop(window_switcher_grabber) - window_switcher_box.visible = false - window_switcher_box.widget = nil - collectgarbage("collect") -end - -local function draw_widget(mouse_keys) - local tasklist_widget = awful.widget.tasklist({ - screen = awful.screen.focused(), - filter = awful.widget.tasklist.filter.currenttags, - buttons = mouse_keys, - style = { - font = beautiful.font, - bg_normal = beautiful.bg_normal, - bg_focus = beautiful.bg_focus, - fg_normal = beautiful.fg_normal, - fg_focus = beautiful.fg_focus, - shape = gears.shape.rounded_rect, - }, - layout = { - layout = wibox.layout.fixed.horizontal, - }, - widget_template = { - { - { - { - awful.widget.clienticon, - forced_height = dpi(80), - forced_width = dpi(80), - halign = "center", - valign = "center", - widget = wibox.container.place, - }, - { - { - widget = wibox.container.scroll.horizontal, - step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, - fps = 60, - speed = 75, - { - id = "text_role", - widget = wibox.widget.textbox, - }, - }, - halign = "center", - valign = "center", - widget = wibox.container.place, - }, - spacing = dpi(15), - layout = wibox.layout.fixed.vertical, - }, - margins = dpi(15), - widget = wibox.container.margin, - }, - forced_width = dpi(150), - forced_height = dpi(150), - id = "background_role", - widget = wibox.container.background, - }, - }) - - return wibox.widget({ - { - tasklist_widget, - margins = dpi(15), - widget = wibox.container.margin, - }, - bg = beautiful.background, - shape = gears.shape.rounded_rect, - widget = wibox.container.background, - }) -end - -local enable = function() - local hide_window_switcher_key = "Escape" - - local select_client_key = 1 - local minimize_key = "n" - local unminimize_key = "N" - local kill_client_key = "q" - - local cycle_key = "Tab" - - local previous_key = "Left" - local next_key = "Right" - - local vim_previous_key = "h" - local vim_next_key = "l" - - local scroll_previous_key = 4 - local scroll_next_key = 5 - - local window_switcher_box = awful.popup({ - bg = "#00000000", - visible = false, - ontop = true, - placement = awful.placement.centered, - screen = awful.screen.focused(), - widget = wibox.container.background, -- A dummy widget to make awful.popup not scream - widget = draw_widget(), - }) - - local mouse_keys = gears.table.join( - awful.button({ - modifiers = { "Any" }, - button = select_client_key, - on_press = function(c) - client.focus = c - end, - }), - - awful.button({ - modifiers = { "Any" }, - button = scroll_previous_key, - on_press = function() - awful.client.focus.byidx(-1) - end, - }), - - awful.button({ - modifiers = { "Any" }, - button = scroll_next_key, - on_press = function() - awful.client.focus.byidx(1) - end, - }) - ) - - local keyboard_keys = { - [hide_window_switcher_key] = function() - window_switcher_hide(window_switcher_box) - end, - - [minimize_key] = function() - if client.focus then - client.focus.minimized = true - end - end, - [unminimize_key] = function() - if awful.client.restore() then - client.focus = awful.client.restore() - end - end, - [kill_client_key] = function() - if client.focus then - client.focus:kill() - end - end, - - [cycle_key] = function() - awful.client.focus.byidx(1) - end, - - [previous_key] = function() - awful.client.focus.byidx(1) - end, - [next_key] = function() - awful.client.focus.byidx(-1) - end, - - [vim_previous_key] = function() - awful.client.focus.byidx(1) - end, - [vim_next_key] = function() - awful.client.focus.byidx(-1) - end, - } - - window_switcher_box:connect_signal("property::width", function() - if window_switcher_box.visible and get_num_clients() == 0 then - window_switcher_hide(window_switcher_box) - end - end) - - window_switcher_box:connect_signal("property::height", function() - if window_switcher_box.visible and get_num_clients() == 0 then - window_switcher_hide(window_switcher_box) - end - end) - - awesome.connect_signal("window_switcher::turn_on", function() - local number_of_clients = get_num_clients() - if number_of_clients == 0 then - return - end - - -- Store client that is focused in a variable - window_switcher_first_client = client.focus - - -- Stop recording focus history - awful.client.focus.history.disable_tracking() - - -- Go to previously focused client (in the tag) - awful.client.focus.history.previous() - - -- Track minimized clients - -- Unminimize them - -- Lower them so that they are always below other - -- originally unminimized windows - local clients = awful.screen.focused().selected_tag:clients() - for _, c in pairs(clients) do - if c.minimized then - table.insert(window_switcher_minimized_clients, c) - c.minimized = false - c:lower() - end - end - - -- Start the keygrabber - window_switcher_grabber = awful.keygrabber.run(function(_, key, event) - if event == "release" then - -- Hide if the modifier was released - -- We try to match Super or Alt or Control since we do not know which keybind is - -- used to activate the window switcher (the keybind is set by the user in keys.lua) - if key:match("Super") or key:match("Alt") or key:match("Control") then - window_switcher_hide(window_switcher_box) - end - -- Do nothing - return - end - - -- Run function attached to key, if it exists - if keyboard_keys[key] then - keyboard_keys[key]() - end - end) - - window_switcher_box.widget = draw_widget(mouse_keys) - window_switcher_box.visible = true - end) -end - -return { enable = enable } diff --git a/home/yashraj/yuki/desktop/wm/awesome/rc.lua b/home/yashraj/yuki/desktop/wm/awesome/rc.lua deleted file mode 100644 index 08b775f..0000000 --- a/home/yashraj/yuki/desktop/wm/awesome/rc.lua +++ /dev/null @@ -1,719 +0,0 @@ --- ░█▄█░█▀█░█▀▄░█▀▀░█▀▀░█▀█░█▀█░█▀█░▀█▀░▀░█▀▀░░░█▀█░█░█░█▀▀░█▀▀░█▀█░█▄█░█▀▀ --- ░█░█░█░█░█▀▄░▀▀█░█▀▀░█░█░█▀█░█▀▀░░█░░░░▀▀█░░░█▀█░█▄█░█▀▀░▀▀█░█░█░█░█░█▀▀ --- ░▀░▀░▀▀▀░▀▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀░░░▀▀▀░░░▀▀▀░░░▀░▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀ - --- >> The file that binds everything together. - --- User variables and preferences --- ============================================= -user = { - terminal = "alacritty", - floating_terminal = "alacritty --class floating_terminal", - scratchpad_terminal = "alacritty --class scratchpad -e tmux", - editor = os.getenv("EDITOR") or "nano", - browser = "vivaldi", - file_manager = "pcmanfm", - visual_editor = "codium", - openweathermap_key = "d1b3b6a81db867259446b0863d5f9108", - openweathermap_city_id = { - "25.6", --- lat - "85.1167", --- lon - }, - openweathermap_weather_units = "metric", - lock_screen_custom_password = "awesome", -} - --- initialization --- ============================================= -local beautiful = require("beautiful") --- Make dpi function global -dpi = beautiful.xresources.apply_dpi - --- Load AwesomeWM libraries -local gears = require("gears") -local gfs = require("gears.filesystem") -local awful = require("awful") -require("awful.autofocus") --- Default notification library -local naughty = require("naughty") - --- Load theme -beautiful.init(gfs.get_configuration_dir() .. "configuration/" .. "theme.lua") - --- Error handling --- =================================================================== -naughty.connect_signal("request::display_error", function(message, startup) - naughty.notification({ - urgency = "critical", - title = "Oops, an error happened" .. (startup and " during startup!" or "!"), - message = message, - }) -end) - --- Features --- =================================================================== --- Load helper functions -local helpers = require("helpers") --- Apps -apps = { - browser = function() - awful.spawn(user.browser, { switchtotag = true }) - end, - file_manager = function() - awful.spawn(user.file_manager, { floating = true }) - end, - term_filemanager = function() - helpers.run_or_raise({ instance = 'ranger' }, false, user.terminal .. " --class ranger -e ranger") - end, - editor = function() - helpers.run_or_raise({ instance = 'editor' }, false, user.terminal .. " --class editor -e " .. user.editor, - { switchtotag = true }) - end, - visual_editor = function() - helpers.run_or_raise({ class = 'VSCodium' }, false, user.visual_editor, { switchtotag = true }) - end, - volume = function() - helpers.run_or_raise({ class = 'Pavucontrol' }, true, "pavucontrol") - end, - process_monitor = function() - helpers.run_or_raise({ instance = 'htop' }, false, user.terminal .. " --class htop -e htop", { switchtotag = true }) - end -} - --- Confuguration folder -require("configuration") - --- Keybinds and mousebinds -local keys = require("keys") - --- Lock screen --- Make sure to install lua-pam as described in the README or configure your --- custom password in the 'user' section above -local lock_screen = require("module.lockscreen") -lock_screen.init() - --- Window switcher -require("module.window_switcher").enable() - --- Get screen geometry --- I am using a single screen setup and I assume that screen geometry will not --- change during the session. -screen_width = awful.screen.focused().geometry.width -screen_height = awful.screen.focused().geometry.height - --- Layouts --- =================================================================== --- Table of layouts to cover with awful.layout.inc, order matters. -awful.layout.layouts = { - awful.layout.suit.tile, - awful.layout.suit.floating, - awful.layout.suit.max, - --awful.layout.suit.spiral, - --awful.layout.suit.spiral.dwindle, - --awful.layout.suit.tile.top, - --awful.layout.suit.fair, - --awful.layout.suit.fair.horizontal, - --awful.layout.suit.tile.left, - --awful.layout.suit.tile.bottom, - --awful.layout.suit.max.fullscreen, - --awful.layout.suit.corner.nw, - --awful.layout.suit.magnifier, - --awful.layout.suit.corner.ne, - --awful.layout.suit.corner.sw, - --awful.layout.suit.corner.se, -} - --- Wallpaper --- =================================================================== -local function set_wallpaper(s) - if beautiful.wallpaper then - local wallpaper = beautiful.wallpaper - -- If wallpaper is a function, call it with the screen - if type(wallpaper) == "function" then - wallpaper = wallpaper(s) - end - - -- >> Method 1: Built in wallpaper function - -- gears.wallpaper.fit(wallpaper, s, true) - gears.wallpaper.maximized(wallpaper, s, true) - - -- >> Method 2: Set theme's wallpaper with feh - --awful.spawn.with_shell("feh --bg-fill " .. wallpaper) - - -- >> Method 3: Set last wallpaper with feh - -- awful.spawn.with_shell(os.getenv("HOME") .. "/.fehbg") - end -end - --- Set wallpaper -awful.screen.connect_for_each_screen(function(s) - -- Wallpaper - set_wallpaper(s) -end) - --- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) -screen.connect_signal("property::geometry", set_wallpaper) - --- Tags --- =================================================================== -awful.screen.connect_for_each_screen(function(s) - -- Each screen has its own tag table. - local l = awful.layout.suit -- Alias to save time :) - -- Tag layouts - local layouts = { - l.max, - l.max, - l.max, - l.max, - l.tile, - l.max, - l.max, - l.max, - l.tile, - l.max, - } - - -- Tag names - local tagnames = beautiful.tagnames or { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" } - -- Create all tags at once (without seperate configuration for each tag) - awful.tag(tagnames, s, layouts) - - -- Create tags with seperate configuration for each tag - -- awful.tag.add(tagnames[1], { - -- layout = layouts[1], - -- screen = s, - -- master_width_factor = 0.6, - -- selected = true, - -- }) - -- ... -end) - --- Determines how floating clients should be placed -local floating_client_placement = function(c) - -- If the layout is floating or there are no other visible - -- clients, center client - if awful.layout.get(mouse.screen) ~= awful.layout.suit.floating or #mouse.screen.clients == 1 then - return awful.placement.centered(c, { honor_padding = true, honor_workarea = true }) - end - - -- Else use this placement - local p = awful.placement.no_overlap + awful.placement.no_offscreen - return p(c, { honor_padding = true, honor_workarea = true, margins = beautiful.useless_gap * 2 }) -end - -local centered_client_placement = function(c) - return gears.timer.delayed_call(function() - awful.placement.centered(c, { honor_padding = true, honor_workarea = true }) - end) -end - --- Rules --- =================================================================== --- Rules to apply to new clients (through the "manage" signal). -awful.rules.rules = { - { - -- All clients will match this rule. - rule = {}, - properties = { - border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - keys = keys.clientkeys, - buttons = keys.clientbuttons, - screen = awful.screen.focused, - size_hints_honor = false, - honor_workarea = true, - honor_padding = true, - maximized = false, - titlebars_enabled = beautiful.titlebar_enabled, - maximized_horizontal = false, - maximized_vertical = false, - placement = floating_client_placement, - } - }, - - -- Floating clients - { - rule_any = { - instance = { - "floating_terminal", - "Devtools", -- Firefox devtools - }, - class = { - "Gpick", - "Lxappearance", - "Nm-connection-editor", - "File-roller", - "fst", - "Nvidia-settings", - }, - name = { - "Event Tester", -- xev - "MetaMask Notification", - "Picture in picture", - }, - role = { - "AlarmWindow", - "pop-up", - "GtkFileChooserDialog", - "conversation", - }, - type = { - "dialog", - }, - }, - properties = { floating = true }, - }, - - -- Fullscreen clients - { - rule_any = { - class = { - "dota2", - "dontstarve_steam", - }, - instance = { - "synthetik.exe", - }, - }, - properties = { fullscreen = true }, - }, - - -- Centered clients - { - rule_any = { - type = { - "dialog", - }, - class = { - "Steam", - "discord", - "music", - "scratchpad", - }, - instance = { - "music", - "scratchpad", - }, - role = { - "GtkFileChooserDialog", - "conversation", - }, - }, - properties = { placement = centered_client_placement }, - }, - - -- Titlebars ON (explicitly) - { - rule_any = { - type = { - "dialog", - }, - role = { - "conversation", - }, - }, - callback = function(c) - decorations.show(c) - end, - }, - - -- "Needy": Clients that steal focus when they are urgent - { - rule_any = { - class = { - "TelegramDesktop", - "firefox", - "Nightly", - }, - type = { - "dialog", - }, - }, - callback = function(c) - c:connect_signal("property::urgent", function() - if c.urgent then - c:jump_to() - end - end) - end, - }, - - -- Fixed terminal geometry for floating terminals - { - rule_any = { - class = { - "Alacritty", - "Termite", - "mpvtube", - "kitty", - "st-256color", - "st", - "URxvt", - }, - }, - properties = { width = screen_width * 0.45, height = screen_height * 0.5 }, - }, - - -- File chooser dialog - { - rule_any = { role = { "GtkFileChooserDialog" } }, - properties = { floating = true, width = screen_width * 0.55, height = screen_height * 0.65 }, - }, - - -- Pavucontrol - { - rule_any = { class = { "Pavucontrol" } }, - properties = { floating = true, width = screen_width * 0.45, height = screen_height * 0.8 }, - }, - - -- Galculator - { - rule_any = { class = { "Galculator" } }, - except_any = { type = { "dialog" } }, - properties = { floating = true, width = screen_width * 0.2, height = screen_height * 0.4 }, - }, - - -- File managers - { - rule_any = { - class = { - "Pcmanfm", - "Nemo", - "Thunar", - }, - }, - except_any = { - type = { "dialog" }, - }, - properties = { floating = true, width = screen_width * 0.45, height = screen_height * 0.55 }, - }, - - -- Scratchpad - { - rule_any = { - instance = { - "scratchpad", - "markdown_input", - }, - class = { - "scratchpad", - "markdown_input", - }, - }, - properties = { - skip_taskbar = false, - floating = true, - ontop = false, - minimized = true, - sticky = false, - width = screen_width * 0.7, - height = screen_height * 0.75, - }, - }, - - -- Music clients (usually a terminal running ncmpcpp) - { - rule_any = { - class = { - "music", - }, - instance = { - "music", - }, - }, - properties = { - floating = true, - width = screen_width * 0.45, - height = screen_height * 0.50, - }, - }, - - -- Image viewers - { - rule_any = { - class = { - "feh", - "Sxiv", - }, - }, - properties = { - floating = true, - width = screen_width * 0.7, - height = screen_height * 0.75, - }, - callback = function(c) - awful.placement.centered(c, { honor_padding = true, honor_workarea = true }) - end, - }, - - -- Steam guard - { - rule = { name = "Steam Guard - Computer Authorization Required" }, - properties = { floating = true }, - -- Such a stubborn window, centering it does not work - -- callback = function(c) - -- gears.timer.delayed_call(function() - -- awful.placement.centered(c,{honor_padding = true, honor_workarea=true}) - -- end) - -- end - }, - - -- MPV - { - rule = { class = "mpv" }, - properties = {}, - callback = function(c) - -- Make it floating, ontop and move it out of the way if the current tag is maximized - if awful.layout.get(awful.screen.focused()) == awful.layout.suit.max then - c.floating = true - c.ontop = true - c.width = screen_width * 0.30 - c.height = screen_height * 0.35 - awful.placement.bottom_right(c, { - honor_padding = true, - honor_workarea = true, - margins = { bottom = beautiful.useless_gap * 2, right = beautiful.useless_gap * 2 }, - }) - end - - -- Restore `ontop` after fullscreen is disabled - -- Sorta tries to fix: https://github.com/awesomeWM/awesome/issues/667 - c:connect_signal("property::fullscreen", function() - if not c.fullscreen then - c.ontop = true - end - end) - end, - }, - - -- Start application on specific workspace - -- =================================================================== - -- Browsing - { - rule_any = { - class = { - "firefox", - "Nightly", - "Vivaldi-stable", - }, - }, - except_any = { - role = { "GtkFileChooserDialog" }, - instance = { "Toolkit" }, - type = { "dialog" }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[1] }, - }, - - -- Editing - { - rule_any = { - class = { - "^editor$", - "VSCodium", - }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[2] }, - }, - - -- Games - { - rule_any = { - class = { - "Wine", - }, - instance = {}, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[3] }, - }, - - -- Chatting - { - rule_any = { - class = { - "discord", - "Signal", - "Slack", - "zoom", - }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[4] }, - }, - - -- System monitoring - { - rule_any = { - class = { - "htop", - }, - instance = { - "htop", - }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[5] }, - }, - - -- Image editing - { - rule_any = { - class = { - "Gimp", - }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[6] }, - }, - - -- Mail - { - rule_any = { - class = { - "email", - }, - instance = { - "email", - }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[7] }, - }, - - -- Game clients/launchers - { - rule_any = { - class = { - "Steam", - "battle.net.exe", - "Lutris", - }, - name = { - "Steam", - }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[8] }, - }, - - -- Miscellaneous - -- All clients that I want out of my way when they are running - { - rule_any = { - class = { - "torrent", - "Transmission", - "Deluge", - "VirtualBox Manager", - "KeePassXC", - }, - instance = { - "torrent", - "qemu", - }, - }, - except_any = { - type = { "dialog" }, - }, - properties = { screen = 1, tag = awful.screen.focused().tags[10] }, - }, -} - --- Signals --- ============================================= -if beautiful.border_width > 0 then - client.connect_signal("focus", function(c) - c.border_color = beautiful.border_focus - end) - client.connect_signal("unfocus", function(c) - c.border_color = beautiful.border_normal - end) -end - --- Set mouse resize mode (live or after) -awful.mouse.resize.set_mode("live") - --- Restore geometry for floating clients --- (for example after swapping from tiling mode to floating mode) -tag.connect_signal("property::layout", function(t) - for k, c in ipairs(t:clients()) do - if awful.layout.get(mouse.screen) == awful.layout.suit.floating then - local cgeo = awful.client.property.get(c, "floating_geometry") - if cgeo then - c:geometry(awful.client.property.get(c, "floating_geometry")) - end - end - end -end) - -client.connect_signal("manage", function(c) - if awful.layout.get(mouse.screen) == awful.layout.suit.floating then - awful.client.property.set(c, "floating_geometry", c:geometry()) - end -end) - -client.connect_signal("property::geometry", function(c) - if awful.layout.get(mouse.screen) == awful.layout.suit.floating then - awful.client.property.set(c, "floating_geometry", c:geometry()) - end -end) - --- When switching to a tag with urgent clients, raise them. --- This fixes the issue (visual mismatch) where after switching to --- a tag which includes an urgent client, the urgent client is --- unfocused but still covers all other windows (even the currently --- focused window). -awful.tag.attached_connect_signal(s, "property::selected", function() - local urgent_clients = function(c) - return awful.rules.match(c, { urgent = true }) - end - for c in awful.client.iterate(urgent_clients) do - if c.first_tag == mouse.screen.selected_tag then - client.focus = c - end - end -end) - --- Enable sloppy focus, so that focus follows mouse. -client.connect_signal("mouse::enter", function(c) - c:activate { context = "mouse_enter", raise = false } -end -) - --- Raise focused clients automatically --- client.connect_signal("focus", function(c) --- c:raise() --- end) - --- Focus all urgent clients automatically -client.connect_signal("property::urgent", function(c) - if c.urgent then - c.minimized = false - c:jump_to() - end -end) - --- Disable ontop when the client is not floating, and restore ontop if needed --- when the client is floating again --- I never want a non floating client to be ontop. -client.connect_signal("property::floating", function(c) - if c.floating then - if c.restore_ontop then - c.ontop = c.restore_ontop - end - else - c.restore_ontop = c.ontop - c.ontop = false - end -end) - --- Startup apps --- =================================================================== --- Spawn once --- awful.spawn.once("command", false) --- Suspend + lockscreen -awful.spawn.with_shell("xss-lock -- awesome-client 'lock_screen_show()'", false) - --- Garbage collection --- Enable for lower memory consumption --- =================================================================== -collectgarbage("setpause", 110) -collectgarbage("setstepmul", 1000) --- EOF ------------------------------------------------------------------------ diff --git a/home/yashraj/yuki/services/default.nix b/home/yashraj/yuki/services/default.nix new file mode 100644 index 0000000..0216db6 --- /dev/null +++ b/home/yashraj/yuki/services/default.nix @@ -0,0 +1,148 @@ +{ + services = { + clipmenu.enable = true; + + flameshot = { + enable = true; + + settings = { + General = { + disabledTrayIcon = true; + showStartupLaunchMessage = false; + }; + }; + }; + + network-manager-applet.enable = true; + + picom = { + enable = true; + backend = "glx"; + vSync = true; + shadow = true; + shadowOffsets = [(-40) (-20)]; + shadowOpacity = 0.55; + shadowExclude = [ + "_GTK_FRAME_EXTENTS@:c" + "_PICOM_SHADOW@:32c = 0" + "_NET_WM_WINDOW_TYPE:a = '_NET_WM_WINDOW_TYPE_NOTIFICATION'" + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" + "class_g = 'Conky'" + "class_g = 'slop'" + "window_type = 'combo'" + "window_type = 'desktop'" + "window_type = 'dnd'" + "window_type = 'dock'" + "window_type = 'dropdown_menu'" + "window_type = 'menu'" + "window_type = 'notification'" + "window_type = 'popup_menu'" + "window_type = 'splash'" + "window_type = 'toolbar'" + "window_type = 'utility'" + ]; + fade = true; + fadeDelta = 10; + fadeSteps = [0.03 0.03]; + fadeExclude = [ + "window_type = 'combo'" + "window_type = 'desktop'" + "window_type = 'dock'" + "window_type = 'dnd'" + "window_type = 'notification'" + "window_type = 'toolbar'" + "window_type = 'unknown'" + "window_type = 'utility'" + "_PICOM_FADE@:32c = 0" + ]; + activeOpacity = 1.0; + inactiveOpacity = 1.0; + menuOpacity = 1.0; + opacityRules = [ + "70:class_g = 'splash'" + "100:class_i = 'tray'" + "90:class_g = 'XTerm'" + "90:class_g = 'Alacritty'" + "90:class_g = 'kitty'" + ]; + wintypes = { + tooltip = { + fade = true; + shadow = true; + focus = true; + full-shadow = true; + }; + dock = {shadow = false;}; + dnd = {shadow = false;}; + popup_menu = {opacity = 1;}; + dropdown_menu = {opacity = 1;}; + desktop = {full-shadow = false;}; + normal = {full-shadow = false;}; + }; + settings = { + shadow-radius = 40; + shadow-color = "#000000"; + shadow-ignore-shaped = false; + frame-opacity = 1.0; + inactive-opacity-override = false; + focus-exclude = [ + "class_g = 'Cairo-clock'" + "class_g = 'Peek'" + "window_type = 'notification'" + "window_type = 'combo'" + "window_type = 'desktop'" + "window_type = 'dialog'" + "window_type = 'dnd'" + "window_type = 'dock'" + "window_type = 'dropdown_menu'" + "window_type = 'menu'" + "window_type = 'tooltip'" + "window_type = 'unknown'" + "window_type = 'utility'" + ]; + corner-radius = 15; + rounded-corners-exclude = [ + "_PICOM_SHADOW@:32c = 0" + "window_type = 'dock'" + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_MAXIMIZED_VERT'" + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_MAXIMIZED_HORZ'" + "class_g = 'Rofi'" + ]; + experimental-backends = true; + blur = { + method = "dual_kawase"; + kernel = "11x11gaussian"; + deviation = 1.0; + strength = 10; + background = true; + background-frame = true; + background-fixed = true; + }; + blur-background-exclude = [ + "_GTK_FRAME_EXTENTS@:c" + "window_type = 'combo'" + "window_type = 'desktop'" + "window_type = 'dnd'" + "window_type = 'menu'" + "window_type = 'toolbar'" + "window_type = 'tooltip'" + "window_type = 'utility'" + "window_type = 'unknown'" + "class_g = 'firefox' && window_type != 'normal'" + "class_g = 'slop'" + ]; + mark-wmwin-focused = true; + mark-ovredir-focused = true; + detect-rounded-corners = true; + detect-client-opacity = true; + detect-transient = true; + detect-client-leader = true; + glx-no-stencil = true; + use-damage = true; + transparent-clipping = false; + unredir-if-possible = false; + log-level = "warn"; + }; + }; + }; +} diff --git a/hosts/shared/default.nix b/hosts/shared/default.nix index b4fbfa0..0af20c3 100644 --- a/hosts/shared/default.nix +++ b/hosts/shared/default.nix @@ -87,8 +87,8 @@ ''; variables = { - EDITOR = "vim"; - BROWSER = "firefox"; + EDITOR = "nvim"; + BROWSER = "vivaldi"; }; };