ktouch & discord

This commit is contained in:
2024-03-19 17:47:55 +01:00
parent 832448b0e0
commit d51ea215f8
9 changed files with 65 additions and 42 deletions

View File

@@ -17,7 +17,7 @@ in {
import = "${theme}";
};
font = {
size = 9;
size = 7;
normal.family = "Fira Code";
bold.family = "Fira Code";
italic.family = "Fira Code";

View File

@@ -2,8 +2,10 @@
imports = [
./alacritty
./anki.nix
./discord.nix
./element.nix
./git.nix
./ktouch.nix
./neovim
./obs
./planify.nix

View File

@@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ discord ];
}

5
home/programs/ktouch.nix Normal file
View File

@@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.programs = with pkgs.libsForQt5; [ ktouch ];
}

View File

@@ -1,18 +1,26 @@
"languageserver": {
"haskell": {
"command": "haskell-language-server-wrapper",
"args": ["--lsp"],
"rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
"filetypes": ["haskell", "lhaskell"],
// Settings are optional, here are some example values
"settings": {
"haskell": {
"checkParents": "CheckOnSave",
"checkProject": true,
"maxCompletions": 40,
"formattingProvider": "ormolu",
"plugin": {
"stan": { "globalOn": true }
{
"languageserver": {
"haskell": {
"command": "haskell-language-server-wrapper",
"args": ["--lsp"],
"rootPatterns": [
"*.cabal",
"stack.yaml",
"cabal.project",
"package.yaml",
"hie.yaml"
],
"filetypes": ["haskell", "lhaskell"],
// Settings are optional, here are some example values
"settings": {
"haskell": {
"checkParents": "CheckOnSave",
"checkProject": true,
"maxCompletions": 40,
"formattingProvider": "ormolu",
"plugin": {
"stan": { "globalOn": true }
}
}
}
}

View File

@@ -1,24 +1,33 @@
module Plugins.Audio where
import Xmobar
import Xmobar.Run.Timer (doEveryTenthSeconds)
import System.Process
import System.Exit
import System.IO (hClose, hGetLine)
import Control.Concurrent
data Audio = Audio String Int deriving (Read, Show)
data Audio = Audio Int deriving (Read, Show)
instance Exec Audio where
alias (Audio _ _) = "audio"
start (Audio f r) cb = if r > 0 then (doEveryTenthSeconds r (audio f cb)) else audio f cb
alias (Audio _) = "audio"
start (Audio r) cb = if r > 0 then go cb r else go cb 1000
where
go :: (String -> IO ()) -> Int -> IO ()
go cb r = do
response <- readProcess "/bin/sh" ["-c", "pulseaudio-ctl full-status"] ""
let list = [w | w <- words (init response)]
audio (head list) (list !! 1) (last list) cb
threadDelay r
go cb r
audio :: String -> (String -> IO ()) -> IO ()
audio format cb = do
(i,o,e,p) <- runInteractiveProcess "pulseaudio-ctl full-status" [] Nothing Nothing
exit <- waitForProcess p
let closeHandles = hClose o >> hClose i >> hClose e
getL = hGetLine o
str <- getL
closeHandles
cb str
--readProcess "pulseaudio-ctl full-status" []
audio :: String -> String -> String -> (String -> IO ()) -> IO ()
audio vol speaker mic cb
| speaker == "yes" = chooseMic vol "#f38ba8" "\xf466" mic cb
| elem vol [show i | i <- [0..49]] = chooseMic vol "#a6e3a1" "\xf027" mic cb
| otherwise = chooseMic vol "#a6e3a1" "\xf028" mic cb
| otherwise = formatAudio vol "a" "c" "d" "e" cb
where
chooseMic :: String -> String -> String -> String -> (String -> IO ()) -> IO ()
chooseMic vol speakerC speakerI mic cb
| mic == "yes" = formatAudio vol speakerC speakerI "#f38ba8" "\xf036d" cb
| otherwise = formatAudio vol speakerC speakerI "#a6e3a1" "\xf036c" cb
formatAudio :: String -> String -> String -> String -> String -> (String -> IO ()) -> IO ()
formatAudio vol speakerC speakerI micC micI cb = cb ("<fc=" ++ speakerC ++ "><fn=1>" ++ speakerI ++ "</fn></fc> " ++ vol ++ "% <fc=" ++ micC ++ "><fn=1>" ++ micI ++ "</fn></fc>")

View File

@@ -1,6 +0,0 @@
packages: .
with-compiler: ghc-9.2.4
package xmobar
flags: +all_extensions

View File

@@ -17,8 +17,8 @@ config =
, fgColor = "#f5e0dc"
, commands =
[
Run $ Audio "abc" 200
--Run $ Com "/bin/sh" ["-c", "Status=$(pulseaudio-ctl full-status); Volume=$(cut -d ' ' -f 1 <<<$Status); Mute=$(cut -d ' ' -f 2 <<<$Status); Microphone=$(cut -d ' ' -f 3 <<<$Status); SpeakerColor=\"#a6e3a1\"; MicColor=\"#a6e3a1\"; if [[ $Mute == \"yes\" ]]; then Symbol=\"\xf466\"; SpeakerColor=\"#f38ba8\"; elif [[ $Volume -le 50 ]]; then Symbol=\"\xf027\"; elseSymbol=\"\xf028\"; fi; if [[ $Microphone == \"yes\" ]]; then MicOut=\"\xf036d\"; MicColor=\"#f38ba8\"; else MicOut=\"\xf036c\"; fi; echo \"<fc=$SpeakerColor><fn=1>$Symbol</fn></fc> $Volume% <fc=$MicColor><fn=1>$MicOut</fn></fc>\""] "audio" 10
--Run $ Audio 10
Run $ Com "/bin/sh" ["-c", "Status=$(pulseaudio-ctl full-status); Volume=$(cut -d ' ' -f 1 <<<$Status); Mute=$(cut -d ' ' -f 2 <<<$Status); Microphone=$(cut -d ' ' -f 3 <<<$Status); SpeakerColor=\"#a6e3a1\"; MicColor=\"#a6e3a1\"; if [[ $Mute == \"yes\" ]]; then Symbol=\"\xf466\"; SpeakerColor=\"#f38ba8\"; elif [[ $Volume -le 50 ]]; then Symbol=\"\xf027\"; elseSymbol=\"\xf028\"; fi; if [[ $Microphone == \"yes\" ]]; then MicOut=\"\xf036d\"; MicColor=\"#f38ba8\"; else MicOut=\"\xf036c\"; fi; echo \"<fc=$SpeakerColor><fn=1>$Symbol</fn></fc> $Volume% <fc=$MicColor><fn=1>$MicOut</fn></fc>\""] "audio" 60
--Run $ Com "/bin/sh" ["-c", "Status=$(pulseaudio-ctl full-status);
-- Volume=$(cut -d ' ' -f 1 <<<$Status);
-- Mute=$(cut -d ' ' -f 2 <<<$Status);
@@ -40,7 +40,7 @@ config =
-- MicOut=\"\xf036d\";
-- MicColor=\"#f38ba8\";
-- else MicOut=\"\xf036c\";
-- fi;
-- fi;xmobar.Run not found
--
-- echo \"<fc=$SpeakerColor><fn=1>$Symbol</fn></fc> $Volume% <fc=$MicColor><fn=1>$MicOut</fn></fc>\""] "audio" 10
--Run $ Audio

View File

@@ -54,7 +54,7 @@ myconfig = def
, ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down 5")
, ("<XF86AudioMicMute>", spawn "pulseaudio-ctl mute-input")
]
`removeKeysP` []
`removeKeysP` [ "M-S-q" ]
myXmobarPP :: PP
myXmobarPP = def