Skip to content

Commit

Permalink
replace scrot with maim
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasglazer committed May 17, 2023
1 parent 233045a commit 9e8dfd1
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions .config/xmonad/lib/Variables.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,32 @@ module Variables
myTextEditor,
myBar,
myLaunchManager,
myScrot,
myScrotSelected,
myScreenshot,
myScreenshotSelected,
myByzanz,
)
where

import Data.Time (formatTime, getCurrentTime)
import Data.Time.Format (defaultTimeLocale)
import Miozu (miozu00, miozu02)
import XMonad (Dimension, KeyMask, mod4Mask)
import XMonad (io, Dimension, KeyMask, mod4Mask)
import XMonad.Util.Run (safeSpawn)

-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
myModMask :: KeyMask
myModMask = mod4Mask

myFont :: String
myFont = "xft:Hack:pixelsize=12"

myBorderWidth :: Dimension
myBorderWidth = 0

myModMask :: KeyMask
myModMask = mod4Mask

myFocusedBorderColor, myNormalBorderColor :: String
myFocusedBorderColor = miozu02
myNormalBorderColor = miozu00
Expand All @@ -52,28 +58,24 @@ myTerminal = "/usr/bin/wezterm"

myAltTerminal :: String
myAltTerminal = "/usr/bin/wezterm"

-- Run emacsclient if emacs daemon is running to avoid full emacs reload
myTextEditor :: String
myTextEditor = "emacsclient -nc"

myBar :: String
myBar = "/usr/bin/xmobar ~/.config/xmonad/xmobar/xmobar.hs"

-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
myLaunchManager :: String
myLaunchManager = "rofi -show drun -theme ~/.config/rofi/miozu.rasi"

myScrot :: String
myScrot = "scrot ~/Pictures/screenshots/%Y-%m-%d-%T-screenshot.png && notify-send 'Screenshot DONE'"

myScrotSelected :: String
myScrotSelected = "scrot -s ~/Pictures/screenshots/%Y-%m-%d-%T-screenshot.png"
-- Return the window ID of the window that the mouse cursor is currently over and make a screenshot
myScreenshot :: String
myScreenshot = "maim -i $(xdotool getmouselocation | grep -oP 'window:\\K[0-9a-fA-F]+') ~/Pictures/screenshots/$(date +'%s_%Y-%m-%d-%H_%M').png && dunstify -h string:x-dunst-stack-tag:screenshot 'Screenshot saved'"
-- Make a screenshot of selected area also copy screenshot to a clipboard
myScreenshotSelected :: String
myScreenshotSelected = "maim -s | tee ~/Pictures/screenshots/$(date +'%s_%Y-%m-%d-%H_%M').png | xclip -selection clipboard -t image/png && dunstify -h string:x-dunst-stack-tag:screenshot 'Screenshot saved and copied to clipboard'"

myByzanz :: IO String
-- TODO fix issue
myByzanz =
("notify-send -t 2000 'Screen recording in:' '5 seconds' && sleep 5;notify-send -t 1500 Recording && byzanz-record -v -c --duration=15 -w 1920 -h 1080 ~/Pictures/gifs/screen_" ++)
<$> fmap (formatTime defaultTimeLocale "%Y-%m-%d-%T_rec.gif && notify-send 'Recorded and saved as:' 'screen_%Y-%m-%d-%T.gif'") getCurrentTime

0 comments on commit 9e8dfd1

Please sign in to comment.