From 9d993daf4b4f7876845bbf127f76723639f346f2 Mon Sep 17 00:00:00 2001 From: 0xTux <0xtux@pm.me> Date: Tue, 6 Aug 2024 06:11:03 +0530 Subject: [PATCH] add bindings for apps --- modules/home-manager/picom/default.nix | 1 + pkgs/awesome/awesome/binds/global/keys.lua | 33 ++++++++++++++-- pkgs/awesome/awesome/config/apps.lua | 4 ++ pkgs/awesome/awesome/config/rules.lua | 44 +++++++++++++++------- 4 files changed, 65 insertions(+), 17 deletions(-) diff --git a/modules/home-manager/picom/default.nix b/modules/home-manager/picom/default.nix index c6ec3c4..d3a298f 100644 --- a/modules/home-manager/picom/default.nix +++ b/modules/home-manager/picom/default.nix @@ -22,6 +22,7 @@ "90:class_g = 'discord'" "90:class_g = 'code'" "90:class_g = 'org.wezfurlong.wezterm'" + "90:class_g = 'wezterm-floating'" ]; settings = { diff --git a/pkgs/awesome/awesome/binds/global/keys.lua b/pkgs/awesome/awesome/binds/global/keys.lua index b0a8d5e..1c14b81 100644 --- a/pkgs/awesome/awesome/binds/global/keys.lua +++ b/pkgs/awesome/awesome/binds/global/keys.lua @@ -16,13 +16,40 @@ awful.keyboard.append_global_keybindings({ ), awful.key({ modkey, mod.shift }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }), awful.key({ modkey, mod.shift }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }), - awful.key({ modkey }, "Return", function() - awful.spawn(apps.terminal) - end, { description = "open a terminal", group = "launcher" }), + + -- Apps related keybindings awful.key({ modkey }, "a", function() awful.spawn("rofi -show drun") end, { description = "run prompt", group = "launcher" }), + awful.key({ modkey }, "Return", function() + awful.spawn(apps.terminal) + end, { description = "open terminal", group = "launcher" }), + + awful.key({ modkey, mod.shift }, "Return", function() + awful.spawn(apps.terminal_floating) + end, { description = "open floating terminal", group = "launcher" }), + + awful.key({ modkey }, "v", function() + awful.spawn(apps.editor_cmd) + end, { description = "open neovim", group = "launcher" }), + + awful.key({ modkey }, "n", function() + awful.spawn(apps.neovide) + end, { description = "open neovide", group = "launcher" }), + + awful.key({ modkey }, "b", function() + awful.spawn(apps.browser) + end, { description = "open browser", group = "launcher" }), + + awful.key({ modkey }, "d", function() + awful.spawn("discord") + end, { description = "open discord", group = "launcher" }), + + awful.key({ modkey }, "t", function() + awful.spawn(apps.file_explorer) + end, { description = "open file explorer", group = "launcher" }), + -- Focus related keybindings. awful.key({ modkey }, "Left", function() awful.client.focus.bydirection("left") diff --git a/pkgs/awesome/awesome/config/apps.lua b/pkgs/awesome/awesome/config/apps.lua index c9b21db..743e2f3 100644 --- a/pkgs/awesome/awesome/config/apps.lua +++ b/pkgs/awesome/awesome/config/apps.lua @@ -1,8 +1,12 @@ -- This is used later as the default terminal and editor to run. local apps = {} apps.terminal = "wezterm" +apps.terminal_floating = "wezterm start --class wezterm-floating" apps.editor = "nvim" apps.editor_cmd = apps.terminal .. " -e " .. apps.editor +apps.neovide = "neovide" +apps.browser = "firefox" +apps.file_explorer = "thunar" -- Set the terminal for the menubar. require("menubar").utils.terminal = apps.terminal diff --git a/pkgs/awesome/awesome/config/rules.lua b/pkgs/awesome/awesome/config/rules.lua index 01c6bdd..b855fba 100644 --- a/pkgs/awesome/awesome/config/rules.lua +++ b/pkgs/awesome/awesome/config/rules.lua @@ -25,17 +25,13 @@ ruled.client.connect_signal("request::rules", function() "Arandr", ".blueman-manager-wrapped", "Gpick", - }, - -- Note that the name property shown in xprop might be set slightly after creation of the client - -- and the name shown there might not match defined rules here. - name = { - "Event Tester", -- xev. - }, - role = { - "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. + "wezterm-floating", }, }, - properties = { floating = true }, + properties = { + floating = true, + placement = awful.placement.centered, + }, }) -- Add titlebars to normal clients and dialogs. @@ -45,9 +41,29 @@ ruled.client.connect_signal("request::rules", function() -- properties = { titlebars_enabled = true }, -- }) - -- Set Firefox to always map on the tag named '2' on screen 1. - -- ruled.client.append_rule({ - -- rule = { class = 'Firefox' }, - -- properties = { screen = 1, tag = '2' } - -- }) + -- Map newly created windows to specific tags + ruled.client.append_rule({ + rule = { class = "org.wezfurlong.wezterm" }, + properties = { screen = 1, tag = "1" }, + }) + + ruled.client.append_rule({ + rule = { class = "neovide" }, + properties = { screen = 1, tag = "1" }, + }) + + ruled.client.append_rule({ + rule = { class = "firefox" }, + properties = { screen = 1, tag = "3" }, + }) + + ruled.client.append_rule({ + rule = { class = "Thunar" }, + properties = { screen = 1, tag = "3" }, + }) + + ruled.client.append_rule({ + rule = { class = "discord" }, + properties = { screen = 1, tag = "4" }, + }) end)