# IOS widget (via Scriptable)

**URL:** <https://community.vikunja.io/t/ios-widget-via-scriptable/2953>\
**Category:** Uncategorized\
**Tags:** methology\
**Created:** [28 October 2024 16:09 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953 "2024-10-28T16:09:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grim73](https://community.vikunja.io/user_avatar/community.vikunja.io/grim73/32/1659_2.png) [@Grim73](https://community.vikunja.io/u/Grim73)\
**Post date:** [28 October 2024 16:09 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/1 "2024-10-28T16:09:28Z")

</div>

I wanted to write some iOS friendly guides for Vikunja, and wanted to get feelers out on how the community uses their devices. I currently have shortcuts, widgets, and things stored in both Data Jar and Jayson to assist on getting data in where I need it. if anyone would like a shortcut for completing tasks, adding tasks, or getting data into Data Jar, please let me know.

I also have a custom widget via Scriptable that I use for tasks at home:

 ![IMG_F77F7DE921D6-1](https://community.vikunja.io/uploads/default/original/2X/3/3c83c21de1c50e948d42dcbf43b6229f8b0e1f4b.jpeg)

let me know if I can be of any help!

---

<div class="post-metadata">

**Author:** ![executed](https://community.vikunja.io/user_avatar/community.vikunja.io/executed/32/2775_2.png) [@executed](https://community.vikunja.io/u/executed)\
**Post date:** [28 January 2025 17:03 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/3 "2025-01-28T17:03:03Z")

</div>

OMG yes please-please, give me all you got.

I just hate doing IOS shortcuts…

I personally was thinking about the shortcut that records an audio, sends this audio to OpenAI Whisper model for transcription, then does Chet-GPT post-processing to format it nicely and then uses Vicuña API to submit a new task into the default project.

But anyway, please share yours, anything is going to be useful.

---

<div class="post-metadata">

**Author:** ![Janov911](https://community.vikunja.io/letter_avatar_proxy/v4/letter/j/ad7895/32.png) [@Janov911](https://community.vikunja.io/u/Janov911)\
**Post date:** [3 February 2025 17:51 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/4 "2025-02-03T17:51:59Z")

</div>

any chance of a writeup of how you work with shortcuts and Vikunja? I take it you’d use the API or webhooks to do so, but would appreciate an explainer to get me started.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Grim73](https://community.vikunja.io/user_avatar/community.vikunja.io/grim73/32/1659_2.png) [@Grim73](https://community.vikunja.io/u/Grim73)\
**Post date:** [3 February 2025 19:44 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/5 "2025-02-03T19:44:08Z")

</div>

Hey all 😅 sorry about ghosting, been going through things in the personal life, here is an edited version of what I posted up top

```json
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: home;
runsInWidget: true
//This script gets a list of tasks based off of the projectid and veiw id set on cons
// let time = importModule("UTC")
// let today = time
// console.log(today)

const url = 'https://VIK.URL/api/v1/projects/VIEW_NUM/views/PROJECT_NUM/tasks';

var test = url
var req = new Request(test);

req.method = 'GET';
req.headers ={
  'Authorization': 'Bearer API_TOKEN_HERE'
};

//start of unpacking and wrapping the data.this currently pulls task name, id, and due date
var result = await req.loadJSON();
console.log(result)

let w = new ListWidget();

// This pulls an image from the internet
// let imgReq = new Request("https://raw.githubusercontent.com/dracula/wallpaper/master/first-collection/macos.png");
// let img = await imgReq.loadImage();

//This uses a local file, stored in iCloud. 
let fm = FileManager.iCloud();
//for more on how to bookmark a file, check out the Scriptable docs
let dir = fm.bookmarkedPath("Kraken");

let img = fm.readImage(dir)

w.backgroundImage = img;
let font = new Font("Fira Code Regular", 12)
let tfont = new Font("Fira Code Regular", 15)
let top = w.addText("task \t\t\t due date")
w.addSpacer(20)
top.centerAlignText()
top.font=tfont
top.color = new Color("44475a")

let table = new UITable()

let header = new UITableRow()
header.isHeader = true

nameOfCell = UITableCell.text("cell1")
nameOfCell.centerAligned()
nameOfCell.widthWeight = 50
header.addCell(nameOfCell)

nameOfCell2 = UITableCell.text("cell2")
nameOfCell2.centerAligned()
nameOfCell2.widthWeight = 50
header.addCell(nameOfCell2)
table.addRow(header)

// Setting todays date for trxt color check below

var date = new Date();
// var dd = String(today.getDate()).padStart(2, '0');
// var mm = String(today.getMonth() + 1)//; //January is 0!
// var yyyy = today.getFullYear();

// today = mm + '/' + dd + '/' + yyyy;
let today = date.toLocaleDateString()

let list =[]
let task = result[0];
let result1 = task["title"]
for (i in result){
  let title = result[i];
  let final = title["title"]
  
  //one-liner found from stack overflow to fix date output
  let dueDate = title['due_date']
  let date = new Date(dueDate).toLocaleDateString();
  console.log(dueDate)
  
  identify = title["id"]
  console.log(final + '\t' + date);
  
  let row = new UITableRow()
  cell = UITableCell.text(final)
  cell.centerAligned()
  row.addCell(cell)
  due = UITableCell.text(date)
  due.centerAligned()
  row.addCell(due)

  table.addRow(row)
  
  
  
// Adds title to list 
  list.push(final)
// let w = new ListWidget();
// let str = JSON.stringify(list)
// let input = w.addText(final + "\t\t\t" + date);
// w.setPadding(0, 0, 0, 5)
// w.addSpacer(20)
// input.centerAlignText()
  
// color check for date

  if(date > today){
  let input = w.addText(final + "\t\t" + date + "🧛🏻‍♂️");
  w.addSpacer(20)
  input.centerAlignText()
  input.textColor = new Color("50fa7b");
  input.font = font
}else if (date == today){
  let input = w.addText(final + "\t\t" + date + "‼️");
  w.addSpacer(20)
  input.centerAlignText()
  input.textColor = new Color("ffb86c");
  input.font = font
}else{
  let input = w.addText(final + "\t\t" + date + "‼️🎃");
  w.addSpacer(20)
  input.centerAlignText()
  input.textColor = new Color("ff5555");
  input.font = font

}

  Script.setShortcutOutput(list)
  Script.setWidget(w);
  Script.complete();
  

// for (each in result){
// console.log(i);
// let ip = i;
// let test = i["title"];
// console.log(test);//}
}

table.present()

Script.complete();

```

---

<div class="post-metadata">

**Author:** ![executed](https://community.vikunja.io/user_avatar/community.vikunja.io/executed/32/2775_2.png) [@executed](https://community.vikunja.io/u/executed)\
**Post date:** [3 February 2025 19:47 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/6 "2025-02-03T19:47:04Z")

</div>

Thank you for the widget code.  
Any chance you could also share task creation code?  
I’ll make sure to wrap it nicely in other topic.

---

<div class="post-metadata">

**Author:** ![Grim73](https://community.vikunja.io/user_avatar/community.vikunja.io/grim73/32/1659_2.png) [@Grim73](https://community.vikunja.io/u/Grim73)\
**Post date:** [3 February 2025 19:56 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/7 "2025-02-03T19:56:04Z")

</div>

That one is a bit more complex, and it looks like I was utilizing a combination of shortcuts, a-Shell, Scriptable and Jayson. When I have more cycles to work on this i will definitely post it.

---

<div class="post-metadata">

**Author:** ![Janov911](https://community.vikunja.io/letter_avatar_proxy/v4/letter/j/ad7895/32.png) [@Janov911](https://community.vikunja.io/u/Janov911)\
**Post date:** [4 February 2025 10:32 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/8 "2025-02-04T10:32:45Z")

</div>

Thanks! Would be appreciated. And of course this first “starter for 10” should keep us busy until then 🙂

---

<div class="post-metadata">

**Author:** ![Grim73](https://community.vikunja.io/user_avatar/community.vikunja.io/grim73/32/1659_2.png) [@Grim73](https://community.vikunja.io/u/Grim73)\
**Post date:** [13 February 2025 23:56 UTC](https://community.vikunja.io/t/ios-widget-via-scriptable/2953/9 "2025-02-13T23:56:28Z")

</div>

Hey guys,

in case you missed it. I will not be continuing to work on this for the time being. I will be [stepping away](https://community.vikunja.io/t/leaving-the-community-semi-permanently/3391) for now.
