This commit is contained in:
Philipp Hochkamp 2023-04-11 21:16:07 +02:00
parent 4e740a4bc0
commit c18d20d33d
4 changed files with 5 additions and 148 deletions

23
flake.lock generated
View file

@ -314,11 +314,11 @@
},
"nixpkgs-master": {
"locked": {
"lastModified": 1681235871,
"narHash": "sha256-Stj/ZGUQnV9SnpcCOiAXNROLfDa5SzHOdOqPtke8uVg=",
"lastModified": 1681239518,
"narHash": "sha256-Q2qOhm6GzTIMb9y9sEsvn4hRFqCzVZiUkJkqf/ITXuc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6c5e8bcc15fd27055b3a74d8e179d737fa9607e3",
"rev": "c8619bc275bdc78302602b9b60d9635733619578",
"type": "github"
},
"original": {
@ -440,22 +440,6 @@
"type": "github"
}
},
"private": {
"flake": false,
"locked": {
"lastModified": 1667531394,
"narHash": "sha256-eo5s09w9DjRTqk4y+ULpYHQw5RNjNi+n9tEyvpbL84g=",
"owner": "thexyno",
"repo": "nixos-config-private-dummy",
"rev": "b38da5d5dd120e7dcc61b2ed3536be69fac649da",
"type": "github"
},
"original": {
"owner": "thexyno",
"repo": "nixos-config-private-dummy",
"type": "github"
}
},
"rnix-lsp": {
"inputs": {
"naersk": "naersk",
@ -498,7 +482,6 @@
"octoprint-spoolmanager": "octoprint-spoolmanager",
"octoprint-telegram": "octoprint-telegram",
"pandoc-latex-template": "pandoc-latex-template",
"private": "private",
"rnix-lsp": "rnix-lsp",
"spoons": "spoons",
"utils": "utils_2",

View file

@ -65,10 +65,6 @@
octoprint-spoolmanager.url = "github:OllisGit/OctoPrint-SpoolManager";
octoprint-spoolmanager.flake = false;
## mail
private.url = "github:thexyno/nixos-config-private-dummy";
private.flake = false;
};
outputs =

View file

@ -49,10 +49,6 @@ with lib.my;
home-manager.users.ragon = { pkgs, lib, inputs, config, ... }:
{
imports = [
"${inputs.private}/mail.nix"
];
home.file.".hammerspoon/init.lua".source =
let
notmuchMails = pkgs.writeScript "notmuch-get-mail-count" ''
@ -64,7 +60,6 @@ with lib.my;
src = ./hammerspoon.lua; inherit notmuchMails;
};
home.file.".hammerspoon/Spoons/MiroWindowsManager.spoon".source = "${inputs.miro}/MiroWindowsManager.spoon";
home.file.".hammerspoon/Spoons/MusicAppMediaFix.spoon".source = "${inputs.spoons}/Source/MusicAppMediaFix.spoon";
home.file.".finicky.js".source = ./finicky.js;
programs.home-manager.enable = true;

View file

@ -39,7 +39,7 @@ local bundleID = {
firefox = "org.mozilla.firefox",
emacs = "org.gnu.emacs",
iterm = "com.googlecode.iterm2",
safari = "com.apple.Safari",
orion = "com.kagi.kagimacOS",
safariTechnologyPreview = "com.apple.SafariTechnologyPreview",
spotify = "com.spotify.client",
bitwarden = "com.bitwarden.desktop",
@ -55,57 +55,6 @@ local usbDevice = {
local function languageIsGerman() return hs.host.locale.preferredLanguages()[1]:sub(0, 2) == "de" end
-- local function maximizeCurrentWindow() hs.window.focusedWindow():maximize() end
--
local function centerCurrentWindow() hs.window.focusedWindow():centerOnScreen() end
--
-- local function moveCurrentWindowToLeftHalf()
-- local win = hs.window.focusedWindow()
-- local screenFrame = win:screen():frame()
-- local newFrame = hs.geometry.rect(screenFrame.x, screenFrame.y, screenFrame.w / 2, screenFrame.h)
-- win:setFrame(newFrame)
-- end
--
-- local function moveCurrentWindowToRightHalf()
-- local win = hs.window.focusedWindow()
-- local screenFrame = win:screen():frame()
-- local newFrame = hs.geometry.rect(screenFrame.x + screenFrame.w / 2, screenFrame.y, screenFrame.w / 2, screenFrame.h)
-- win:setFrame(newFrame)
-- end
--
-- local function moveCurentWindowToNextScreen()
-- local win = hs.window.focusedWindow()
-- win:moveToScreen(win:screen():next())
-- end
local function moveMouseToWindowCenter()
local windowCenter = hs.window.frontmostWindow():frame().center
hs.mouse.absolutePosition(windowCenter)
end
local function moveMouseToUpperLeft()
local screenFrame = (hs.window.focusedWindow():screen() or hs.screen.primaryScreen()):frame()
local newPoint = hs.geometry.point(screenFrame.x + screenFrame.w / 4, screenFrame.y + screenFrame.h / 4)
hs.mouse.absolutePosition(newPoint)
end
local function moveMouseToUpperRight()
local screenFrame = (hs.window.focusedWindow():screen() or hs.screen.primaryScreen()):frame()
local newPoint = hs.geometry.point(screenFrame.x + screenFrame.w * 3 / 4, screenFrame.y + screenFrame.h / 4)
hs.mouse.absolutePosition(newPoint)
end
local function moveMouseToLowerLeft()
local screenFrame = (hs.window.focusedWindow():screen() or hs.screen.primaryScreen()):frame()
local newPoint = hs.geometry.point(screenFrame.x + screenFrame.w / 4, screenFrame.y + screenFrame.h * 3 / 4)
hs.mouse.absolutePosition(newPoint)
end
local function moveMouseToLowerRight()
local screenFrame = (hs.window.focusedWindow():screen() or hs.screen.primaryScreen()):frame()
local newPoint = hs.geometry.point(screenFrame.x + screenFrame.w * 3 / 4, screenFrame.y + screenFrame.h * 3 / 4)
hs.mouse.absolutePosition(newPoint)
end
----------------------------------------------------------------------------------------------------
-- Menu
@ -263,12 +212,6 @@ function showHideBundleId(bundleId)
end
end
-- hs.hotkey.bind(modifiers.window, hs.keycodes.map.left, moveCurrentWindowToLeftHalf)
-- hs.hotkey.bind(modifiers.window, hs.keycodes.map.right, moveCurrentWindowToRightHalf)
-- hs.hotkey.bind(modifiers.window, hs.keycodes.map.down, moveCurentWindowToNextScreen)
-- hs.hotkey.bind(modifiers.window, hs.keycodes.map["return"], maximizeCurrentWindow)
hs.hotkey.bind(modifiers.window, "c", centerCurrentWindow)
hs.loadSpoon("MiroWindowsManager")
hs.window.animationDuration = 0
spoon.MiroWindowsManager:bindHotkeys({
@ -281,27 +224,13 @@ spoon.MiroWindowsManager:bindHotkeys({
})
hs.hotkey.bind(modifiers.hyper, "[", moveMouseToWindowCenter)
hs.hotkey.bind(modifiers.hyper, "m", moveMouseToUpperLeft)
hs.hotkey.bind(modifiers.hyper, "o", moveMouseToUpperRight)
hs.hotkey.bind(modifiers.hyper, hs.keycodes.map.up, moveMouseToLowerLeft)
hs.hotkey.bind(modifiers.hyper, hs.keycodes.map.down, moveMouseToLowerRight)
hs.hotkey.bind(modifiers.hyper, hs.keycodes.map.delete, function() hs.caffeinate.lockScreen() end)
hs.hotkey.bind(modifiers.hyper, "a", function() showHideBundleId(bundleID.activityMonitor) end)
hs.hotkey.bind(modifiers.hyper, "c", function() showHideBundleId(bundleID.safari) end)
hs.hotkey.bind(modifiers.hyper, "o", function() showHideBundleId(bundleID.orion) end)
hs.hotkey.bind(modifiers.hyper, "f", function() showHideBundleId(bundleID.faclieThings) end)
hs.hotkey.bind(modifiers.hyper, "p", function() showHideBundleId(bundleID.timeular) end)
hs.hotkey.bind(modifiers.hyper, "b", function() showHideBundleId(bundleID.bitwarden) end)
hs.hotkey.bind(modifiers.hyper, "t", function() showHideBundleId(bundleID.iterm) end)
hs.hotkey.bind({ modifier.cmd }, "\\", function()
local application = hs.application.frontmostApplication()
if application:bundleID() == bundleID.bitwarden then
application:hide()
else
hs.application.launchOrFocusByBundleID(bundleID.bitwarden)
end
end)
----------------------------------------------------------------------------------------------------
-- Mouse Shortcuts
@ -327,49 +256,3 @@ mouseTap = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDown }, function(
return false
end)
mouseTap:start()
----------------------------------------------------------------------------------------------------
-- Clipboard Manager
----------------------------------------------------------------------------------------------------
-- clipboard = require("clipboard")
-- clipboard:start()
--
-- hs.hotkey.bind(modifiers.clipboard, "v", function() clipboard:toggleClipboard() end)
-- hs.hotkey.bind(modifiers.clipboard, hs.keycodes.map.delete, function() clipboard:clearAll() end)
----------------------------------------------------------------------------------------------------
-- notmuch indicator
----------------------------------------------------------------------------------------------------
local notmuchTaskRunning = false
local function refreshNotmuchMenubar(currentlyRunning)
hs.task.new("@notmuchMails@", function(exitCode, stdout, stderr)
if currentlyRunning then
stdout = "R: " .. stdout
end
print(stdout)
notmuchMenubar:setTitle(hs.styledtext.new(stdout))
end):start()
end
local function notmuchTimerFunction()
if not notmuchTaskRunning then
refreshNotmuchMenubar(true)
notmuchTaskRunning = true
hs.task.new("/etc/profiles/per-user/ragon/bin/zsh",
function() notmuchTaskRunning = false; refreshNotmuchMenubar(false) end,
function() return false end, { "-c", "syncmail" }):start()
end
end
notmuchMenubar = hs.menubar.new()
-- notmuchMenubar:setClickCallback(function(options)
-- if options.shift then
-- notmuchTimerFunction()
-- else
-- hs.task.new("@myEmacs@/bin/emacsclient", nil, function() return false end,
-- { "-c", "-a", "", "--eval", "(=notmuch)" }):start()
-- end
-- end)
notmuchTimer = hs.timer.doEvery(300, notmuchTimerFunction)