Initial
This commit is contained in:
커밋
e65159a362
50
README.md
Normal file
50
README.md
Normal file
@ -0,0 +1,50 @@
|
||||
# Sway Stickynotes
|
||||
|
||||
Add a stickynote to your Sway workspace. This makes it easy to remember what you were doing on each workspace.
|
||||
|
||||
## Usage
|
||||
- Execute `stickynote` via an application launcher (e.g. `dmenu` using Super+D)
|
||||
- Edit the current workspace's stickynote text
|
||||
- Enjoy the helpful stickynote!
|
||||
|
||||
![Screenshot](screenshot.png)
|
||||
|
||||
## Install
|
||||
|
||||
### Scripts
|
||||
Core script:
|
||||
```
|
||||
sudo cp sway_stickynotes /usr/local/bin/
|
||||
```
|
||||
|
||||
Dialog launcher, edit this one if you don't use `termite` as your terminal emulator:
|
||||
```
|
||||
sudo cp stickynote /usr/local/bin/
|
||||
```
|
||||
|
||||
### Waybar configuration
|
||||
#### ~/.config/waybar/config
|
||||
```
|
||||
...
|
||||
"modules-left": [
|
||||
"sway/workspaces",
|
||||
"custom/stickynote"
|
||||
],
|
||||
...
|
||||
"custom/stickynote": {
|
||||
"exec": "sway_stickynotes get",
|
||||
"interval": 1
|
||||
},
|
||||
```
|
||||
|
||||
#### ~/.config/waybar/style
|
||||
```
|
||||
#custom-stickynote {
|
||||
background: #1f1f1f;
|
||||
padding: 2px 10px;
|
||||
border: 1px solid #333;
|
||||
}
|
||||
```
|
||||
|
||||
Done!
|
||||
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | 크기: 33 KiB |
4
stickynote
Executable file
4
stickynote
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
termite -e "sway_stickynotes ask"
|
||||
|
47
sway_stickynotes
Executable file
47
sway_stickynotes
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
NOTESDIR=~/.config/sway_stickynotes
|
||||
|
||||
WORKSPACE=`swaymsg -t get_workspaces -p | grep \(focused\) | cut -f2 -d " "`
|
||||
|
||||
function print_usage {
|
||||
echo "Usage: $0 CMD [VAL]"
|
||||
echo " CMD ... command: get / set / ask"
|
||||
echo " get ... returns the current value"
|
||||
echo " set ... set a new value"
|
||||
echo " ask ... show a dialog to update the current value"
|
||||
echo " VAL ... value set when CMD == 'set'"
|
||||
}
|
||||
|
||||
function show_dialog {
|
||||
CMD=$0
|
||||
TEMPFILE=~/.config/sway_stickynotes/note
|
||||
|
||||
mkdir -p `dirname $TEMPFILE`
|
||||
$CMD get > $TEMPFILE
|
||||
|
||||
dialog --inputbox "Updated stickynote:" 10 30 "`cat $TEMPFILE`" 2> $TEMPFILE
|
||||
VAL=`cat $TEMPFILE`
|
||||
$CMD set "$VAL"
|
||||
}
|
||||
|
||||
mkdir -p $NOTESDIR
|
||||
|
||||
if [ $1 == "-h" ] || [ $1 == "--help" ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
elif [[ $1 == "get" ]]; then
|
||||
VAL=`cat $NOTESDIR/$WORKSPACE 2>/dev/null`
|
||||
echo $VAL
|
||||
exit 0
|
||||
elif [[ $1 == "set" ]]; then
|
||||
shift 1
|
||||
echo "$@" > $NOTESDIR/$WORKSPACE
|
||||
exit 0
|
||||
elif [ $1 == "ask" ]; then
|
||||
show_dialog
|
||||
else
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
불러오는 중...
Reference in New Issue
Block a user